Skip to content

Conversation

lusmoura
Copy link
Collaborator

@lusmoura lusmoura commented Jun 7, 2024

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 for ChatRole in the Chat module. This change affects both the schema definition in chat.py and the generate_chat_response function in services/chat.py.

Files changed:

  • src/backend/schemas/chat.py
  • src/backend/services/chat.py

Code changes:

  • Added a new TOOL role to the ChatRole StrEnum in chat.py.
  • Modified the ChatMessage class in chat.py to include an optional tool_results field, which stores a list of tool call results.
  • Updated the default value of the tool_results field in chat.py to an empty list.
  • Refactored the generate_chat_response function in services/chat.py to handle the new tool_results field in the ChatMessage class.

Summary:
The PR introduces a new TOOL role for the ChatRole 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. The tool_results field in the ChatMessage 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.

@lusmoura lusmoura changed the title Chat: update request Chat: update response Jun 7, 2024
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (main@3b5f94f). Learn more about missing BASE report.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #184   +/-   ##
=======================================
  Coverage        ?   86.76%           
=======================================
  Files           ?      128           
  Lines           ?     4140           
  Branches        ?        0           
=======================================
  Hits            ?     3592           
  Misses          ?      548           
  Partials        ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@lusmoura lusmoura merged commit d3d0024 into main Jun 10, 2024
@lusmoura lusmoura deleted the luisa/fix_tools_chat_history branch June 10, 2024 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants