Fix: added compatibility of azure openai for individual rag config

This commit is contained in:
weberm1 2025-06-06 12:03:22 +02:00
parent 9105189817
commit 37addd6347
2 changed files with 10 additions and 3 deletions

View File

@ -2267,7 +2267,8 @@ DOWNLOADED_EMBEDDING_MODELS = PersistentConfig(
"rag.downloaded_embedding_models",
os.getenv("DOWNLOADED_EMBEDDING_MODELS", {"":["sentence-transformers/all-MiniLM-L6-v2"],
"openai":["text-embedding-3-small"],
"ollama":[]})
"ollama":[],
"azure_openai_config": []})
)
DOWNLOADED_RERANKING_MODELS = PersistentConfig(
@ -2282,7 +2283,8 @@ LOADED_EMBEDDING_MODELS = PersistentConfig(
"rag.loaded_embedding_models",
os.getenv("LOADED_EMBEDDING_MODELS", {"":["sentence-transformers/all-MiniLM-L6-v2"],
"openai":[],
"ollama":[]})
"ollama":[],
"azure_openai_config": []})
)
LOADED_RERANKING_MODELS = PersistentConfig(

View File

@ -813,6 +813,11 @@ try:
# Load all embedding models that are currently in use
for engine, model_list in app.state.config.LOADED_EMBEDDING_MODELS.items():
for model in model_list:
if engine == "azure_openai":
# For Azure OpenAI, model is a dict: {model_name: version}
model_name, azure_openai_api_version = next(iter(model.items()))
model = model_name
app.state.ef[model] = get_ef(
engine,
model,
@ -835,7 +840,7 @@ try:
app.state.config.RAG_EMBEDDING_BATCH_SIZE,
azure_api_version=(
app.state.config.RAG_AZURE_OPENAI_API_VERSION
if app.state.config.RAG_EMBEDDING_ENGINE == "azure_openai"
if engine == "azure_openai"
else None
),
)