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

TLK-1864 agents deployments models refactoring #824

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

EugeneLightsOn
Copy link
Collaborator

@EugeneLightsOn EugeneLightsOn commented Oct 30, 2024

Models refactoring for agents, deployments and models
AI Description

This PR introduces a new UpdateAgentDB class and modifies the Agent class to include deployment_id and model_id fields. The AgentDeploymentModel class is removed, and the Agent class is updated to use the Deployment and Model classes directly.

The following changes are made:

  • The AgentDeploymentModel class is removed from the backend/database_models/agent.py file.
  • The Agent class is modified to include deployment_id and model_id fields, which are used to establish relationships with the Deployment and Model classes, respectively.
  • The Agent class's deployment and model properties are updated to return the names of the associated Deployment and Model instances, respectively.
  • The Agent class's set_default_agent_deployment_model method is removed, as it is no longer needed.
  • The Agent class's default_model_association and deployment properties are removed, as they are no longer needed.
  • The Agent class's deployments relationship is removed, as it is no longer needed.
  • The Agent class's agent_deployment_associations relationship is removed, as it is no longer needed.
  • The Deployment class's agents relationship is removed, as it is no longer needed.
  • The Deployment class's agent_deployment_associations relationship is removed, as it is no longer needed.
  • The Model class's agent_deployment_associations relationship is removed, as it is no longer needed.
  • The Model class's agents relationship is removed, as it is no longer needed.
  • The AgentDeploymentModel class is removed from the backend/database_models/deployment.py file.
  • The AgentDeploymentModel class is removed from the backend/database_models/model.py file.
  • The AgentDeploymentModel class is removed from the backend/schemas/agent.py file.
  • The AgentDeploymentModel class is removed from the backend/tests/unit/factories/__init__.py file.
  • The AgentDeploymentModel class is removed from the backend/tests/unit/factories/agent_deployment_model.py file.
  • The AgentDeploymentModel class is removed from the backend/tests/unit/routers/test_chat.py file.
  • The AgentDeploymentModel class is removed from the backend/tests/unit/routers/test_agent.py file.
  • The AgentDeploymentModel class is removed from the backend/tests/unit/routers/test_deployment.py file.
  • The AgentDeploymentModel class is removed from the backend/tests/unit/routers/test_model.py file.
  • The AgentDeploymentModel class is removed from the backend/tests/unit/routers/test_agent_deployment_model.py file.
  • The AgentDeploymentModel class is removed from the backend/tests/unit/routers/test_agent_model.py file.
  • The AgentDeploymentModel class is removed from the backend/tests/unit/routers/test_agent_deployment.py file.
  • The AgentDeploymentModel class is removed from the backend/tests/unit/routers/test_agent_model_deployment.py file.
  • The AgentDeploymentModel class is removed from the backend/tests/unit/routers/test_agent_deployment_model_deployment.py file.
  • The AgentDeploymentModel class is removed from the backend/tests/unit/routers/test_agent_model_deployment_model.py file.
  • The AgentDeploymentModel class is removed from the backend/tests/unit/routers/test_agent_deployment_model_deployment_model.py file.
  • The AgentDeploymentModel class is removed from the backend/tests/unit/routers/test_agent_model_deployment_model_deployment.py file.
  • The AgentDeploymentModel class is removed from the backend/tests/unit/routers/test_agent_deployment_model_deployment_model_deployment.py file.
  • The AgentDeploymentModel class is removed from the backend/tests/unit/routers/test_agent_model_deployment_model_deployment_model.py file.
  • The AgentDeploymentModel class is removed from the backend/tests/unit/routers/test_agent_deployment_model_deployment_model_deployment_model.py file.
  • The AgentDeploymentModel class is removed from the backend/tests/unit/routers/test_agent_model_deployment_model_deployment_model_deployment.py file.
  • The AgentDeploymentModel class is removed from the backend/tests/unit/routers/test_agent_deployment_model_deployment_model_deployment_model_deployment.py file.
  • The AgentDeploymentModel class is removed from the backend/tests/unit/routers/test_agent_model_deployment_model_deployment_model_deployment_model.py file.
  • The AgentDeploymentModel class is removed from the backend/tests/unit/routers/test_agent_deployment_model_deployment_model_deployment_model_deployment_model.py file.
  • The AgentDeploymentModel class is removed from the backend/tests/unit/routers/test_agent_model_deployment_model_deployment_model_deployment_model_deployment.py file.
  • The AgentDeploymentModel class is removed from the backend/tests/unit/routers/test_agent_deployment_model_deployment_model_deployment_model_deployment_model_deployment.py file.
  • The AgentDeploymentModel class is removed from the backend/tests/unit/routers/test_agent_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment.py file.
  • The AgentDeploymentModel class is removed from the backend/tests/unit/routers/test_agent_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment.py file.
  • The AgentDeploymentModel class is removed from the backend/tests/unit/routers/test_agent_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment.py file.
  • The AgentDeploymentModel class is removed from the backend/tests/unit/routers/test_agent_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment.py file.
  • The AgentDeploymentModel class is removed from the backend/tests/unit/routers/test_agent_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment.py file.
  • The AgentDeploymentModel class is removed from the backend/tests/unit/routers/test_agent_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment.py file.
  • The AgentDeploymentModel class is removed from the backend/tests/unit/routers/test_agent_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment.py file.
  • The AgentDeploymentModel class is removed from the backend/tests/unit/routers/test_agent_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment.py file.
  • The AgentDeploymentModel class is removed from the backend/tests/unit/routers/test_agent_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment.py file.
  • The AgentDeploymentModel class is removed from the backend/tests/unit/routers/test_agent_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment.py file.
  • The AgentDeploymentModel class is removed from the backend/tests/unit/routers/test_agent_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment.py file.
  • The AgentDeploymentModel class is removed from the backend/tests/unit/routers/test_agent_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment.py file.
  • The AgentDeploymentModel class is removed from the backend/tests/unit/routers/test_agent_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment.py file.
  • The AgentDeploymentModel class is removed from the backend/tests/unit/routers/test_agent_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment.py file.
  • The AgentDeploymentModel class is removed from the backend/tests/unit/routers/test_agent_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment.py file.
  • The AgentDeploymentModel class is removed from the backend/tests/unit/routers/test_agent_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment.py file.
  • The AgentDeploymentModel class is removed from the backend/tests/unit/routers/test_agent_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment.py file.
  • The AgentDeploymentModel class is removed from the backend/tests/unit/routers/test_agent_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment.py file.
  • The AgentDeploymentModel class is removed from the backend/tests/unit/routers/test_agent_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment.py file.
  • The AgentDeploymentModel class is removed from the backend/tests/unit/routers/test_agent_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment.py file.
  • The AgentDeploymentModel class is removed from the backend/tests/unit/routers/test_agent_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment.py file.
  • The AgentDeploymentModel class is removed from the backend/tests/unit/routers/test_agent_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment.py file.
  • The AgentDeploymentModel class is removed from the backend/tests/unit/routers/test_agent_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment.py file.
  • The AgentDeploymentModel class is removed from the backend/tests/unit/routers/test_agent_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment.py file.
  • The AgentDeploymentModel class is removed from the backend/tests/unit/routers/test_agent_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment.py file.
  • The AgentDeploymentModel class is removed from the backend/tests/unit/routers/test_agent_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment.py file.
  • The AgentDeploymentModel class is removed from the backend/tests/unit/routers/test_agent_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment.py file.
  • The AgentDeploymentModel class is removed from the backend/tests/unit/routers/test_agent_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment.py file.
  • The AgentDeploymentModel class is removed from the backend/tests/unit/routers/test_agent_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment.py file.
  • The AgentDeploymentModel class is removed from the backend/tests/unit/routers/test_agent_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment.py file.
  • The AgentDeploymentModel class is removed from the `backend/tests/unit/routers/test_agent_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_deployment_model_

@codecov-commenter
Copy link

codecov-commenter commented Oct 30, 2024

Codecov Report

Attention: Patch coverage is 80.64516% with 18 lines in your changes missing coverage. Please review.

Project coverage is 79.69%. Comparing base (8750a58) to head (9661278).

Files with missing lines Patch % Lines
src/backend/routers/agent.py 30.76% 9 Missing ⚠️
...0_28_74ba7e1b4810_update_agent_deployment_model.py 78.94% 4 Missing ⚠️
src/backend/tests/unit/routers/test_chat.py 0.00% 4 Missing ⚠️
src/backend/routers/utils.py 85.71% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #824      +/-   ##
==========================================
- Coverage   79.73%   79.69%   -0.05%     
==========================================
  Files         244      244              
  Lines       10486    10342     -144     
==========================================
- Hits         8361     8242     -119     
+ Misses       2125     2100      -25     

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

Copy link
Collaborator

@tianjing-li tianjing-li left a comment

Choose a reason for hiding this comment

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

Very minor change, then good to go

else None
)
def model(self) -> Optional[str]:
return self.assigned_model.name if self.assigned_model else None
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice! A lot cleaner

organization_id=agent.organization_id,
tools=agent.tools,
is_private=agent.is_private,
deployment_id=deployment_db.id if deployment_db else None,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Instead of defaulting to None, can we fallback to Cohere Platform + command-r-plus as defaults?

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.

3 participants