-
Notifications
You must be signed in to change notification settings - Fork 0
feat(providers): add native tool/function calling #145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
cchinchilla-dev
wants to merge
4
commits into
main
Choose a base branch
from
feat/tool-calling-116
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
9a71830
add native tool/function calling across providers
cchinchilla-dev f9f820c
add tool-calling example and replay support for tool-iteration loops
cchinchilla-dev a58a156
fix(providers): parse ollama-shaped tool_calls (no type, dict args)
cchinchilla-dev c2966e8
docs: surface tool calling in changelog, workflow-yaml, and examples
cchinchilla-dev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| name: tool-calling-agent | ||
| version: "1.0" | ||
| description: | | ||
| Demonstrates native tool/function calling. The model decides | ||
| at runtime to invoke ``http_request`` to fetch JSON from an API, | ||
| receives the result on the next turn, and emits a final answer. | ||
|
|
||
| Runs offline against the committed recording fixture. With | ||
| ``--provider openai --model gpt-4o-mini`` it makes real calls and | ||
| the model picks the tool autonomously. | ||
|
|
||
| Producing a fresh recording: | ||
| agentloom run examples/35_tool_calling.yaml --provider openai \\ | ||
| --model gpt-4o-mini --record recordings/tool_calling.json | ||
|
|
||
| config: | ||
| provider: mock | ||
| model: gpt-4o-mini | ||
| responses_file: recordings/tool_calling.json | ||
| latency_model: constant | ||
| latency_ms: 0 | ||
| sandbox: | ||
| enabled: true | ||
| allow_network: true | ||
| allowed_domains: ["httpbin.org"] | ||
| allowed_schemes: ["https"] | ||
|
|
||
| state: | ||
| question: "What HTTP method does the httpbin /get endpoint accept?" | ||
|
|
||
| steps: | ||
| - id: ask | ||
| type: llm_call | ||
| prompt: "{state.question}" | ||
| tools: | ||
| - name: http_request | ||
| description: "Make an HTTP request to a given URL and return the response body." | ||
| parameters: | ||
| type: object | ||
| properties: | ||
| url: | ||
| type: string | ||
| description: "Full URL to GET." | ||
| method: | ||
| type: string | ||
| enum: ["GET", "POST"] | ||
| description: "HTTP method." | ||
| required: [url] | ||
| tool_choice: auto | ||
| max_tool_iterations: 3 | ||
| output: answer |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| { | ||
| "ask": [ | ||
| { | ||
| "content": "", | ||
| "provider": "openai", | ||
| "model": "gpt-4o-mini", | ||
| "tool_calls": [ | ||
| { | ||
| "id": "call_demo_1", | ||
| "name": "http_request", | ||
| "arguments": {"url": "https://httpbin.org/get", "method": "GET"} | ||
| } | ||
| ], | ||
| "usage": {"prompt_tokens": 35, "completion_tokens": 18, "total_tokens": 53}, | ||
| "cost_usd": 0.000018, | ||
| "finish_reason": "tool_calls" | ||
| }, | ||
| { | ||
| "content": "The /get endpoint of httpbin accepts the GET HTTP method, as confirmed by the successful response from https://httpbin.org/get.", | ||
| "provider": "openai", | ||
| "model": "gpt-4o-mini", | ||
| "usage": {"prompt_tokens": 320, "completion_tokens": 26, "total_tokens": 346}, | ||
| "cost_usd": 0.000061, | ||
| "finish_reason": "stop" | ||
| } | ||
| ] | ||
| } |
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.