client.checkApiKey() -> Cohere.CheckApiKeyResponse
-
-
-
Checks that the api key in the Authorization header is valid and active
-
-
-
await client.checkApiKey();
-
-
-
requestOptions:
CohereClient.RequestOptions
-
-
client.v2.chatStream({ ...params }) -> core.Stream
-
-
-
Generates a message from the model in response to a provided conversation. To learn more about the features of the Chat API follow our Text Generation guides.
Follow the Migration Guide for instructions on moving from API v1 to API v2.
-
-
-
await client.v2.chatStream({ model: "string", messages: [ { role: "user", content: "string", }, ], tools: [ { type: "function", function: { name: "string", description: "string", parameters: { string: { key: "value", }, }, }, }, ], documents: ["string"], citationOptions: { mode: Cohere.CitationOptionsMode.Fast, }, responseFormat: { type: "text", }, safetyMode: Cohere.V2ChatStreamRequestSafetyMode.Contextual, maxTokens: 1, stopSequences: ["string"], temperature: 1.1, seed: 1, frequencyPenalty: 1.1, presencePenalty: 1.1, k: 1.1, p: 1.1, returnPrompt: true, });
-
-
-
request:
Cohere.V2ChatStreamRequest
-
requestOptions:
V2.RequestOptions
-
-
client.v2.chat({ ...params }) -> Cohere.ChatResponse
-
-
-
Generates a message from the model in response to a provided conversation. To learn more about the features of the Chat API follow our Text Generation guides.
Follow the Migration Guide for instructions on moving from API v1 to API v2.
-
-
-
await client.v2.chat({ model: "model", messages: [ { role: "tool", toolCallId: "messages", }, ], });
-
-
-
request:
Cohere.V2ChatRequest
-
requestOptions:
V2.RequestOptions
-
-
client.v2.embed({ ...params }) -> Cohere.EmbedByTypeResponse
-
-
-
This endpoint returns text embeddings. An embedding is a list of floating point numbers that captures semantic information about the text that it represents.
Embeddings can be used to create text classifiers as well as empower semantic search. To learn more about embeddings, see the embedding page.
If you want to learn more how to use the embedding model, have a look at the Semantic Search Guide.
-
-
-
await client.v2.embed({ model: "model", inputType: Cohere.EmbedInputType.SearchDocument, embeddingTypes: [Cohere.EmbeddingType.Float], });
-
-
-
request:
Cohere.V2EmbedRequest
-
requestOptions:
V2.RequestOptions
-
-
client.v2.rerank({ ...params }) -> Cohere.V2RerankResponse
-
-
-
This endpoint takes in a query and a list of texts and produces an ordered array with each text assigned a relevance score.
-
-
-
await client.v2.rerank({ model: "model", query: "query", documents: ["documents"], });
-
-
-
request:
Cohere.V2RerankRequest
-
requestOptions:
V2.RequestOptions
-
-
client.embedJobs.list() -> Cohere.ListEmbedJobResponse
-
-
-
The list embed job endpoint allows users to view all embed jobs history for that specific user.
-
-
-
await client.embedJobs.list();
-
-
-
requestOptions:
EmbedJobs.RequestOptions
-
-
client.embedJobs.create({ ...params }) -> Cohere.CreateEmbedJobResponse
-
-
-
This API launches an async Embed job for a Dataset of type
embed-input
. The result of a completed embed job is new Dataset of typeembed-output
, which contains the original text entries and the corresponding embeddings.
-
-
-
await client.embedJobs.create({ model: "model", datasetId: "dataset_id", inputType: Cohere.EmbedInputType.SearchDocument, });
-
-
-
request:
Cohere.CreateEmbedJobRequest
-
requestOptions:
EmbedJobs.RequestOptions
-
-
client.embedJobs.get(id) -> Cohere.EmbedJob
-
-
-
This API retrieves the details about an embed job started by the same user.
-
-
-
await client.embedJobs.get("id");
-
-
-
id:
string
— The ID of the embed job to retrieve.
-
requestOptions:
EmbedJobs.RequestOptions
-
-
client.embedJobs.cancel(id) -> void
-
-
-
This API allows users to cancel an active embed job. Once invoked, the embedding process will be terminated, and users will be charged for the embeddings processed up to the cancellation point. It's important to note that partial results will not be available to users after cancellation.
-
-
-
await client.embedJobs.cancel("id");
-
-
-
id:
string
— The ID of the embed job to cancel.
-
requestOptions:
EmbedJobs.RequestOptions
-
-
client.datasets.list({ ...params }) -> Cohere.DatasetsListResponse
-
-
-
List datasets that have been created.
-
-
-
await client.datasets.list();
-
-
-
request:
Cohere.DatasetsListRequest
-
requestOptions:
Datasets.RequestOptions
-
-
client.datasets.create(data, evalData, { ...params }) -> Cohere.DatasetsCreateResponse
-
-
-
Create a dataset by uploading a file. See 'Dataset Creation' for more information.
-
-
-
await client.datasets.create(fs.createReadStream("/path/to/your/file"), fs.createReadStream("/path/to/your/file"), { name: "name", type: Cohere.DatasetType.EmbedInput, });
-
-
-
data:
File | fs.ReadStream | Blob
-
evalData:
File | fs.ReadStream | Blob | undefined
-
request:
Cohere.DatasetsCreateRequest
-
requestOptions:
Datasets.RequestOptions
-
-
client.datasets.getUsage() -> Cohere.DatasetsGetUsageResponse
-
-
-
View the dataset storage usage for your Organization. Each Organization can have up to 10GB of storage across all their users.
-
-
-
await client.datasets.getUsage();
-
-
-
requestOptions:
Datasets.RequestOptions
-
-
client.datasets.get(id) -> Cohere.DatasetsGetResponse
-
-
-
Retrieve a dataset by ID. See 'Datasets' for more information.
-
-
-
await client.datasets.get("id");
-
-
-
id:
string
-
requestOptions:
Datasets.RequestOptions
-
-
client.datasets.delete(id) -> Record
-
-
-
Delete a dataset by ID. Datasets are automatically deleted after 30 days, but they can also be deleted manually.
-
-
-
await client.datasets.delete("id");
-
-
-
id:
string
-
requestOptions:
Datasets.RequestOptions
-
-
client.connectors.list({ ...params }) -> Cohere.ListConnectorsResponse
-
-
-
Returns a list of connectors ordered by descending creation date (newer first). See 'Managing your Connector' for more information.
-
-
-
await client.connectors.list();
-
-
-
request:
Cohere.ConnectorsListRequest
-
requestOptions:
Connectors.RequestOptions
-
-
client.connectors.create({ ...params }) -> Cohere.CreateConnectorResponse
-
-
-
Creates a new connector. The connector is tested during registration and will cancel registration when the test is unsuccessful. See 'Creating and Deploying a Connector' for more information.
-
-
-
await client.connectors.create({ name: "name", url: "url", });
-
-
-
request:
Cohere.CreateConnectorRequest
-
requestOptions:
Connectors.RequestOptions
-
-
client.connectors.get(id) -> Cohere.GetConnectorResponse
-
-
-
Retrieve a connector by ID. See 'Connectors' for more information.
-
-
-
await client.connectors.get("id");
-
-
-
id:
string
— The ID of the connector to retrieve.
-
requestOptions:
Connectors.RequestOptions
-
-
client.connectors.delete(id) -> Cohere.DeleteConnectorResponse
-
-
-
Delete a connector by ID. See 'Connectors' for more information.
-
-
-
await client.connectors.delete("id");
-
-
-
id:
string
— The ID of the connector to delete.
-
requestOptions:
Connectors.RequestOptions
-
-
client.connectors.update(id, { ...params }) -> Cohere.UpdateConnectorResponse
-
-
-
Update a connector by ID. Omitted fields will not be updated. See 'Managing your Connector' for more information.
-
-
-
await client.connectors.update("id");
-
-
-
id:
string
— The ID of the connector to update.
-
request:
Cohere.UpdateConnectorRequest
-
requestOptions:
Connectors.RequestOptions
-
-
client.connectors.oAuthAuthorize(id, { ...params }) -> Cohere.OAuthAuthorizeResponse
-
-
-
Authorize the connector with the given ID for the connector oauth app. See 'Connector Authentication' for more information.
-
-
-
await client.connectors.oAuthAuthorize("id");
-
-
-
id:
string
— The ID of the connector to authorize.
-
request:
Cohere.ConnectorsOAuthAuthorizeRequest
-
requestOptions:
Connectors.RequestOptions
-
-
client.models.get(model) -> Cohere.GetModelResponse
-
-
-
Returns the details of a model, provided its name.
-
-
-
await client.models.get("command-r");
-
-
-
model:
string
-
requestOptions:
Models.RequestOptions
-
-
client.models.list({ ...params }) -> Cohere.ListModelsResponse
-
-
-
Returns a list of models available for use. The list contains models from Cohere as well as your fine-tuned models.
-
-
-
await client.models.list();
-
-
-
request:
Cohere.ModelsListRequest
-
requestOptions:
Models.RequestOptions
-
-
client.finetuning.listFinetunedModels({ ...params }) -> Cohere.ListFinetunedModelsResponse
-
-
-
await client.finetuning.listFinetunedModels();
-
-
-
request:
Cohere.FinetuningListFinetunedModelsRequest
-
requestOptions:
Finetuning.RequestOptions
-
-
client.finetuning.createFinetunedModel({ ...params }) -> Cohere.CreateFinetunedModelResponse
-
-
-
await client.finetuning.createFinetunedModel({ name: "api-test", settings: { baseModel: { baseType: Cohere.BaseType.BaseTypeChat, }, datasetId: "my-dataset-id", }, });
-
-
-
request:
Cohere.FinetunedModel
-
requestOptions:
Finetuning.RequestOptions
-
-
client.finetuning.getFinetunedModel(id) -> Cohere.GetFinetunedModelResponse
-
-
-
await client.finetuning.getFinetunedModel("id");
-
-
-
id:
string
— The fine-tuned model ID.
-
requestOptions:
Finetuning.RequestOptions
-
-
client.finetuning.deleteFinetunedModel(id) -> Cohere.DeleteFinetunedModelResponse
-
-
-
await client.finetuning.deleteFinetunedModel("id");
-
-
-
id:
string
— The fine-tuned model ID.
-
requestOptions:
Finetuning.RequestOptions
-
-
client.finetuning.updateFinetunedModel(id, { ...params }) -> Cohere.UpdateFinetunedModelResponse
-
-
-
await client.finetuning.updateFinetunedModel("id", { name: "name", settings: { baseModel: { baseType: Cohere.BaseType.BaseTypeUnspecified, }, datasetId: "dataset_id", }, });
-
-
-
id:
string
— FinetunedModel ID.
-
request:
Cohere.FinetuningUpdateFinetunedModelRequest
-
requestOptions:
Finetuning.RequestOptions
-
-
client.finetuning.listEvents(finetunedModelId, { ...params }) -> Cohere.ListEventsResponse
-
-
-
await client.finetuning.listEvents("finetuned_model_id");
-
-
-
finetunedModelId:
string
— The parent fine-tuned model ID.
-
request:
Cohere.FinetuningListEventsRequest
-
requestOptions:
Finetuning.RequestOptions
-
-
client.finetuning.listTrainingStepMetrics(finetunedModelId, { ...params }) -> Cohere.ListTrainingStepMetricsResponse
-
-
-
await client.finetuning.listTrainingStepMetrics("finetuned_model_id");
-
-
-
finetunedModelId:
string
— The parent fine-tuned model ID.
-
request:
Cohere.FinetuningListTrainingStepMetricsRequest
-
requestOptions:
Finetuning.RequestOptions
-
-