Chat: update response #184
Merged
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.
With the new version of the Cohere SDK, chat_history can contain tool results, which was breaking existing tests
AI Description
The PR introduces a new
TOOL
role forChatRole
in theChat
module. This change affects both the schema definition inchat.py
and thegenerate_chat_response
function inservices/chat.py
.Files changed:
src/backend/schemas/chat.py
src/backend/services/chat.py
Code changes:
TOOL
role to theChatRole
StrEnum
inchat.py
.ChatMessage
class inchat.py
to include an optionaltool_results
field, which stores a list of tool call results.tool_results
field inchat.py
to an empty list.generate_chat_response
function inservices/chat.py
to handle the newtool_results
field in theChatMessage
class.Summary:
The PR introduces a new
TOOL
role for theChatRole
enumeration, enhancing the flexibility of the chat system by allowing messages to be associated with tools. This change is reflected in both the schema definition and the chat response generation logic. Thetool_results
field in theChatMessage
class provides a way to store and retrieve results from tool calls, improving the chat system's ability to handle tool-related interactions and responses.