Skip to content

add getJsonSchema() to TypeChatJsonValidator #272

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

mmoskal
Copy link
Member

@mmoskal mmoskal commented Apr 24, 2025

This is a little experiment, to possibly allow using structured outputs with TypeChat.

Note that you would want to only use this as a grammar for constraining the output, not pass the schema to the model - the TypeScript file is probably much better for this, as the schema is 3x bigger than TypeScript source (with indentation; without indentation schema is 1.5x bigger). OpenAI-compatible endpoints will often pass the schema to the model using chat template.

This works for all example schemas (excluding Zod, but it can be handled natively I guess) and all schemas in TypeAgent.

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

Successfully merging this pull request may close these issues.

1 participant