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

Boolean: Gets a value indicating whether the tool execution should be aborted.

Arguments

Dictionary<String, Object>: Gets the arguments for the tool execution.

Endpoint

SmartEndpoint: Gets the endpoint associated with the tool context.

Id

String: Gets the unique identifier for the tool context.

Iteration

Int32: Gets the current iteration count for the tool execution.

ReturnValue

Object: 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: Object. The result of the tool invocation.

InvokeAsync(session)

Invokes the tool asynchronously.

Parameter
Type
Description

session

The session invoking the tool.

Returns: Task. 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