Search API domain
class yandex_cloud_ml_sdk._search_api.domain.SearchAPIDomain
Domain for working with Yandex Search API services.
generative: GenerativeSearchFunction
API for generative response service
web: WebSearchFunction
API for web search service
image: ImageSearchFunction
API for text image search service
by_image: ByImageSearchFunction
API for search by image service
Generative search
class yandex_cloud_ml_sdk._search_api.generative.function.GenerativeSearchFunction
Generative search function for creating search object which provides methods for invoking generative search.
__call__(*, site=Undefined, host=Undefined, url=Undefined, fix_misspell=Undefined, enable_nrfm_docs=Undefined, search_filters=Undefined)
Creates generative search object which provides methods for invoking generative search.
Not to be confused with sdk.tools.generative_search. Tools domain is for creating tools for using in LLMs/Assistants and search_api domain is for using Search API directly.
To learn more about parameters and their formats and possible values, refer to generative search documentation
NB: All of the site, host, url parameters are mutually exclusive.
|
Parameters |
|
|
Return type |
property available_formats
class yandex_cloud_ml_sdk._search_api.generative.generative.GenerativeSearch
Generative search class which provides concrete methods for working with Search API and incapsulates search setting.
run(request, *, timeout=60)
Run a search query with given request and search settings of this generative search object.
To change initial search settings use .configure method:
>>> search = sdk.search_api.generative(site="site")
>>> search = search.configure(site="other_site")
|
Parameters |
Also message could be one of the data formats:
|
|
Return type |
as_tool(description)
Converts generative search instance to GenerativeSearchTool object which is eligible to use as tools in LLMs/Assistants.
|
Parameters |
description (str |
|
Return type |
property config: ConfigTypeT
configure(*, site=Undefined, host=Undefined, url=Undefined, fix_misspell=Undefined, enable_nrfm_docs=Undefined, search_filters=Undefined)
Returns the new object with config fields overrode by passed values.
To learn more about parameters and their formats and possible values, refer to generative search documentation
NB: All of the site, host, url parameters are mutually exclusive and using one of them is mandatory.
|
Parameters |
|
|
Return type |
property uri: str
Web search
class yandex_cloud_ml_sdk._search_api.web.function.WebSearchFunction
Web search function for creating search object which provides methods for invoking web search.
__call__(search_type, *, family_mode=Undefined, fix_typo_mode=Undefined, localization=Undefined, sort_order=Undefined, sort_mode=Undefined, group_mode=Undefined, groups_on_page=Undefined, docs_in_group=Undefined, max_passages=Undefined, region=Undefined, user_agent=Undefined, metadata=Undefined)
Creates web search object which provides methods for web search.
To learn more about parameters and their formats and possible values, refer to web search documentation
|
Parameters |
|
|
Return type |
class yandex_cloud_ml_sdk._search_api.web.web.WebSearch
Web search class which provides concrete methods for working with Web Search API and incapsulates search setting.
property config: ConfigTypeT
configure(*, search_type=Undefined, family_mode=Undefined, fix_typo_mode=Undefined, localization=Undefined, sort_order=Undefined, sort_mode=Undefined, group_mode=Undefined, groups_on_page=Undefined, docs_in_group=Undefined, max_passages=Undefined, region=Undefined, user_agent=Undefined, metadata=Undefined)
Returns the new object with config fields overrode by passed values.
To learn more about parameters and their formats and possible values, refer to web search documentation
|
Parameters |
|
|
Return type |
property uri: str
run(query: str
run(query: str
Run a search query with given query and search settings of this web search object.
To change initial search settings use .configure method:
>>> search = sdk.search_api.web(search_type='BE')
>>> search = search.configure(search_type='RU')
|
Parameters |
|
|
Returns |
Parsed search results object or bytes string depending on format parameter. |
run_deferred(query: str
run_deferred(query: str
Run a deferred search query with given query and search settings of this web search object.
To change initial search settings use .configure method:
>>> search = sdk.search_api.web(search_type='BE')
>>> search = search.configure(search_type='RU')
|
Parameters |
|
|
Returns |
Operation with parsed search results object or bytes string return depending on format parameter. |
class yandex_cloud_ml_sdk._search_api.web.result.WebSearchResult
A class representing the partially parsed result of a Web search request with XML format.
next_page(*, timeout=None)
Run a web search request with previous search parameters except page number being increment by one.
|
Parameters |
timeout (float |
|
Return type |
next_page_deferred(*, timeout=None)
Launch a deferred web search request with previous search parameters except page number being increment by one.
|
Parameters |
timeout (float |
|
Return type |
count(value) → integer -- return number of occurrences of value
property docs: tuple
Returns all documents within search response.
index(value[, start[, stop]]) → integer -- return first index of value.
Raises ValueError if the value is not present.
Supporting start and stop arguments is optional, but recommended.
xml: bytes
Non-parsed XML result of search request.
groups: tuple
Parsed values of
page: int
Returned search page number.
Image search
class yandex_cloud_ml_sdk._search_api.image.function.ImageSearchFunction
Image search function for creating search object which provides methods for invoking image search.
__call__(search_type, *, family_mode=Undefined, fix_typo_mode=Undefined, format=Undefined, size=Undefined, orientation=Undefined, color=Undefined, site=Undefined, docs_on_page=Undefined, user_agent=Undefined)
Creates image search object which provides methods for image search.
To learn more about parameters and their formats and possible values, refer to image search documentation
|
Parameters |
|
|
Return type |
class yandex_cloud_ml_sdk._search_api.image.image.ImageSearch
Image search class which provides concrete methods for working with Image Search API and incapsulates search setting.
property config: ConfigTypeT
configure(*, search_type=Undefined, family_mode=Undefined, fix_typo_mode=Undefined, format=Undefined, size=Undefined, orientation=Undefined, color=Undefined, site=Undefined, docs_on_page=Undefined, user_agent=Undefined)
Returns the new object with config fields overrode by passed values.
To learn more about parameters and their formats and possible values, refer to image search documentation
|
Parameters |
|
|
Return type |
property uri: str
run(query: str
run(query: str
Run a search query with given query and search settings of this image search object.
To change initial search settings use .configure method:
>>> search = sdk.search_api.image(search_type='BE')
>>> search = search.configure(search_type='RU')
|
Parameters |
|
|
Returns |
Parsed search results object or bytes string depending on format parameter. |
class yandex_cloud_ml_sdk._search_api.image.result.ImageSearchResult
A class representing the partially parsed result of a Image search request with XML format.
next_page(*, timeout=None)
Run a image search request with previous search parameters except page number being increment by one.
|
Parameters |
timeout (float |
|
Return type |
count(value) → integer -- return number of occurrences of value
property docs: tuple
Returns all documents within search response.
index(value[, start[, stop]]) → integer -- return first index of value.
Raises ValueError if the value is not present.
Supporting start and stop arguments is optional, but recommended.
xml: bytes
Non-parsed XML result of search request.
groups: tuple
Parsed values of
page: int
Returned search page number.
Search by image
class yandex_cloud_ml_sdk._search_api.by_image.function.ByImageSearchFunction
ByImage search function for creating search object which provides methods for invoking by_image search.
__call__(*, family_mode=Undefined, site=Undefined)
Creates by_image search object which provides methods for search by image.
To learn more about parameters and their formats and possible values, refer to search by image documentation
|
Parameters |
|
|
Return type |
class yandex_cloud_ml_sdk._search_api.by_image.by_image.ByImageSearch
ByImage search class which provides concrete methods for working with ByImage Search API and incapsulates search setting.
run(image_data, *, page=0, timeout=60)
Run a search query with given image_data bytes and search settings of this by_image search object.
To change initial search settings use .configure method:
>>> search = sdk.search_api.by_image(site="ya.ru")
>>> search = search.configure(site="yandex.ru")
|
Parameters |
|
|
Returns |
Parsed search results object. |
|
Return type |
run_from_url(url, *, page=0, timeout=60)
Run a search query with given image located at url and search settings of this by_image search object.
To change initial search settings use .configure method:
>>> search = sdk.search_api.by_image(site="ya.ru")
>>> search = search.configure(site="yandex.ru")
|
Parameters |
|
|
Returns |
Parsed search results object. |
|
Return type |
run_from_id(cbir_id, *, page=0, timeout=60)
Run a search query with given CBIR ID of the image and search settings of this by_image search object.
To change initial search settings use .configure method:
>>> search = sdk.search_api.by_image(site="ya.ru")
>>> search = search.configure(site="yandex.ru")
|
Parameters |
|
|
Returns |
Parsed search results object. |
|
Return type |
property config: ConfigTypeT
configure(*, family_mode=Undefined, site=Undefined)
Returns the new object with config fields overrode by passed values.
To learn more about parameters and their formats and possible values, refer to search by image documentation
|
Parameters |
|
|
Return type |
property uri: str
class yandex_cloud_ml_sdk._search_api.by_image.result.ByImageSearchResult
A class representing the result of a search by image request.
next_page(*, timeout=None)
Run a search by image request with previous search parameters except page number being increment by one.
|
Parameters |
timeout (float |
|
Return type |
count(value) → integer -- return number of occurrences of value
property docs: tuple
Synonym for .images attribute
index(value[, start[, stop]]) → integer -- return first index of value.
Raises ValueError if the value is not present.
Supporting start and stop arguments is optional, but recommended.
images: tuple
cbir_id: str
page: int
Returned search page number.