llm.ToolCall
The content in this help topic pertains to SuiteScript 2.1.
|
Object Description |
A tool call request from the large language model (LLM), which is returned as part of the response from llm.generateText(options) or llm.generateTextStreamed(options). This object represents a single request from the LLM to run a defined tool as part of an LLM interaction. The LLM generates a tool call request when it determines that running a particular tool may help provide a more accurate or useful response to your prompt. This object enables dynamic, context-driven integration between the LLM and your SuiteScript code, allowing for real-time data retrieval, business logic execution, or other operations to be included in LLM interactions. This object is returned in the Response.toolCalls property (when calling llm.generateText(options)) or StreamedResponse.toolCalls property (when calling llm.generateTextStreamed(options)). This object includes properties for the name of the tool to call (ToolCall.name) and key-value pairs for each input parameter required by the tool, as specified in the tool definition (ToolCall.parameters). Your SuiteScript code is responsible for iterating over these tool calls, running the appropriate handler logic with the provided parameters, and returning the results to the LLM. |
|
Supported Script Types |
Server scripts For more information, see SuiteScript 2.x Script Types. |
|
Module |
|
|
Methods and Properties |
|
|
Since |
2025.2 |
Syntax
The following code sample shows the syntax for this member. It isn't a functional example. For a complete script example, see N/llm Module Script Samples.
// Add additional code
...
const result = llm.generateText({
prompt: "Write a 200 word pitch for a TV show about bears.",
modelFamily: llm.ModelFamily.COHERE_COMMAND,
// myTools is an array of llm.Tool objects created using llm.createTool(options)
tools: myTools
});
const toolCalls = result.toolCalls;
...
// Add additional code