TextBlock (message/_block.py)

agentscope · src/agentscope/message/_block.py · python · Apache-2.0
ai

Module exposing: TextBlock, ThinkingBlock, Base64Source, URLSource, DataBlock, HintBlock, ToolCallState, ToolCallBlock

# Source: https://github.com/agentscope-ai/agentscope | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
# Provided via justclaw.it.com; keep this notice with the code.
# -*- coding: utf-8 -*-
"""The content blocks of messages."""
from enum import StrEnum
from typing import Literal, List, TypeAlias, Any
from pydantic import BaseModel, Field, AnyUrl, field_serializer, ConfigDict

from .._utils._common import _generate_id, _generate_timestamp
from ..permission import PermissionRule


class TextBlock(BaseModel):
    """The text block."""

    type: Literal["text"] = "text"
    """The type of the text block, which is always 'text'."""
    text: str
    """The text content of the block."""
    id: str = Field(default_factory=_generate_id)
    """The un

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key