#Access Custom Assistant on Bot Command

1 messages · Page 1 of 1 (latest)

bitter raft
#

Hello everyone, so i'm building my own bot and i want it to answer questions with a specified command, i don't need it to save the conversations, so i just need it to make a simple reply, but i have a custom assistant with instructions, and i can't seem to access it:

async def gpt(ctx, *, user_input: str):
headers = {
"Content-Type": "application/json",
"Authorization": f"Bearer {OPENAI_API_KEY}"
}
data = {
"model": "gpt-3.5-turbo-0125",
"messages": [
{
"role": "system",
"content": "You're a helpful assistant'"
},
{
"role": "user",
"content": user_input
}
]
}
response = requests.post("https://api.openai.com/v1/chat/completions", headers=headers, json=data)
if response.status_code == 200:
try:
result = response.json()
completion = result["choices"][0]["message"]["content"]
await ctx.reply(completion)
except KeyError:
await ctx.send("Failed to generate response. Please try again later.")
else:
await ctx.send("Failed to connect to the OpenAI API. Please try again later.")

This is the function i'm using, but apparently by using my AssistantID on the model it doesn't work
But works if i use the normal gpt_3.5_turbo_00125 code that is above
`
Can anyone help please?

#

Access Custom Assistant on Bot Command

ebon quest
bitter raft
ebon quest