SmartTool.ToolContext

Wisej.AI.SmartTool ToolContext

Namespace: Wisej.AI

Assembly: Wisej.AI (3.5.0.0)

Represents the context in which a smart tool operates, providing properties and methods to manage tool execution.

public class ToolContext

The ToolContext class encapsulates the state and behavior required to execute a smart tool, including its arguments, session, and endpoint.

Constructors

ToolContext()

Initializes a new instance of ToolContext.

Properties

Abort

Booleanarrow-up-right: Gets a value indicating whether the tool execution should be aborted.

Arguments

Dictionary<String, Object>arrow-up-right: Gets the arguments for the tool execution.

Endpoint

SmartEndpoint: Gets the endpoint associated with the tool context.

Id

Stringarrow-up-right: Gets the unique identifier for the tool context.

Iteration

Int32arrow-up-right: Gets the current iteration count for the tool execution.

ReturnValue

Objectarrow-up-right: Gets or sets the return value of the tool execution.

Session

SmartSession: Gets the session associated with the tool context.

Tool

SmartTool: Gets the tool associated with the context.

Methods

Invoke()

Invokes the tool synchronously.

Returns: Objectarrow-up-right. The result of the tool invocation.

InvokeAsync(session)

Invokes the tool asynchronously.

Parameter
Type
Description

session

The session invoking the tool.

Returns: Taskarrow-up-right. A task representing the asynchronous operation.

This method handles exceptions and manages the tool invocation lifecycle, including raising events before and after invocation.

Last updated