01 | local HttpService = game:GetService( "HttpService" ) |
02 | local API_KEY = "blanked out for privacy" |
03 | local API_URL = "https://api.openai.com/v1/engines/davinci/completions" |
04 |
05 | function generateText(prompt, length) |
06 | local requestBody = HttpService:JSONEncode( { |
07 | prompt = prompt, |
08 | length = length, |
09 | temperature = 0.7 , |
10 | } ) |
11 |
12 | local headers = { |
13 | [ "Content-Type" ] = "application/json" , |
14 | [ "Authorization" ] = "Bearer " .. API_KEY, |
15 | } |