mirror of
https://github.com/agentscope-ai/ReMe.git
synced 2026-09-17 23:51:19 +00:00
Some checks are pending
Pre-commit / run (ubuntu-latest) (push) Waiting to run
- Introduce BaseAsTokenCounter and EstimatedAsTokenCounter for token estimation - Add AsMsgStat and AsBlockStat schema for message statistics tracking - Implement FileIO class with read/write/append/edit operations - Create file utility functions for safe async file reading and truncation - Add MemorySearch component for semantic search in memory files - Register new component types in ComponentEnum and update imports - Add constants for default host, port, and truncation limits - Create BaseService abstract base class for service implementations - Implement BaseStep with component accessors and lifecycle management - Add proper __all__ exports for all new modules and components
28 lines
1 KiB
Python
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")
|