brahmai-research/aiforcause

Error: 500

Closed this issue · 4 comments

I come back, now with this code:

local http = game:GetService("HttpService")
local endpoint = "https://aiforcause.deepnight.tech/openai/v1/chat/completions"
local headers = {["Authorization"] = "Bearer helloguys"}

local function query(input: string)
	return http:JSONDecode(http:PostAsync(endpoint, http:JSONEncode({
		["model"] = "gpt-3.5-turbo", 
		["messages"] = {
			{["role"] = "user", ["message"] = input}
		},
		["temperature"] = 0.7
	}), Enum.HttpContentType.ApplicationJson, false, headers))
end

Yes this is luau, used for Roblox. Can you see any error?

This is my input: print(query("You are now YTech Bot, you need to answer and ONLY answer this question: " .. "What is 1+1?"))

Hey @Stoppedwumm,
We checked the logs and found an error for BadRequest.

Please make sure the API is being called correctly. In case your code is correct, please let us know and we'll try to figure out the problem!

Regards
Team BRAHMAI

Hey @Stoppedwumm, after looking at your code, I believe I've found the error.
It should be:

["content"] = input

and not

["message"] = input

Cheers ✌️

Hey @Stoppedwumm, after looking at your code, I believe I've found the error. It should be:

["content"] = input

and not

["message"] = input

Cheers ✌️

Thanks! Have a good one