class documentation

class TemporalModel(BaseChatModel): (source)

View In Hierarchy

A BaseChatModel that runs each generation as a Temporal activity.

Parameters
modelThe provider model name resolved worker-side by the plugin's model_provider (e.g. "anthropic:claude-sonnet-4-5"). Only the name crosses the workflow boundary; credentials stay on the worker.
activity_optionsOptional per-model execute_activity overrides (timeouts, retry policy). Falls back to the plugin's model_activity_options.
Method bind_tools Bind tools to the model the way LangChain's create_agent expects.
Class Variable activity_options Undocumented
Class Variable model Undocumented
Class Variable model_config Undocumented
Async Method _agenerate Undocumented
Async Method _astream Undocumented
Method _build_input Undocumented
Method _generate Undocumented
Method _stream Undocumented
Method _summary Undocumented
Property _llm_type Undocumented
def bind_tools(self, tools: Sequence[Any], *, tool_choice: Any | None = None, **kwargs: Any) -> Any: (source)

Bind tools to the model the way LangChain's create_agent expects.

BaseChatModel.bind_tools is abstract (raises NotImplementedError), but the agent factory calls model.bind_tools(tools, ...) on every model node — so a durable model must implement it or the whole loop dies. The tools are converted to their JSON schema now (at bind time) so the bound object is serialization-safe, and carried as the tools kwarg that _build_input already reads and forwards to the activity, where the real provider model is what actually binds them.

activity_options: dict[str, Any] | None = (source)

Undocumented

Undocumented

model_config: dict = (source)

Undocumented

async def _agenerate(self, messages: list[BaseMessage], stop: list[str] | None = None, run_manager: AsyncCallbackManagerForLLMRun | None = None, **kwargs: Any) -> ChatResult: (source)

Undocumented

async def _astream(self, messages: list[BaseMessage], stop: list[str] | None = None, run_manager: AsyncCallbackManagerForLLMRun | None = None, **kwargs: Any) -> AsyncIterator[ChatGenerationChunk]: (source)

Undocumented

def _build_input(self, messages: Sequence[BaseMessage], streaming_topic: str | None, **kwargs: Any) -> _activity.ModelActivityInput: (source)

Undocumented

def _generate(self, messages: list[BaseMessage], stop: list[str] | None = None, run_manager: CallbackManagerForLLMRun | None = None, **kwargs: Any) -> ChatResult: (source)

Undocumented

def _stream(self, messages: list[BaseMessage], stop: list[str] | None = None, run_manager: CallbackManagerForLLMRun | None = None, **kwargs: Any) -> Iterator[ChatGenerationChunk]: (source)

Undocumented

def _summary(self) -> str: (source)

Undocumented

Undocumented