[WIP] Backend: mock unit tests #908
Open
+473
−346
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
pytest
job now includes additional steps for setting up the Python environment, installing dependencies, and configuring the test database.poetry
package manager is used to install dependencies.make test-db
, and the tests are executed withmake run-integration-tests
andmake run-unit-tests-debug
.pytest
job also includes steps for uploading coverage reports to Codecov.Model Deployments
name
,env_vars
,rerank_enabled
,list_models
, andis_available
methods have been updated to use@staticmethod
instead of@classmethod</co: 2,3,4,5,6,7>
.invoke_chat
method now accepts additional keyword arguments (**kwargs
) in theazure.py
,bedrock.py
,cohere_platform.py
,sagemaker.py
, andsingle_container.py
files.invoke_rerank
method now accepts additional keyword arguments (**kwargs
) in theazure.py
,bedrock.py
,cohere_platform.py
,sagemaker.py
, andsingle_container.py
files.invoke_chat_stream
method has been updated fromAsyncGenerator[Any, Any]
toAny
in thebase.py
file.invoke_rerank
method now accepts a list of strings instead of a list of dictionaries in thebase.py
file.Routers
create_organization
function inorganization.py
now usesOrganizationModel(**organization.model_dump())
instead ofOrganizationModel(**organization.dict())
to create a new organization.with_user
method incontext.py
now returnsSelf
instead of"Context"
.with_agent
method incontext.py
now returnsSelf
instead of"Context"
.with_agent_tool_metadata
method incontext.py
now returnsSelf
instead of"Context"
.with_model
method incontext.py
now returnsSelf
instead of"Context"
.with_deployment_config
method incontext.py
now returnsSelf
instead of"Context"
.with_conversation_id
method incontext.py
now returnsSelf
instead of"Context"
.with_stream_start_ms
method incontext.py
now returnsSelf
instead of"Context"
.