Closed RockyNiu closed 2 months ago
Add an error handling in get_rag_response() when AI response misses ending bracket at the end.
The example error response:
"\n{\n \"invoice_number\": 61356291,\n \"invoice_date\": \"09/06/2012\",\n \"client_name\": \"Rodriguez-Stevens\",\n \"client_address\": \"2280 Angela Plain Hortonshire, MS 93248\",\n \"client_tax_id\": \"939-98-8477\",\n \"seller_name\": \"Chapman, Kim and Green\",\n \"seller_address\": \"64731 James Branch Smithmouth, NC 26872\",\n \"seller_tax_id\": \"949-84-9105\",\n \"iban\": \"GB50ACIE59715038217063\",\n \"names_of_invoice_items\": [\n \"Wine Glasses Goblets Pair Clear Glass\",\n \"With Hooks Stemware Storage Multiple Uses Iron Wine Rack\",\n \"Replacement Corkscrew Parts Spiral Worm Wine Opener Bottle Houdini\",\n \"HOME ESSENTIALS GRADIENT STEMLESS WINE GLASSES SET OF 4 20 FL OZ (591 ml) NEW\"\n ],\n \"gross_worth_of_invoice_items\": [\n 60.0,\n 123.55,\n 8.25,\n 14.29\n ],\n \"total_gross_worth\": \"$212.09\""
Add an error handling in get_rag_response() when AI response misses ending bracket at the end.
The example error response:
"\n{\n \"invoice_number\": 61356291,\n \"invoice_date\": \"09/06/2012\",\n \"client_name\": \"Rodriguez-Stevens\",\n \"client_address\": \"2280 Angela Plain Hortonshire, MS 93248\",\n \"client_tax_id\": \"939-98-8477\",\n \"seller_name\": \"Chapman, Kim and Green\",\n \"seller_address\": \"64731 James Branch Smithmouth, NC 26872\",\n \"seller_tax_id\": \"949-84-9105\",\n \"iban\": \"GB50ACIE59715038217063\",\n \"names_of_invoice_items\": [\n \"Wine Glasses Goblets Pair Clear Glass\",\n \"With Hooks Stemware Storage Multiple Uses Iron Wine Rack\",\n \"Replacement Corkscrew Parts Spiral Worm Wine Opener Bottle Houdini\",\n \"HOME ESSENTIALS GRADIENT STEMLESS WINE GLASSES SET OF 4 20 FL OZ (591 ml) NEW\"\n ],\n \"gross_worth_of_invoice_items\": [\n 60.0,\n 123.55,\n 8.25,\n 14.29\n ],\n \"total_gross_worth\": \"$212.09\""