Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specifying endpoints/deployments for Azure OpenAI embeddings #292

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ AZURE_OPENAI_DEPLOYMENT_NAME=placeholder
AZURE_OPENAI_API_KEY=placeholder
AZURE_OPENAI_API_BASE=placeholder
AZURE_OPENAI_API_VERSION=placeholder
AZURE_OPENAI_EMBEDDINGS_DEPLOYMENT_NAME=placeholder
CONNERY_RUNNER_URL=https://your-personal-connery-runner-url
CONNERY_RUNNER_API_KEY=placeholder
PROXY_URL=your_proxy_url
Expand Down
8 changes: 7 additions & 1 deletion backend/app/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,13 @@ def _determine_azure_or_openai_embeddings() -> PGVector:
if os.environ.get("AZURE_OPENAI_API_KEY"):
return PGVector(
connection_string=PG_CONNECTION_STRING,
embedding_function=AzureOpenAIEmbeddings(),
embedding_function=AzureOpenAIEmbeddings(
azure_endpoint=os.environ.get("AZURE_OPENAI_API_BASE"),
azure_deployment=os.environ.get(
"AZURE_OPENAI_EMBEDDINGS_DEPLOYMENT_NAME"
),
openai_api_version=os.environ.get("AZURE_OPENAI_API_VERSION"),
),
use_jsonb=True,
)
raise ValueError(
Expand Down
Loading