Skip to main content

This Python library provides a simple wrapper for interacting with Yandex Language Models, making it easy to send requests for text generation.

Project description

YaGPT API

License


This Python library provides a simple wrapper for interacting with Yandex Language Models, making it easy to send requests for text generation.

Features

Simplified Interaction: Easily send requests to Yandex Language Models with just a few lines of code.

Error Handling: Robust error handling for HTTP requests and unexpected errors.

Example Usage: Included example for quick integration into your projects.

Source Code: GitHub

Installation

pip install YaGPT

Usage

from YaGPT import YaGPT, YaGPTException

# Replace with your actual values
folder_id = "your_folder_id"
iam_token = "your_iam_token"

# Create a LanguageModel instance
lm = YaGPT(folder_id, iam_token)

try:
    # Send a request to the language model
    result = lm.instruct(
            model="general",
            instruction_text="Найди ошибки в тексте и исправь их",
            request_text="Ламинат подойдет для укладке на кухне или в детской комнате",
            max_tokens=1500,
            temperature=0.6)

    if result:
        for alternative in result:
            print(f"Generated Text: {alternative['text']}")
            print(f"Score: {alternative['score']}")
            print(f"Number of Tokens: {alternative['num_tokens']}")
            print()
except YaGPTException as e:
    print(f"Language Model Error: {e}")

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

YaGPT-0.1.0.tar.gz (4.1 kB view details)

Uploaded Source

File details

Details for the file YaGPT-0.1.0.tar.gz.

File metadata

  • Download URL: YaGPT-0.1.0.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.13

File hashes

Hashes for YaGPT-0.1.0.tar.gz
Algorithm Hash digest
SHA256 73abd58eb497cdf64457b063969d6e8fa1361c75d328579553a5a95ccb1cc329
MD5 cbe0d19c2a6bc473d9463801eb5f8229
BLAKE2b-256 5cf4104b003a18659d361998d2593594f3c61b979b2218a3f837f3082bc68ee9

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