SmartHub
Wisej.AI.SmartHub
Last updated
Wisej.AI.SmartHub
Last updated
Namespace: Wisej.AI
Assembly: Wisej.AI (3.5.0.0)
Represents a SmartHub component that provides AI capabilities to controls within a container.
The SmartHub class is an extender provider that allows controls to be extended with AI functionalities. It manages various services and tools to facilitate AI operations, such as embedding generation, document conversion, and similarity queries.
Initializes a new instance of the class.
Initializes a new instance of the class with a specified container control.
containerControl
The container control to which the SmartHub is attached.
Throws:
Thrown when the containerControl is null.
container
Asynchronously asks a question and returns a response message.
question
The question to ask.
An optional image to include in the question. Default is null
.
Option system prompt.
Throws:
disposing
true to release both managed and unmanaged resources; false to release only unmanaged resources.
Asynchronously generates an embedding for a specified text.
text
The text to embed.
Asynchronously generates an embedding for a specified array of text chunks.
chunks
The text chunks to embed.
Throws:
Gets the adapter associated with a specified control.
control
The control for which to get the adapter.
Throws:
Gets the adapter of a specified type associated with a specified control.
T
The type of the adapter.
control
The control for which to get the adapter.
Throws:
Gets the AI properties for a specified control.
control
The control for which to get the AI properties.
Gets the value of a specified parameter.
parameter
The parameter for which to get the value.
Throws:
Asynchronously ingests a document from a specified file path.
filePath
The file path of the document to ingest.
documentName
The name of the document.
The name of the collection. Default is null.
The metadata for the document. Default is null.
Whether to overwrite an existing document. Default is false.
Asynchronously ingests a document from a specified stream.
stream
The stream of the document to ingest.
documentName
The name of the document.
The name of the collection. Default is null.
Whether to overwrite an existing document. Default is false.
The metadata for the document. Default is null.
Removes a specified adapter from the SmartHub.
adapter
The adapter to remove.
Throws:
Removes a tool from the SmartHub.
tool
The tool to remove.
Throws:
Asynchronously performs a similarity query on a specified query and text chunks.
query
The query text.
chunks
The text chunks to compare against.
topN
The number of top results to return.
minSimilarity
The minimum similarity threshold.
The function to compute similarity. Default is null.
Throws:
Asynchronously performs a similarity query on a specified query, text chunks, and vectors.
query
The query text.
chunks
The text chunks to compare against.
vectors
The vectors to compare against.
topN
The number of top results to return.
minSimilarity
The minimum similarity threshold.
The function to compute similarity. Default is null.
Throws:
Asynchronously calculates similarity scores for a specified query and text chunks.
query
The query text.
chunks
The text chunks to compare against.
The function to compute similarity. Default is null.
Throws:
Asynchronously calculates similarity scores for a specified query, text chunks, and embeddings.
query
The query text.
chunks
The text chunks to compare against.
embeddings
The embeddings to compare against.
The function to compute similarity. Default is null.
Throws:
Adds a tool to the SmartHub.
tool
The tool to add.
Throws:
Uses tools from a specified target.
target
The target from which to use tools.
Represents a provider that supplies tools.
Initializes a new instance of the class attached to an implementation.
An that represents the container of the extender.
: Gets the binding context for the SmartHub.
: Returns or sets the container that provides the for binding to the interface implemented by a . (Default: null
)
: Gets or sets the culture information for the SmartHub. (Default: null
)
: Gets or sets a data source that can be used to resolve prompt parameters. (Default: null
)
: Gets or sets the default endpoint. (Default: null
)
: Gets a value indicating whether the SmartHub is disposed.
image
systemPrompt
Returns: . A task representing the asynchronous operation, with a as the result.
Thrown when the question is null.
Releases the unmanaged resources used by the and optionally releases the managed resources.
Returns: . A task representing the asynchronous operation, with an as the result.
Returns: . A task representing the asynchronous operation, with an as the result.
Thrown when the chunks array is null.
Returns: . The associated with the control, or null if none exists.
Thrown when the control is null.
Returns: . The adapter of type T associated with the control, or null if none exists.
Thrown when the control is null.
Returns: . The associated with the control.
Returns: . The value of the parameter as a string.
Thrown when the parameter is null.
collectionName
metadata
overwrite
Returns: . A task representing the asynchronous operation, with an as the result.
This method utilizes several services to perform its operations: , and , and , and .Throws:
Thrown when the filePath or documentName is null.
collectionName
overwrite
metadata
Returns: . A task representing the asynchronous operation, with an as the result.
This method utilizes several services to perform its operations: , and , and , and .Throws:
Thrown when the stream or documentName is null.
Thrown when the adapter is null.
Returns: . The current instance.
Thrown when the tool is null.
computeSimilarity
Returns: . A task representing the asynchronous operation, with an array of strings as the result.
Thrown when the query or chunks are null.
computeSimilarity
Returns: . A task representing the asynchronous operation, with an array of strings as the result.
Thrown when the query, chunks, or vectors are null.
computeSimilarity
Returns: . A task representing the asynchronous operation, with an array of floats as the result.
Thrown when the query or chunks are null.
computeSimilarity
Returns: . A task representing the asynchronous operation, with an array of floats as the result.
Thrown when the query, chunks, or embeddings are null.
Returns: . The current instance.
Thrown when the tool is null.
Returns: . The current instance.