From a8e69a02e6897689a1727fb7542ed5684b1348e2 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Thu, 28 Sep 2023 10:30:35 -0700 Subject: fix: :bug: fix azure openai bug for 07 version --- continuedev/src/continuedev/libs/llm/openai.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/continuedev/src/continuedev/libs/llm/openai.py b/continuedev/src/continuedev/libs/llm/openai.py index 6afa4e77..d21bbde1 100644 --- a/continuedev/src/continuedev/libs/llm/openai.py +++ b/continuedev/src/continuedev/libs/llm/openai.py @@ -118,11 +118,12 @@ class OpenAI(LLM): messages=[{"role": "user", "content": prompt}], **args, ): - if "content" in chunk.choices[0].delta: + if len(chunk.choices) > 0 and "content" in chunk.choices[0].delta: yield chunk.choices[0].delta.content else: async for chunk in await openai.Completion.acreate(prompt=prompt, **args): - yield chunk.choices[0].text + if len(chunk.choices) > 0: + yield chunk.choices[0].text async def _stream_chat(self, messages: List[ChatMessage], options): args = self.collect_args(options) -- cgit v1.2.3-70-g09d2