Text Completion

Once you initialized the client and stored it as a variable, we can simply use the TextCompletion function in the client like this:

local response = client.TextCompletion({
    prompt = 'Human: Hello\nAI:',
    stop = {
        'Human:',
        'AI:'
    }
})

The response variable will contain the following:

  • Used model "response.model" (string)

  • The first choice "response.choice" (table)

  • Token usage "response.usage" (table)

All arguments/Options

prompt (string) (required)

temperature (number) (optional) (default: 0.7)

max_tokens (number) (optional) (default: 256)

stop (table) (optional) (default: {})

Last updated

Was this helpful?