llm.createToolResult(options)
The content in this help topic pertains to SuiteScript 2.1.
|
Method Description |
Creates a tool result that you can provide when calling llm.generateText(options) or llm.generateTextStreamed(options). Tool results let you send the output of a tool (such as the result of a SuiteQL query or a business operation) back to the large language model (LLM). You generate tool results in your SuiteScript code after handling a tool call request, which is represented by a llm.ToolCall object. These results provide additional relevant data that the LLM uses when creating its response. After you create a tool result, you can provide it to subsequent llm.generateText(options) or llm.generateTextStreamed(options) calls, which lets the LLM incorporate the results of the tool call and return a more accurate and relevant response. |
|
Returns |
|
|
Supported Script Types |
Server scripts For more information, see SuiteScript 2.x Script Types. |
|
Governance |
None |
|
Module |
|
|
Since |
2025.2 |
Parameters
|
Parameter |
Type |
Required / Optional |
Description |
Since |
|---|---|---|---|---|
|
|
required |
The original tool call request from the LLM. This parameter links the result to a specific tool call request. |
2025.2 |
|
|
|
Object[] |
required |
An array of output objects representing the results of running the tool. Each output object typically includes a |
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 toolResult = llm.createToolResult({
// toolCall is the originating tool call request from the LLM
call: toolCall,
// handlerResult is the result of running the tool specified by the
// tool call request
outputs: [{ result: handlerResult }]
});
...
// Add additional code