mirror of
https://github.com/open-webui/open-webui
synced 2025-06-23 02:16:52 +00:00
Fix: added compatibility of azure openai for individual rag config
This commit is contained in:
parent
9105189817
commit
37addd6347
@ -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(
|
||||
|
@ -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
|
||||
),
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user