Skip to main content

SmartCopilotAdapter

Namespace: Wisej.AI.Adapters

Assembly: Wisej.AI

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).

public class SmartCopilotAdapter : SmartAdapter

Works with:

  • AzureAI/OpenAI gpt-4
  • AzureAI/OpenAI gpt-4o
  • AzureAI/OpenAI gpt-3.5
  • AzureAI/Anthropic Claude
  • Google Gemini
  • Llama3:8b and 70b

When the user instructions contain extra information (i.e. "add Microsoft as a new client"), the additional parameters are extracted, processed and are available in the Parameters property delivered with the ExecuteAction event arguments. You are not limited to the predefined actions in the application. When you add a method decorated with the ToolAttribute the AI can invoke it when necessary. This is a simple example that sends an email when prompted by the user:


[SmartTool.Tool]
[Description("Sends an email message.")]
public void SendEmailMessage(
[Description("Email address of the recipient.")]
string destinationEmail,

[Description("Subject line.")]
string subject,

[Description("Message text.")]
string message) {

// code to send an email, or open a dialog box.
}

Constructors​

SmartCopilotAdapter()​

Initializes a new instance of the SmartCopilotAdapter class.

Properties​

BotAvatar​

String: Gets or sets the icon of the AI bot. (Default: "resource.wx/Wisej.AI/Icons/wisej-avatar.svg")

BotName​

String: Gets or sets the name of the AI bot. (Default: "Wisej.AI")

ChatBox​

ChatBox: Gets the ChatBox control associated with this adapter.

User​

User: Gets the User associated with the AI bot.

The User is created using BotName and BotAvatar.

Methods​

OnControlCreated(control)​

ParameterTypeDescription
controlControl

OnControlDisposed(control)​

ParameterTypeDescription
controlControl

OnExecuteAction(e)​

Raises the ExecuteAction event.

ParameterTypeDescription
eExecuteActionEventArgsThe ExecuteActionEventArgs instance containing the event data.

RunAsyncCore(control)​

Executes the core logic asynchronously.

ParameterTypeDescription
controlControlThe control associated with the operation.

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

Events​

ExecuteAction​

ExecuteActionEventHandler Occurs when an action is executed.

Implements​

NameDescription
IToolProviderRepresents a provider that supplies tools.