Browse Source

Refine error message for re-rank model. (#5278)

### What problem does this PR solve?

#5261

### Type of change

- [x] Refactoring
tags/v0.17.0
Kevin Hu 8 months ago
parent
commit
605cfdb8dc
No account linked to committer's email address
1 changed files with 7 additions and 5 deletions
  1. 7
    5
      api/apps/llm_app.py

+ 7
- 5
api/apps/llm_app.py View File

@@ -236,15 +236,17 @@ def add_llm():
msg += f"\nFail to access model({mdl_nm})." + str(
e)
elif llm["model_type"] == LLMType.RERANK:
mdl = RerankModel[factory](
key=llm["api_key"],
model_name=mdl_nm,
base_url=llm["api_base"]
)
try:
mdl = RerankModel[factory](
key=llm["api_key"],
model_name=mdl_nm,
base_url=llm["api_base"]
)
arr, tc = mdl.similarity("Hello~ Ragflower!", ["Hi, there!", "Ohh, my friend!"])
if len(arr) == 0:
raise Exception("Not known.")
except KeyError:
msg += f"{factory} dose not support this model({mdl_nm})"
except Exception as e:
msg += f"\nFail to access model({mdl_nm})." + str(
e)

Loading…
Cancel
Save