Skip to content

Add cloud-tests #206

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

Merged
merged 3 commits into from
Oct 4, 2024
Merged

Add cloud-tests #206

merged 3 commits into from
Oct 4, 2024

Conversation

billytrend-cohere
Copy link
Collaborator

@billytrend-cohere billytrend-cohere commented Oct 4, 2024

This pull request introduces a new set of cloud tests for the Cohere API, covering various functionalities such as chat, embedding, and reranking. The tests are designed to ensure the API's reliability and functionality, and they are implemented using the Jest testing framework.

Changes:

  • package.json: The "bin" field is added to specify the location of the test script, and a new "cloud-tests" script is defined to run the cloud tests.
  • src/test/cloud-tests/chat-2.test.ts: This file contains tests for the chat functionality, specifically the chat and chatStream methods. It imports the necessary modules, sets up the test environment, and defines test cases to verify the expected behaviour of the chat methods.
  • src/test/cloud-tests/chat.test.ts: Similar to the previous file, this one also tests the chat functionality but focuses on the chatStream method. It imports the required modules, configures the test environment, and defines test cases to validate the expected behaviour of the chat stream.
  • src/test/cloud-tests/convict.ts: This file sets up the configuration for the cloud tests. It imports the convict module, defines an array of testable features, and creates a configuration object with properties like baseUrl, apiKey, and featuresToTest. The configuration is then validated and exported for use in other test files.
  • src/test/cloud-tests/embed-2.test.ts: This file contains tests for the embedding functionality, specifically the v2.embed method. It imports the necessary modules, sets up the test environment, and defines a test case to verify the expected behaviour of the embedding method.
  • src/test/cloud-tests/embed.test.ts: Similar to the previous file, this one also tests the embedding functionality but focuses on the embed method. It imports the required modules, configures the test environment, and defines a test case to validate the expected behaviour of the embedding method.
  • src/test/cloud-tests/rerank-2.test.ts: This file contains tests for the reranking functionality, specifically the v2.rerank method. It imports the necessary modules, sets up the test environment, and defines a test case to verify the expected behaviour of the reranking method.
  • src/test/cloud-tests/rerank.test.ts: Similar to the previous file, this one also tests the reranking functionality but focuses on the rerank method. It imports the required modules, configures the test environment, and defines a test case to validate the expected behaviour of the reranking method.
  • src/test/cloud-tests/script.ts: This file is the entry point for running the cloud tests. It imports the Jest CLI, retrieves configuration values from the convict.ts file, sets environment variables, and then runs the cloud tests using the Jest CLI.
  • src/test/cloud-tests/utils.ts: This file defines utility functions for the cloud tests. It imports the CohereClient class, retrieves configuration values, and exports helper functions like skipIf and skipIfTestTypeIsnt to conditionally skip tests based on the configuration.

@billytrend-cohere billytrend-cohere merged commit d08363f into main Oct 4, 2024
3 checks passed
@billytrend-cohere billytrend-cohere deleted the billy/cloud-tests branch October 4, 2024 12:39
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