Skip to content

Documentation v1.0.0


Documentation / @openassistant/utils / ToolOutputManager

Class: ToolOutputManager ​

Defined in: packages/utils/src/tool-output-manager.ts:44

ToolOutputManager handles storage and retrieval of tool execution results Works on both client and server side with mutex protection for concurrent access

Constructors ​

Constructor ​

new ToolOutputManager(): ToolOutputManager

Returns ​

ToolOutputManager

Methods ​

addToolOutput() ​

addToolOutput(toolCallId, data): Promise<void>

Defined in: packages/utils/src/tool-output-manager.ts:79

Add a tool output to the manager

Parameters ​

toolCallId ​

string

Unique identifier for the tool call

data ​

unknown

Data returned by the tool

Returns ​

Promise<void>


clearAll() ​

clearAll(): Promise<void>

Defined in: packages/utils/src/tool-output-manager.ts:201

Clear all tool outputs

Returns ​

Promise<void>


createOnToolCompletedCallback() ​

createOnToolCompletedCallback(): (toolCallId, data?) => Promise<void>

Defined in: packages/utils/src/tool-output-manager.ts:227

Create an onToolCompleted callback function for use with tools

Returns ​

A callback function that can be used with tool configurations

(toolCallId, data?): Promise<void>

Parameters ​
toolCallId ​

string

data? ​

unknown

Returns ​

Promise<void>


endSession() ​

endSession(): Promise<void>

Defined in: packages/utils/src/tool-output-manager.ts:65

End the current request session

Returns ​

Promise<void>


findDataByDatasetName() ​

findDataByDatasetName(datasetName): Promise<unknown>

Defined in: packages/utils/src/tool-output-manager.ts:165

Find data by dataset name from all stored tool outputs Searches through all tool outputs for objects containing the dataset name as a key

Parameters ​

datasetName ​

string

Name of the dataset to search for

Returns ​

Promise<unknown>

The data associated with the dataset name, or null if not found


getAllToolOutputs() ​

getAllToolOutputs(): Promise<ToolOutput[]>

Defined in: packages/utils/src/tool-output-manager.ts:189

Get all tool outputs (for debugging/admin purposes)

Returns ​

Promise<ToolOutput[]>

Array of all tool outputs


getLastToolOutput() ​

getLastToolOutput(): Promise<ToolOutput | null>

Defined in: packages/utils/src/tool-output-manager.ts:96

Get the most recent tool output

Returns ​

Promise<ToolOutput | null>

The last tool output or null if none exists


getLastToolOutputFromCurrentSession() ​

getLastToolOutputFromCurrentSession(): Promise<ToolOutput | null>

Defined in: packages/utils/src/tool-output-manager.ts:111

Get the most recent tool output from the current session only

Returns ​

Promise<ToolOutput | null>

The last tool output from current session or null if none exists


getToolOutputsFromCurrentSession() ​

getToolOutputsFromCurrentSession(): Promise<ToolOutput[]>

Defined in: packages/utils/src/tool-output-manager.ts:148

Get all tool outputs from the current session

Returns ​

Promise<ToolOutput[]>

Array of tool outputs from current session


hasToolOutputs() ​

hasToolOutputs(): Promise<boolean>

Defined in: packages/utils/src/tool-output-manager.ts:214

Check if there are any tool outputs stored

Returns ​

Promise<boolean>

True if there are tool outputs, false otherwise


hasToolOutputsInCurrentSession() ​

hasToolOutputsInCurrentSession(): Promise<boolean>

Defined in: packages/utils/src/tool-output-manager.ts:133

Check if there are any tool outputs from the current session

Returns ​

Promise<boolean>

True if there are tool outputs from current session, false otherwise


startSession() ​

startSession(): Promise<string>

Defined in: packages/utils/src/tool-output-manager.ts:52

Start a new request session to track tool outputs for this specific request

Returns ​

Promise<string>

Released under the MIT License.