feat: unified tools= parameter for tool calling#199
Open
Kamilbenkirane wants to merge 14 commits intomainfrom
Open
feat: unified tools= parameter for tool calling#199Kamilbenkirane wants to merge 14 commits intomainfrom
Kamilbenkirane wants to merge 14 commits intomainfrom
Conversation
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
Member
Author
Code reviewFound 1 issue:
celeste-python/src/celeste/modalities/text/providers/openai/client.py Lines 75 to 78 in 065a599 celeste-python/src/celeste/modalities/text/providers/xai/client.py Lines 73 to 76 in 065a599 celeste-python/src/celeste/modalities/text/providers/openresponses/client.py Lines 122 to 125 in 065a599 🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
Replace individual boolean parameters (web_search, x_search, code_execution) with a single tools= list parameter that accepts Tool instances, user-defined dicts, and raw passthrough dicts. - Add Tool, WebSearch, XSearch, CodeExecution classes with provider-specific ToolMappers that translate to wire format - Add ToolCall on Output and ToolResult(Message) for multi-turn tool use - Add ToolSupport constraint for model-level tool validation - Add _parse_tool_calls to all providers (Anthropic, OpenAI, xAI, Google, OpenResponses) for non-streaming tool call extraction - Add _aggregate_tool_calls to streaming for all providers - Update templates for new tools parameter pattern
- WebSearch (non-streaming + streaming) across all 4 providers - User-defined function tool with ToolCall parsing across all 4 providers - xAI XSearch server-side tool - Fix grok-3-mini model config: remove server-side tool support (xAI API only supports server-side tools on grok-4+ family)
… protocols Add protocol-level shared helpers so providers don't duplicate parsing logic: - Chat Completions: parse_tool_calls, serialize_messages, ToolsMapper, streaming tool call deltas - OpenResponses: parse_tool_calls, parse_text_content, serialize_messages - ToolCall extra="allow" for provider-specific fields (e.g. Google thoughtSignature) - Accept ToolResult in message lists for multi-turn tool conversations
Mirrors OpenResponsesTextClient — shared generate(), analyze(), _init_request(), _parse_content(), _parse_tool_calls() for all Chat Completions providers. DeepSeek, Groq, HuggingFace, Mistral, Moonshot now inherit from it, keeping only parameter_mappers() and _stream_class() overrides (Mistral also keeps _parse_content for thinking models). Also renames parse_text_content → parse_content in OpenResponses tools.
Map WebSearch to browser_search (Groq's native format) and add ToolSupport constraints to all Groq models. GPT-OSS models support WebSearch and CodeExecution; others support user-defined function tools only.
…al, Moonshot Add ToolSupport constraints to all models and ToolsMapper parameter mappers for the 5 Chat Completions providers. Groq GPT-OSS models support WebSearch + CodeExecution, Moonshot models support WebSearch, all others support user-defined function tools only.
065a599 to
6ca21dc
Compare
This was referenced Mar 25, 2026
…ol (#229) OpenResponses is a protocol, not a provider. The provider-level `modalities/text/providers/openresponses/` was a parallel hierarchy that reimplemented tool call parsing inline instead of delegating to the canonical `parse_tool_calls()` from the protocol layer. The inline versions were also less robust (KeyError vs .get() with fallback). OpenAI, xAI, and Ollama now inherit from the protocol-level `OpenResponsesTextClient`, matching the ChatCompletions pattern where DeepSeek, Groq, Mistral etc. inherit from `ChatCompletionsTextClient`. Fixes #219
gpt-4-turbo, gpt-4, gpt-3.5-turbo, and grok-2-vision-1212 all support tool calling but were missing TextParameter.TOOLS in their parameter constraints. Added ToolSupport(tools=[]) so they properly advertise tool support in model metadata. Fixes #225
Tool mappers now emit UnsupportedParameterWarning when a non-None WebSearch field (e.g. blocked_domains, max_uses) is not supported by the target provider. Each mapper declares _supported_fields so new WebSearch fields automatically trigger warnings on providers that don't map them. Closes #231
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.
Context
Closes #191. Builds on the rescoped #150 (which separated primitives from framework concerns) and supersedes #147 (closed — auto-execution is a framework concern).
Philosophy: Celeste is primitives, not a framework. Tools are a parameter — celeste passes schemas to providers, normalizes responses into ToolCall objects, and returns them. It never auto-executes. This mirrors how the Anthropic SDK, OpenAI SDK, and Google GenAI SDK all work: they return raw tool calls and stop.
Sub-issues
Critical
High
Medium
Low
What changed
Replace three boolean parameters (web_search=True, x_search=True, code_execution=True) with a single tools= list parameter that accepts three tool shapes:
1. Tool classes — server-side tools mapped automatically
2. User-defined function tools — dict with name
3. Raw passthrough — dict without name
Multi-turn tool use
Architecture
ToolMapper (parallel to ParameterMapper)
Each provider defines ToolMapper subclasses for the tools it supports. A single ToolsMapper (a ParameterMapper) dispatches to the right ToolMapper based on tool_type.
ToolSupport constraint
Model-level validation. Each model declares which Tool classes it supports:
Output parsing
Migration
Test plan