fix: Remove protected 'name' attribute from entity type models
Pydantic BaseModel reserves 'name' as a protected attribute. Removed the 'name' attribute from dynamically created entity type models as it's not needed - the entity type name is already stored as the class name and dict key. Fixed error: name cannot be used as an attribute for Requirement as it is a protected attribute name.
This commit is contained in:
parent
ca929c5604
commit
8c02683174
1 changed files with 1 additions and 1 deletions
|
|
@ -154,11 +154,11 @@ class GraphitiService:
|
|||
custom_types = {}
|
||||
for entity_type in self.config.graphiti.entity_types:
|
||||
# Create a dynamic Pydantic model for each entity type
|
||||
# Note: Don't use 'name' as it's a protected Pydantic attribute
|
||||
entity_model = type(
|
||||
entity_type.name,
|
||||
(BaseModel,),
|
||||
{
|
||||
'__annotations__': {'name': str},
|
||||
'__doc__': entity_type.description,
|
||||
},
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue