Conversation
…SML fallback - Pass tools from OpenAI request to Command Code API using input_schema format - Handle tool-input-start/delta/end and tool-call SSE events in both paths - Convert OpenAI tool definitions (parameters → input_schema) for CC API - Handle tool role messages (tool results) in _build_generate_body - Add DSML <|DSML|tool_calls> parser as fallback for models that emit text - Add _make_openai_chunk/_make_openai_response tool_calls support - Tested: streaming + non-streaming tool calls, tool result round-trip, no-tools backward compat - All 27 existing tests pass
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add full tool calling support to the Command Code provider client.
Changes
Tool passing
_build_generate_bodynow forwards thetoolsarray from the OpenAI request to the Command Code APIparameters) to CC format (input_schema)toolrole messages (tool results) in the message conversionStructured tool call event handling (primary)
The Command Code API returns structured SSE events for tool calls when tools are passed correctly:
tool-input-start→ creates tool call placeholder with ID and nametool-input-delta→ accumulates argument JSON fragmentstool-input-end→ finalizes argumentstool-call→ complete tool call (id, name, input)These are handled in both streaming and non-streaming paths and translated to OpenAI-compatible
tool_callsobjects.DSML parser (fallback)
Added a DSML
<|DSML|tool_calls>parser as a fallback for cases where a model emits tool calls as text rather than structured events. Supports:<|DSML|invoke name="...">with<|DSML|parameter>tags<name>/<parameters>JSON format<|DSML|...>Response builders
_make_openai_chunknow acceptstool_callsparameter for streaming_make_openai_responsenow acceptstool_callsparameter for non-streamingfinish_reasonset to"tool_calls"when tool calls are emittedTesting
2+2→{"expression": "2+2"})