Repository navigation
feat(core-ai): tool calling for both provider protocols - #4630
Merged
Merged
Conversation
Spine for agent mode. Text-only chat path is unchanged. - ChatMessage content is now Vec<ContentBlock> (Text, ToolUse, ToolResult); user()/assistant() still build one Text block, text() joins Text blocks. - ChatRequest gains tools: Vec<ToolSpec>. - ReplyEvent::ToolCall and StopReason::ToolUse. - Anthropic: serialize tools and tool_use/tool_result blocks; assemble streamed tool_use blocks into one ToolCall; map stop_reason tool_use. - OpenAI: serialize tools as function specs and tool_calls/role:tool messages; assemble streamed delta.tool_calls by index; map finish_reason tool_calls. - FFI and Linux keep compiling; both drop ToolCall and treat ToolUse as a normal end for now. FFI UniFFI surface unchanged.
datlechin
enabled auto-merge (squash)
November 27, 2026 09:01
This was referenced Nov 27, 2026
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
tablepro-ainow carries tool calls for both provider protocols. The text-only chat path is unchanged.ChatMessagecontent isVec<ContentBlock>(Text,ToolUse,ToolResult).ChatMessage::user/assistantstill build a singleTextblock;ChatMessage::text()joins theTextblocks.ChatRequestgainstools: Vec<ToolSpec>(name, description, JSON Schema input).ReplyEvent::ToolCall { id, name, input }andStopReason::ToolUse.toolsandtool_use/tool_resultblocks (a plain text turn stays a bare string); assemblecontent_block_start+input_json_delta+content_block_stopinto oneToolCall; mapstop_reason: tool_use.toolsas{type:function, function:{name,description,parameters}}and messages withtool_calls/role:toolresults (arguments as a JSON string); assemble streameddelta.tool_callsby index; mapfinish_reason: tool_calls.ToolCallfor now and treatToolUseas a normal end. The FFI UniFFI surface is unchanged, so no bindings were regenerated.Test plan
tablepro-aiunit tests: Anthropic and OpenAI request serialization carriestoolsand structured content; streaming parsers assemble atool_use/tool_callsblock from captured SSE chunk sequences into oneReplyEvent::ToolCallwith the right id/name/parsed input;stop_reason/finish_reasonmap toStopReason::ToolUse.cargo test --locked -p tablepro-ai(59 lib + 14 provider tests green),cargo clippy --locked -p tablepro-ai --all-targetswarning-free,cargo check --locked -p tablepro-ffigreen,cargo test --locked -p tablepro-ffi --test aigreen (text chat unchanged).glycincrate needsmemfd); the Linux edits are a struct-field init and two match arms, left for Linux CI.Fixes #