SemanticTextMemory.SearchAsync Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Find some information in memory
public System.Collections.Generic.IAsyncEnumerable<Microsoft.SemanticKernel.Memory.MemoryQueryResult> SearchAsync (string collection, string query, int limit = 1, double minRelevanceScore = 0, bool withEmbeddings = false, Microsoft.SemanticKernel.Kernel? kernel = default, System.Threading.CancellationToken cancellationToken = default);
abstract member SearchAsync : string * string * int * double * bool * Microsoft.SemanticKernel.Kernel * System.Threading.CancellationToken -> System.Collections.Generic.IAsyncEnumerable<Microsoft.SemanticKernel.Memory.MemoryQueryResult>
override this.SearchAsync : string * string * int * double * bool * Microsoft.SemanticKernel.Kernel * System.Threading.CancellationToken -> System.Collections.Generic.IAsyncEnumerable<Microsoft.SemanticKernel.Memory.MemoryQueryResult>
Public Function SearchAsync (collection As String, query As String, Optional limit As Integer = 1, Optional minRelevanceScore As Double = 0, Optional withEmbeddings As Boolean = false, Optional kernel As Kernel = Nothing, Optional cancellationToken As CancellationToken = Nothing) As IAsyncEnumerable(Of MemoryQueryResult)
Parameters
- collection
- String
Collection to search
- query
- String
What to search for
- limit
- Int32
How many results to return
- minRelevanceScore
- Double
Minimum relevance score, from 0 to 1, where 1 means exact match.
- withEmbeddings
- Boolean
Whether to return the embeddings of the memories found.
- kernel
- Kernel
The Kernel containing services, plugins, and other state for use throughout the operation.
- cancellationToken
- CancellationToken
The CancellationToken to monitor for cancellation requests. The default is None.
Returns
Memories found