Skip to content

Commit

Permalink
fix an error with openai api
Browse files Browse the repository at this point in the history
  • Loading branch information
Chenglong-MS committed Feb 20, 2025
1 parent 7eb1ebe commit b7f4606
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions py-src/data_formulator/agents/client_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,17 @@ def get_completion(self, messages):
# Configure LiteLLM

if self.endpoint == "openai":
client = openai.OpenAI(api_key=self.params["api_key"], base_url=self.params["api_base"] if "api_base" in self.params else None)
client = openai.OpenAI(
api_key=self.params["api_key"],
base_url=self.params["api_base"] if "api_base" in self.params else None,
timeout=120
)

return client.chat.completions.create(
model=self.model,
messages=messages,
**{k: v for k, v in self.params.items() if k != "api_key"}
temperature=self.params["temperature"],
max_tokens=self.params["max_completion_tokens"],
)
else:
return litellm.completion(
Expand Down

0 comments on commit b7f4606

Please sign in to comment.