Getting dates populated into JSON Schema

Newbie so apologize for any protocol errors. I am trying to parse dates from plaintext into a JSON schema. I get random dates instead. For example this input:

Can I get a quote for 20 pallets of oranges, 10000 lbs, and 30 pallets of lemons, 10000 lbs going from Chicago to Houston, pickup tomorrow?

produces a random date output:

“pickupDate” : “2023-11-24”,

Here is the portion of my schema for that element:

                        gen.writeFieldName('pickupDate');
                        gen.writeStartObject();
                            gen.writeFieldName('type');
                            gen.writeStartArray();
                                gen.writeString('string');
                                gen.writeString('null');
                            gen.writeEndArray();      
                            gen.writeStringField('description', 'The pickup date in ISO Format for the shipment pickup location');          
                        gen.writeEndObject();  

Is there anything I can do with prompts or element description, or anything else to grab the date. Seems like an easy thing that the model is missing.

Welcome @dcraigmile

Try this schema for the pickupDate param:

"pickupDate": {
    "type": ["string", "null"],
    "description": "The pickup date in ISO Format (yyyy-mm-dd) for the shipment pickup location, where terms like 'tomorrow' should be resolved to the actual date."
}

Also, make sure to pass the current date-time in system instructions so the model knows what’s the current date, in order to be able to calculate tomorrow or the day after tomorrow.

You’d also want to run some checks when you receive the function call to make sure that the value is valid.

Thank you, sps! I will give this a try and let you know.

sps, this worked perfectly. THANK YOU!!

2 Likes