You can use Gemini response_schema to get structured output from your text input. How to extract numerical values Sample code Response from Gemini: You might have noticed that I use an Explanation class along with the field I want to extract. Here is why
You can increase the accuracy of the response for the Structured Output from GPT4 API by asking for an Explanation How to ask for an explanation? Just add an explanation class to each output parameter you expect, like below! (Yes, GPT and Gemini LLMs are both smart enough to infer …