liwenju0 commited on
Commit
8c3fb63
·
1 Parent(s): 1aee27d

when qwen rerank model not return ok, raise exception to notice user (#3593)

Browse files

### What problem does this PR solve?

When calling the Qwen rerank model, if the model does not return
correctly, an exception should be raised to notify the user, rather than
simply returning a value of 0, as this would be confusing to the user.
### Type of change

- [x] New Feature (non-breaking change which adds functionality)

Files changed (1) hide show
  1. rag/llm/rerank_model.py +2 -1
rag/llm/rerank_model.py CHANGED
@@ -452,4 +452,5 @@ class QWenRerank(Base):
452
  for r in resp.output.results:
453
  rank[r.index] = r.relevance_score
454
  return rank, resp.usage.total_tokens
455
- return rank, 0
 
 
452
  for r in resp.output.results:
453
  rank[r.index] = r.relevance_score
454
  return rank, resp.usage.total_tokens
455
+ else:
456
+ raise ValueError(f"Error calling QWenRerank model {self.model_name}: {resp.status_code} - {resp.text}")