You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There's an error in the schema generation function (pydantic_model_to_json_schema) when handling Pydantic models. The error occurs in the clean_property function with the message: "Schema generation failed: Unexpected error in schema generation: 'type'". This happens when trying to create custom tool with nested models within the custom tool code sent - the system tries to generate JSON schemas for nested Pydantic models.
Please describe your setup
How did you install letta?
docker
Describe your setup
MacOS
Screenshots
Reproduction Steps
Here's a minimal example that reproduces the error:
from pydantic import BaseModel, Field
class DateFormatted(BaseModel):
date: str = Field(..., description='The date string to be formatted')
timezone: str = Field(..., description='The timezone to use for the date')
date_format: str = Field(..., description='The format to apply to the date')
class WorkflowParams(BaseModel):
date_formatted: DateFormatted = Field(
..., description='Format configuration for the date', title='DateFormatted'
)
valid: bool = Field(
..., description='If it is a valid value'
)
When trying to generate the schema for these models, the error occurs in the clean_property function, suggesting that some property types aren't being handled correctly.
The issue appears to be in the schema generation code where it doesn't properly handle all possible type structures that Pydantic can generate. The clean_property function needs to be more robust in handling:
Missing type fields
Complex type definitions
Nested model references
Letta Config
Using default configuration.
The text was updated successfully, but these errors were encountered:
Describe the bug
There's an error in the schema generation function (
pydantic_model_to_json_schema
) when handling Pydantic models. The error occurs in theclean_property
function with the message:"Schema generation failed: Unexpected error in schema generation: 'type'".
This happens when trying to create custom tool with nested models within the custom tool code sent - the system tries to generate JSON schemas for nested Pydantic models.Please describe your setup
Screenshots
Reproduction Steps
Here's a minimal example that reproduces the error:
When trying to generate the schema for these models, the error occurs in the clean_property function, suggesting that some property types aren't being handled correctly.
{ "detail": "Schema generation failed: Unexpected error in schema generation: 'type'" }
Additional context
The issue appears to be in the schema generation code where it doesn't properly handle all possible type structures that Pydantic can generate. The clean_property function needs to be more robust in handling:
Missing type fields
Complex type definitions
Nested model references
Letta Config
Using default configuration.
The text was updated successfully, but these errors were encountered: