Skip to content

Proposal: Enable multi-provider support in ash_ai using lang_schema #24

@nallwhy

Description

@nallwhy

Is your feature request related to a problem? Please describe.

Currently, ash_ai uses ash_json_api to generate structured outputs and function parameters. This works well for OpenAI’s API, but the generated schema doesn’t comply with the requirements of other providers like Gemini. As a result, ash_ai cannot be easily used with non-OpenAI providers.

Describe the solution you'd like

I’d like to propose integrating lang_schema, a library I created to abstract schema definitions and generate provider-specific JSON schemas. It defines an abstract schema format and provides converters for each provider (e.g., OpenAI, Gemini).
If we introduce a new library, ash_lang_schema, to convert Ash resources into this abstract schema format, then ash_ai could support multiple AI providers seamlessly—not just OpenAI.

Describe alternatives you've considered

  • Extending ash_json_api to support Gemini or other providers, but this would likely lead to increasing complexity and diverging logic.
  • Manually writing separate schema generators per provider, which would duplicate effort and reduce maintainability.

Additional context

This proposal builds on langchain#278, where I first introduced the idea of abstracting JSON schemas for cross-provider AI integration.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions