How do i get tool_call_id

while run.status != "completed":
        time.sleep(0.5)
        run = client.beta.threads.runs.retrieve(thread_id=thread.id, run_id=run.id)
        print(run.tools[1].function.name)
        if run.status == "requires_action":
            submit = client.beta.threads.runs.submit_tool_outputs(
                    thread_id=thread.id,
                    run_id=run.id,
                    tool_outputs=[
                        
                            {
      "tool_call_id": "the id",
      "output": "the output"
    },
                        
                      ]
                  )```

Based on your code (sorry i wrote in JS)

if (run.status === "requires_action") {

   const required_action = run.required_action

  for(let tool of required_action.submit_tool_outputs.tool_calls) {

      // tool.function.name
      // tool.function.arguments
      // tool.id <--- tool_call_id

  }

}
2 Likes

Thank you so much! It worked finally

1 Like