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.
Created a new function extract_tool_calls_and_text which replaces the existing extract_tool_calls function.
The new function returns both a list of ToolCall objects and a string containing any text content from the response.
Modified the relevant parts of the 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.
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.