call a chatGPT Assistant through API

Hi
I'm trying to create a GPT in R for my shinyapps using an specific assistant created in the openAi platform

So far I have managed to call the API's (or even use a document as a reference) in R itself, but still don't know how to call an Assistant

This is the code I'm using, but where do I call the assistant?

request("https://api.openai.com/v1/chat/completions") |>
req_auth_bearer_token(token = api_key) |>
req_headers("Content-Type" = "application/json") |>
req_body_json(
data=list(model="gpt-3.5-turbo",
messages=list(
list(role="user",content="2 + 1, where 2 represents a 5 and 1 represents a -1")
))
)|>
req_perform()

Thanks in any help

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.