chore: initial import of standalone agentscope project
Some checks failed
Pre-commit / run (ubuntu-latest) (push) Has been cancelled
Deploy Sphinx documentation to Pages / build_en (ubuntu-latest, 3.10) (push) Has been cancelled
Deploy Sphinx documentation to Pages / build_zh (ubuntu-latest, 3.10) (push) Has been cancelled
Python Unittest Coverage / test (macos-15, 3.10) (push) Has been cancelled
Python Unittest Coverage / test (macos-15, 3.11) (push) Has been cancelled
Python Unittest Coverage / test (macos-15, 3.12) (push) Has been cancelled
Python Unittest Coverage / test (ubuntu-latest, 3.10) (push) Has been cancelled
Python Unittest Coverage / test (ubuntu-latest, 3.11) (push) Has been cancelled
Python Unittest Coverage / test (ubuntu-latest, 3.12) (push) Has been cancelled
Python Unittest Coverage / test (windows-latest, 3.10) (push) Has been cancelled
Python Unittest Coverage / test (windows-latest, 3.11) (push) Has been cancelled
Python Unittest Coverage / test (windows-latest, 3.12) (push) Has been cancelled
Some checks failed
Pre-commit / run (ubuntu-latest) (push) Has been cancelled
Deploy Sphinx documentation to Pages / build_en (ubuntu-latest, 3.10) (push) Has been cancelled
Deploy Sphinx documentation to Pages / build_zh (ubuntu-latest, 3.10) (push) Has been cancelled
Python Unittest Coverage / test (macos-15, 3.10) (push) Has been cancelled
Python Unittest Coverage / test (macos-15, 3.11) (push) Has been cancelled
Python Unittest Coverage / test (macos-15, 3.12) (push) Has been cancelled
Python Unittest Coverage / test (ubuntu-latest, 3.10) (push) Has been cancelled
Python Unittest Coverage / test (ubuntu-latest, 3.11) (push) Has been cancelled
Python Unittest Coverage / test (ubuntu-latest, 3.12) (push) Has been cancelled
Python Unittest Coverage / test (windows-latest, 3.10) (push) Has been cancelled
Python Unittest Coverage / test (windows-latest, 3.11) (push) Has been cancelled
Python Unittest Coverage / test (windows-latest, 3.12) (push) Has been cancelled
This commit is contained in:
42
src/agentscope/model/_model_response.py
Normal file
42
src/agentscope/model/_model_response.py
Normal file
@@ -0,0 +1,42 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""The model response module."""
|
||||
|
||||
from dataclasses import dataclass, field
|
||||
from typing import Literal, Sequence
|
||||
|
||||
from ._model_usage import ChatUsage
|
||||
from .._utils._common import _get_timestamp
|
||||
from .._utils._mixin import DictMixin
|
||||
from ..message import (
|
||||
TextBlock,
|
||||
ToolUseBlock,
|
||||
ThinkingBlock,
|
||||
AudioBlock,
|
||||
)
|
||||
from ..types import JSONSerializableObject
|
||||
|
||||
|
||||
@dataclass
|
||||
class ChatResponse(DictMixin):
|
||||
"""The response of chat models."""
|
||||
|
||||
content: Sequence[TextBlock | ToolUseBlock | ThinkingBlock | AudioBlock]
|
||||
"""The content of the chat response, which can include text blocks,
|
||||
tool use blocks, or thinking blocks."""
|
||||
|
||||
id: str = field(default_factory=lambda: _get_timestamp(True))
|
||||
"""The unique identifier formatter """
|
||||
|
||||
created_at: str = field(default_factory=_get_timestamp)
|
||||
"""When the response was created"""
|
||||
|
||||
type: Literal["chat"] = field(default_factory=lambda: "chat")
|
||||
"""The type of the response, which is always 'chat'."""
|
||||
|
||||
usage: ChatUsage | None = field(default_factory=lambda: None)
|
||||
"""The usage information of the chat response, if available."""
|
||||
|
||||
metadata: dict[str, JSONSerializableObject] | None = field(
|
||||
default_factory=lambda: None,
|
||||
)
|
||||
"""The metadata of the chat response"""
|
||||
Reference in New Issue
Block a user