Skip to content

Commit

Permalink
when qwen rerank model not return ok, raise exception to notice user (#…
Browse files Browse the repository at this point in the history
…3593)

### 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)
  • Loading branch information
liwenju0 authored Nov 22, 2024
1 parent a10c2f2 commit 8750963
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion rag/llm/rerank_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,4 +452,5 @@ def similarity(self, query: str, texts: list):
for r in resp.output.results:
rank[r.index] = r.relevance_score
return rank, resp.usage.total_tokens
return rank, 0
else:
raise ValueError(f"Error calling QWenRerank model {self.model_name}: {resp.status_code} - {resp.text}")

0 comments on commit 8750963

Please sign in to comment.