Skip to content

mirascope.core.base.structured_stream

This module defines the base class for structured streams.

BaseStructuredStream

BaseStructuredStream(
    *,
    stream: BaseStream,
    response_model: type[_ResponseModelT],
    fields_from_call_args: dict[str, Any]
)

Bases: Generic[_ResponseModelT]

A base class for streaming structured outputs from LLMs.

Source code in mirascope/core/base/structured_stream.py
def __init__(
    self,
    *,
    stream: BaseStream,
    response_model: type[_ResponseModelT],
    fields_from_call_args: dict[str, Any],
) -> None:
    """Initializes an instance of `BaseStructuredStream`."""
    self.stream = stream
    self.response_model = response_model
    self.fields_from_call_args = fields_from_call_args