Portkey-AI / gateway

A Blazing Fast AI Gateway with integrated Guardrails. Route to 200+ LLMs, 50+ AI Guardrails with 1 fast & friendly API.
https://portkey.ai/features/ai-gateway
MIT License
6k stars 410 forks source link

Enhance JSON Schema and JSON Keys plugins with better error handling and explanations #585

Closed roh26it closed 3 weeks ago

roh26it commented 3 weeks ago

What Happened?

Our JSON Schema and JSON Keys plugins currently lack detailed error reporting and explanations, making it difficult for users to understand why their validations are failing or succeeding. We need to improve these plugins to provide more comprehensive feedback and handle a wider range of JSON input scenarios.

What Should Have Happened?

Proposed Changes

Update both plugins to handle JSON within code blocks and in plain text. Enhance error reporting to include detailed explanations of validation results. Improve JSON extraction to handle multiple JSON objects within a single response. Update the plugins to return more informative data objects, including matched JSON, present/missing keys, and validation errors. Refactor the test suites for both plugins to cover new functionality and edge cases.

Expected Outcome

Users will receive more detailed feedback on why their JSON validations succeed or fail. The plugins will be more robust, handling a wider range of input scenarios. Debugging and troubleshooting will be easier with the additional context provided.

Relevant Code Snippet

No response

Your Twitter/LinkedIn

No response