Skip to content

Commit 499a64f

Browse files
toslali-ibmclaude
andauthored
Fix top_p: null still sent in API requests after #385 (#415)
PR #385 made top_p optional and defaulted it to None in LLMConfig, but openai.py still unconditionally includes top_p in the request params dict. This sends "top_p": null to providers like AWS Bedrock that don't strip null values, causing 400 errors. Only include top_p in params when it is explicitly set. Fixes #414 Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 38207bb commit 499a64f

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

openevolve/llm/openai.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,11 @@ async def generate_with_context(
155155
"model": self.model,
156156
"messages": formatted_messages,
157157
"temperature": kwargs.get("temperature", self.temperature),
158-
"top_p": kwargs.get("top_p", self.top_p),
159158
"max_tokens": kwargs.get("max_tokens", self.max_tokens),
160159
}
160+
top_p = kwargs.get("top_p", self.top_p)
161+
if top_p is not None:
162+
params["top_p"] = top_p
161163

162164
# Handle reasoning_effort for open source reasoning models.
163165
reasoning_effort = kwargs.get("reasoning_effort", self.reasoning_effort)

0 commit comments

Comments
 (0)