Yandex Cloud ML SDK
Yandex Cloud AI Studio provides Yandex Cloud ML SDK, a library of tools and code examples for Python development. ML SDK provides a standardized method of working with foundation models and simplifies integration with other Yandex Cloud services.
The ML SDK library implements the synchronous and asynchronous Python interfaces based on gRPC API calls of AI Studio services. ML SDK offers the following features:
- Text generation by YandexGPT
- Working with embeddings
- Working with YandexGPT based classifiers
- Creating AI assistants
- Image generation by YandexART
- Integration with LangChain
You can see the full list of supported functions, library source code, and use cases on GitHub
Installation and usage
You can install the ML SDK library using the pip
pip install yandex-cloud-ml-sdk
When initializing the library, you need to specify the ID of the folder you will use to work with models as well as authentication credentials. ML SDK supports the following authentication methods:
The example below will prompt YandexGPT Pro with "What is sky?".
from yandex_cloud_ml_sdk import YCloudML
sdk = YCloudML(folder_id="<folder_ID>", auth="<token>")
model = sdk.models.completions('yandexgpt')
model = model.configure(temperature=0.5)
result = model.run("What is sky?")
for alternative in result:
print(alternative)