Skip to contents

Sends messages to an assistant using the OpenAI-compatible chat completions interface. This interface is useful for OpenAI-compatible responses but has limited functionality compared to the standard chat interface.

Usage

assistant_chat_completions(assistant_name, messages, model = NULL)

Arguments

assistant_name

Name of the assistant

messages

List of message objects. Each message should have: - role: Either "user" or "assistant" - content: The message text (cannot be empty)

model

Optional model to use (e.g., "gpt-4o")

Value

List with http response, content (OpenAI-style response), and status_code. Content includes: - id: Response ID - model: Model used - choices: List of choice objects with message and finish_reason

Examples

if (FALSE) { # \dontrun{
assistant_chat_completions(
  assistant_name = "my-assistant",
  messages = list(
    list(role = "user", content = "What is the maximum height of a red pine?")
  )
)
} # }