Skip to content
Draft
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
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class AzureOpenAIEMSetting(BaseEMSetting):
)
api_key: SecretKey = Field(
description='The secret that stores the API key used to authenticate requests to the AI Provider API.',
examples=[RawSecretKey(secret='ab7-************-A1IV4B')]
examples=[RawSecretKey(secret='ab7-************-A1IV4B')],
)
deployment_name: str = Field(
description='The deployment name you chose when you deployed the model.',
Expand All @@ -55,3 +55,7 @@ class AzureOpenAIEMSetting(BaseEMSetting):
description='The API version to use for this operation.',
examples=['2023-05-15'],
)
number_of_chunk_per_request: int = Field(
description='The number of chunks sent per request, take care of your rate limits. Default value is 50',
default=50,
)
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,15 @@ class OpenAIEMSetting(BaseEMSetting):
)
api_key: SecretKey = Field(
description='The secret that stores the API key used to authenticate requests to the AI Provider API.',
examples=[RawSecretKey(secret='ab7-************-A1IV4B')]
examples=[RawSecretKey(secret='ab7-************-A1IV4B')],
)
model: str = Field(description='The model id', examples=['text-embedding-ada-002'])
base_url: str = Field(
description='The OpenAI endpoint base URL',
examples=['https://api.openai.com/v1'],
default='https://api.openai.com/v1'
)
default='https://api.openai.com/v1',
)
number_of_chunk_per_request: int = Field(
description='The number of chunks sent per request, take care of your rate limits. Default value is 50.',
default=50,
)
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2023-2024 Credit Mutuel Arkea
# Copyright (C) 2023-2025 Credit Mutuel Arkea
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -47,8 +47,9 @@ def get_embedding_model(self) -> Embeddings:
azure_endpoint=str(self.setting.api_base),
azure_deployment=self.setting.deployment_name,
# the model is not Nullable, it has a default value
model=self.setting.model or OpenAIEmbeddings.__fields__["model"].default,
model=self.setting.model or OpenAIEmbeddings.__fields__['model'].default,
timeout=application_settings.em_provider_timeout,
chunk_size=self.setting.number_of_chunk_per_request,
)

@openai_exception_handler(provider='AzureOpenAIService')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2023-2024 Credit Mutuel Arkea
# Copyright (C) 2023-2025 Credit Mutuel Arkea
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -50,6 +50,7 @@ def get_embedding_model(self) -> Embeddings:
base_url=self.setting.base_url,
model=self.setting.model,
timeout=application_settings.em_provider_timeout,
chunk_size=self.setting.chunk_size,
)

@openai_exception_handler(provider='OpenAI')
Expand Down