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: Deployments refactor; Add deployment service and fix deployment config setting #831

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

Conversation

malexw
Copy link
Collaborator

@malexw malexw commented Nov 6, 2024

The motivation for this change was a request to improve how deployment configs are set in Coral.

Deployments are set up by creating subclasses of BaseDeployment and usually these have the configuration values we want to use when calling models. However, we also have the ability to make changes to these models, which are then stored in the DB. This refactor introduces a deployment_service module to hide the differences between models that are purely defined in code and models that have updates stored in the DB.

This change also finishes off the partially-completed Coral work that allows for changing model config values.

There is a new potential security issue now introduced. We are assuming that anyone who is running Toolkit should have permission to view and change global deployment configurations, which includes API keys. If that's not true, we'll need to add a concept of admin users in the future and prevent non-admins from viewing and changing these values.

AI Description

This PR introduces a new DeploymentNotFoundError exception to handle cases where a deployment is not found. It also refactors the get_deployment function to use a new deployment_service module, which provides methods for retrieving deployments by name or ID. The get_deployment function now returns a BaseDeployment instance, which is a base class for all model deployment options.

The PR also adds a new DeploymentInfo class, which represents the information required to interact with an LLM. This class is used in various parts of the codebase, including the create_deployment, update_deployment, and get_deployment functions.

Additionally, the PR updates the create_deployment_by_config and create_model_by_config functions to use the new DeploymentInfo class. It also updates the validate_deployment_config function to use the new deployment_service module.

The PR also introduces a new get_installed_deployments function, which returns a list of installed deployments. This function is used in the get_available_deployments function, which has been updated to use the new deployment_service module.

The PR also updates the get_deployments_info function to use the new deployment_service module. This function is used in the list_deployments function, which has been updated to use the new DeploymentInfo class.

The PR also introduces a new update_config function, which updates the configuration of a deployment. This function is used in the set_env_vars function, which has been updated to use the new deployment_service module.

The PR also updates the validate_env_vars function to use the new deployment_service module. This function is used in the create_agent function, which has been updated to use the new DeploymentInfo class.

The PR also introduces a new get_default_deployment function, which returns the default deployment. This function is used in the get_deployment function, which has been updated to use the new deployment_service module.

The PR also updates the get_available_deployments function to use the new deployment_service module. This function is used in the get_deployments_info function, which has been updated to use the new DeploymentInfo class.

The PR also updates the get_deployment_info function to use the new deployment_service module. This function is used in the get_deployment function, which has been updated to use the new DeploymentInfo class.

The PR also updates the get_deployment_info_by_name function to use the new deployment_service module. This function is used in the get_deployments_info function, which has been updated to use the new DeploymentInfo class.

The PR also updates the get_deployments_info function to use the new deployment_service module. This function is used in the list_deployments function, which has been updated to use the new DeploymentInfo class.

The PR also updates the get_deployment_info function to use the new deployment_service module. This function is used in the get_deployment function, which has been updated to use the new DeploymentInfo class.

The PR also updates the get_deployment_info_by_name function to use the new deployment_service module. This function is used in the get_deployments_info function, which has been updated to use the new DeploymentInfo class.

The PR also updates the get_deployments_info function to use the new deployment_service module. This function is used in the list_deployments function, which has been updated to use the new DeploymentInfo class.

The PR also updates the get_deployment_info function to use the new deployment_service module. This function is used in the get_deployment function, which has been updated to use the new DeploymentInfo class.

The PR also updates the get_deployment_info_by_name function to use the new deployment_service module. This function is used in the get_deployments_info function, which has been updated to use the new DeploymentInfo class.

The PR also updates the get_deployments_info function to use the new deployment_service module. This function is used in the list_deployments function, which has been updated to use the new DeploymentInfo class.

The PR also updates the get_deployment_info function to use the new deployment_service module. This function is used in the get_deployment function, which has been updated to use the new DeploymentInfo class.

The PR also updates the get_deployment_info_by_name function to use the new deployment_service module. This function is used in the get_deployments_info function, which has been updated to use the new DeploymentInfo class.

The PR also updates the get_deployments_info function to use the new deployment_service module. This function is used in the list_deployments function, which has been updated to use the new DeploymentInfo class.

The PR also updates the get_deployment_info function to use the new deployment_service module. This function is used in the get_deployment function, which has been updated to use the new DeploymentInfo class.

The PR also updates the get_deployment_info_by_name function to use the new deployment_service module. This function is used in the get_deployments_info function, which has been updated to use the new DeploymentInfo class.

The PR also updates the get_deployments_info function to use the new deployment_service module. This function is used in the list_deployments function, which has been updated to use the new DeploymentInfo class.

The PR also updates the get_deployment_info function to use the new deployment_service module. This function is used in the get_deployment function, which has been updated to use the new DeploymentInfo class.

The PR also updates the get_deployment_info_by_name function to use the new deployment_service module. This function is used in the get_deployments_info function, which has been updated to use the new DeploymentInfo class.

The PR also updates the get_deployments_info function to use the new deployment_service module. This function is used in the list_deployments function, which has been updated to use the new DeploymentInfo class.

The PR also updates the get_deployment_info function to use the new deployment_service module. This function is used in the get_deployment function, which has been updated to use the new DeploymentInfo class.

The PR also updates the get_deployment_info_by_name function to use the new deployment_service module. This function is used in the get_deployments_info function, which has been updated to use the new DeploymentInfo class.

The PR also updates the get_deployments_info function to use the new deployment_service module. This function is used in the list_deployments function, which has been updated to use the new DeploymentInfo class.

The PR also updates the get_deployment_info function to use the new deployment_service module. This function is used in the get_deployment function, which has been updated to use the new DeploymentInfo class.

The PR also updates the get_deployment_info_by_name function to use the new deployment_service module. This function is used in the get_deployments_info function, which has been updated to use the new DeploymentInfo class.

The PR also updates the get_deployments_info function to use the new deployment_service module. This function is used in the list_deployments function, which has been updated to use the new DeploymentInfo class.

The PR also updates the get_deployment_info function to use the new deployment_service module. This function is used in the get_deployment function, which has been updated to use the new DeploymentInfo class.

The PR also updates the get_deployment_info_by_name function to use the new deployment_service module. This function is used in the get_deployments_info function, which has been updated to use the new DeploymentInfo class.

The PR also updates the get_deployments_info function to use the new deployment_service module. This function is used in the list_deployments function, which has been updated to use the new DeploymentInfo class.

The PR also updates the get_deployment_info function to use the new deployment_service module. This function is used in the get_deployment function, which has been updated to use the new DeploymentInfo class.

The PR also updates the get_deployment_info_by_name function to use the new deployment_service module. This function is used in the get_deployments_info function, which has been updated to use the new DeploymentInfo class.

The PR also updates the get_deployments_info function to use the new deployment_service module. This function is used in the list_deployments function, which has been updated to use the new DeploymentInfo class.

The PR also updates the get_deployment_info function to use the new deployment_service module. This function is used in the get_deployment function, which has been updated to use the new DeploymentInfo class.

The PR also updates the get_deployment_info_by_name function to use the new deployment_service module. This function is used in the get_deployments_info function, which has been updated to use the new DeploymentInfo class.

The PR also updates the get_deployments_info function to use the new deployment_service module. This function is used in the list_deployments function, which has been updated to use the new DeploymentInfo class.

The PR also updates the get_deployment_info function to use the new deployment_service module. This function is used in the get_deployment function, which has been updated to use the new DeploymentInfo class.

The PR also updates the get_deployment_info_by_name function to use the new deployment_service module. This function is used in the get_deployments_info function, which has been updated to use the new DeploymentInfo class.

The PR also updates the get_deployments_info function to use the new deployment_service module. This function is used in the list_deployments function, which has been updated to use the new DeploymentInfo class.

The PR also updates the get_deployment_info function to use the new deployment_service module. This function is used in the get_deployment function, which has been updated to use the new DeploymentInfo class.

The PR also updates the get_deployment_info_by_name function to use the new deployment_service module. This function is used in the get_deployments_info function, which has been updated to use the new DeploymentInfo class.

The PR also updates the get_deployments_info function to use the new deployment_service module. This function is used in the list_deployments function, which has been updated to use the new DeploymentInfo class.

The PR also updates the get_deployment_info function to use the new deployment_service module. This function is used in the get_deployment function, which has been updated to use the new DeploymentInfo class.

The PR also updates the get_deployment_info_by_name function to use the new deployment_service module. This function is used in the get_deployments_info function, which has been updated to use the new DeploymentInfo class.

The PR also updates the get_deployments_info function to use the new deployment_service module. This function is used in the list_deployments function, which has been updated to use the new DeploymentInfo class.

The PR also updates the get_deployment_info function to use the new deployment_service module. This function is used in the get_deployment function, which has been updated to use the new DeploymentInfo class.

The PR also updates the get_deployment_info_by_name function to use the new deployment_service module. This function is used in the get_deployments_info function, which has been updated to use the new DeploymentInfo class.

The PR also updates the get_deployments_info function to use the new deployment_service module. This function is used in the list_deployments function, which has been updated to use the new DeploymentInfo class.

The PR also updates the get_deployment_info function to use the new deployment_service module. This function is used in the get_deployment function, which has been updated to use the new DeploymentInfo class.

The PR also updates the get_deployment_info_by_name function to use the new deployment_service module. This function is used in the get_deployments_info function, which has been updated to use the new DeploymentInfo class.

The PR also updates the get_deployments_info function to use the new deployment_service module. This function is used in the list_deployments function, which has been updated to use the new DeploymentInfo class.

The PR also updates the get_deployment_info function to use the new deployment_service module. This function is used in the get_deployment function, which has been updated to use the new DeploymentInfo class.

The PR also updates the get_deployment_info_by_name function to use the new deployment_service module. This function is used in the get_deployments_info function, which has been updated to use the new DeploymentInfo class.

The PR also updates the get_deployments_info function to use the new deployment_service module. This function is used in the list_deployments function, which has been updated to use the new DeploymentInfo class.

The PR also updates the get_deployment_info function to use the new deployment_service module. This function is used in the get_deployment function, which has been updated to use the new DeploymentInfo class.

The PR also updates the get_deployment_info_by_name function to use the new deployment_service module. This function is used in the get_deployments_info function, which has been updated to use the new DeploymentInfo class.

The PR also updates the get_deployments_info function to use the new deployment_service module. This function is used in the list_deployments function, which has been updated to use the new DeploymentInfo class.

The PR also updates the get_deployment_info function to use the new deployment_service module. This function is used in the get_deployment function, which has been updated to use the new DeploymentInfo class.

The PR also updates the get_deployment_info_by_name function to use the new deployment_service module. This function is used in the get_deployments_info function, which has been updated to use the new DeploymentInfo class.

The PR also updates the get_deployments_info function to use the new deployment_service module. This function is used in the list_deployments function, which has been updated to use the new DeploymentInfo class.

The PR also updates the get_deployment_info function to use the new deployment_service module. This function is used in the get_deployment function, which has been updated to use the new DeploymentInfo class.

The PR also updates the get_deployment_info_by_name function to use the new deployment_service module. This function is used in the get_deployments_info function, which has been updated to use the new DeploymentInfo class.

The PR also updates the get_deployments_info function to use the new deployment_service module. This function is used in the list_deployments function, which has been updated to use the new DeploymentInfo class.

The PR also updates the get_deployment_info function to use the new deployment_service module. This function is used in the get_deployment function, which has been updated to use the new DeploymentInfo class.

The PR also updates the get_deployment_info_by_name function to use the new deployment_service module. This function is used in the get_deployments_info function, which has been updated to use the new DeploymentInfo class.

The PR also updates

Copy link
Collaborator Author

@malexw malexw left a comment

Choose a reason for hiding this comment

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

TODOs

src/backend/cli/main.py Outdated Show resolved Hide resolved
src/backend/config/settings.py Outdated Show resolved Hide resolved
src/backend/crud/deployment.py Outdated Show resolved Hide resolved
src/backend/crud/deployment.py Outdated Show resolved Hide resolved
src/backend/main.py Show resolved Hide resolved
src/backend/schemas/deployment.py Outdated Show resolved Hide resolved
src/backend/services/request_validators.py Outdated Show resolved Hide resolved
src/interfaces/coral_web/.env.development Outdated Show resolved Hide resolved
src/interfaces/coral_web/package.json Outdated Show resolved Hide resolved
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.

Great great PR, happy to see a lot of these changes. Added some general comments throughout

src/backend/chat/custom/utils.py Show resolved Hide resolved
src/backend/chat/custom/utils.py Outdated Show resolved Hide resolved
src/backend/cli/main.py Outdated Show resolved Hide resolved
src/backend/config/deployments.py Outdated Show resolved Hide resolved
src/backend/config/deployments.py Outdated Show resolved Hide resolved
src/backend/routers/deployment.py Show resolved Hide resolved
src/backend/services/deployment.py Show resolved Hide resolved
src/backend/services/deployment.py Outdated Show resolved Hide resolved
src/community/config/deployments.py Outdated Show resolved Hide resolved
src/backend/config/deployments.py Outdated Show resolved Hide resolved
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.

Looks good to me, pinged @EugeneLightsOn to help take a second look

Copy link
Collaborator

@EugeneLightsOn EugeneLightsOn left a comment

Choose a reason for hiding this comment

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

Great work, some changes are requested

src/backend/services/request_validators.py Show resolved Hide resolved
src/backend/crud/deployment.py Show resolved Hide resolved
src/backend/services/request_validators.py Show resolved Hide resolved
src/backend/crud/deployment.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@EugeneLightsOn EugeneLightsOn left a comment

Choose a reason for hiding this comment

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

Great PR Alex! Small nit to fix and ready to go.

src/backend/schemas/deployment.py Show resolved Hide resolved
Copy link
Collaborator

@EugeneLightsOn EugeneLightsOn left a comment

Choose a reason for hiding this comment

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

Great PR, Alex. Looks good to me

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