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
  • DocumentTools()
  • Properties
  • ConversionService
  • EmbeddingGenerationService
  • FilePath
  • FileType
  • MaxClusters
  • MaxContextTokens
  • MinSimilarity
  • RerankingEnabled
  • RerankingService
  • Stream
  • TextSplitterService
  • TokenizerService
  • TopN
  • Methods
  • EmbedQuestionAsync(question)
  • query_document(question)
  • RerankAsync(question, chunks)
  • summarize_document()
  • Implements
Export as PDF
  1. Components
  2. API
  3. Tools

DocumentTools

Wisej.AI.Tools.DocumentTools

PreviousDocumentSearchToolsNextFullCalendarTools

Last updated 5 days ago

Namespace: Wisej.AI.Tools

Assembly: Wisej.AI (3.5.0.0)

Provides tools for processing, embedding, and querying documents using AI services.

public class DocumentTools : ToolsContainer
Public Class DocumentTools
    Inherits ToolsContainer

The class enables document processing tasks such as:

  • Embedding documents for similarity and summarization tasks.

  • Querying documents based on semantic similarity.

  • Summarizing document content using clustering techniques. It integrates with various AI services, including tokenization, text splitting, document conversion, and embedding generation.

Constructors

DocumentTools()

Initializes a new instance of the class.

This constructor injects the required services into the instance using the application's service provider.

Properties

Setting this property will reset the internal document.

Methods

Asynchronously generates an embedding for the specified question.

Parameter
Type
Description

question

The question to be embedded. Must not be null or empty.

This method checks if the provided question is null or empty and returns null if so. Otherwise, it delegates the embedding generation to the EmbeddingGenerationService.

Queries a single document based on the provided document name and question.

Parameter
Type
Description

question

The question to query the document for.

Asynchronously reranks the provided text chunks based on their relevance to the given question.

Parameter
Type
Description

question

The question used as the basis for reranking.

chunks

An array of text chunks to be reranked.

This method is intended to be overridden in derived classes to implement custom reranking logic. The method should return the chunks array reordered by relevance to the question .

Summarizes the content of a specified document.

Implements

Name
Description

Represents a container for tools, providing access to a hub, adapter, and a collection of parameters.

ConversionService

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

EmbeddingGenerationService

: Gets or sets the embedding generation service used for generating embeddings from text.

FilePath

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

Setting this property will reset the internal document and stream references. If the value changes, the and the internal document are set to null.

FileType

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

MaxClusters

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

MaxContextTokens

: Gets or sets the maximum number of context tokens. (Default: 4096)

MinSimilarity

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

RerankingEnabled

: Gets or sets a value indicating whether reranking is enabled. (Default: False)

RerankingService

: Gets or sets the reranking service.

Stream

: Gets or sets the stream associated with the document. (Default: null)

Setting this property will reset the internal document and file path references. If the value changes, the and the internal document are set to null.

TextSplitterService

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

TokenizerService

: Gets or sets the tokenizer service used for truncating context tokens.

TopN

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

EmbedQuestionAsync(question)

Returns: . A task that represents the asynchronous operation. The task result contains the generated for the question, or null if the input is invalid.

query_document(question)

Returns: . A task that represents the asynchronous operation. The task result contains the query result as a string.

RerankAsync(question, chunks)

Returns: . A task that represents the asynchronous operation. The task result contains an array of reranked text chunks.

summarize_document()

Returns: . A task that represents the asynchronous operation. The task result contains the summary as a string.

IDocumentConversionService
IEmbeddingGenerationService
String
String
Int32
Int32
Single
Boolean
IRerankingService
Stream
ITextSplitterService
ITokenizerService
Int32
Task<Embedding>
Embedding
Task<String>
Task<String[]>
Task<String>
Stream
FilePath
String
String
String
String[]
IToolsContainer
ToolsContainer
DocumentTools
DocumentTools
DocumentTools
DocumentTools