Skip to content

Commit b7f4606

Browse files
committed
fix an error with openai api
1 parent 7eb1ebe commit b7f4606

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

py-src/data_formulator/agents/client_utils.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,17 @@ def get_completion(self, messages):
6161
# Configure LiteLLM
6262

6363
if self.endpoint == "openai":
64-
client = openai.OpenAI(api_key=self.params["api_key"], base_url=self.params["api_base"] if "api_base" in self.params else None)
64+
client = openai.OpenAI(
65+
api_key=self.params["api_key"],
66+
base_url=self.params["api_base"] if "api_base" in self.params else None,
67+
timeout=120
68+
)
6569

6670
return client.chat.completions.create(
6771
model=self.model,
6872
messages=messages,
69-
**{k: v for k, v in self.params.items() if k != "api_key"}
73+
temperature=self.params["temperature"],
74+
max_tokens=self.params["max_completion_tokens"],
7075
)
7176
else:
7277
return litellm.completion(

0 commit comments

Comments
 (0)