Showcasing the GPT4-o capabilities of parsing text into structured data. We start by configuring an Assistant with "file-search" capabilities and the instruction: "You are a helpful assistant designed to output JSON. When provided with a file containing an invoice, return the Total Amount, Customer Company Name, Customer Representative Name, Customer Email, and Shipping Address.
Example response:
{
"TotalAmount": "number", // Do not return the currency, just the amount
"CompanyName": "string", // The customer company name. Empty if not found, do not return the supplier company name.
"Name": "string", // Customer representative name or empty if not found
"Email": "string", // The email address of the customer. Empty if not found, do not return the supplier email address.
"ShippingAddress": "string" // Transform the shipping address by removing carriage returns and extra spaces so it reads as one line. Do not include phone numbers.
}
Only output valid JSON. Do not include any additional text or explanations."
The code will then upload an invoice file to a vector store and call the assistant to extract the fields instructed using the vector store. After the execution, the thread, vector store and file are deleted.