mirror of
https://github.com/basicmachines-co/basic-memory
synced 2026-06-21 13:47:35 +00:00
split up parsing
This commit is contained in:
@@ -1,5 +1,23 @@
|
||||
"""Markdown parsing and handling for basic-memory."""
|
||||
"""Basic Memory markdown parsing."""
|
||||
|
||||
from .parser import EntityParser, ParseError
|
||||
from .exceptions import ParseError
|
||||
from .parser import EntityParser
|
||||
from .schemas import (
|
||||
Entity,
|
||||
EntityFrontmatter,
|
||||
EntityContent,
|
||||
EntityMetadata,
|
||||
Observation,
|
||||
Relation,
|
||||
)
|
||||
|
||||
__all__ = ["EntityParser", "ParseError"]
|
||||
__all__ = [
|
||||
'ParseError',
|
||||
'EntityParser',
|
||||
'Entity',
|
||||
'EntityFrontmatter',
|
||||
'EntityContent',
|
||||
'EntityMetadata',
|
||||
'Observation',
|
||||
'Relation',
|
||||
]
|
||||
@@ -1,4 +1,5 @@
|
||||
class ParseError(Exception):
|
||||
"""Raised when parsing fails"""
|
||||
"""Exceptions for markdown parsing."""
|
||||
|
||||
pass
|
||||
class ParseError(Exception):
|
||||
"""Exception raised when parsing fails."""
|
||||
pass
|
||||
@@ -1,18 +1,14 @@
|
||||
from basic_memory.markdown.schemas.entity import (
|
||||
Entity,
|
||||
EntityFrontmatter,
|
||||
EntityContent,
|
||||
EntityMetadata,
|
||||
)
|
||||
from basic_memory.markdown.schemas.observation import Observation
|
||||
from basic_memory.markdown.schemas.relation import Relation
|
||||
"""Model schemas for basic-memory markdown parsing."""
|
||||
|
||||
from .entity import Entity, EntityFrontmatter, EntityContent, EntityMetadata
|
||||
from .observation import Observation
|
||||
from .relation import Relation
|
||||
|
||||
__all__ = [
|
||||
"Entity",
|
||||
"EntityFrontmatter",
|
||||
"EntityContent",
|
||||
"EntityMetadata",
|
||||
"Observation",
|
||||
"Relation",
|
||||
]
|
||||
'Entity',
|
||||
'EntityFrontmatter',
|
||||
'EntityContent',
|
||||
'EntityMetadata',
|
||||
'Observation',
|
||||
'Relation',
|
||||
]
|
||||
@@ -6,6 +6,9 @@ from typing import Any, Dict, List, Optional
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
from basic_memory.markdown.schemas.observation import Observation
|
||||
from basic_memory.markdown.schemas.relation import Relation
|
||||
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -40,5 +43,5 @@ class Entity(BaseModel):
|
||||
"""Complete entity combining frontmatter, content, and metadata."""
|
||||
|
||||
frontmatter: EntityFrontmatter
|
||||
content: EntityContent
|
||||
metadata: EntityMetadata = EntityMetadata()
|
||||
content: EntityContent
|
||||
metadata: EntityMetadata = EntityMetadata()
|
||||
Reference in New Issue
Block a user