Skip to content

fix: add GPT-OSS stop tokens for tool-calling streams#1951

Open
saschabuehrle wants to merge 1 commit intostrands-agents:mainfrom
saschabuehrle:fix/issue-1949
Open

fix: add GPT-OSS stop tokens for tool-calling streams#1951
saschabuehrle wants to merge 1 commit intostrands-agents:mainfrom
saschabuehrle:fix/issue-1949

Conversation

@saschabuehrle
Copy link

Bug

Fixes #1949 — GPT-OSS tool-calling streams can continue past the call boundary when no stop tokens are configured.

Fix

When formatting OpenAI chat requests, this adds GPT-OSS stop tokens (call, return, end) if the model id contains gpt-oss and no explicit stop parameter is set.

This keeps existing behavior intact for other models and preserves user-provided stop tokens.

Testing

  • Added tests covering default GPT-OSS stop token injection.
  • Added tests covering preservation of explicit stop tokens from params.
  • Could not run tests locally in this environment because pytest is not installed.

Happy to address any feedback.

Greetings, saschabuehrle

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] GPT-OSS tool calling doesn’t work properly as <|call|> wasn't set as a stop token

1 participant