Explorar el Código

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 hace 8 meses
padre
commit
605cfdb8dc
No account linked to committer's email address
Se han modificado 1 ficheros con 7 adiciones y 5 borrados
  1. 7
    5
      api/apps/llm_app.py

+ 7
- 5
api/apps/llm_app.py Ver fichero

@@ -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)

Cargando…
Cancelar
Guardar