WebSearchEnginePlugin.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.
Performs a web search using the provided query, count, and offset.
[Microsoft.SemanticKernel.KernelFunction]
public System.Threading.Tasks.Task<string> SearchAsync(string query, int count = 10, int offset = 0, System.Threading.CancellationToken cancellationToken = default);
[<Microsoft.SemanticKernel.KernelFunction>]
member this.SearchAsync : string * int * int * System.Threading.CancellationToken -> System.Threading.Tasks.Task<string>
Public Function SearchAsync (query As String, Optional count As Integer = 10, Optional offset As Integer = 0, Optional cancellationToken As CancellationToken = Nothing) As Task(Of String)
Parameters
- query
- String
The text to search for.
- count
- Int32
The number of results to return. Default is 1.
- offset
- Int32
The number of results to skip. Default is 0.
- cancellationToken
- CancellationToken
A cancellation token to observe while waiting for the task to complete.
Returns
A task that represents the asynchronous operation. The value of the TResult parameter contains the search results as a string.
- Attributes
Remarks
This method is marked as "unsafe." The usage of JavaScriptEncoder.UnsafeRelaxedJsonEscaping may introduce security risks. Only use this method if you are aware of the potential risks and have validated the input to prevent security vulnerabilities.