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

[WIP] Backend: mock unit tests #908

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

Conversation

ezawadski
Copy link
Collaborator

@ezawadski ezawadski commented Jan 15, 2025

Mocking Cohere API behaviour to remove API Key requirement for backend Unit Tests

AI Description

This PR introduces several changes to the backend integration and unit tests, as well as updates to the model deployments and routers.

Backend Integration and Unit Tests

  • The pytest job now includes additional steps for setting up the Python environment, installing dependencies, and configuring the test database.
  • The Python version has been updated to 3.11, and the poetry package manager is used to install dependencies.
  • The test database is set up using make test-db, and the tests are executed with make run-integration-tests and make run-unit-tests-debug.
  • The pytest job also includes steps for uploading coverage reports to Codecov.

Model Deployments

  • The name, env_vars, rerank_enabled, list_models, and is_available methods have been updated to use @staticmethod instead of @classmethod</co: 2,3,4,5,6,7>.
  • The invoke_chat method now accepts additional keyword arguments (**kwargs) in the azure.py, bedrock.py, cohere_platform.py, sagemaker.py, and single_container.py files.
  • The invoke_rerank method now accepts additional keyword arguments (**kwargs) in the azure.py, bedrock.py, cohere_platform.py, sagemaker.py, and single_container.py files.
  • The return type of the invoke_chat_stream method has been updated from AsyncGenerator[Any, Any] to Any in the base.py file.
  • The invoke_rerank method now accepts a list of strings instead of a list of dictionaries in the base.py file.

Routers

  • The create_organization function in organization.py now uses OrganizationModel(**organization.model_dump()) instead of OrganizationModel(**organization.dict()) to create a new organization.
  • The with_user method in context.py now returns Self instead of "Context".
  • The with_agent method in context.py now returns Self instead of "Context".
  • The with_agent_tool_metadata method in context.py now returns Self instead of "Context".
  • The with_model method in context.py now returns Self instead of "Context".
  • The with_deployment_config method in context.py now returns Self instead of "Context".
  • The with_conversation_id method in context.py now returns Self instead of "Context".
  • The with_stream_start_ms method in context.py now returns Self instead of "Context".

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.

1 participant