All pages
Powered by GitBook
1 of 1

Loading...

SmartDocumentAdapter

Wisej.AI.Adapters.SmartDocumentAdapter

Namespace: Wisej.AI.Adapters

Assembly: Wisej.AI (3.5.0.0)

  • SmartAdapter

    • SmartDocumentAdapter

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.

public class SmartDocumentAdapter : SmartAdapter

This class integrates with the to search within the document being managed. It provides properties to configure the bot's appearance and document handling, and events to manage responses.

Constructors

SmartDocumentAdapter()

Initializes a new instance of the class.

Properties

AutoReset

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

BotAvatar

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

BotName

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

ChatBox

: Gets the associated ChatBox control.

ConversionService

: Gets or sets the document conversion service used for converting documents to text.

FilePath

: Gets or sets the file path of the document. (Default: null)

FileType

: Gets or sets the file type. i.e. .docx, .pdf, .txt. If null it will be detected automatically. (Default: null)

MaxClusters

: Get or sets the maximum number of vector clusters to generate when performing summarization tasks. (Default: 5)

MinSimilarity

: Gets or sets the minimum similarity threshold. (Default: 0.25)

Stream

: Gets or sets the file path of the document. (Default: null)

TextSplitterService

: Gets or sets the text splitter service used for splitting text into smaller chunks.

TopN

: Gets or sets the number of top results to retrieve. (Default: 10)

User

: Gets the user representing the bot.

Methods

AskAsync(question)

Parameter
Type
Description

Returns: .

Throws:

  • When question is null.

OnAnswerReceived(e)

Raises the event.

Parameter
Type
Description

OnControlCreated(control)

Parameter
Type
Description

OnControlDisposed(control)

Parameter
Type
Description

ParseAnswer(text)

Parameter
Type
Description

Returns: .

ParseSourceText(text)

Parameter
Type
Description

Returns: .

ResetSession(removeMessages)

Resets the conversation history.

Parameter
Type
Description

RunAsyncCore(control)

Executes the core logic asynchronously.

Parameter
Type
Description

Returns: . A task representing the asynchronous operation.

Events

AnswerReceived

Occurs when an answer is received.

Implements

Name
Description

question

String

e

AnswerReceivedArgs

The AnswerReceivedArgs instance containing the event data.

control

Control

control

Control

text

String

text

String

removeMessages

Boolean

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

control

Control

The control associated with the operation.

IToolProvider

Represents a provider that supplies tools.

Public Class SmartDocumentAdapter
    Inherits SmartAdapter
IEmbeddingStorageService
SmartDocumentAdapter
Boolean
String
String
ChatBox
IDocumentConversionService
String
String
Int32
Single
Stream
ITextSplitterService
Int32
User
Task<String>
ArgumentNullException
AnswerReceived
String
String
Task<Message>
AnswerReceivedHandler