From 8c0c23c9e0122bc803735503eb4c14c027e0095d Mon Sep 17 00:00:00 2001 From: phact Date: Mon, 1 Apr 2024 14:13:15 -0400 Subject: [PATCH] null check gemini --- impl/routes/threads.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/impl/routes/threads.py b/impl/routes/threads.py index 27fab63..5c110c0 100644 --- a/impl/routes/threads.py +++ b/impl/routes/threads.py @@ -783,9 +783,10 @@ async def process_rag( if 'gemini' in model: async for part in response: - text += part.choices[0].delta.content - start_time = await maybe_checkpoint(assistant_id, astradb, created_at, file_ids, frequency_in_seconds, message_id, - run_id, start_time, text, thread_id) + if part.choices[0].delta.content is not None: + text += part.choices[0].delta.content + start_time = await maybe_checkpoint(assistant_id, astradb, created_at, file_ids, frequency_in_seconds, message_id, + run_id, start_time, text, thread_id) else: done = False while not done: