Skip to main content

Multimodal SDK for working with Yandex AI Studio services

Project description

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:

  • 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.
  • Files
    • Upload, download, list and delete files stored in Yandex Cloud AI Studio.
  • Image generation
    • Generate images via YandexART models.
  • 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.
  • Search indexes
    • Create, update, delete and query text, vector and hybrid search indexes.
  • DEPRECATED Assistants
    • Create, list, update and delete AI assistants.
  • DEPRECATED Threads
    • Organize conversations into threads, retrieve messages, and post new messages.
    • Create and track execution of assistant runs, retrieve logs and results.

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

  • Batch processing
    • Run long‑running batch tasks with automatic polling.
  • Tools
    • Built‑in tools such as Generative Search Tool, Function Tool and Search Index Tool that can be used in Assistants, Completions, and Chat, providing a unified way to extend functionality across the SDK.
  • 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

yandex_ai_studio_sdk-0.20.0.tar.gz (215.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

yandex_ai_studio_sdk-0.20.0-py3-none-any.whl (331.6 kB view details)

Uploaded Python 3

File details

Details for the file yandex_ai_studio_sdk-0.20.0.tar.gz.

File metadata

  • Download URL: yandex_ai_studio_sdk-0.20.0.tar.gz
  • Upload date:
  • Size: 215.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.32.3

File hashes

Hashes for yandex_ai_studio_sdk-0.20.0.tar.gz
Algorithm Hash digest
SHA256 082f0d161764c10c351414dd7c377fd6f706a7bd9468a6395c2f336834d441a3
MD5 21b0e34c762788ee65fd300d87b71cf1
BLAKE2b-256 e0154c6307cc04ac07353d14ba0309e0536426b2aa49ca8929f9b8f62497af7a

See more details on using hashes here.

File details

Details for the file yandex_ai_studio_sdk-0.20.0-py3-none-any.whl.

File metadata

File hashes

Hashes for yandex_ai_studio_sdk-0.20.0-py3-none-any.whl
Algorithm Hash digest
SHA256 400e373a25940aa68307e5180853e1fb657588f06d23442120e264bd02388c32
MD5 db1066ee217a941ac2c23b49e9073903
BLAKE2b-256 41d2f830a6a2a403da291efdc2c4bf89da0603760f19064f9e20b80d3c701362

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page