Skip to content

Proposal: Abstracted JSON Schema Generator for AI Model Integration #278

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
nallwhy opened this issue Mar 24, 2025 · 2 comments
Open

Proposal: Abstracted JSON Schema Generator for AI Model Integration #278

nallwhy opened this issue Mar 24, 2025 · 2 comments

Comments

@nallwhy
Copy link
Contributor

nallwhy commented Mar 24, 2025

While working with both OpenAI and Gemini models using JSON responses, I noticed that the way each API handles json_schema differs quite significantly. Currently, the json_schema details are provided externally (outside of the LangChain library), but to seamlessly support multiple AI providers without requiring the user to handle these differences manually, it would be valuable to introduce an abstraction layer for defining schemas.

I’d like to propose the addition of:
• An abstracted, unified representation of json_schema.
• AI-specific schema generators that can transform this abstract schema into the correct format for each provider (e.g., OpenAI, Gemini).

With such an abstraction in place, it would open the door to utilities that could easily convert existing structures like Typespecs, Ecto Schemas, or Ash Resources into this unified schema format. This would significantly reduce the friction when integrating structured data responses across different AI models.

Would love to hear thoughts on this idea! Happy to contribute if there’s interest.

@nallwhy
Copy link
Contributor Author

nallwhy commented Mar 24, 2025

Currently, ash_ai(https://github.com/ash-project/ash_ai) uses the OpenAPI specification provided by ash_json_api. However, I feel that this approach may not be expressive enough for our needs. For example, Gemini introduces features like propertyOrdering which are outside the scope of the standard OpenAPI spec.

@nallwhy
Copy link
Contributor Author

nallwhy commented Apr 14, 2025

This repo provides useful references on how to write JSON schemas for each LLM.

https://github.com/samchon/openapi/blob/master/src/structures/IChatGptSchema.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant