LogoLogo
HomeNewsSupportVideos
  • Welcome
  • Wisej.NET
  • Concepts
    • Getting Started
    • General Concepts
    • Architecture
    • Extensibility
    • AI Providers
    • Vector Databases
    • Usage Metrics
    • Logging & Error Handling
  • Markup
  • Components
    • API
      • SmartAdapter
        • SmartAudioTTSAdapter
        • SmartAudioWhisperAdapter
        • SmartCalendarAdapter
        • SmartChartAdapter
        • SmartChartJS3Adapter
        • SmartChatBoxAdapter
        • SmartComboBoxAdapter
        • SmartCopilotAdapter
        • SmartDataEntryAdapter
        • SmartDocumentAdapter
        • SmartFullCalendarAdapter
        • SmartObjectAdapter
        • SmartPictureBoxAdapter
        • SmartQueryAdapter
        • SmartRealtimeAdapter
        • SmartReportAdapter
        • SmartTextBoxAdapter
        • SmartAdapter.ExtendsAttribute
        • SmartAdapter.FieldNameAttribute
        • SmartAdapter.FieldPromptAttribute
        • SmartAdapter.FieldRectangleAttribute
        • SmartAdapter.WorksWithAttribute
      • SmartEndpoint
        • AmazonBedrockEndpoint
        • AnthropicEndpoint
        • AzureAIEndpoint
        • CerebrasEndpoint
        • DeepSeekEndpoint
        • GoogleAIEndpoint
        • GroqCloudEndpoint
        • GroqCloudEndpointWhisper
        • HuggingFaceEndpoint
        • HuggingFaceJavaScriptEndpoint
        • LocalAIEndpoint
        • LocalAIEndpointImageGen
        • LocalAIEndpointTTS
        • LocalAIEndpointWhisper
        • NvidiaAIEndpoint
        • OllamaEndpoint
        • OpenAIEndpoint
        • OpenAIEndpointDallE
        • OpenAIEndpointRealtime
        • OpenAIEndpointTTS
        • OpenAIEndpointWhisper
        • SambaNovaEndpoint
        • SmartHttpEndpoint
        • TogetherAIEndpoint
        • XAIEndpoint
        • SmartEndpoint.Metrics
        • SmartEndpoint.Response
      • SmartExtensions
      • SmartHub
        • SmartSession.ConvertParameterEventArgs
        • SmartSession.ConvertParameterEventHandler
        • SmartSession.ErrorEventArgs
        • SmartSession.ErrorEventHandler
        • SmartSession.InvokeToolEventArgs
        • SmartSession.InvokeToolEventHandler
        • SmartSession.MessagesEventArgs
        • SmartSession.MessagesEventHandler
      • SmartObject
      • SmartPrompt
        • SmartAgentPrompt
        • SmartParallelPrompt
        • SmartPrompt.Parameter
        • SmartSession.ConvertParameterEventArgs
        • SmartSession.ConvertParameterEventHandler
        • SmartSession.ErrorEventArgs
        • SmartSession.ErrorEventHandler
        • SmartSession.InvokeToolEventArgs
        • SmartSession.InvokeToolEventHandler
        • SmartSession.MessagesEventArgs
        • SmartSession.MessagesEventHandler
      • SmartRealtimeSession
      • SmartSession
        • SmartSession.ConvertParameterEventArgs
        • SmartSession.ConvertParameterEventHandler
        • SmartSession.ErrorEventArgs
        • SmartSession.ErrorEventHandler
        • SmartSession.InvokeToolEventArgs
        • SmartSession.InvokeToolEventHandler
        • SmartSession.Message
        • SmartSession.MessageCollection
        • SmartSession.MessageRole
        • SmartSession.MessagesEventArgs
        • SmartSession.MessagesEventHandler
        • SmartSession.TrimmingStrategy
      • SmartTool
        • SmartTool.IToolProvider
        • SmartTool.ToolAttribute
        • SmartTool.ToolContext
      • Markup
        • MarkupExtensions
      • Controls
        • UVLightOverlay
      • Embeddings
        • EmbeddedDocument
        • Embedding
        • Matches
        • Metadata
      • Helpers
        • ApiKeys
        • Markdown
        • TextTokenizer
      • Services
        • DefaultSessionTrimmingService
        • IDocumentConversionService
          • DefaultDocumentConversionService
        • IEmbeddingGenerationService
          • DefaultEmbeddingGenerationService
          • HuggingFaceEmbeddingGenerationService
        • IEmbeddingStorageService
          • AzureAISearchEmbeddingStorageService
          • ChromaEmbeddingStorageService
          • FileSystemEmbeddingStorageService
          • MemoryEmbeddingStorageService
          • PineconeEmbeddingStorageService
          • QdrantEmbeddingStorageService
        • IHttpClientService
          • DefaultHttpClientService
        • ILoggerService
          • DefaultLoggerService
        • IOCRService
          • DefaultOCRService
        • IRerankingService
          • DefaultRerankingService
          • LocalAIRerankingService
          • PineconeRerankingService
        • ISessionTrimmingService
          • DefaultSessionTrimmingService
        • ITextSplitterService
          • RecursiveCharacterTextSplitterService
          • TextSplitterServiceBase
        • ITokenizerService
          • DefaultTokenizerService
        • IWebSearchService
          • BingWebSearchService
          • BraveWebSearchService
          • GoogleWebSearchService
      • Tools
        • ArxivTools
        • ChartJS3Tools
        • DatabaseTools
        • DataTableFilterTools
        • DocumentSearchTools
        • DocumentTools
        • FullCalendarTools
        • IToolsContainer
        • MathTools
        • ToolsContainer
        • UtilityTools
        • WebSearchTools
    • Built-in Services
      • IOCRService
      • ILoggerService
      • ITextSplitterService
      • ITokenizerService
      • IHttpClientService
      • IWebSearchService
      • IRerankingService
      • ISessionTrimmingService
      • IDocumentConversionService
      • IEmbeddingStorageService
      • IEmbeddingGenerationService
    • Built-in SmartTools
      • ToolsContainer
      • MathTools
      • UtilityTools
      • DatabaseTools
      • DocumentTools
      • DocumentSearchTools
      • WebSearchTools
      • ChartJS3Tools
      • FullCalendarTools
    • Built-in SmartAdapters
      • SmartAdapter
      • SmartAudioTTSAdapter
      • SmartAudioWhisperAdapter
      • SmartCalendarAdapter
      • SmartChartAdapter
      • SmartChartJS3Adapter
      • SmartChatBoxAdapter
      • SmartComboBoxAdapter
      • SmartCopilotAdapter
      • SmartDataEntryAdapter
      • SmartDocumentAdapter
      • SmartFullCalendarAdapter
      • SmartObjectAdapter
      • SmartPictureBoxAdapter
      • SmartQueryAdapter
      • SmartRealtimeAdapter
      • SmartReportAdapter
      • SmartTextBoxAdapter
    • Configure Services
    • Using SmartHub
    • Using SmartTools
    • Using SmartPrompt
    • Using SmartSession
    • Using SmartRealTimeAdapter
    • UVLightOverlay Control
Powered by GitBook
On this page
  • Constructors
  • SmartChatBoxAdapter()
  • Properties
  • AutoReset
  • BotAvatar
  • BotName
  • ChatBox
  • User
  • Methods
  • FormatAnswer(answer, sources)
  • OnAnswerReceived(args)
  • OnControlCreated(control)
  • OnControlDisposed(control)
  • OnSourceClicked(args)
  • ParseAnswer(text)
  • ParseSources(text)
  • ResetSession(removeMessages)
  • RunAsyncCore(control)
  • Events
  • AnswerReceived
  • SourceClicked
  • Implements
Export as PDF
  1. Components
  2. API
  3. SmartAdapter

SmartChatBoxAdapter

Wisej.AI.Adapters.SmartChatBoxAdapter

PreviousSmartChartJS3AdapterNextSmartComboBoxAdapter

Last updated 5 days ago

Namespace: Wisej.AI.Adapters

Assembly: Wisej.AI (3.5.0.0)

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

public class SmartChatBoxAdapter : SmartAdapter
Public Class SmartChatBoxAdapter
    Inherits 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

You are not limited to what the model can answer. When you add a method decorated with the the AI can invoke it when necessary in order to retrieve any information or take any action. This is a simple example that provides current date/time knowledge to the AI bot, including the name of the day:


    [SmartTool.Tool]
    [Description("Returns the current date and time.")]
    public DateTime GetCurrentDateTime() {
      return DateTime.Now.ToLongDateString() + " " + DateTime.Now.ToLongTimeString();
    }
  

When the AI needs to know the current date/time it will invoke this method. For example: "When is the next national holiday in {country}?". In this example you can see how to allow the AI to take an action.


  [SmartTool.Tool]
  [Description("Changes the background color of the application header.")]
  public void SetHeaderColor(
      [Description("Name of the new color. Use @toolbar to reset to the original color.")]
      string color)
  {
    ((MainPage)Application.MainPage).panelHeader.BackColor = Color.FromName(color);
  }

When the AI wants to change the header color it will invoke this method with the correct parameter. Use this feature with a lot of caution! A method like "LaunchThermonuclearStrike()" is not allowed.

Constructors

Properties

Methods

Parameter
Type
Description

answer

sources

Parameter
Type
Description

args

Parameter
Type
Description

control

Parameter
Type
Description

control

Parameter
Type
Description

args

Parameter
Type
Description

text

Parameter
Type
Description

text

Resets the conversation history.

Parameter
Type
Description

removeMessages

Indicates whether all messages from the ChatBox control should also be removed.

Parameter
Type
Description

control

Events

Implements

Name
Description

Represents a provider that supplies tools.

SmartChatBoxAdapter()

Initializes a new instance of .

AutoReset

: Gets or sets a value indicating whether the history of the conversation is cleared after each response. (Default: False)

BotAvatar

: Icon of the AI bot. (Default: "resource.wx/Wisej.AI/Icons/wisej-avatar.svg")

BotName

: Name of the AI bot. (Default: "Wisej.AI")

ChatBox

:

User

: The User associated to the AI bot. It's created using and .

FormatAnswer(answer, sources)

Returns: .

OnAnswerReceived(args)

OnControlCreated(control)

OnControlDisposed(control)

OnSourceClicked(args)

ParseAnswer(text)

Returns: .

ParseSources(text)

Returns: .

ResetSession(removeMessages)

RunAsyncCore(control)

Returns: .

AnswerReceived

SourceClicked

SmartChatBoxAdapter
Boolean
String
String
ChatBox
String
String
String[]
Task<Message>
AnswerReceivedEventHandler
SourceClickedEventHandler
SmartAdapter
SmartChatBoxAdapter
SmartTool
ToolAttribute
ChatBox
User
BotName
BotAvatar
String
String[]
AnswerReceivedEventArgs
Control
Control
SourceClickedEventArgs
String
String
Boolean
Control
IToolProvider