I’m trying to use the assistants API to summarize some PDF-s (extract some CSV data). But I’m getting an error after the run ‘completes’ (fails) with a server error…
I still think the issue is with me doing wrong. Here’s how my flow:
- Create the file via this URL: “https://api.openai.com/v1/files” (File purpose - assistants).
- Create thread.
- Create a message in the thread with an Attachment which holds the file ID and the code interpreter tool.
- Create run for the thread with an assistant that ‘holds’ every tool.
This is the JSON of the message object
{
"id": "msg_my_msg_id",
"created_at": 1731529254,
"assistant_id": null,
"thread_id": "thread_my_thread_id",
"run_id": null,
"role": "user",
"content": [
{
"type": "text",
"text": {
"value": "Build a csv from this data",
"annotations": []
},
"image_file": null,
"image_url": null
}
],
"attachments": [
{
"file_id": "file-M5mbO7YthlipD7Y6bEw6htDc",
"tools": [
{
"type": "code_interpreter"
}
]
}
],
"metadata": {}
}
And this is the JSON of the run object I get back right now
{
"id": "msg_my_msg_id",
"created_at": 1731529254,
"assistant_id": null,
"thread_id": "thread_my_thread_id",
"run_id": null,
"role": "user",
"content": [
{
"type": "text",
"text": {
"value": "Build a csv from this data",
"annotations": []
},
"image_file": null,
"image_url": null
}
],
"attachments": [
{
"file_id": "file-M5mbO7YthlipD7Y6bEw6htDc",
"tools": [
{
"type": "code_interpreter"
}
]
}
],
"metadata": {}
}
My first try was with a PDF file, after it failed, I created a small .txt file just to test, after it failed as well, I came here. Please help me internet.
Any other info I can provide if needed.