Kevin Hu commited on
Commit
29b22dd
·
1 Parent(s): 0d43cf3

Fix missplace for vector sim weight and token sim weight. (#4627)

Browse files

### What problem does this PR solve?

#4610

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)

Files changed (1) hide show
  1. api/apps/sdk/chat.py +2 -2
api/apps/sdk/chat.py CHANGED
@@ -140,7 +140,7 @@ def create(tenant_id):
140
  res["prompt"] = renamed_dict
141
  del res["prompt_config"]
142
  new_dict = {"similarity_threshold": res["similarity_threshold"],
143
- "keywords_similarity_weight": res["vector_similarity_weight"],
144
  "top_n": res["top_n"],
145
  "rerank_model": res['rerank_id']}
146
  res["prompt"].update(new_dict)
@@ -304,7 +304,7 @@ def list_chat(tenant_id):
304
  res["prompt"] = renamed_dict
305
  del res["prompt_config"]
306
  new_dict = {"similarity_threshold": res["similarity_threshold"],
307
- "keywords_similarity_weight": res["vector_similarity_weight"],
308
  "top_n": res["top_n"],
309
  "rerank_model": res['rerank_id']}
310
  res["prompt"].update(new_dict)
 
140
  res["prompt"] = renamed_dict
141
  del res["prompt_config"]
142
  new_dict = {"similarity_threshold": res["similarity_threshold"],
143
+ "keywords_similarity_weight": 1-res["vector_similarity_weight"],
144
  "top_n": res["top_n"],
145
  "rerank_model": res['rerank_id']}
146
  res["prompt"].update(new_dict)
 
304
  res["prompt"] = renamed_dict
305
  del res["prompt_config"]
306
  new_dict = {"similarity_threshold": res["similarity_threshold"],
307
+ "keywords_similarity_weight": 1-res["vector_similarity_weight"],
308
  "top_n": res["top_n"],
309
  "rerank_model": res['rerank_id']}
310
  res["prompt"].update(new_dict)