Assistant calls and responses

So, the responses in the API reference documentation should be taken as a guideline. When alternating between languages in the documentation the query/request format changes but the response is always the same.

I’m not much of a Python programmer myself, but it seems like they are wrapped using Pydantic (Which to me seems to be some way to apply and enforce structures/schemas using typing/models). I believe this is new, and why it’s not documented clearly.

It’s kind of nice, I guess. If you’re using an editor equipped for it you can access it’s attributes instead of blind-shooting the property and getting a traditional Python facepalming run-time error.

I’ve run into this issue as well when using Jupyter with Python. AFAIK the structure is the same, the only difference being that it’s all inside of a “data” object, maybe? Not sure 100%. Everything else is the same.

The same way you would with any other language. It’s Pagination.

get https://api.openai.com/v1/threads/{thread_id}/messages

Query parameters
limit
integer
Optional
Defaults to 20

A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
order
string
Optional
Defaults to desc

Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order.
after
string
Optional

A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.
before
string
Optional

A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.

https://platform.openai.com/docs/api-reference/messages/listMessages

tl;dr it’s just Python library (Pydantic) verbiage. Besides the potential data object it’s practically the same.

Not dumb at all. I have scratched my head a couple times when returning back from my comfortable languages to Python and having failures parsing an OpenAI response.