fix: openai compatable with llama and gemini

This commit is contained in:
Alex
2025-03-13 00:10:13 +00:00
parent 5d5ea3eb8f
commit 51eced00aa
3 changed files with 128 additions and 26 deletions

View File

@@ -125,9 +125,9 @@ class OpenAILLM(BaseLLM):
)
for line in response:
if line.choices[0].delta.content is not None:
if len(line.choices) > 0 and line.choices[0].delta.content is not None and len(line.choices[0].delta.content) > 0:
yield line.choices[0].delta.content
else:
elif len(line.choices) > 0:
yield line.choices[0]
def _supports_tools(self):