Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

fix Pydantic model parsing #1087

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

Merged
merged 1 commit into from
Jan 15, 2024
Merged

Conversation

DeNeutoy
Copy link
Contributor

Fixes #1048, #1043

Problem

When parsing json schemas generated from a Pydantic model, if the schema has references to other models, it contains a $defs key, which are referred to in the schema itself via $ref. This $defs key does not have a type key, as it is actually defining the types - and so the SchemaConverter throws an error, as it requires all schema keys to have a type. This assert is actually not required, as it is caught later on after iterating through the various options for schema_types here:

https://github.com/abetlen/llama-cpp-python/compare/main...DeNeutoy:fix-model-parsing?expand=1#diff-22ae5683f6e444008ca0411a78851823be188bd8e7f287327397462c5671a1a4L1502

I've deleted it and added a test. Cool project, thanks!

@abetlen
Copy link
Owner

abetlen commented Jan 15, 2024

@DeNeutoy thank you for the contribution!

@abetlen abetlen merged commit c689ccc into abetlen:main Jan 15, 2024
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.

Can't create grammar from JSON schema if referencing multiple definitions
2 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.