Tools

Search index tool

class yandex_ai_studio_sdk._tools.search_index.tool.SearchIndexTool

Tool for working with search indexes.

A SearchIndexTool represents an executable tool that provides instructions on how to apply and interact with search indexes, as opposed to a SearchIndex which represents the data/resource itself — actual search index data and provides methods for managing the index (adding files, updating metadata, etc.). A SearchIndexTool encapsulates the configuration and behavior for performing search operations across one or more search indexes.

search_index_ids: tuple[str]... ,

Tuple of search index IDs to use with this tool

max_num_results: int | None = None

Maximum number of results to return from search, optional

rephraser: Rephraser | None = None

Rephraser instance for query rephrasing, optional

call_strategy: CallStrategy | None = None

Strategy for calling the search index, optional

class yandex_ai_studio_sdk._tools.search_index.rephraser.function.RephraserFunction

Function for creating Rephraser object, which incapsulating rephrasing settings.

__call__(model_name, *, model_version='latest')

Creates a Rephraser object, which incapsulating rephrasing settings.

Parameters

  • model_name (str | Literal[True] | ~yandex_ai_studio_sdk._tools.search_index.rephraser.model.Rephraser) – Model ID used for model uri definition in a resulting Rephraser object. It is handled differently depending on the type and format of the input value:

  • If model_name includes :// substring, it would be used unchanged.

  • Otherwise if model_name is a string, it would be used in gpt://<folder_id>/<model_name>/<model_version> template.

  • If model_name is a True, it would be transformed into default value gpt://<folder_id>/rephraser/<model_version>

  • If model_name is a Rephraser object, it would returned unchanged.

  • model_version (str) – <model_version> value for model uri template, refer to model_name parameter documentation for details.

Returns

Rephraser object, which incapsulating rephrasing settings

Return type

Rephraser

class yandex_ai_studio_sdk._tools.search_index.rephraser.model.Rephraser

Class for incapsulating rephraser settings.

Used to rewrite the last user message for search, incorporating context from the previous conversation.

For usage search index tool with and without rephraser example see (sync SDK/async SDK).

property config: ConfigTypeT

configure(**kwargs)

Return type

Self

property fine_tuned: bool | None

property name: str | None

property owner: str | None

property uri: str

property version: str | None

class yandex_ai_studio_sdk._tools.search_index.call_strategy.CallStrategy

Represents call strategy for search index tools.

The call strategy determines when a tool should be called: - ‘always’: call the tool on every request - function dict: call based on function instruction

property value: Literal['always'] | FunctionDictType

Get the current call strategy value.

Function tool

class yandex_ai_studio_sdk._tools.tool.FunctionTool

A function tool that can be called by AI models.

This class represents a callable function that can be used by AI models for function calling capabilities. It encapsulates the function’s metadata including its name, description, parameter schema, and validation settings.

The function tool can be used with both completions and assistants APIs, providing a unified interface for defining external functions that models can invoke during conversations or completion requests.

name: str

Name of the function

description: str | None

Optional function description

parameters: JsonSchemaType

Function parameters schema

strict: bool | None

Whether to enforce strict parameter validation

Generative search tool

class yandex_ai_studio_sdk._tools.generative_search.GenerativeSearchTool

A generative search tool that can be called by LLMs/Assistants models.

To learn more about generative search itself, refer to generative search documentation

Objects of this class could be used in any place which requires BaseTool instance, but not every place/feature supports all of the tool types.

description: str = ''

Description of tool instance which also instructs model when to call it.

enable_nrfm_docs: bool | None = None

tells to backend to include or not to include pages, which are not available via direct clicks from given sites/hosts/urls to search result.

fix_misspell: bool | None = None

tells to backend to fix or not to fix misspels in queries.

host: tuple[str, ...] | None = None

Parameter for limiting search to specific location or list of hosts.

search_filters: tuple[FilterType, ...] | None = None

allows to limit search results with additional filters.

site: tuple[str, ...] | None = None

Parameter for limiting search to specific location or list of sites.

url: tuple[str, ...] | None = None

Parameter for limiting search to specific location or list of urls.

Предыдущая
Следующая