cohere-toolkit
cohere-toolkit copied to clipboard
backend: more compass file fixes
Thank you for contributing to the Cohere Toolkit!
-
[ ] PR title: "area: description"
- Where "area" is whichever of interface, frontend, model, tools, backend, etc. is being modified. Use "docs: ..." for purely docs changes, "infra: ..." for CI changes.
- Example: "deployment: add Azure model option"
-
[ ] PR message: Delete this entire checklist and replace with
- Description: a description of the change
- Issue: the issue # it fixes, if applicable
- Dependencies: any dependencies required for this change
-
[ ] Add tests and docs: Please include testing and documentation for your changes
-
[ ] Lint and test: Run
make lintandmake run-tests
AI Description
This pull request makes changes to the file handling and indexing mechanisms in the backend services.
Changed Files:
src/backend/routers/agent.pysrc/backend/schemas/file.pysrc/backend/services/file.pysrc/backend/tools/files.py
Summary:
- The
Fileclass insrc/backend/schemas/file.pyhas been updated to make theconversation_idandfile_contentfields optional. - The
get_compass()function insrc/backend/services/file.pynow accepts additional parameters, includingcompass_api_url,compass_parser_url,compass_username, andcompass_password. - The
insert_files_in_compassfunction now passes thectxparameter after thefilesanduser_idparameters. - The
consolidate_agent_files_in_compassfunction now includes logging statements before and after invoking thecreate_indexaction. It also uses theget_file_extensionfunction to determine thefile_extensioninstead of directly usingfilename. - The
insert_files_in_compassfunction has been updated similarly to use theget_file_extensionfunction. - The
compass_file_searchfunction insrc/backend/tools/files.pynow uses theget_compass()function to retrieve the compass instance and invokes the search action directly on it. It also includes additional error handling and prints the search results.
Codecov Report
Attention: Patch coverage is 18.75000% with 13 lines in your changes missing coverage. Please review.
Project coverage is 74.80%. Comparing base (
99de6a9) to head (9fbc937). Report is 21 commits behind head on main.
Additional details and impacted files
@@ Coverage Diff @@
## main #728 +/- ##
==========================================
- Coverage 75.00% 74.80% -0.20%
==========================================
Files 261 262 +1
Lines 11492 11537 +45
==========================================
+ Hits 8619 8630 +11
- Misses 2873 2907 +34
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.