cohere-toolkit icon indicating copy to clipboard operation
cohere-toolkit copied to clipboard

backend: more compass file fixes

Open scott-cohere opened this issue 1 year ago • 1 comments

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 lint and make 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.py
  • src/backend/schemas/file.py
  • src/backend/services/file.py
  • src/backend/tools/files.py

Summary:

  • The File class in src/backend/schemas/file.py has been updated to make the conversation_id and file_content fields optional.
  • The get_compass() function in src/backend/services/file.py now accepts additional parameters, including compass_api_url, compass_parser_url, compass_username, and compass_password.
  • The insert_files_in_compass function now passes the ctx parameter after the files and user_id parameters.
  • The consolidate_agent_files_in_compass function now includes logging statements before and after invoking the create_index action. It also uses the get_file_extension function to determine the file_extension instead of directly using filename.
  • The insert_files_in_compass function has been updated similarly to use the get_file_extension function.
  • The compass_file_search function in src/backend/tools/files.py now uses the get_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.

scott-cohere avatar Aug 21 '24 21:08 scott-cohere

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.

Files with missing lines Patch % Lines
src/backend/tools/files.py 0.00% 7 Missing :warning:
src/backend/services/file.py 0.00% 5 Missing :warning:
src/backend/routers/agent.py 0.00% 1 Missing :warning:
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.

codecov-commenter avatar Aug 21 '24 21:08 codecov-commenter