mirror of
https://github.com/basicmachines-co/basic-memory
synced 2026-06-21 13:47:35 +00:00
rename EntityParser to KnowledgeParser
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
"""Base package for markdown parsing."""
|
||||
|
||||
from basic_memory.markdown.parser import EntityParser
|
||||
from basic_memory.markdown.knowledge_parser import KnowledgeParser
|
||||
from basic_memory.markdown.schemas import (
|
||||
Entity,
|
||||
EntityContent,
|
||||
@@ -16,7 +16,7 @@ __all__ = [
|
||||
"EntityContent",
|
||||
"EntityFrontmatter",
|
||||
"EntityMetadata",
|
||||
"EntityParser",
|
||||
"KnowledgeParser",
|
||||
"Observation",
|
||||
"Relation",
|
||||
"ParseError",
|
||||
|
||||
@@ -80,9 +80,7 @@ class MarkdownParser(ABC, Generic[T]):
|
||||
|
||||
# Create final document
|
||||
return await self.create_document(
|
||||
frontmatter=parsed_frontmatter,
|
||||
content=parsed_content,
|
||||
metadata=parsed_metadata
|
||||
frontmatter=parsed_frontmatter, content=parsed_content, metadata=parsed_metadata
|
||||
)
|
||||
|
||||
except Exception as e:
|
||||
@@ -164,11 +162,11 @@ class MarkdownParser(ABC, Generic[T]):
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
async def parse_metadata(self, metadata: Optional[str]) -> Any:
|
||||
async def parse_metadata(self, metadata_section: Optional[str]) -> Any:
|
||||
"""Parse metadata section."""
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
async def create_document(self, frontmatter: Any, content: Any, metadata: Any) -> T:
|
||||
"""Create document from parsed sections."""
|
||||
pass
|
||||
pass
|
||||
|
||||
@@ -17,7 +17,7 @@ from basic_memory.markdown.schemas import (
|
||||
)
|
||||
|
||||
|
||||
class EntityParser(MarkdownParser[Entity]):
|
||||
class KnowledgeParser(MarkdownParser[Entity]):
|
||||
"""Parser for entity markdown files.
|
||||
|
||||
Entity files must have:
|
||||
Reference in New Issue
Block a user