feat: return reasoning content as reasoning_content field - #3
A8Cl233395 wants to merge 2 commits into
Conversation
|
Thanks for this — the direction is right and I want to take it. The reasoning split is genuinely useful for clients, and the image handling fixes a real defect (today we inline base64 into a text part, which no vision model can use). Before merging I need three changes, all driven by one hard constraint in this project: the request body we send upstream must be byte-shaped like the one the CommandCode CLI sends. The bridge should not be distinguishable from the CLI on the wire. I checked the changes against the CLI bundle ( 1. The image part field is
|
Convert OpenAI image_url parts into native {type:"image"} parts for
/alpha/generate so vision models receive real image input instead of a
text part full of base64. Image parts are built only from base64 data
URIs and always carry the CLI's mimeType field; remote URLs and
non-base64 data URIs fall back to the short [image_url: ...] /
[image: ...] text placeholders, so the bridge never emits an image part
shape the CommandCode CLI cannot produce. Tool-result images are
forwarded as a following user message because the upstream ModelMessage
schema rejects image parts inside tool-result output.
BREAKING CHANGE: with INCLUDE_REASONING enabled, upstream reasoning
deltas are no longer appended to content. Streaming chunks carry them in
delta.reasoning_content and non-streaming responses in
message.reasoning_content. When the flag is off, the provider passthrough
strips reasoning_content instead of leaving it in the payload. Reasoning
content still counts toward the empty-visible-response guard, and
assistant messages that carry reasoning_content are forwarded upstream as
leading {type:"reasoning"} parts, matching the CommandCode CLI.
41ac2cc to
a22dbc5
Compare
|
All three points addressed: |
When INCLUDE_REASONING is enabled, emit upstream reasoning deltas as the reasoning_content field instead of merging them into content: streaming chunks use delta.reasoning_content, non-streaming responses use message.reasoning_content, and the provider passthrough keeps reasoning_content (stripping it only when the flag is off). Reasoning content also counts toward the empty visible response guard.