class documentation
class TemporalModel(BaseChatModel): (source)
A BaseChatModel that runs each generation as a Temporal activity.
| Parameters | |
| model | The 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 | Optional per-model execute_activity overrides (timeouts, retry policy). Falls back to the plugin's model_activity_options. |
| Method | bind |
Bind tools to the model the way LangChain's create_agent expects. |
| Class Variable | activity |
Undocumented |
| Class Variable | model |
Undocumented |
| Class Variable | model |
Undocumented |
| Async Method | _agenerate |
Undocumented |
| Async Method | _astream |
Undocumented |
| Method | _build |
Undocumented |
| Method | _generate |
Undocumented |
| Method | _stream |
Undocumented |
| Method | _summary |
Undocumented |
| Property | _llm |
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.
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