Correct usage of the summarize function

This commit is contained in:
sabaimran
2024-10-09 15:58:05 -07:00
parent c91678078d
commit 4fbaef10e9
2 changed files with 17 additions and 4 deletions

View File

@@ -783,7 +783,7 @@ async def chat(
async for result in send_llm_response(response_log):
yield result
else:
response_log = await generate_summary_from_files(
async for response in generate_summary_from_files(
q=q,
user=user,
file_filters=file_filters,
@@ -791,7 +791,9 @@ async def chat(
subscribed=subscribed,
send_status_func=partial(send_event, ChatEvent.STATUS),
send_response_func=partial(send_llm_response),
)
):
yield response
await sync_to_async(save_to_conversation_log)(
q,
response_log,

View File

@@ -245,14 +245,25 @@ async def execute_information_collection(
)
)
else:
response_log = await generate_summary_from_files(
async for response in generate_summary_from_files(
q=query,
user=user,
file_filters=file_filters,
meta_log=conversation_history,
subscribed=subscribed,
send_status_func=send_status_func,
)
):
if isinstance(response, dict) and ChatEvent.STATUS in response:
yield response[ChatEvent.STATUS]
else:
response_log = response
previous_iterations.append(
InformationCollectionIteration(
data_source=this_iteration.data_source,
query=this_iteration.query,
context=response_log,
)
)
else:
iteration = MAX_ITERATIONS