Skip to contents

This function submits a user message to the Cohere Chat API, potentially along with other parameters such as chat history or connectors, and returns the API's response.

Usage

create_chat_cohere(
  prompt,
  chat_history = NULL,
  connectors = NULL,
  model = "command",
  api_key = Sys.getenv("COHERE_API_KEY")
)

Arguments

prompt

A string containing the user message.

chat_history

A list of previous messages for context, if any.

connectors

A list of connector objects, if any.

model

A string representing the Cohere model to be used, defaulting to "command". Other options include "command-light", "command-nightly", and "command-light-nightly".

api_key

The API key for accessing the Cohere API, defaults to the COHERE_API_KEY environment variable.

Value

The response from the Cohere Chat API containing the model's reply.