코드 샘플
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 참조
속성
메서드
GenerateTextAsync