Skip to content

Commit

Permalink
Merge pull request #2126 from solliancenet/cp-dalle-model-fix
Browse files Browse the repository at this point in the history
Fix for Assistants DALL-E model
  • Loading branch information
ciprianjichici authored Jan 14, 2025
2 parents ba2c9f2 + df1c997 commit 18e4e0e
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ def _get_language_model(self, override_operation_type: OperationTypes = None) ->
DefaultAzureCredential(exclude_environment_credential=True),
scope
)

if op_type == OperationTypes.CHAT:
language_model = AzureChatOpenAI(
azure_endpoint=self.api_endpoint.url,
Expand All @@ -279,13 +279,12 @@ def _get_language_model(self, override_operation_type: OperationTypes = None) ->
azure_ad_token_provider=token_provider,
azure_deployment=self.ai_model.deployment_name
)
elif op_type == OperationTypes.ASSISTANTS_API or op_type == OperationTypes.IMAGE_SERVICES:
elif op_type == OperationTypes.ASSISTANTS_API or op_type == OperationTypes.IMAGE_SERVICES:
# Assistants API clients can't have deployment as that is assigned at the assistant level.
language_model = async_aoi(
azure_endpoint=self.api_endpoint.url,
api_version=self.api_endpoint.api_version,
openai_api_type='azure_ad',
azure_ad_token_provider=token_provider,
api_version=self.api_endpoint.api_version,
azure_ad_token_provider=token_provider
)
else:
raise LangChainException(f"Unsupported operation type: {op_type}", 400)
Expand Down

0 comments on commit 18e4e0e

Please sign in to comment.