ReMe/reme_cli/schema/base_node.py
jinli.yl 4b5fb37b6a
Some checks are pending
Pre-commit / run (ubuntu-latest) (push) Waiting to run
feat(core): add core components and architecture for ReMe CLI
- Implement BaseComponent with async lifecycle and context management
- Add ApplicationContext for managing component initialization and registry
- Create Application class for orchestrating job execution and lifecycle
- Add AS LLM components with OpenAI chat model wrapper
- Implement AS LLM formatter components with OpenAI formatter
- Add client implementations including base, HTTP and ReMe clients
- Create embedding model base class with caching and batching support
- Implement file store base class with vector and full-text search
- Add file watcher components for monitoring file system changes
- Create job components for executing workflows
- Implement service components for exposing jobs via different protocols
- Add configuration schema with ApplicationConfig and ComponentConfig
- Include utility modules for case conversion, chunking, logging and similarity
- Register component types and create component registry system
2026-04-13 23:51:59 +08:00

29 lines
1.1 KiB
Python

"""Base node schema module.
This module defines the BaseNode model, which serves as the foundational
data structure for nodes in the knowledge graph or document processing pipeline.
"""
from uuid import uuid4
from pydantic import BaseModel, Field
class BaseNode(BaseModel):
"""Base node model for graph and document structures.
This model represents a single node in the knowledge graph or
a chunk in the document processing pipeline. It contains text content,
optional embeddings, and associated metadata.
Attributes:
id: Unique identifier for the node, auto-generated if not provided.
text: Text content of the node.
embedding: Optional vector embedding of the text content.
metadata: Additional metadata associated with the node.
"""
id: str = Field(default_factory=lambda: uuid4().hex, description="Unique node identifier")
text: str = Field(default="", description="Text content of the node")
embedding: list[float] | None = Field(default=None, description="Vector embedding of text")
metadata: dict = Field(default_factory=dict, description="Additional metadata")