mirror of
https://github.com/khoj-ai/khoj.git
synced 2024-11-27 17:35:07 +01:00
Do not deduplicate search results used for chat context
- Chat uses compiled form of search results, not the raw entries to provide context for chat. The compiled snipped search results themselves are unique and using multiple of them for context from the same raw note is fine if they cross the score and rank thresholds This should improve the context provided for chat - Also apply score_threshold, no deduplication to the answers API
This commit is contained in:
parent
672f61529e
commit
280061e1fa
1 changed files with 2 additions and 2 deletions
|
@ -55,7 +55,7 @@ def answer_beta(q: str):
|
|||
api_key = state.processor_config.conversation.openai_api_key
|
||||
|
||||
# Collate context for GPT
|
||||
result_list = search(q, n=2, r=True)
|
||||
result_list = search(q, n=2, r=True, score_threshold=0, dedupe=False)
|
||||
collated_result = "\n\n".join([f"# {item.additional['compiled']}" for item in result_list])
|
||||
logger.debug(f"Reference Context:\n{collated_result}")
|
||||
|
||||
|
@ -87,7 +87,7 @@ def chat(q: Optional[str] = None):
|
|||
return {"status": "ok", "response": []}
|
||||
|
||||
# Collate context for GPT
|
||||
result_list = search(q, n=2, r=True, score_threshold=0)
|
||||
result_list = search(q, n=2, r=True, score_threshold=0, dedupe=False)
|
||||
collated_result = "\n\n".join([f"# {item.additional['compiled']}" for item in result_list])
|
||||
logger.debug(f"Reference Context:\n{collated_result}")
|
||||
|
||||
|
|
Loading…
Reference in a new issue