server/python_tools: add python tool parsing logic#10453
Closed
ParthSareen wants to merge 2 commits intomainfrom
Closed
server/python_tools: add python tool parsing logic#10453ParthSareen wants to merge 2 commits intomainfrom
ParthSareen wants to merge 2 commits intomainfrom
Conversation
There was a problem hiding this comment.
Pull Request Overview
This pull request adds Python tool parsing logic to the server package with comprehensive unit tests for both function calls and value parsing.
- Implements parsing of Python function calls with keyword arguments and handles multiple function calls in a single string.
- Adds dedicated tests to cover various argument types and edge cases for both function and value parsing.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| server/python_tools_test.go | Introduces tests covering a range of scenarios from valid calls to error cases. |
| server/python_tools.go | Implements functions to parse Python values and function call strings. |
769e995 to
82f0e0f
Compare
jmorganca
reviewed
Apr 29, 2025
| }, | ||
| { | ||
| name: "whitespace handling", | ||
| input: "get_current_weather( location = \"San Francisco\" , temp = 72 )", |
Member
There was a problem hiding this comment.
Should we add more tests with edge cases such as text before/after, etc?
Member
Author
There was a problem hiding this comment.
Not in this case as the outer function (in next PR) is going to be handling that. Will have tests for varying messages there.
jmorganca
reviewed
Apr 30, 2025
server/python_tools.go
Outdated
| for _, match := range matches { | ||
| name := s[match[2]:match[3]] | ||
| args := s[match[4]:match[5]] | ||
| arguments := make(api.ToolCallFunctionArguments) |
Member
There was a problem hiding this comment.
Suggested change
| arguments := make(api.ToolCallFunctionArguments) | |
| var arguments api.ToolCallFunctionArguments |
8abc5eb to
9ecbcc4
Compare
9ecbcc4 to
611d3a1
Compare
6 tasks
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.
This PR introduces a small python parsing package for supporting python based tool calls.
Only kwargs and empty python functions are currently supported.
The parsing logic can be a bit hard to figure out so feedback to make clearer is appreciated!