feat(tool runner): add support for server-side tools#1086
Conversation
779b28d to
2027f76
Compare
2027f76 to
134124b
Compare
…passing-tools-to-upstream
RobertCraigie
left a comment
There was a problem hiding this comment.
Instead of using BetaToolUnionParam should we only type it to allow server side tools? or rather, not allow client side tools?
I'm concerned about a footgun with surprising behaviour where a user passes in a normal client side tool without using our tool helpers, where if the model tries to call it, you'd probably get a weird error.
So another solution would be to make sure the error message in that case is helpful.
How would a user pass the client side tools without using tool helpers? It is basically only possible with the tool helpers feature. |
|
cause now you can do |
|
Ah, I see now. The server tool use blocks have other types, not 'tool_use', so our tool runner doesn't see them. For example, the web search tool use block will send 'server_tool_use' |
|
sorry no I mean that you could do this runner = client.beta.messages.tool_runner(
max_tokens=1024,
model="claude-3-5-sonnet-latest",
tools=[{"name": "get_weather", "input_schema": {...}}],
messages=[{"role": "user", "content": "What is the weather in SF?"}],
)which form the anthropic API perspective is the exact same as |
|
In that case, the tool runner will send an error message as a tool call result back to Anthropic, and the user will probably see a final message from Anthropic saying that the user-provided tool wasn't successfully called. Would it be sufficient if we add a warning there, so it would be clear to the user that something is wrong? |
| client_side_tools: list[BetaRunnableTool] = [] | ||
| server_side_tools: list[BetaToolUnionParam] = [] |
There was a problem hiding this comment.
nit: this is a bit of a misnomer
| client_side_tools: list[BetaRunnableTool] = [] | |
| server_side_tools: list[BetaToolUnionParam] = [] | |
| runnable_tools: list[BetaRunnableTool] = [] | |
| raw_tools: list[BetaToolUnionParam] = [] |
(not a big fan of raw_tools so fft come up with something else)
There was a problem hiding this comment.
changed
I'm ok with raw_tools, it's an internal naming so I wont think so much
e12ab18 to
4425c1a
Compare
No description provided.