Learn R Programming

edgemodelr (version 0.1.6)

edge_completion: Generate text completion using loaded model

Description

Generate text completion using loaded model

Usage

edge_completion(ctx, prompt, n_predict = 128L, temperature = 0.8, top_p = 0.95)

Value

Generated text as character string

Arguments

ctx

Model context from edge_load_model()

prompt

Input text prompt

n_predict

Maximum tokens to generate (default: 128)

temperature

Sampling temperature (default: 0.8)

top_p

Top-p sampling parameter (default: 0.95)

Examples

Run this code
if (FALSE) {
# Requires a downloaded model (not run in checks)
model_path <- "model.gguf"
if (file.exists(model_path)) {
  ctx <- edge_load_model(model_path)
  result <- edge_completion(ctx, "The capital of France is", n_predict = 50)
  cat(result)
  edge_free_model(ctx)
}
}

Run the code above in your browser using DataLab