Apprendre
Classe de moteur
TextGenerator

*Ce contenu est traduit en utilisant l'IA (Beta) et peut contenir des erreurs. Pour consulter cette page en anglais, clique ici.


Résumé
Membres hérités
Échantillons de code
Générer du texte
local Workspace = game:GetService("Workspace")
local textGenerator = Instance.new("TextGenerator")
textGenerator.Parent = Workspace
textGenerator.SystemPrompt = "Vous êtes un PNJ utile dans un monde virtuel."
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("Texte généré : " .. response.GeneratedText)
print("Jeton de contexte : " .. response.ContextToken)
print("Modèle : " .. response.Model)
return response
end
else
warn("Échec de la génération de texte : " .. tostring(response))
end
return nil
end
getResponse("Dis-moi quelque chose de cool.")

Référence API
Propriétés
Seed
Lecture parallèle
Capacités : Basic
TextGenerator.Seed:number

SystemPrompt
Lecture parallèle
Capacités : Basic
TextGenerator.SystemPrompt:string

Temperature
Lecture parallèle
Capacités : Basic
TextGenerator.Temperature:number

TopP
Lecture parallèle
Capacités : Basic
TextGenerator.TopP:number

Méthodes
GenerateTextAsync
Rendement
Capacités : Basic
TextGenerator:GenerateTextAsync(request:Dictionary):Dictionary
Paramètres
request:Dictionary
Retours

©2026 Société Roblox. Roblox, le logo Roblox et Powering Imagination font partie de nos marques déposées aux États-Unis et dans d'autres pays.