Fix /beta/chat API to use Entry class instead of old dictionary pattern

Search returns response of type SearchResponse instead of a dict now
This commit is contained in:
Debanjum Singh Solanky 2023-01-08 15:26:31 -03:00
parent f2436039a0
commit 74e779f8d0

View file

@ -45,8 +45,8 @@ def chat(q: str):
if get_from_dict(metadata, "intent", "memory-type") == "notes": if get_from_dict(metadata, "intent", "memory-type") == "notes":
query = get_from_dict(metadata, "intent", "query") query = get_from_dict(metadata, "intent", "query")
result_list = search(query, n=1, t=SearchType.Org) result_list = search(query, n=1, t=SearchType.Org, r=True)
collated_result = "\n".join([item["entry"] for item in result_list]) collated_result = "\n".join([item.entry for item in result_list])
logger.debug(f'Semantically Similar Notes:\n{collated_result}') logger.debug(f'Semantically Similar Notes:\n{collated_result}')
gpt_response = summarize(collated_result, summary_type="notes", user_query=q, api_key=state.processor_config.conversation.openai_api_key) gpt_response = summarize(collated_result, summary_type="notes", user_query=q, api_key=state.processor_config.conversation.openai_api_key)
else: else: