fix: streaming with tools google and openai halfway

This commit is contained in:
Alex
2025-04-14 18:54:40 +01:00
parent b468e0c164
commit 231b792452
3 changed files with 21 additions and 42 deletions

View File

@@ -44,10 +44,13 @@ class ClassicAgent(BaseAgent):
):
yield {"answer": resp.message.content}
else:
completion = self.llm.gen_stream(
model=self.gpt_model, messages=messages, tools=self.tools
)
for line in completion:
# completion = self.llm.gen_stream(
# model=self.gpt_model, messages=messages, tools=self.tools
# )
# log type of resp
logger.info(f"Response type: {type(resp)}")
logger.info(f"Response: {resp}")
for line in resp:
if isinstance(line, str):
yield {"answer": line}