Emulates specified tools using an LLM instead of executing them.
This middleware allows selective emulation of tools for testing purposes.
By default (when tools=None), all tools are emulated. You can specify which
tools to emulate by passing a list of tool names or BaseTool instances.
LLMToolEmulator(
self,
*,
tools: list[str | BaseTool] | None = None,
model: str | BaseChatModel | None = None
)| Name | Type | Description |
|---|---|---|
tools | list[str | BaseTool] | None | Default: NoneList of tool names ( If If empty list, no tools will be emulated. |
model | str | BaseChatModel | None | Default: NoneModel to use for emulation. Defaults to Can be a model identifier string or |
| Name | Type |
|---|---|
| tools | list[str | BaseTool] | None |
| model | str | BaseChatModel | None |
Logic to run before the agent execution starts.
Async logic to run before the agent execution starts.
Logic to run before the model is called.
Async logic to run before the model is called.
Logic to run after the model is called.
Async logic to run after the model is called.
Intercept and control model execution via handler callback.
Intercept and control async model execution via handler callback.
Logic to run after the agent execution completes.
Async logic to run after the agent execution completes.