agentscope.models.response module
Parser for model response.
- class ModelResponse(text: str | None = None, embedding: Sequence | None = None, image_urls: Sequence[str] | None = None, raw: Any | None = None, parsed: Any | None = None, stream: Generator[str, None, None] | None = None)[source]
Bases:
object
Encapsulation of data returned by the model.
The main purpose of this class is to align the return formats of different models and act as a bridge between models and agents.
- property is_stream_exhausted: bool
Whether the stream has been processed already.
- property stream: None | Generator[Tuple[bool, str], None, None]
Return the stream generator if it exists.
- property text: str
Return the text field. If the stream field is available, the text field will be updated accordingly.