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.
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:
"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.chat
andchatStream
methods. It imports the necessary modules, sets up the test environment, and defines test cases to verify the expected behaviour of the chat methods.chatStream
method. It imports the required modules, configures the test environment, and defines test cases to validate the expected behaviour of the chat stream.convict
module, defines an array of testable features, and creates a configuration object with properties likebaseUrl
,apiKey
, andfeaturesToTest
. The configuration is then validated and exported for use in other test files.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.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.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.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.convict.ts
file, sets environment variables, and then runs the cloud tests using the Jest CLI.CohereClient
class, retrieves configuration values, and exports helper functions likeskipIf
andskipIfTestTypeIsnt
to conditionally skip tests based on the configuration.