powered by
Generate text completions using HuggingFace's API
create_completion_huggingface( prompt, history = NULL, model = "tiiuae/falcon-7b-instruct", token = Sys.getenv("HF_API_KEY"), max_new_tokens = 250 )
A list with the generated completions and other information returned by the API.
The prompt for generating completions
A list of the previous chat responses
The model to use for generating text
The API key for accessing HuggingFace's API. By default, the function will try to use the HF_API_KEY environment variable.
HF_API_KEY
Maximum number of tokens to generate, defaults to 250
if (FALSE) { create_completion_huggingface( model = "gpt2", prompt = "Hello world!" ) }
Run the code above in your browser using DataLab