-
Notifications
You must be signed in to change notification settings - Fork 367
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tools: unify retrievers/functions and add file tools #164
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #164 +/- ##
=======================================
Coverage ? 86.76%
=======================================
Files ? 128
Lines ? 4140
Branches ? 0
=======================================
Hits ? 3592
Misses ? 548
Partials ? 0 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, just a few nits
This is the first of a series of PRs to introduce multihop to the toolkit.
read_file
andsearch_document
tools to support uploaded files and tools simultaneously.chat_history
to add an utterance containing the available files before generating the tool calls.Looking for review for chunking documents and manipulating
chat_history
.AI Description
This PR introduces two new tools,
ReadFileTool
andSearchFileTool
, which allow for reading and searching within uploaded files.The changes include:
ReadFileTool
andSearchFileTool
classes insrc/backend/tools/files.py
.src/backend/chat/custom/custom.py
to handle the new tools and add file content to the chat history.src/backend/config/tools.py
to include the new tools and adjust existing tool definitions.get_files_by_file_names
function insrc/backend/crud/file.py
to retrieve files by their names.file_content
field insrc/backend/database_models/file.py
to store file content.src/backend/model_deployments/base.py
,src/backend/model_deployments/azure.py
,src/backend/model_deployments/bedrock.py
, andsrc/backend/model_deployments/cohere_platform.py
to includechat_history
in theinvoke_tools
method.src/backend/routers/conversation.py
to read file content during file upload.SYSTEM
role insrc/backend/schemas/chat.py
andsrc/backend/schemas/cohere_chat.py
to identify system messages.tool_results
field insrc/backend/schemas/cohere_chat.py
to store results from invoking tools.ReadFileTool
andSearchFileTool
insrc/backend/tools/__init__.py
.poetry.lock
to include the new dependencypypdf
.