Skip to content

Conversation

@amittell
Copy link
Contributor

@amittell amittell commented Apr 10, 2025

Context

Allow streaming to be used when using Open AI Compatible provider with Grok3 API directly.

Implementation

If x.ai in base_url remove unsupported stream_options.

Screenshots

before after

How to Test

Configure Grok3 API in the Open AI Compatible provider and enable streaming support, observe the 400 error "unsupported option: stream_options".

After fix streaming works with Grok3 as expected.

References

https://docs.x.ai/docs/guides/streaming-response#streaming-response


Important

Enable Grok3 streaming in OpenAiHandler by excluding stream_options for x.ai base URLs, with tests added.

  • Behavior:
    • In openai.ts, OpenAiHandler now excludes stream_options when base_url is for x.ai, enabling Grok3 streaming.
    • Adds _isGrokXAI() to check if the base URL is for x.ai.
  • Tests:
    • In openai.test.ts, adds tests for Grok xAI configuration and verifies stream_options exclusion during streaming.
  • Misc:
    • No changes to existing functionality for non-Grok3 providers.

This description was created by Ellipsis for dc3f06c. It will automatically update as commits are pushed.

@changeset-bot
Copy link

changeset-bot bot commented Apr 10, 2025

⚠️ No Changeset found

Latest commit: dc3f06c

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Apr 10, 2025

const isGrokXAI = this._isGrokXAI(this.options.openAiBaseUrl)

const requestOptions: OpenAI.Chat.Completions.ChatCompletionCreateParamsStreaming = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider extracting the logic for constructing streaming options into a helper function to reduce duplication.

@dosubot dosubot bot added the enhancement New feature or request label Apr 10, 2025
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Apr 10, 2025
@mrubens mrubens merged commit 1445bb0 into RooCodeInc:main Apr 10, 2025
19 checks passed
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Apr 10, 2025
@amittell amittell deleted the grox3_openai_fix branch April 10, 2025 12:08
ouob-tw added a commit to ouob-tw/BigFont-Roo-Code that referenced this pull request May 6, 2025
fix: update ChatRowContent(user msg in chat windows) background and font size for better styling

Add o1-pro to api.ts (RooCodeInc#2433)

Add the o1-pro model to the openai section. Sourced model info from: https://platform.openai.com/docs/models/o1-pro

Update contributors list (RooCodeInc#2411)

docs: update contributors list [skip ci]

Co-authored-by: mrubens <[email protected]>

Add custom instructions for de (RooCodeInc#2383)

v3.11.11 (RooCodeInc#2435)

API fixes (RooCodeInc#2438)

Changeset version bump (RooCodeInc#2436)

* changeset version bump

* Update CHANGELOG.md

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Matt Rubens <[email protected]>

More sane evals default concurrency + staggered startup (RooCodeInc#2441)

Fix gh fork command (RooCodeInc#2442)

Add a script to copy eval run results to Turso (RooCodeInc#2452)

Fall back on aggressive line number stripping in diffs (RooCodeInc#2453)

* Add option for aggressive line number stripping

* Fall back on aggressive line number stripping in diffs

Make Grok3 streaming work with OpenAI Compatible (RooCodeInc#2449)

Update contributors list (RooCodeInc#2434)

docs: update contributors list [skip ci]

Co-authored-by: mrubens <[email protected]>

v3.11.12 (RooCodeInc#2454)

Changeset version bump (RooCodeInc#2455)

* changeset version bump

* Updating CHANGELOG.md format

* Update CHANGELOG.md

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: R00-B0T <[email protected]>
Co-authored-by: Matt Rubens <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request lgtm This PR has been approved by a maintainer size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants