add list_by_type tool

This commit is contained in:
phernandez
2024-12-30 14:44:23 -06:00
parent 566a796d68
commit 8dd2de3e9a
8 changed files with 192 additions and 25 deletions
+2 -1
View File
@@ -44,7 +44,7 @@ from basic_memory.schemas.response import (
# Discovery and analytics models
from basic_memory.schemas.discovery import (
EntityTypeList,
ObservationCategoryList,
ObservationCategoryList, TypedEntityList,
)
# For convenient imports, export all models
@@ -76,4 +76,5 @@ __all__ = [
# Discovery and Analytics
"EntityTypeList",
"ObservationCategoryList",
"TypedEntityList"
]
+13 -2
View File
@@ -1,7 +1,9 @@
"""Schemas for knowledge discovery and analytics endpoints."""
from typing import List
from pydantic import BaseModel
from typing import List, Optional
from pydantic import BaseModel, Field
from basic_memory.schemas.response import EntityResponse
class EntityTypeList(BaseModel):
@@ -12,3 +14,12 @@ class EntityTypeList(BaseModel):
class ObservationCategoryList(BaseModel):
"""List of unique observation categories in the system."""
categories: List[str]
class TypedEntityList(BaseModel):
"""List of entities of a specific type."""
entity_type: str = Field(..., description="Type of entities in the list")
entities: List[EntityResponse]
total: int = Field(..., description="Total number of entities")
sort_by: Optional[str] = Field(None, description="Field used for sorting")
include_related: bool = Field(False, description="Whether related entities are included")