File Search and Function Calling: Stuck at Required_Action?

Hello, I am currently working on an assistant that reads in a PDF file of a using File Search and then have the API scrape it for important info, which is to be outputted into a very specific excel file format using function calling. Here is the start of the function:

‘’’
{
“name”: “create_excel”,
“description”: “Create an Excel file with extracted information for all tabs”,
“parameters”: {
“type”: “object”,
“properties”: {
“agreements”: {
“type”: “object”,
“description”: “Data for the Agreements tab (Tab 1)”,
“properties”: {
“Code”: {
“type”: “string”,
“description”: “Code”
},
“Name”: {
“type”: “string”
},
“Type”: {
“type”: “string”
},
“Sub_Type”: {
“type”: “string”
},
“Status_Group”: {
“type”: “string”
},
“Status”: {
“type”: “string”
},
“Responsible_Office”: {
“type”: “string”
‘’’

But I am running into an issue where my poll creates eternally stuck at “required_action.” This seems to be the same point at which the assistant in the playground requires user input like “Success: True” to continue, however I see it already has found the data I want. When I try to access the output with:

messages = list(client.beta.threads.messages.list(thread_id=thread.id, run_id=run.id))
messages = [] Empty!

But when I try to access the run from:
run = client.beta.threads.runs.create_and_poll( thread_id=thread.id, assistant_id=assistant.id)

The run has all of my data + instructions but I can see the:
required_action=RequiredAction(submit_tool_outputs=RequiredActionSubmitToolOutputs(tool_calls=[RequiredActionFunctionToolCall In the run, immedieatly followed by all of the data I need in the correct format!

How do I get past this and just get my data in the correct JSON format to be turned into an excel file? I already have that code written, I would just rather get the correct output from the assistant. When I attempt to get past the required_action, by typing “Success: ‘True’” into the assistant playground, it just gives me a random summary I didn’t ask for. The API is clearly calling the correct function (I have detailed instructions), I just cant get the correct output!

My specific excel template is very long (37 tabs) so I have been wary of just putting that really long JSON format into the instructions but could try that.

Any help is greatly appreciated, sorry for the long post.

you need to submit that output. see the last part here:

// Submit all tool outputs at once after collecting them in a list
    if (toolOutputs.length > 0) {
      run = await client.beta.threads.runs.submitToolOutputsAndPoll(
        thread.id,
        run.id,
        { tool_outputs: toolOutputs },
      );
      console.log("Tool outputs submitted successfully.");
    } else {
      console.log("No tool outputs to submit.");
    }

however, please note that the final output in the message will be determined by your instruction.