Skip to main content

predict_tools

Function predict_tools 

Source
pub async fn predict_tools<M>(
    llm: &M,
    prompt: impl Into<String>,
    tools: Vec<ToolDefinition>,
) -> Result<LLMResult, PredictToolsError<M::Error>>
where M: BaseChatModel + ?Sized,
Expand description

One-shot tool call: bind_tools + chat in a single entry point.

Binds tools to llm, sends prompt as a single human message, and returns the model response — including any tool_calls. This is a thin convenience for callers that want one turn with tools and plan to execute the tool calls themselves; it does not run an agent loop or auto-execute tools (that is AgentExecutor’s job).

§Errors

Returns PredictToolsError::ToolsUnsupported when the model’s bind_tools returns None, instead of silently degrading to a tool-less prompt.