From 5c09b8077588a447d6eaac9b7f624571be3ddb1d Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Sun, 27 Aug 2023 23:16:04 -0700 Subject: fix: :bug: patch for ocassional 0 choices from older azure versions --- continuedev/src/continuedev/libs/llm/openai.py | 2 ++ docs/docs/customization.md | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/continuedev/src/continuedev/libs/llm/openai.py b/continuedev/src/continuedev/libs/llm/openai.py index 48e773a3..ea77397f 100644 --- a/continuedev/src/continuedev/libs/llm/openai.py +++ b/continuedev/src/continuedev/libs/llm/openai.py @@ -166,6 +166,8 @@ class OpenAI(LLM): messages=messages, **args, ): + if len(chunk.choices) == 0: + continue yield chunk.choices[0].delta if "content" in chunk.choices[0].delta: completion += chunk.choices[0].delta.content diff --git a/docs/docs/customization.md b/docs/docs/customization.md index a1a9111e..3240c185 100644 --- a/docs/docs/customization.md +++ b/docs/docs/customization.md @@ -156,7 +156,7 @@ config = ContinueConfig( default=OpenAI(api_key="my-api-key", model="gpt-3.5-turbo", openai_server_info=OpenAIServerInfo( api_base="https://my-azure-openai-instance.openai.azure.com/", engine="my-azure-openai-deployment", - api_version="2023-03-15-preview", # NOTE: It is recommended not to change api_version. Newer versions may not work correctly. + api_version="2023-03-15-preview", api_type="azure" )) ) -- cgit v1.2.3-70-g09d2