YaGPT API
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}")
Release files for YaGPT 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| YaGPT-0.1.0.tar.gz | 4.1 kB | Details |
Release files / YaGPT-0.1.0.tar.gz
| Download URL | YaGPT-0.1.0.tar.gz |
|---|---|
| Size | 4.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
73abd58eb497cdf64457b063969d6e8fa1361c75d328579553a5a95ccb1cc329
|
|
BLAKE2b-256 checksum How to use checksums |
5cf4104b003a18659d361998d2593594f3c61b979b2218a3f837f3082bc68ee9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.13
|