class documentation

A Temporal-based LLM model that executes model invocations as activities.

Method __init__ Initialize the TemporalModel.
Async Method generate_content_async Generate content asynchronously by executing model invocation as a Temporal activity.
Instance Variable _activity_config Undocumented
Instance Variable _model_name Undocumented
Instance Variable _summary_fn Undocumented
def __init__(self, model_name: str, activity_config: ActivityConfig | None = None, *, summary_fn: Callable[[LlmRequest], str | None] | None = None): (source)

Initialize the TemporalModel.

Parameters
model_name:strThe name of the model to use.
activity_config:ActivityConfig | NoneConfiguration options for the activity execution.
summary_fn:Callable[[LlmRequest], str | None] | NoneOptional callable that receives the LlmRequest and returns a summary string (or None) for the activity. Must be deterministic as it is called during workflow execution. If the callable raises, the exception will propagate and fail the workflow task.
Raises
ValueErrorIf both ActivityConfig["summary"] and summary_fn are set.
async def generate_content_async(self, llm_request: LlmRequest, stream: bool = False) -> AsyncGenerator[LlmResponse, None]: (source)

Generate content asynchronously by executing model invocation as a Temporal activity.

Parameters
llm_request:LlmRequestThe LLM request containing model parameters and content.
stream:boolWhether to stream the response (currently ignored).
Returns
AsyncGenerator[LlmResponse, None]Undocumented
Yields
The responses from the model.
_activity_config = (source)

Undocumented

_model_name = (source)

Undocumented

_summary_fn = (source)

Undocumented