Skip to contents

Create a chat object.

Usage

create_chat(
  vendor,
  api_key = "",
  port = if (vendor == "ollama") 11434 else NULL,
  api_version = ""
)

Arguments

vendor

A character vector with one element. Currently, only 'openai', 'mistral', 'anthropic' and 'ollama' are supported.

api_key

The API key for the vendor's chat engine. If the vendor is 'ollama', this parameter is not required.

port

The port number for the ollama chat engine. Default to ollama's standard port. If the vendor is not 'ollama', this parameter is not required.

api_version

Api version that is required for Anthropic

Value

A chat object

Examples

if (FALSE) {
dotenv::load_dot_env()
chat_openai <- create_chat('openai', Sys.getenv('OAI_DEV_KEY'))
chat_mistral <- create_chat('mistral', Sys.getenv('MISTRAL_DEV_KEY'))
}