YandexGPTEmbeddings#
- class langchain_community.embeddings.yandex.YandexGPTEmbeddings[source]#
Bases:
BaseModel
,Embeddings
YandexGPT Embeddings models.
To use, you should have the
yandexcloud
python package installed.There are two authentication options for the service account with the
ai.languageModels.user
role:You can specify the token in a constructor parameter iam_token
or in an environment variable YC_IAM_TOKEN. - You can specify the key in a constructor parameter api_key or in an environment variable YC_API_KEY.
To use the default model specify the folder ID in a parameter folder_id or in an environment variable YC_FOLDER_ID.
Example
from langchain_community.embeddings.yandex import YandexGPTEmbeddings embeddings = YandexGPTEmbeddings(iam_token="t1.9eu...", folder_id=<folder-id>)
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
- param api_key: SecretStr = ''#
Yandex Cloud Api Key for service account with the ai.languageModels.user role
- Constraints:
type = string
writeOnly = True
format = password
- param disable_request_logging: bool = False#
YandexGPT API logs all request data by default. If you provide personal data, confidential information, disable logging.
- param doc_model_name: str = 'text-search-doc'#
Doc model name to use.
- param doc_model_uri: str = ''#
Doc model uri to use.
- param folder_id: str = ''#
Yandex Cloud folder ID
- param grpc_metadata: Sequence [Required]#
- param iam_token: SecretStr = ''#
Yandex Cloud IAM token for service account with the ai.languageModels.user role
- Constraints:
type = string
writeOnly = True
format = password
- param max_retries: int = 6#
Maximum number of retries to make when generating.
- param model_name: str = 'text-search-query' (alias 'query_model_name')#
Query model name to use.
- param model_uri: str = '' (alias 'query_model_uri')#
Query model uri to use.
- param model_version: str = 'latest'#
Model version to use.
- param sleep_interval: float = 0.0#
Delay between API requests
- param url: str = 'llm.api.cloud.yandex.net:443'#
The url of the API.
- async aembed_documents(texts: List[str]) List[List[float]] #
Asynchronous Embed search docs.
- Parameters:
texts (List[str]) – List of text to embed.
- Returns:
List of embeddings.
- Return type:
List[List[float]]
- async aembed_query(text: str) List[float] #
Asynchronous Embed query text.
- Parameters:
text (str) – Text to embed.
- Returns:
Embedding.
- Return type:
List[float]
Examples using YandexGPTEmbeddings