Skip to content
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

[backend] agents API #186

Merged
merged 17 commits into from
Jun 10, 2024
Merged

[backend] agents API #186

merged 17 commits into from
Jun 10, 2024

Conversation

scott-cohere
Copy link
Contributor

@scott-cohere scott-cohere commented Jun 7, 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"

This PR builds on top of #175. In #175 we set up the DB and agents entity model. In this PR we set up the new API routes the logic write unit tests for the API logic and added postman examples.

  • 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 the ability to manage agents, including creating, listing, updating, and deleting them. It also adds tests for these new functionalities.

Code Changes:

  • Added new router for agents in src/backend/routers/agent.py.
  • Added agent-related functions in src/backend/routers/agent.py.
  • Updated src/backend/config/routers.py to include AGENT in RouterName and added RouterName.AGENT` configuration.
  • Added ModelType and DeploymentType enums in src/backend/schemas/agent.py.
  • Updated Agent, CreateAgent, UpdateAgent, and added DeleteAgent in src/backend/schemas/agent.py.
  • Updated update_agent function in src/backend/crud/agent.py to exclude None values when updating agent attributes.
  • Updated Agent class in src/backend/database_models/agent.py to make version, description, preamble, and temperature nullable.
  • Added tests for agent creation, listing, updating, and deletion in src/backend/tests/routers/test_agent.py.
  • Added Alembic migration script in src/backend/alembic/versions/1cbb45f9fe25_.py to update the agents table.

@scott-cohere scott-cohere changed the title [backend [backend] agents API Jun 7, 2024
@scott-cohere scott-cohere marked this pull request as ready for review June 7, 2024 21:14
docs/postman/Toolkit.postman_collection.json Show resolved Hide resolved
src/backend/database_models/agent.py Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 99.23954% with 2 lines in your changes missing coverage. Please review.

Please upload report for BASE (main@95fcd0f). Learn more about missing BASE report.

Files Patch % Lines
src/backend/alembic/versions/a9b07acef4e8_.py 84.61% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #186   +/-   ##
=======================================
  Coverage        ?   87.51%           
=======================================
  Files           ?      130           
  Lines           ?     4391           
  Branches        ?        0           
=======================================
  Hits            ?     3843           
  Misses          ?      548           
  Partials        ?        0           

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

@scott-cohere scott-cohere merged commit 7c65779 into main Jun 10, 2024
4 checks passed
@scott-cohere scott-cohere deleted the scott/agents-api branch June 10, 2024 15:35
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.

4 participants