fix: support Pydantic BaseModel as prediction output type in schema gen#2785
Merged
tempusfrangit merged 1 commit intomainfrom Feb 27, 2026
Merged
fix: support Pydantic BaseModel as prediction output type in schema gen#2785tempusfrangit merged 1 commit intomainfrom
tempusfrangit merged 1 commit intomainfrom
Conversation
The tree-sitter schema parser only recognized cog.BaseModel subclasses. Pydantic BaseModel subclasses failed with 'unsupported type' because: 1. IsBaseModel() only checked module=='cog', not 'pydantic' 2. inheritsFromBaseModel() only handled 'identifier' AST nodes, missing 'attribute' nodes for dotted access (pydantic.BaseModel) 3. parseImportFrom() only handled aliased_import inside import_list, missing top-level aliased imports (from X import Y as Z) Now supports all three import styles: - from pydantic import BaseModel - from pydantic import BaseModel as PydanticBaseModel - import pydantic; class Foo(pydantic.BaseModel) Includes 3 unit tests and 1 integration test.
michaeldwan
approved these changes
Feb 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The tree-sitter schema parser only recognized cog.BaseModel subclasses. Pydantic BaseModel subclasses failed with 'unsupported type' because:
Now supports all three import styles:
Includes 3 unit tests and 1 integration test.