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
  • Overview
  • Properties
  • Hub
  • AutoUpdate
  • AutoRun
  • Busy
  • SystemPrompt
  • Usage
  • Tools
  • Parameters
  • Agents
  • Session
  • Controls
  • Events
  • Start
  • Done
  • BusyChanged
Export as PDF
  1. Components
  2. Built-in SmartAdapters

SmartAdapter

Overview

This is the base class for all adapters. It provides essential functionality and common properties that are shared by all adapter implementations.

In Wisej.AI, the concept of adapters serves the purpose of connecting application objects to AI providers. Acting as a "bridge," these adapters adjust the AI responses to ensure compatibility with the specific application objects. This adaptation facilitates seamless integration between the AI functionalities and the targeted application components.

The SmartAdapter utilizes all the Wisej.AI components (such as SmartHub, SmartPrompt, and SmartSession), along with various tools, to maximize the powerful UI controls and real-time capabilities of Wisej.NET.

Properties

All adapters share these properties.

Hub

The Hub property is responsible for connecting the adapter to a SmartHub instance, which serves as the source for obtaining the endpoint for the adapter's operation. Multiple adapters can be configured to utilize the same SmartHub instance.

AutoUpdate

AutoUpdate is a property that specifies whether the adapter should automatically refresh the browser upon completion of its processing tasks. This functionality requires an active WebSocket connection. The default value is true.

AutoRun

AutoRun is a property that determines whether the adapter should execute automatically. This property is applicable only to adapters linked to a control and intended to respond to control-related events. For instance, if the adapter is configured to trigger actions when the text of a control changes, it utilizes this property. The default value is true.

Busy

The Busy property is a read-only attribute that indicates whether the adapter is currently engaged in processing a request sent to the AI endpoint.

When the value of this property changes, it triggers the BusyChanged event.

SystemPrompt

The system prompt utilized by the adapter can be specified as either a string or a key name within an .ini file. This property is helps in fine-tuning the adapter's behavior.

For instance, you can set the system prompt with the following syntax:

this.adapter1.SystemPrompt = "You are allowed to answer only questions related to customer service matters";

This configuration directs the adapter to focus exclusively on customer service-related inquiries.

Usage

Tools

The Tools property is a collection of SmartTool methods that are registered with the adapter. This property allows you to add, remove, and inspect the tools within the collection.

Parameters

The collection of parameters associated with this adapter consists of placeholders that can be utilized throughout Wisej.AI. These placeholders can be inserted in various locations, such as:

  • Prompts

  • Description attribute

  • FieldPrompt attribute

Placeholders are enclosed within {{ and }}. However, they are defined using only their name. To assign a value to a parameter, you can use the Add() method to add or replace a parameter or the indexer.

this.adapter1.SystemPrompt = "SQL statements must be valid for {{database-name}}";

this.adapter1.Parameters["database-name"] = "DB2";
this.adapter1.Parameters.Add("database-name", "MySql");

Agents

Agents within this collection are processed in the order they are added, ensuring a predictable sequence of operations. This enables developers to orchestrate complex sequences of actions or modifications before or after AI model interactions.

Agents in Wisej.AI are capable of working also with audio and image-related adapters. They can perform pre-processing or post-processing tasks on audio and images, allowing for a wide range of functionalities such as enhancing, analyzing, or transforming the media content in conjunction with AI capabilities.

Session

The Session property maintains a reference to the current SmartSession utilized by the adapter. This property is essential as it allows the adapter to access and manage session-specific data and states, providing a context for operations and ensuring that interactions with the AI model can be tailored based on the session's attributes and history.

Controls

This refers to the collection of controls associated with the adapter. It is important to note that not all adapters are linked to controls.

Events

Start

This event is triggered when the adapter begins its communication with the AI model. It marks the initial stage of interaction, allowing developers to execute any predefined actions or set up necessary conditions at the onset of the exchange between the adapter and the AI model.

Done

This event is triggered once the adapter has received a response from the AI model and completed processing it. At this point, all necessary handling, modifications, and enhancements have been applied. This event provides an opportunity for developers to perform post-processing actions, such as logging the transaction, updating the user interface, or invoking other application logic based on the finalized data.

BusyChanged

Similar to the Start and Done events, the BusyChanged event occurs whenever there is a change in the value of the Busy property.

PreviousBuilt-in SmartAdaptersNextSmartAudioTTSAdapter

Last updated 3 days ago

The Usage property is an instance of the class. It encapsulates the total metrics for the adapter, specifically measured in terms of InputTokens and OutputTokens.

The Agents collection within the SmartAdapter class manages a collection . subscribed to receive notifications from the adapter. This collection allows developers to add, remove, and manage a series of agents that can interact with the SmartAdapter.

Metrics
usage
SmartAgentPrompts