Skip to content

Commit 93b6e06

Browse files
authored
Merge pull request #1593 from swirlai/DS_4002_configure_genai_model_for_rag
[DS 4002] Improve ability for users to configure GenAI model for RAG
2 parents 04d6b64 + 97bccfb commit 93b6e06

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

swirl/openai/openai.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ def _init_openai_client(self, provider, key):
5959
ai_client = OpenAI(api_key=key)
6060
elif provider == "AZUREAI":
6161
from openai import AzureOpenAI
62-
ai_client = AzureOpenAI(api_key=key, azure_endpoint=self._azure_endpoint, api_version="2023-10-01-preview")
62+
self._azure_api_version = getattr(settings, "AZURE_API_VERSION", None)
63+
ai_client = AzureOpenAI(api_key=key, azure_endpoint=self._azure_endpoint, api_version=self._azure_api_version)
6364
else:
6465
raise NotImplementedError(f"Unknown AI provider {provider}. Client initialization not supported.")
6566
except Exception as err:

swirl_server/settings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@
295295
AZURE_OPENAI_KEY = env.get_value('AZURE_OPENAI_KEY', default='')
296296
AZURE_OPENAI_ENDPOINT = env.get_value('AZURE_OPENAI_ENDPOINT', default='')
297297
AZURE_MODEL = env.get_value('AZURE_MODEL', default='')
298+
AZURE_API_VERSION = os.getenv("AZURE_API_VERSION", default='')
298299

299300
# Defines for RAG ChatGPT models
300301
CGPT_MODEL_3 = "gpt-3.5-turbo"

0 commit comments

Comments
 (0)