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
  • Methods
  • ExistsAsync(collectionName, documentName)
  • QueryAsync(collectionName, query, topN, minSimilarity, filter)
  • QueryAsync(collectionName, documentName, query, topN, minSimilarity)
  • RemoveAsync(collectionName, filter)
  • RemoveAsync(collectionName, documentName)
  • RetrieveAsync(collectionName, documentName, includeEmbedding)
  • RetrieveAsync(collectionName, includeEmbedding, filter)
  • StoreAsync(collectionName, document)
  • Implemented By
Export as PDF
  1. Components
  2. API
  3. Services

IEmbeddingStorageService

Wisej.AI.Services.IEmbeddingStorageService

PreviousHuggingFaceEmbeddingGenerationServiceNextAzureAISearchEmbeddingStorageService

Last updated 5 days ago

Namespace: Wisej.AI.Services

Assembly: Wisej.AI (3.5.0.0)

Represents a service for storing and querying embedded documents within specified collections.

public interface IEmbeddingStorageService
Public Interface IEmbeddingStorageService

Methods

ExistsAsync(collectionName, documentName)

Asynchronously checks if a specific document exists within a collection by its name.

Parameter
Type
Description

collectionName

The name of the collection to check.

documentName

The name of the document to check for existence.

Returns: . A boolean indicating whether the document exists in the collection.

This method is used to verify the presence of a document within a collection, useful for conditional operations. Example usage:


  var service = GetEmbeddingStorageService();
  bool exists = await service.ExistsAsync("myCollection", "document1");

Throws:

  • Thrown if collectionName or documentName is null.

Asynchronously queries a collection of embedded documents based on a vector query, returning the top K similar documents.

Parameter
Type
Description

collectionName

The name of the collection to query.

query

The query vector to compare against the stored document embeddings.

topN

The maximum number of similar documents to return.

minSimilarity

The minimum similarity threshold for the documents to be considered relevant.

An optional predicate to filter documents before similarity calculation. Defaults to null.

This method is used to find documents that are similar to a given vector representation, which is useful in applications such as information retrieval and recommendation systems. Example usage:


  var service = GetEmbeddingStorageService();
  var similarDocuments = await service.QueryAsync("myCollection", new float[] { 0.1f, 0.2f, 0.3f }, 5, 0.8f);

Throws:

Asynchronously queries for a specific document within a collection based on its name and a query vector.

Parameter
Type
Description

collectionName

The name of the collection containing the document.

documentName

The name of the document to query.

query

The query vector to compare against the document's embedding.

topN

The maximum number of similar documents to consider.

minSimilarity

The minimum similarity threshold for the document to be considered relevant.

This method allows for retrieving specific documents by name and assessing their similarity based on a vector. Example usage:


  var service = GetEmbeddingStorageService();
  var document = await service.QueryAsync("myCollection", "document1", new float[] { 0.1f, 0.2f, 0.3f }, 5, 0.8f);

Throws:

Asynchronously removes documents from a collection that match a specified predicate.

Parameter
Type
Description

collectionName

The name of the collection from which documents will be removed.

An optional predicate to filter documents for removal. Defaults to null.

This method is useful for cleaning up documents that meet specific criteria from a collection. If no filter is provided, no action is taken, and the method exits without removing any documents. Example usage:


  var service = GetEmbeddingStorageService();
  await service.RemoveAsync("myCollection", doc => doc.Name.StartsWith("temp"));

Throws:

Asynchronously removes a specific document from a collection by its name.

Parameter
Type
Description

collectionName

The name of the collection from which the document will be removed.

documentName

The name of the document to be removed.

This method directly targets and removes a document by its name, making it efficient for known documents. Example usage:


  var service = GetEmbeddingStorageService();
  await service.RemoveAsync("myCollection", "document1");

Throws:

Asynchronously retrieves a specific document from a collection by its name, with optional inclusion of its embedding.

Parameter
Type
Description

collectionName

The name of the collection to retrieve the document from.

documentName

The name of the document to retrieve.

includeEmbedding

A boolean indicating whether to include the document's embedding in the retrieval.

This method fetches a document by its name and optionally includes the embedding data, which can be useful for detailed inspections. Example usage:


  var service = GetEmbeddingStorageService();
  var document = await service.RetrieveAsync("myCollection", "document1", false);

Throws:

Asynchronously retrieves documents from a collection with optional embedding inclusion and filtering.

Parameter
Type
Description

collectionName

The name of the collection to retrieve documents from.

includeEmbedding

A boolean indicating whether to include the embeddings of documents in the retrieval.

An optional predicate to filter documents for retrieval. Defaults to null.

This method retrieves documents from a collection, optionally including their embedding data, and applies an optional filter. Example usage:


  var service = GetEmbeddingStorageService();
  var documents = await service.RetrieveAsync("myCollection", false, doc => doc.Name.Contains("important"));

Throws:

Asynchronously stores an embedded document within the specified collection.

Parameter
Type
Description

collectionName

The name of the collection where the document will be stored.

document

The embedded document to store.

This method is used to persist an embedded document in the specified collection, allowing it to be queried later. Example usage:


  var service = GetEmbeddingStorageService();
  await service.StoreAsync("myCollection", new EmbeddedDocument("newDocument"));

Throws:

Implemented By

Name
Description

Represents a service for storing and querying embeddings using Azure AI Search.

Represents a service for storing and retrieving embeddings using Chroma.

Represents a service for storing and retrieving embeddings using Pinecone.

Represents a service for storing and retrieving embeddings using Qdrant.

QueryAsync(collectionName, query, topN, minSimilarity, filter)

filter

Returns: . An array of that are most similar to the query vector.

Thrown if collectionName or query is null.

Thrown if topN is less than 1 or minSimilarity is not between 0 and 1.

QueryAsync(collectionName, documentName, query, topN, minSimilarity)

Returns: . The matching the documentName and meeting the similarity criteria.

Thrown if collectionName , documentName , or query is null.

Thrown if topN is less than 1 or minSimilarity is not between 0 and 1.

RemoveAsync(collectionName, filter)

filter

Returns: .

Thrown if collectionName is null.

RemoveAsync(collectionName, documentName)

Returns: .

Thrown if collectionName or documentName is null.

RetrieveAsync(collectionName, documentName, includeEmbedding)

Returns: . The that matches the specified document name.

Thrown if collectionName or documentName is null.

RetrieveAsync(collectionName, includeEmbedding, filter)

filter

Returns: . An array of that match the specified criteria.

Thrown if collectionName is null.

StoreAsync(collectionName, document)

Returns: .

Thrown if collectionName or document is null.

Provides a file system-based implementation of the interface.

Provides an in-memory implementation of the interface.

Task<EmbeddedDocument[]>
EmbeddedDocument
ArgumentNullException
ArgumentException
Task<EmbeddedDocument>
EmbeddedDocument
ArgumentNullException
ArgumentException
Task
ArgumentNullException
Task
ArgumentNullException
Task<EmbeddedDocument>
EmbeddedDocument
ArgumentNullException
Task<EmbeddedDocument[]>
EmbeddedDocument
ArgumentNullException
Task
ArgumentNullException
String
String
String
Single[]
Int32
Single
Predicate<EmbeddedDocument>
String
String
Single[]
Int32
Single
String
Predicate<EmbeddedDocument>
String
String
String
String
Boolean
String
Boolean
Predicate<EmbeddedDocument>
String
EmbeddedDocument
AzureAISearchEmbeddingStorageService
ChromaEmbeddingStorageService
FileSystemEmbeddingStorageService
IEmbeddingStorageService
MemoryEmbeddingStorageService
IEmbeddingStorageService
PineconeEmbeddingStorageService
QdrantEmbeddingStorageService
Task<Boolean>
ArgumentNullException