Skip to content

Commit

Permalink
Merge pull request #399 from devchat-ai/fix_timeout_error
Browse files Browse the repository at this point in the history
Update OpenAI API base URL handling
  • Loading branch information
yangbobo2021 authored May 30, 2024
2 parents 2aea6e1 + c6f24ba commit 02f0ebc
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion devchat/openai/openai_chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,10 @@ def stream_response(self, prompt: OpenAIPrompt) -> Iterator:
api_key = os.environ.get("OPENAI_API_KEY", None)
base_url = os.environ.get("OPENAI_API_BASE", "https://api.openai.com/v1/")

if not os.environ.get("USE_TIKTOKEN", False) and base_url != "https://api.openai.com/v1/":
if (
not os.environ.get("USE_TIKTOKEN", False)
and base_url.find("https://api.openai.com/v1") == -1
):
config_params = self.config.dict(exclude_unset=True)
if prompt.get_functions():
config_params["functions"] = prompt.get_functions()
Expand Down

0 comments on commit 02f0ebc

Please sign in to comment.