เรียนรู้
Engine Class
TextGenerator

*เนื้อหานี้แปลโดยใช้ AI (เวอร์ชัน Beta) และอาจมีข้อผิดพลาด หากต้องการดูหน้านี้เป็นภาษาอังกฤษ ให้คลิกที่นี่


สรุป
วิธีการ
สมาชิกที่ได้รับทอด
ตัวอย่างโค้ด
local Workspace = game:GetService("Workspace")
local textGenerator = Instance.new("TextGenerator")
textGenerator.Parent = Workspace
textGenerator.SystemPrompt = "คุณเป็น NPC ที่มีประโยชน์ในโลกเสมือน"
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("ข้อความที่สร้างขึ้น: " .. response.GeneratedText)
print("โทเค็นบริบท: " .. response.ContextToken)
print("โมเดล: " .. response.Model)
return response
end
else
warn("การสร้างข้อความล้มเหลว: " .. tostring(response))
end
return nil
end
getResponse("บอกอะไรที่น่าสนใจให้ฉันฟัง")

เอกสารอ้างอิงเกี่ยวกับ API
คุณสมบัติ
Seed
อ่านพร้อมๆ กัน
ความสามารถ: Basic
TextGenerator.Seed:number

SystemPrompt
อ่านพร้อมๆ กัน
ความสามารถ: Basic
TextGenerator.SystemPrompt:string

Temperature
อ่านพร้อมๆ กัน
ความสามารถ: Basic
TextGenerator.Temperature:number

TopP
อ่านพร้อมๆ กัน
ความสามารถ: Basic
TextGenerator.TopP:number

วิธีการ
GenerateTextAsync
ผลตอบแทน
ความสามารถ: Basic
TextGenerator:GenerateTextAsync(request:Dictionary):Dictionary
พารามิเตอร์
request:Dictionary
ส่งค่ากลับ

©2026 Roblox Corporation. Roblox, โลโก้ Roblox และ Powering Imagination เป็นส่วนหนึ่งของเครื่องหมายการค้าที่จดทะเบียน และไม่ได้จดทะเบียนของเราในสหรัฐฯ และประเทศอื่นๆ