all tests passing

This commit is contained in:
phernandez
2024-12-14 18:04:42 -06:00
parent f075c29a58
commit 1312046786
7 changed files with 28 additions and 65 deletions
+2 -2
View File
@@ -6,7 +6,7 @@ from pathlib import Path
from loguru import logger
from basic_memory.schemas import EntityIn, ObservationIn, RelationIn
from basic_memory.schemas import EntityIn, RelationIn
class FileOperationError(Exception):
@@ -158,7 +158,7 @@ async def read_entity_file(project_entities_path: Path, entity_id: str) -> Entit
parts = line.split(" | ", 1)
content = parts[0]
context = parts[1] if len(parts) > 1 else None
observations.append(ObservationIn(content=content))
observations.append(content)
elif in_relations and line.startswith("- "):
# Parse relation line: - [target_id] relation_type | context
line = line[2:] # Remove the bullet point
+1 -1
View File
@@ -74,7 +74,7 @@ class EntityIn(EntityBase):
concept, etc. Each entity has a unique name, a type, and a list of
associated observations.
"""
observations: List[ObservationIn] = []
observations: List[str] = []
relations: List[RelationIn] = []
model_config = ConfigDict(populate_by_name=True)
@@ -5,7 +5,6 @@ from sqlalchemy import select
from basic_memory.models import Observation
from basic_memory.repository.observation_repository import ObservationRepository
from basic_memory.schemas import ObservationIn
from . import DatabaseSyncError
@@ -19,7 +18,7 @@ class ObservationService:
self.project_path = project_path
self.observation_repo = observation_repo
async def add_observations(self, entity_id: str, observations: List[ObservationIn]) -> List[Observation]:
async def add_observations(self, entity_id: str, observations: List[str]) -> List[Observation]:
"""
Add multiple observations to an entity.
Returns the created observations with IDs set.