Skip to content

Conversation

@sanal-cohere
Copy link
Contributor

@sanal-cohere sanal-cohere commented Jun 19, 2024

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 PR introduces a new Python class, CompassTool, which extends the BaseTool class. This class provides functionality to interact with a Compass instance and perform operations such as creating, searching, updating, and deleting documents.

File Walkthrough:

The changes are made in the src/backend/tools/compass.py file:

  • New imports are added, including modules from the compass_sdk package.
  • The CompassTool class is defined, inheriting from BaseTool.
  • The is_available class method checks for the existence of required environment variables related to Compass configuration.
  • The __init__ method initializes the CompassTool class by setting the Compass URL, username, and password, either through direct arguments or environment variables.
  • The call method serves as the entry point for using the CompassTool. It performs various checks to ensure that the required parameters are provided and then delegates the action to specific methods (_create, _search, _update, _delete) based on the specified action.
  • The _parse method is responsible for parsing the input file and validating its existence.
  • The _create method inserts a document into Compass by first parsing the input and then using the insert_docs method of the CompassClient.
  • The _search method executes a search query on Compass and returns the top-k results.
  • The _update method updates a file in Compass by first deleting and then recreating it.
  • The _delete method removes a file from Compass using the delete_document method of the CompassClient.

Summary:

The CompassTool class provides a comprehensive set of methods to interact with a Compass instance, offering a user-friendly way to perform common operations on Compass documents.

@CLAassistant
Copy link

CLAassistant commented Jun 19, 2024

CLA assistant check
All committers have signed the CLA.

@sanal-cohere sanal-cohere changed the title Initial commit for Compass Tool Adding Compass Tool Jun 19, 2024
Copy link

@benrules3 benrules3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approach is looking good 👍

Copy link

@benrules3 benrules3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Compass integration looks right, good updates 👍

@sanal-cohere sanal-cohere marked this pull request as ready for review June 20, 2024 19:01
Copy link
Collaborator

@lusmoura lusmoura left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 0% with 83 lines in your changes missing coverage. Please review.

Please upload report for BASE (main@123a9c0). Learn more about missing BASE report.

Files Patch % Lines
src/backend/tools/compass.py 0.00% 83 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #240   +/-   ##
=======================================
  Coverage        ?   87.26%           
=======================================
  Files           ?      147           
  Lines           ?     5212           
  Branches        ?        0           
=======================================
  Hits            ?     4548           
  Misses          ?      664           
  Partials        ?        0           

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

lusmoura and others added 17 commits June 21, 2024 15:26
improve auth guide
* create new agent form

* render agents list

* link back to base agent page

* perform post submission actions

* move input labels outside of input borders

* move submit button

* gen client

* factor out agent base form

* use default content type

* list custom agents

* check if agent name is unique

* and deployment + env variables to agent form

* add deployments

* clean up

* add submit modal

* push to new agent page on create success

* only show available deployments

* remove deployments dropdown

* feat: List Assistants returned from API (#242)

* feat: list agents from BE

* Update src/interfaces/coral_web/src/components/Conversation/MessagingContainer.tsx

Co-authored-by: misspia-cohere <[email protected]>

---------

Co-authored-by: misspia-cohere <[email protected]>

* nits

---------

Co-authored-by: Khalil Najjar <[email protected]>
should_store logic to the attach_files_to_messages
* initial chat changes

* need to test

* done

* Remove old test

* default model for agents right now
* Organizations initial commit

* Organizations initial commit

* Organizations initial commit - sync main

* Organizations initial commit - sync main - blacked

* Organizations initial commit - sync main - lint

* Organizations initial commit - sync main - tests

* Organizations initial commit - sync main - tests

* Organizations initial commit - review fixes

* Organizations initial commit - review fixes
* create new agent form

* render agents list

* link back to base agent page

* perform post submission actions

* move input labels outside of input borders

* move submit button

* gen client

* factor out agent base form

* check if agent name is unique

* and deployment + env variables to agent form

* add deployments

* clean up

* remove deployments dropdown

* init agent page

* create agent drawer

* use agent form

* add update agent request

* add get agent request

* fix rebase errors

* remove model from agent form

* add agent drawer to conversation

* remove unused componenets

* use new agent name for update success message

* fix(toolkit): Address code feedback + improvements (#249)

address code feedback improvements

---------

Co-authored-by: Khalil Najjar <[email protected]>
* feat(toolkit): add/remove recently used agents

* merge main
* GUide

* Chang

* Change

* Change

* Update docs/walkthrough/walkthrough.md

Co-authored-by: Luísa Moura <[email protected]>

* Update walkthrough.md

---------

Co-authored-by: Luísa Moura <[email protected]>
* updates

* remove client changes

* remove logs

* use better header user id check

* fix validators

* typo
* Metrics: add middleware

* add chat calls

* merge

* lint

* make it async

* add user id

* add more fields

* add retry and duration

* add meta

* comments

* fix tests

* improve error handling

* rename fields

* match spec

* comments

* clean code

* only create loop when theres endpoint

* add assistant id to chat
* feat(toolkit): show assistant welcome message

* feat(toolkit): show assistant welcome message
* add login page components

* Add Register page and hooks for auth

* Add the register page and connect all the frontend elements

* Redirect to /login if the token expires and clean up some console errors

* Add error messages for failed logins

* frontend: Add Single Sign-on to Toolkit (#227)

* Add Google SSO login plus OpenID components

* Dynamically set SSO login buttons and show or hide username and password based on auth_strategies

---------

Co-authored-by: Tianjing Li <[email protected]>

* fix startup event

* Fix build errors and update the API client

* Fix tests by adding missing env vars

Add test OIDC_WELL_KNOWN_ENDPOINT var to fixtures

* Add a walkthrough guide of the toolkit  (#251)

* GUide

* Chang

* Change

* Change

* Update docs/walkthrough/walkthrough.md

Co-authored-by: Luísa Moura <[email protected]>

* Update walkthrough.md

---------

Co-authored-by: Luísa Moura <[email protected]>

* coral-web: fix agent info panel opening by default (#253)

cast isEditAgentPanelOpen to boolean

* [backend] enforce agent update with user-id (#246)

* updates

* remove client changes

* remove logs

* use better header user id check

* fix validators

* typo

* Metrics: add middleware (#185)

* Metrics: add middleware

* add chat calls

* merge

* lint

* make it async

* add user id

* add more fields

* add retry and duration

* add meta

* comments

* fix tests

* improve error handling

* rename fields

* match spec

* comments

* clean code

* only create loop when theres endpoint

* add assistant id to chat

* feat(toolkit): show assistant welcome message (#255)

* feat(toolkit): show assistant welcome message

* feat(toolkit): show assistant welcome message

---------

Co-authored-by: misspia-cohere <[email protected]>
Co-authored-by: Tianjing Li <[email protected]>
Co-authored-by: Beatrix De Wilde <[email protected]>
Co-authored-by: Luísa Moura <[email protected]>
Co-authored-by: misspia-cohere <[email protected]>
Co-authored-by: Scott <[email protected]>
Co-authored-by: Khalil Najjar <[email protected]>
@sanal-cohere sanal-cohere merged commit 0c5db02 into main Jun 21, 2024
@sanal-cohere sanal-cohere deleted the sanal/compass branch June 21, 2024 16:42
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.