Skip to contents

Perform an API request to interact with language models

Usage

perform_api_request(
  .request,
  .api,
  .stream = FALSE,
  .timeout = 60,
  .parse_response_fn = NULL,
  .dry_run = FALSE
)

Arguments

.request

The httr2 request object.

.api

The API identifier (e.g., "claude", "openai").

.stream

Stream the response if TRUE.

.timeout

Request timeout in seconds.

.parse_response_fn

A function to parse the assistant's reply.

.dry_run

If TRUE, perform a dry run and return the request object.

Value

A list containing the assistant's reply and response headers.