Skip to content

fix: explicitly set stream=False to prevent SSE issues with some providers#455

Open
octo-patch wants to merge 1 commit intoalgorithmicsuperintelligence:mainfrom
octo-patch:fix/issue-436-stream-false
Open

fix: explicitly set stream=False to prevent SSE issues with some providers#455
octo-patch wants to merge 1 commit intoalgorithmicsuperintelligence:mainfrom
octo-patch:fix/issue-436-stream-false

Conversation

@octo-patch
Copy link
Copy Markdown

Fixes #436

Problem

Some LLM API providers (e.g. kivest/ezif endpoints) default to returning streaming Server-Sent Events (SSE) responses instead of standard JSON. The OpenAI client then receives a raw string that lacks a .choices attribute, causing:

'str' object has no attribute 'choices'

Solution

Add "stream": False explicitly to the non-streaming request params in openevolve/llm/openai.py. This makes the non-streaming behaviour explicit and ensures JSON is always returned regardless of provider defaults. This is standard OpenAI API behaviour and is a no-op for providers that already default to non-streaming.

Testing

  • Verified the change applies only to the standard (non-reasoning-model) code path
  • The fix is backwards-compatible: providers that already return non-streaming JSON are unaffected

@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


octo-patch seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Kivest LLM API returns streaming SSE by default causing 'str' object has no attribute 'choices' error

2 participants