SmartAdapter

Wisej.AI.SmartAdapter

Namespace: Wisej.AI

Assembly: Wisej.AI (3.5.0.0)

Represents an abstract base class for creating smart adapters that interact with AI endpoints.

public class SmartAdapter : Component, IToolProvider

Constructors

SmartAdapter()

Initializes a new instance of the SmartAdapter class.

SmartAdapter(container)

Initializes a new instance of the SmartAdapter class attached to an IContainer implementation to allow for disposing the SmartAdapter when the service container is disposed.

Name
Type
Description

container

An IContainer that represents the container of the component.

Properties

Agents

AgentCollection: Gets the collection of agents associated with this adapter.

AutoRun

Boolean: Gets or sets a value indicating whether the adapter should automatically run. (Default: True)

AutoUpdate

Boolean: Gets or sets a value indicating whether the adapter should automatically update the browser when is done processing (requires a working WebSocket connection). (Default: True)

Busy

Boolean: Gets or sets a value indicating whether the adapter is busy. (Default: False)

Controls

IList<Control>: Gets the list of controls associated with this adapter.

HasTools

Boolean: Gets a value indicating whether the adapter has any tools.

Hub

SmartHub: Gets or sets the SmartHub associated with this adapter.

Name

String: Gets or sets the name of the adapter.

Parameters

ParameterCollection: Gets the collection of parameters associated with this adapter.

Session

SmartSession: Gets the SmartSession in use by the adapter.

SystemPrompt

String: Gets or sets the system prompt used by the adapter. (Default: "")

Tools

ToolCollection: Gets the collection of tools associated with this adapter.

Usage

Metrics: Gets the usage metrics for the session.

Methods

ClearTools()

Clears all tools from the adapter.

CreateSession(prompt)

Creates a new session with an optional prompt.

Parameter
Type
Description

prompt

The prompt to use for the session.

Returns: SmartSession. A new SmartSession instance.

CreateSession<T>(systemPrompt)

Creates a new session of a specified type with an optional prompt.

Parameter
Type
Description

T

The type of session to create.

systemPrompt

The system prompt to use for the session.

Returns: T. A new session of type T .

Dispose(disposing)

Releases the unmanaged resources used by the SmartAdapter and optionally releases the managed resources.

Parameter
Type
Description

disposing

True to release both managed and unmanaged resources; false to release only unmanaged resources.

GetJSON(message)

Returns the JSON string returned in the message by stripping the enclosing markers (json and ) if present.

Parameter
Type
Description

message

Message with the response text that may be a JSON string.

Returns: String. JSON string.

IsAssociatedWith(control)

Determines whether a control is associated with the adapter.

Parameter
Type
Description

control

The control to check.

Returns: Boolean. True if the control is associated; otherwise, false.

NotifyAgentsAsync(message)

Notifies all agents asynchronously with a message.

Parameter
Type
Description

message

The message to notify agents with.

Returns: Task. A task representing the asynchronous operation.

OnBusyChanged(e)

Raises the BusyChanged event.

Parameter
Type
Description

e

An EventArgs that contains the event data.

OnControlCreated(control)

Called when a control is created.

Parameter
Type
Description

control

The control that was created.

OnControlDisposed(control)

Called when a control is disposed.

Parameter
Type
Description

control

The control that was disposed.

OnDone(e)

Raises the Done event.

Parameter
Type
Description

e

An EventArgs that contains the event data.

OnStart(e)

Raises the Start event.

Parameter
Type
Description

e

An EventArgs that contains the event data.

RegisterControl(control)

Registers a control with the adapter.

Parameter
Type
Description

control

The control to register.

RemoveTool(tool)

Removes a tool from the adapter.

Parameter
Type
Description

tool

The tool to remove.

Returns: SmartAdapter.

RemoveTools(target)

Removes the tools from the specified object.

Parameter
Type
Description

target

The target object containing tools.

Returns: SmartAdapter. The current SmartAdapter instance.

RunAsync(control)

Runs the adapter asynchronously.

Parameter
Type
Description

control

The control to run the adapter on.

Returns: Task<Message>. A task representing the asynchronous operation.

UnregisterControl(control)

Unregisters a control from the adapter.

Parameter
Type
Description

control

The control to unregister.

UseTool(tool)

Adds a tool to the adapter.

Parameter
Type
Description

tool

The tool to add.

Returns: SmartAdapter.

UseTools(target)

Adds multiple tools to the adapter from a target object.

Parameter
Type
Description

target

The target object containing tools.

Returns: SmartAdapter.

Events

BusyChanged

EventHandler Occurs when the busy state of the adapter changes.

Done

EventHandler Occurs when the adapter has completed processing.

Start

EventHandler Occurs when the adapter starts processing.

Inherited By

Name
Description

Converts the Text of the associated Audio control into lifelike speech.

Transcribes the audio file of the of the associated Audio control to its Text property in the original language of the audio. speech-to-text

Represents a smart calendar adapter that extends the functionality of a SmartAdapter.

Represents an adapter that enhances a chart control with AI features.

Represents an adapter that enhances a ChartJS control with several AI features.

Turns the ChatBox control into a AI-powered bot. It can answer any question (depending on the AI model being used) and can invoke methods in your applications as needed (see SmartTool).

Adds semantic filtering to the ComboBox auto-complete functionality.

Turns the ChatBox control into a AI-powered assistant. It can control and navigate an application, click menu items, navigation bar items, buttons, etc. It can also invoke methods in your applications as needed (see SmartTool).

Enhances all the controls in the associated container with the AI-powered capability to extract structured data from unstructured text.

Represents a document adapter that can perform AI tasks using a document as a data source and interact with the user through a ChatBox control.

Converts unstructured text into a structured .NET object.

Represents an adapter for a PictureBox that generates images based on a description using the OpenAI DALL-E endpoint.

Represents an adapter that generates a data set from a database schema and a user-provided description.

Represents a smart adapter that provides real-time data processing capabilities for use with the OpenAIEndpointRealtime endpoint.

Enhances the ChatBox control to allow seamless PDF report queries using an AI provider.

Enhances a TextBox control with several AI features, including suggestions, translation, and auto-correction.

Implements

Name
Description

Represents a provider that supplies tools.

Last updated