Add text extraction to tool call processing in BedrockLLM #96
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.
Description
This pull request enhances the functionality of the
BedrockLLM
class by modifying how tool calls and text are extracted from the model's response. Previously, when tools were provided, only tool calls were extracted, and any text content was ignored. This change allows for both tool calls and text to be processed and returned.Here an example answer before the change:
Here after the change:
Changes
extract_tool_calls_and_text
which replaces the existingextract_tool_calls
function.ToolCall
objects and a string containing any text content from the response.BedrockLLM
class to utilize this new function and handle the returned text.Motivation
This change allows users to receive both tool calls and text content when using the BedrockLLM with tools, providing a more complete and flexible interaction with the model.
Additional Notes
This change maintains backwards compatibility with existing usage while providing enhanced functionality for users who need access to both tool calls and text content.