ReMe/reme_cli/schema/stream_chunk.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

28 lines
1 KiB
Python

"""Stream chunk schema module.
This module defines the StreamChunk model for handling streaming
responses in the application, particularly for LLM outputs.
"""
from pydantic import BaseModel, Field
from ..enumeration import ChunkEnum
class StreamChunk(BaseModel):
"""A chunk of streaming response data.
Represents a single chunk in a streaming response sequence,
commonly used for LLM outputs that are delivered incrementally.
Attributes:
chunk_type: Type identifier for the chunk content.
chunk: The actual chunk data (string, dict, or list).
done: Whether this is the final chunk in the stream.
metadata: Additional metadata about this chunk.
"""
chunk_type: ChunkEnum = Field(default=ChunkEnum.CONTENT, description="Type of chunk content")
chunk: str | dict | list = Field(default="", description="Chunk payload data")
done: bool = Field(default=False, description="Whether stream is complete")
metadata: dict = Field(default_factory=dict, description="Chunk metadata")