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

Fix azure #2665

Merged
merged 5 commits into from
Oct 8, 2024
Merged

Fix azure #2665

merged 5 commits into from
Oct 8, 2024

Conversation

pablonyx
Copy link
Contributor

@pablonyx pablonyx commented Oct 2, 2024

Description

Fixes https://linear.app/danswer/issue/DAN-733/add-proper-support-for-azure

How Has This Been Tested?

[Describe the tests you ran to verify your changes]

Accepted Risk

[Any know risks or failure modes to point out to reviewers]

Related Issue(s)

[If applicable, link to the issue(s) this PR addresses]

Checklist:

  • All of the automated tests pass
  • All PR comments are addressed and marked resolved
  • If there are migrations, they have been rebased to latest main
  • If there are new dependencies, they are added to the requirements
  • If there are new environment variables, they are added to all of the deployment methods
  • If there are new APIs that don't require auth, they are added to PUBLIC_ENDPOINT_SPECS
  • Docker images build and basic functionalities work
  • Author has done a final read through of the PR right before merge

Copy link

vercel bot commented Oct 2, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
internal-search ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 8, 2024 10:28pm

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

This PR adds support for Azure OpenAI deployments, focusing on the integration of the 'deployment_name' field across various components of the Danswer application.

  • Added 'deployment_name' field to LLMProvider model in database and related interfaces
  • Updated LLM configuration and factory to include Azure-specific deployment parameters
  • Modified UI components to support Azure OpenAI deployments in assistant and LLM provider forms
  • Adjusted PostgreSQL port from 5432 to 5433 in Docker Compose files to avoid potential conflicts
  • Enhanced image generation tool handling, including support for Azure's DALL-E service

23 file(s) reviewed, 5 comment(s)
Edit PR Review Bot Settings

@@ -16,10 +16,12 @@ class WellKnownLLMProviderDescriptor(BaseModel):
api_base_required: bool
api_version_required: bool
custom_config_keys: list[CustomConfigKey] | None = None
single_model_supported: bool = False
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Consider adding a comment explaining the purpose of this field


llm_names: list[str]
default_model: str | None = None
default_fast_model: str | None = None
deployment_name_required: bool = False
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Add a comment explaining when this field is used

@@ -108,6 +110,8 @@ def fetch_available_well_known_llms() -> list[WellKnownLLMProviderDescriptor]:
api_version_required=True,
custom_config_keys=[],
llm_names=fetch_models_for_provider(AZURE_PROVIDER_NAME),
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: Azure provider not included in _PROVIDER_TO_MODELS_MAP, this may return an empty list

Comment on lines +150 to +157
if llm_provider.default_model_name not in llm_provider.display_model_names:
llm_provider.display_model_names.append(llm_provider.default_model_name)

if (
llm_provider.fast_default_model_name
and llm_provider.fast_default_model_name not in llm_provider.display_model_names
):
llm_provider.display_model_names.append(llm_provider.fast_default_model_name)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: This logic might be better placed in the LLMProviderUpsertRequest model's validation or in a separate function for cleaner code organization.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to clean upsert as clean and minimal as possible

Comment on lines +37 to +43
def is_image_generation_available(db_session: Session) -> bool:
providers = db_session.query(LLMProvider).all()
for provider in providers:
if provider.name == "OpenAI":
return True

return bool(AZURE_DALLE_API_KEY)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: This function assumes OpenAI always supports image generation. Consider checking for specific OpenAI models that support DALL-E.

@pablonyx pablonyx enabled auto-merge October 8, 2024 22:28
@pablonyx pablonyx added this pull request to the merge queue Oct 8, 2024
Merged via the queue into main with commit 8f61505 Oct 8, 2024
7 checks passed
@pablonyx pablonyx deleted the fix_azure branch October 17, 2024 23:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants