Classe do mecanismo
TextGenerator
*Este conteúdo é traduzido por IA (Beta) e pode conter erros. Para ver a página em inglês, clique aqui.
Amostras de código
local Workspace = game:GetService("Workspace")
local textGenerator = Instance.new("TextGenerator")
textGenerator.Parent = Workspace
textGenerator.SystemPrompt = "Você é um NPC útil em um 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 Gerado: " .. response.GeneratedText)
print("Token de Contexto: " .. response.ContextToken)
print("Modelo: " .. response.Model)
return response
end
else
warn("Falha na geração de texto: " .. tostring(response))
end
return nil
end
getResponse("Me conte algo legal.")Referência API
Propriedades
Métodos
GenerateTextAsync
Parâmetros
Devolução