Learn R Programming

gptstudio (version 0.4.0)

create_completion_huggingface: Generate text completions using HuggingFace's API

Description

Generate text completions using HuggingFace's API

Usage

create_completion_huggingface(
  prompt,
  history = NULL,
  model = "tiiuae/falcon-7b-instruct",
  token = Sys.getenv("HF_API_KEY"),
  max_new_tokens = 250
)

Value

A list with the generated completions and other information returned by the API.

Arguments

prompt

The prompt for generating completions

history

A list of the previous chat responses

model

The model to use for generating text

token

The API key for accessing HuggingFace's API. By default, the function will try to use the HF_API_KEY environment variable.

max_new_tokens

Maximum number of tokens to generate, defaults to 250

Examples

Run this code
if (FALSE) {
create_completion_huggingface(
  model = "gpt2",
  prompt = "Hello world!"
)
}

Run the code above in your browser using DataLab