Skip to main content

Yandex AI Studio SDK

This Python library provides a simple and efficient software development kit (SDK) for interacting with Yandex Cloud AI Studio services. The SDK abstracts away the complexities of raw gRPC and REST calls, making it easier for developers to integrate cloud functionality into their applications seamlessly.

Features

Yandex AI Studio SDK offers a comprehensive set of high‑level abstractions that map directly to the capabilities exposed by Yandex Cloud. The current feature set includes:

  • SpeechKit
  • Completions
    • Text generation (completion) models with streaming support.
    • Chat usage tracking, tool calls (function calling for example).
  • Chat
    • OpenAI‑compatible chat API (sdk.chat) designed to work seamlessly with the rest of the Yandex AI Studio SDK.
    • Send and receive messages, stream responses, and work with tool calls in a unified way.
    • OpenAI‑compatible text embeddings endpoint (sdk.chat.text_embeddings).
  • Files
    • Upload, download, list and delete files stored in Yandex Cloud AI Studio.
  • Image generation
    • Generate images via YandexART models.
  • Vision OCR
    • Recognize text in images and PDFs (JPEG, PNG, PDF).
  • Text embeddings
    • Compute dense vector embeddings for arbitrary text.
  • Text classifiers
    • Run multi‑class, multi‑label and binary classifiers.
  • Yandex Search API
    • Generative, web, image and by image search.
    • Wordstat keyword statistics: query volume trends, top queries, regional and device distribution.
  • Search indexes
    • Create, update, delete and query text, vector and hybrid search indexes.

Note: The Assistants, Threads, Runs, and Messages domains have been removed from the SDK. If you were using these features, please refer to the migration guide to Responses API.

Also there is some cross-domain functionality for features above:

  • Batch processing
    • Run long‑running batch tasks with automatic polling.
  • Tools
    • Function Tool for extending models with custom callable functions in Completions and Chat.
  • Tuning
    • Fine‑tune models with configurable optimizers, schedulers and other hyper‑parameters.
  • Datasets
    • Manage dataset lifecycle, upload data, validate schemas, and perform task‑type specific operations.

Additionally, Yandex AI Studio SDK offers:

  • Authentication
    • Automatic selection of authentication method (API key, IAM token, OAuth token, CLI, metadata service, etc.).
  • Error handling & retries
    • Rich exception hierarchy, retry policies, and configurable gRPC interceptors.
  • Async & sync support
    • Every high‑level service is available in both asynchronous and synchronous variants.
  • LangChain integration
    • Ready‑to‑use wrappers for LangChain (.langchain()) with an optional extra installation.

Installation

You can install the library via pip:

pip install yandex-ai-studio-sdk

SDK Reference

https://aistudio.yandex.ru/docs/ai-studio/sdk-ref/

Usage

Here's a basic example of how to use the SDK:

from yandex_ai_studio_sdk import AIStudio

sdk = AIStudio(folder_id="...", auth="<APIKey/IAMToken/SomethingElse>")

model = sdk.models.completions('yandexgpt')
model = model.configure(temperature=0.5)
result = model.run("foo")

for alternative in result:
    print(alternative)

For more usage examples look into examples folder.

LangChain integration

To use LangChain integration, install yandex-ai-studio-sdk package with a langchain extra:

pip install yandex-ai-studio-sdk[langchain]

Usage example:

from yandex_ai_studio_sdk import AIStudio
from langchain_core.messages import AIMessage, HumanMessage

sdk = AIStudio(folder_id="...", auth="<APIKey/IAMToken/SomethingElse>")

model = sdk.models.completions('yandexgpt').langchain()

langchain_result = model.invoke([
    HumanMessage(content="hello!"),
    AIMessage(content="Hi there human!"),
    HumanMessage(content="Meow!"),
])

For more LangChain integration examples look into examples/langchain folder.

CLI

The SDK ships a command-line tool for building vector search indexes from local files, S3-compatible storage, MediaWiki pages, and Confluence:

# Install base CLI (local files + Confluence)
pip install yandex-ai-studio-sdk

# With S3 / Yandex Object Storage support
pip install "yandex-ai-studio-sdk[cli-s3]"

# With Wikipedia / MediaWiki support
pip install "yandex-ai-studio-sdk[cli-wiki]"

yandex-ai-studio vector-stores local docs/*.pdf --name "My index"

See the full CLI reference in src/yandex_ai_studio_sdk/cli/search_index/README.md.

Metadata

Release files for yandex-ai-studio-sdk 0.22.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for yandex-ai-studio-sdk 0.22.1
File Size Uploaded
yandex_ai_studio_sdk-0.22.1.tar.gz 212.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for yandex-ai-studio-sdk 0.22.1
File Interpreter ABI Platform
yandex_ai_studio_sdk-0.22.1-py3-none-any.whl Python 3 none any Details

Total release size: 524.7 kB

Release files / yandex_ai_studio_sdk-0.22.1.tar.gz

Download URL yandex_ai_studio_sdk-0.22.1.tar.gz
Size 212.3 kB
Tags Source
SHA-256 checksum
How to use checksums
af3b8e6b3e41d6755292588834e2bcbe09176b931c58ef083a8358017c331abc
BLAKE2b-256 checksum
How to use checksums
387bcd9ca9ef10957a103bb5e6a6a6066c5f69787e4c84982b6ded8a9668791d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.32.3

Release files / yandex_ai_studio_sdk-0.22.1-py3-none-any.whl

Download URL yandex_ai_studio_sdk-0.22.1-py3-none-any.whl
Size 312.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bb787e3ae311f4ee7966f032071570aec55180451c6d04420be05565ac148f8c
BLAKE2b-256 checksum
How to use checksums
b1961075eb9c4510e6a677ef76adfc788877ef7a6e595a505c2779c785ab8f97
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.32.3

Release history Release notifications | RSS feed

This release

0.22.1 This release

2 release files

0.22.0

2 release files

0.21.0

2 release files

0.20.0

2 release files

0.19.1

2 release files

0.19.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page