forked from microsoft/semantic-kernel
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathITextSearch.cs
More file actions
89 lines (81 loc) · 4.98 KB
/
ITextSearch.cs
File metadata and controls
89 lines (81 loc) · 4.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
// Copyright (c) Microsoft. All rights reserved.
using System.Diagnostics.CodeAnalysis;
using System.Threading;
using System.Threading.Tasks;
namespace Microsoft.SemanticKernel.Data;
/// <summary>
/// Interface for text based search queries with type-safe LINQ filtering for use with Semantic Kernel prompts and automatic function calling.
/// </summary>
/// <typeparam name="TRecord">The type of record being searched.</typeparam>
[Experimental("SKEXP0001")]
public interface ITextSearch<TRecord>
{
/// <summary>
/// Perform a search for content related to the specified query and return <see cref="string"/> values representing the search results.
/// </summary>
/// <param name="query">What to search for.</param>
/// <param name="searchOptions">Options used when executing a text search.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> to monitor for cancellation requests. The default is <see cref="CancellationToken.None"/>.</param>
Task<KernelSearchResults<string>> SearchAsync(
string query,
TextSearchOptions<TRecord>? searchOptions = null,
CancellationToken cancellationToken = default);
/// <summary>
/// Perform a search for content related to the specified query and return <see cref="TextSearchResult"/> values representing the search results.
/// </summary>
/// <param name="query">What to search for.</param>
/// <param name="searchOptions">Options used when executing a text search.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> to monitor for cancellation requests. The default is <see cref="CancellationToken.None"/>.</param>
Task<KernelSearchResults<TextSearchResult>> GetTextSearchResultsAsync(
string query,
TextSearchOptions<TRecord>? searchOptions = null,
CancellationToken cancellationToken = default);
/// <summary>
/// Perform a search for content related to the specified query and return strongly-typed <typeparamref name="TRecord"/> values representing the search results.
/// </summary>
/// <param name="query">What to search for.</param>
/// <param name="searchOptions">Options used when executing a text search.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> to monitor for cancellation requests. The default is <see cref="CancellationToken.None"/>.</param>
Task<KernelSearchResults<TRecord>> GetSearchResultsAsync(
string query,
TextSearchOptions<TRecord>? searchOptions = null,
CancellationToken cancellationToken = default);
}
/// <summary>
/// Interface for text based search queries for use with Semantic Kernel prompts and automatic function calling.
/// This non-generic interface uses legacy <see cref="TextSearchFilter"/> for backward compatibility.
/// </summary>
[System.Obsolete("Use ITextSearch<TRecord> with LINQ-based filtering instead. This interface will be removed in a future version.")]
public interface ITextSearch
{
/// <summary>
/// Perform a search for content related to the specified query and return <see cref="string"/> values representing the search results.
/// </summary>
/// <param name="query">What to search for.</param>
/// <param name="searchOptions">Options used when executing a text search.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> to monitor for cancellation requests. The default is <see cref="CancellationToken.None"/>.</param>
Task<KernelSearchResults<string>> SearchAsync(
string query,
TextSearchOptions? searchOptions = null,
CancellationToken cancellationToken = default);
/// <summary>
/// Perform a search for content related to the specified query and return <see cref="TextSearchResult"/> values representing the search results.
/// </summary>
/// <param name="query">What to search for.</param>
/// <param name="searchOptions">Options used when executing a text search.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> to monitor for cancellation requests. The default is <see cref="CancellationToken.None"/>.</param>
Task<KernelSearchResults<TextSearchResult>> GetTextSearchResultsAsync(
string query,
TextSearchOptions? searchOptions = null,
CancellationToken cancellationToken = default);
/// <summary>
/// Perform a search for content related to the specified query and return <see cref="object"/> values representing the search results.
/// </summary>
/// <param name="query">What to search for.</param>
/// <param name="searchOptions">Options used when executing a text search.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> to monitor for cancellation requests. The default is <see cref="CancellationToken.None"/>.</param>
Task<KernelSearchResults<object>> GetSearchResultsAsync(
string query,
TextSearchOptions? searchOptions = null,
CancellationToken cancellationToken = default);
}