Clase de motor
TextGenerator
*Este contenido se traduce usando la IA (Beta) y puede contener errores. Para ver esta página en inglés, haz clic en aquí.
Muestras de código
local Workspace = game:GetService("Workspace")
local textGenerator = Instance.new("TextGenerator")
textGenerator.Parent = Workspace
textGenerator.SystemPrompt = "Eres un NPC útil en un mundo virtual."
textGenerator.Temperature = 0.8
textGenerator.TopP = 0.6
textGenerator.Seed = 7
local function getResponse(userInput)
local request = {
UserPrompt = userInput,
MaxTokens = 50
}
local success, response = pcall(function()
return textGenerator:GenerateTextAsync(request)
end)
if success then
if response then
print("Texto Generado: " .. response.GeneratedText)
print("Token de Contexto: " .. response.ContextToken)
print("Modelo: " .. response.Model)
return response
end
else
warn("La generación de texto falló: " .. tostring(response))
end
return nil
end
getResponse("Dime algo genial.")Referencia API
Propiedades
Métodos
GenerateTextAsync
Parámetros
Devuelve