mirror of
https://github.com/gadievron/raptor.git
synced 2026-04-24 21:46:00 +03:00
[PR #46] [MERGED] Add Pydantic model support to LLM schema handler #51
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/raptor#51
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/gadievron/raptor/pull/46
Author: @gadievron
Created: 12/22/2025
Status: ✅ Merged
Merged: 12/26/2025
Merged by: @danielcuthbert
Base:
main← Head:fix/bug-40-pydantic-schema📝 Commits (1)
a88cf15Add Pydantic model support to LLM schema handler📊 Changes
1 file changed (+21 additions, -5 deletions)
View changed files
📝
packages/llm_analysis/llm/providers.py(+21 -5)📄 Description
Summary
Extends
_dict_schema_to_pydantic()to accept both dict schemas and Pydantic model classes, supporting RAPTOR's intentional hybrid approach for flexibility.Problem
The function
_dict_schema_to_pydantic()inpackages/llm_analysis/llm/providers.pyonly handles dict schemas, but RAPTOR's hybrid design allows both dicts and Pydantic models. When Instructor library passes Pydantic models directly, TypeError occurs, breaking LLM structured output generation.Root Cause
RAPTOR intentionally uses hybrid Pydantic/dict approach:
Changes
1. Add Pydantic Model Detection
File:
packages/llm_analysis/llm/providers.pyLines: 65-101
Union[Dict[str, Any], Type[BaseModel]]type supportisclass()check to detect Pydantic modelsType of Change
Impact
Fixes #40
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.