chat_api {askgpt}R Documentation

Request answer from openai's chat API

Description

Request answer from openai's chat API

Usage

chat_api(
  prompt,
  model = NULL,
  config = NULL,
  max_tokens = NULL,
  api_key = NULL,
  ...
)

Arguments

prompt

character string of the prompt to be completed.

model

character string of the model to be used (defaults to "text-davinci-003").

config

a configuration prompt to tell the model how it should behave.

max_tokens

The maximum number of tokens to generate in the completion. 2048L is the maximum the models accept.

api_key

set the API key. If NULL, looks for the env OPENAI_API_KEY.

...

additional parameters to be passed to the API (see [the API documentation](https://platform.openai.com/docs/api-reference/completions)

Value

A tibble with available models

a httr2 response object

Examples

## Not run: 
chat_api("Hi, how are you?", config = "answer as a friendly chat bot")

## End(Not run)

[Package askgpt version 0.1.3 Index]