ChatGPT assistant list API call

Hi,
This is a strange issue!
I can't call the list part og a ChatGPT Assistant Chat?
All calls to create a thread etc is working fine.
I have made a 'to-the-bone' example to illustrate the problem.

A call to 'ChatGPTassistantList' give an error: "Missing required parameter: 'role'..."

If I check the call using reqbin.com/curl I'm getting the expected response: Run Curl Commands Online (reqbin.com)

Any ideas of what is going on?
Br Teddy

Is capitalization important in "OpenAI-Beta" vs "Openai-Beta" ?

I just tested both versions with same result.

(And I'm getting the exact same error in Kodular)

Maybe add an extra header for "role" : "unknown" ?

If it's important, the client will try to use it, otherwise ignore it.

If the file was started in Kodular, it can't be used in App Inventor.

It looks like you have simply received response content that you didn't expect, which is an error message. The error message has been triggered because your request excludes the parameter "role".

The file was created manually in App Inventor to test if App Inventor was giving the same wrong response by the same request.
I can repeatedly test externally with a curl tool and get the correct response from OpenIA, and repeatedly do the same in both App Inventor and Kodular which is giving the same wrong response.
To add a message to the OpenIA thread I'm using this block, and that is working and returning correct response.

It's very strange (frustrating)

The request does not require the "role" parameter.


API Reference - OpenAI API

OpenAI is relatively new - we can expect lots of anomalies and bugs.

But still, it's strange that a simpel Html-post is returning in this way.
Do you know a way to debug further into this issue?

The problem could be that OpenAI is expecting NO data and only a Post with Headers. The working version in curl does not include '-d', and if I include an empty -d '{}' i'm getting the exact same error as in App Inventor.
Is there a way in App Inventor to make a HTTP post with an empty Data part?

I don't know :thinking: I am wondering if we could get App Inventor to run the curl script, since curl can be embedded in JavaScript and we can run JavaScript. That is the kind of challenge that would I think motivate my colleague Tim.

Please post your working curl commands..
From your first post I only can see the headers, but not the data part ..
Or is this a Get request?
Also provide the corresponding documentation

Taifun

1 Like

Thanks allot! Of course! It's a Get request. (no data...)
Now it's working and data is returned as expected. :slight_smile:
Br Teddy

Great that you got it working...
Please provide a screenshot of the working solution to help others with the same question in future

Taifun

This is the solution:


Thanks again!

2 Likes

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