-
Notifications
You must be signed in to change notification settings - Fork 2.8k
feat: enable mergeToolResultText for all OpenAI-compatible providers #10299
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: enable mergeToolResultText for all OpenAI-compatible providers #10299
Conversation
Review complete. No issues found.
Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues. |
Add mergeToolResultText option to convertToOpenAiMessages() that merges text content after tool_result blocks into the last tool message instead of creating separate user messages. Enable this for the Roo Code Cloud provider. This improves compatibility with reasoning/thinking models (like DeepSeek-reasoner, GLM-4.7, etc.) where a user message after tool results causes the model to drop all previous reasoning_content. - Add mergeToolResultText option to ConvertToOpenAiMessagesOptions interface - Implement merging logic in openai-format.ts with proper edge case handling - Enable mergeToolResultText: true in roo.ts provider - Add 6 unit tests covering the new behavior
…iders Enable mergeToolResultText option for the remaining 15 OpenAI-compatible providers (excluding Roo Code Cloud which is in PR #10301): - base-openai-compatible-provider.ts - openrouter.ts, openai.ts (4 places) - deepinfra.ts, lm-studio.ts, unbound.ts, qwen-code.ts - cerebras.ts, vercel-ai-gateway.ts, featherless.ts, xai.ts - requesty.ts, lite-llm.ts, huggingface.ts, chutes.ts This follows PR #10301 which introduces the mergeToolResultText option and enables it for the Roo Code Cloud provider. Together they standardize the environment_details merging behavior across all OpenAI-compatible providers. Depends on: #10301
950baf3 to
7e9bdc0
Compare
|
Summary
Standardizes the environment_details merging behavior across all OpenAI-compatible providers. This ensures that text content after tool_result blocks (like
environment_details) is merged into the last tool message instead of creating separate user messages.This behavior was previously implemented for DeepSeek (
r1-format.ts) and Z.ai (zai-format.ts) providers but not for the other 16 OpenAI-compatible providers.Changes
mergeToolResultTextoption toconvertToOpenAiMessages()inopenai-format.tsConvertToOpenAiMessagesOptionsinterface with the new optionmergeToolResultText: truein all 16 OpenAI-compatible providers:Why This Matters
When using native tool calling, the
environment_detailstext that follows tool results was being sent as a separate user message. Some models have issues with user messages interrupting tool call sequences, which can:By merging this text into the last tool message, we maintain a cleaner message flow that works better across all model types.
Important
Standardizes
environment_detailsmerging for all OpenAI-compatible providers by addingmergeToolResultTextoption toconvertToOpenAiMessages()and enabling it across 16 providers.mergeToolResultTextoption toconvertToOpenAiMessages()inopenai-format.tsto mergeenvironment_detailsinto the last tool message.mergeToolResultText: truefor 16 OpenAI-compatible providers, includingbase-openai-compatible-provider.ts,roo.ts, andopenrouter.ts.openai-format.spec.tsto cover new merging behavior.This description was created by
for 7e9bdc0. You can customize this summary. It will automatically update as commits are pushed.