Skip to contents

When a model decides to call tools, finish_reason(x) is "tool" and this helper returns what it asked for. call_llm_tools() uses it internally; it is exported so custom loops can be built on it.

Usage

tool_calls(x)

Arguments

x

An llmr_response object.

Value

A list with one element per requested call: list(id =, name =, arguments =, arguments_raw =, arguments_ok =). arguments is a named list. arguments_raw is the argument text as the model sent it (NA when the provider delivers parsed arguments). arguments_ok is FALSE when that text is not a JSON object, for example when the reply was cut off mid-call; arguments is then empty and the call should not be run. list() when the response contains no tool calls.