Add support for tool execution - #41
Merged
Merged
Conversation
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 pull request adds support for tool calls to the
dspy-rslibrary, enabling language models to interact with external tools during chat completions. The changes introduce a newToolDyntrait object for passing tools, update the adapter and predictor interfaces to accept tools, implement the tool execution loop in the language model, and provide tests for tool call functionality.Tool Call Support Integration
ToolDyntrait object and updated relevant imports to support dynamic tool handling across the adapter, core, and predictor modules. [1] [2] [3] [4]Adaptertrait,ChatAdapter, andPredictpredictor to accept and forward a list of tools for use during prediction and chat completion. [1] [2] [3]Language Model Execution Loop
LMstruct, allowing the model to handle tool calls, execute tools, and continue the conversation until a text response is generated or a maximum iteration count is reached. [1] [2]LM::callmethod to process tool definitions, set tool choice, and correctly accumulate token usage across tool calls. [1] [2]Utilities and Testing
NoToolplaceholder type to handle cases where no tools are provided, improving error handling and interface clarity.Closes #33