79650192

Date: 2025-06-02 19:02:50
Score: 1.5
Natty:
Report link

Following a comment by @furas, I changed the code to use the attachments keyword instead of file_ids, and now it works. Here's the corrected code:

       # Create a new assistant 
        assistant = client.beta.assistants.create(
            name="Seminar HTML to CSV Assistant",
            instructions=instructions,
            model="gpt-4",
            tools=[{"type": "code_interpreter"}],
        )


        # Create a thread
        thread = client.beta.threads.create()

        # Create a message with the uploaded file
        message = client.beta.threads.messages.create(
            thread_id=thread.id,
            role="user",
            content="Here is the HTML content for the seminar page.",
            attachments=[{"file_id": file.id, "tools": [{"type": "code_interpreter"}]}]
        )


        # Run the assistant
        run = client.beta.threads.runs.create(
            thread_id=thread.id,
            assistant_id=assistant.id
        )
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • User mentioned (1): @furas
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: John Paul