Skip to main content

Module for simple connecting to YandexGPT Api

Project description

(Module for simple connecting to YandexGPT Api)

Example to use:

from yandex_gpt import YandexGPT, Messages, SystemMessage, UserMessage

yandex_gpt_client = YandexGPT(
    OAUTH_TOKEN,
    FOLDER_ID
)

chat = Messages(
    SystemMessage('Ты в диалоге с пользователем. Отвечай на все его запросы'),
    UserMessage('Привет! Посоветуй фильм на вечер')
)

response = yandex_gpt_client.completion(chat)
print(response.alternatives[0].message)

It is possible to replace the model like this

from yandex_gpt import YandexGPT, YandexGPTModels

yandex_gpt_client = YandexGPT(
    OAUTH_TOKEN,
    FOLDER_ID,
    gpt_model=YandexGPTModels.YANDEX_GPT_LITE
)

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_gpt-0.2.0.tar.gz (3.8 kB view hashes)

Uploaded Source

Built Distribution

yandex_gpt-0.2.0-py3-none-any.whl (5.6 kB view hashes)

Uploaded Python 3

Supported by

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