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
  • SmartPrompt(text)
  • Properties
  • PromptDictionaries
  • Text
  • Methods
  • AskAsync(hub, question, image)
  • AskAsync(endpoint, question, image)
  • Clone()
  • RemoveTool(tool)
  • RemoveTools(target)
  • ResolvePrompt(key)
  • SavePrompts(filePath)
  • UseTool(tool)
  • UseTools(target)
  • Inherited By
  • Implements
Export as PDF
  1. Components
  2. API

SmartPrompt

Wisej.AI.SmartPrompt

PreviousSmartObjectNextSmartAgentPrompt

Last updated 5 days ago

Namespace: Wisej.AI

Assembly: Wisej.AI (3.5.0.0)

Represents a smart prompt component that can process and manage prompts with tools and parameters.

public class SmartPrompt : SmartObject, IToolProvider, ICloneable
Public Class SmartPrompt
    Inherits SmartObject
    Implements IToolProvider, ICloneable

The class provides functionality to manage prompts, tools, and parameters. It supports cloning and asynchronous operations to ask questions using a smart hub or endpoint.


SmartPrompt prompt = new SmartPrompt("You are a weather expert");
prompt.Start += (s, e) => Console.WriteLine("Processing started.");
prompt.Done += (s, e) => Console.WriteLine("Processing done.");
await prompt.AskAsync(new OpenAIEndpoint(), "What is the weather today?");

Constructors

SmartPrompt(text)

Initializes a new instance of the class with the specified text.

Name
Type
Description

text

The initial text for the prompt. Default is null.

Properties

The prompt dictionaries are loaded from the AI directory and embedded resources.

Methods

Asynchronously asks a question using the specified smart hub.

Parameter
Type
Description

hub

The smart hub to use.

question

The question to ask.

An optional image to include in the question. Default is null.

Throws:

Asynchronously asks a question using the specified smart endpoint.

Parameter
Type
Description

endpoint

The smart endpoint to use.

question

The question to ask.

An optional image to include. Default is null.

Throws:

Removes a tool from the smart prompt.

Parameter
Type
Description

tool

The tool to remove.

Throws:

Removes the tools from the specified object.

Parameter
Type
Description

target

The target object containing tools.

Resolves the prompt text for the specified key.

Parameter
Type
Description

key

The key to resolve.

Saves the prompts to the specified file path.

Parameter
Type
Description

filePath

The file path to save the prompts to.

Adds a tool to the smart prompt.

Parameter
Type
Description

tool

The tool to add.

Throws:

Uses the tools from the specified target object.

Parameter
Type
Description

target

The target object containing tools.

Inherited By

Name
Description

TODO:

Represents a smart parallel prompt that can execute multiple tasks concurrently.

Implements

Name
Description

Represents a provider that supplies tools.

PromptDictionaries

: Gets the collection of prompt dictionaries.

Text

: Gets or sets the text of the smart prompt. (Default: null)

The text is resolved using the method.

AskAsync(hub, question, image)

image

Returns: . A task representing the asynchronous operation, with a result.

Thrown when the hub or question is null.

AskAsync(endpoint, question, image)

image

Returns: . A task representing the asynchronous operation, with a result.

Thrown when the endpoint or question is null.

Clone()

Creates a new instance of the class that is a copy of the current instance.

Returns: . A new object that is a copy of this instance.

RemoveTool(tool)

Returns: . The current instance.

Thrown when the tool is null.

RemoveTools(target)

Returns: . The current instance.

ResolvePrompt(key)

Returns: . The resolved prompt text, or the key if not found.

SavePrompts(filePath)

UseTool(tool)

Returns: . The current instance.

Thrown when the tool is null.

UseTools(target)

Returns: . The current instance.

IList<IDictionary<String, String>>
String
Task<Message>
Message
ArgumentNullException
Task<Message>
Message
ArgumentNullException
SmartPrompt
SmartPrompt
SmartPrompt
SmartPrompt
SmartPrompt
ArgumentNullException
SmartPrompt
SmartPrompt
String
SmartPrompt
SmartPrompt
ArgumentNullException
SmartPrompt
SmartPrompt
ResolvePrompt
String
SmartHub
String
Image
SmartEndpoint
String
Image
Delegate
Object
String
String
Delegate
Object
SmartAgentPrompt
SmartParallelPrompt
IToolProvider
SmartObject
SmartPrompt
SmartPrompt
SmartPrompt