Is there any way to convert file (pdf) content into JSON?

I have uploaded a PDF file using this API:

curl https://api.openai.com/v1/files \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -F purpose="assistants" \
  -F file="@./resume.pdf"

I received the file ID file-213we. Is there an API that allows me to pass the file ID and a question?

My goal is to extract information from the resume and get it in JSON format, including details such as Name, Email, Phone Number, Experience, etc.

like this?

thread = client.beta.threads.create(
  messages=[
    {
      "role": "user",
      "content": question,
       "attachments": [
        { "file_id": "file-213we", "tools": [{"type": "file_search"}] }
      ],
    }
  ]
)

you need to use assistants api with file search enabled.

2 Likes