DocumentSearchTools
Wisej.AI.Tools.DocumentSearchTools
Last updated
Wisej.AI.Tools.DocumentSearchTools
Last updated
Namespace: Wisej.AI.Tools
Assembly: Wisej.AI (3.5.0.0)
Provides tools for searching and managing documents within a specified collection.
This class allows for embedding questions, querying documents, listing documents, and summarizing document content. It utilizes these services: , .
Initializes a new instance of the class.
collectionName
The name of the document collection. Default is an empty string.
filter
A predicate to filter embedded documents. Default is null.
Throws:
Thrown when collectionName is null.
Asynchronously generates an embedding for the specified question.
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
.
Lists all documents in the collection.
Queries all documents based on the provided question.
question
The question to query documents for.
This method retrieves all documents that match the embedded question.
Queries a single document based on the provided document name and question.
document_name
The name of the document to query.
question
The question to query the document for.
Reads metadata for the specified documents.
document_names
An array of document names to read metadata for.
Asynchronously reranks the provided text chunks based on their relevance to the given question.
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.
document_name
The name of the document to summarize.
Represents a container for tools, providing access to a hub, adapter, and a collection of parameters.
: Gets or sets the name of the document collection. (Default: null
)
: Gets or sets the embedding generation service used for embedding questions.
: Gets or sets the embedding storage service used for storing and retrieving embedded documents.
: Get or sets the maximum number of vector clusters to generate when performing summarization tasks. (Default: 5
)
: Gets or sets the maximum number of context tokens. (Default: 4096
)
: Gets or sets the maximum number of documents that can be returned. (Default: 100
)
: Gets or sets the minimum similarity threshold for document retrieval. (Default: 0.25
)
: Gets or sets a value indicating whether reranking is enabled. (Default: False
)
: Gets or sets the reranking service.
: Gets or sets the tokenizer service used for truncating content to fit within the maximum context tokens.
: Gets or sets the number of top chunks to retrieve. (Default: 10
)
Returns: . A task that represents the asynchronous operation. The task result contains the generated for the question, or null
if the input is invalid.
Returns: . A task that represents the asynchronous operation. The task result contains a list of document names as a string.
Returns: . A task that represents the asynchronous operation. The task result contains the query results as a string.
Returns: . A task that represents the asynchronous operation. The task result contains the query result as a string.
Returns: . A task that represents the asynchronous operation. The task result contains the metadata as a string.
Returns: . A task that represents the asynchronous operation. The task result contains an array of reranked text chunks.
Returns: . A task that represents the asynchronous operation. The task result contains the summary as a string.