TextSearch Class
The base class for all text searches.
Note: This class is marked as 'experimental' and may change in the future.
Constructor
TextSearch()
Methods
| create_get_search_results |
Create a kernel function from a get_search_results function. |
| create_get_text_search_results |
Create a kernel function from a get_text_search_results function. |
| create_search |
Create a kernel function from a search function. |
| get_search_results |
Search for text, returning a KernelSearchResult with the results directly from the service. |
| get_text_search_results |
Search for text, returning a KernelSearchResult with TextSearchResults. |
| search |
Search for text, returning a KernelSearchResult with a list of strings. |
create_get_search_results
Create a kernel function from a get_search_results function.
create_get_search_results(options: SearchOptions | None = None, parameters: list[KernelParameterMetadata] | None = None, options_update_function: OptionsUpdateFunctionType | None = None, return_parameter: KernelParameterMetadata | None = None, function_name: str = 'search', description: str = 'Perform a search for content related to the specified query and return string results', string_mapper: Callable[[TMapInput], str] | None = None) -> KernelFunction
Parameters
| Name | Description |
|---|---|
|
options
|
The search options. Default value: None
|
|
parameters
|
The parameters for the function, a list of KernelParameterMetadata. Default value: None
|
|
options_update_function
|
A function to update the search options. The function should return the updated query and options. There is a default function that can be used, or you can supply your own. The default function uses the parameters and the kwargs to update the options. Adding equal to filters to the options for all parameters that are not "query", "top", or "skip". As well as adding equal to filters for parameters that have a default value. Default value: None
|
|
return_parameter
|
The return parameter for the function. Default value: None
|
|
function_name
|
The name of the function, to be used in the kernel, default is "search". Default value: search
|
|
description
|
The description of the function, a default is provided. Default value: Perform a search for content related to the specified query and return string results
|
|
string_mapper
|
The function to map the search results to strings. Default value: None
|
Returns
| Type | Description |
|---|---|
|
The kernel function. |
create_get_text_search_results
Create a kernel function from a get_text_search_results function.
create_get_text_search_results(options: SearchOptions | None = None, parameters: list[KernelParameterMetadata] | None = None, options_update_function: OptionsUpdateFunctionType | None = None, return_parameter: KernelParameterMetadata | None = None, function_name: str = 'search', description: str = 'Perform a search for content related to the specified query and return string results', string_mapper: Callable[[TMapInput], str] | None = None) -> KernelFunction
Parameters
| Name | Description |
|---|---|
|
options
|
The search options. Default value: None
|
|
parameters
|
The parameters for the function, a list of KernelParameterMetadata. Default value: None
|
|
options_update_function
|
A function to update the search options. The function should return the updated query and options. There is a default function that can be used, or you can supply your own. The default function uses the parameters and the kwargs to update the options. Adding equal to filters to the options for all parameters that are not "query", "top", or "skip". As well as adding equal to filters for parameters that have a default value. Default value: None
|
|
return_parameter
|
The return parameter for the function. Default value: None
|
|
function_name
|
The name of the function, to be used in the kernel, default is "search". Default value: search
|
|
description
|
The description of the function, a default is provided. Default value: Perform a search for content related to the specified query and return string results
|
|
string_mapper
|
The function to map the search results to strings. Default value: None
|
Returns
| Type | Description |
|---|---|
|
The kernel function. |
create_search
Create a kernel function from a search function.
create_search(options: SearchOptions | None = None, parameters: list[KernelParameterMetadata] | None = None, options_update_function: OptionsUpdateFunctionType | None = None, return_parameter: KernelParameterMetadata | None = None, function_name: str = 'search', description: str = 'Perform a search for content related to the specified query and return string results', string_mapper: Callable[[TMapInput], str] | None = None) -> KernelFunction
Parameters
| Name | Description |
|---|---|
|
options
|
The search options. Default value: None
|
|
parameters
|
The parameters for the function, a list of KernelParameterMetadata. Default value: None
|
|
options_update_function
|
A function to update the search options. The function should return the updated query and options. There is a default function that can be used, or you can supply your own. The default function uses the parameters and the kwargs to update the options. Adding equal to filters to the options for all parameters that are not "query", "top", or "skip". As well as adding equal to filters for parameters that have a default value. Default value: None
|
|
return_parameter
|
The return parameter for the function. Default value: None
|
|
function_name
|
The name of the function, to be used in the kernel, default is "search". Default value: search
|
|
description
|
The description of the function, a default is provided. Default value: Perform a search for content related to the specified query and return string results
|
|
string_mapper
|
The function to map the search results to strings. Default value: None
|
Returns
| Type | Description |
|---|---|
|
The kernel function. |
get_search_results
Search for text, returning a KernelSearchResult with the results directly from the service.
abstract async get_search_results(query: str, options: SearchOptions | None = None, **kwargs: Any) -> KernelSearchResults[Any]
Parameters
| Name | Description |
|---|---|
|
query
Required
|
|
|
options
|
Default value: None
|
get_text_search_results
Search for text, returning a KernelSearchResult with TextSearchResults.
abstract async get_text_search_results(query: str, options: SearchOptions | None = None, **kwargs: Any) -> KernelSearchResults[TextSearchResult]
Parameters
| Name | Description |
|---|---|
|
query
Required
|
|
|
options
|
Default value: None
|
search
Search for text, returning a KernelSearchResult with a list of strings.
abstract async search(query: str, options: SearchOptions | None = None, **kwargs: Any) -> KernelSearchResults[str]
Parameters
| Name | Description |
|---|---|
|
query
Required
|
The query to search for. |
|
options
|
The search options. Default value: None
|
|
**kwargs
Required
|
If options is None, the search options can be passed as keyword arguments. They are then used to create a search options object. |
Attributes
options_class
The options class for the search.
is_experimental
is_experimental = True
stage_status
stage_status = 'experimental'