{"id":26410874,"url":"https://github.com/allseeteam/yandexgpt-python","last_synced_at":"2025-03-17T20:19:45.925Z","repository":{"id":232940022,"uuid":"785229267","full_name":"allseeteam/yandexgpt-python","owner":"allseeteam","description":"Python SDK for YaGPT API","archived":false,"fork":false,"pushed_at":"2024-04-15T07:18:26.000Z","size":36,"stargazers_count":10,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2024-06-22T15:07:24.786Z","etag":null,"topics":["python","sdk-python","yandexgpt","yandexgpt-2-wrapper"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/allseeteam.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2024-04-11T13:14:31.000Z","updated_at":"2024-06-11T15:14:07.000Z","dependencies_parsed_at":"2024-04-13T21:36:10.867Z","dependency_job_id":"e95d9d25-e53b-4dbe-9583-e4a2191919a9","html_url":"https://github.com/allseeteam/yandexgpt-python","commit_stats":null,"previous_names":["allseeteam/yandexgpt-python"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allseeteam%2Fyandexgpt-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allseeteam%2Fyandexgpt-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allseeteam%2Fyandexgpt-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allseeteam%2Fyandexgpt-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/allseeteam","download_url":"https://codeload.github.com/allseeteam/yandexgpt-python/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244102810,"owners_count":20398386,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["python","sdk-python","yandexgpt","yandexgpt-2-wrapper"],"created_at":"2025-03-17T20:19:45.376Z","updated_at":"2025-03-17T20:19:45.920Z","avatar_url":"https://github.com/allseeteam.png","language":"Python","readme":"# YandexGPT Python SDK\n\n## Introduction\nThe YandexGPT Python SDK provides an easy-to-use interface for interacting with the Yandex GPT API. It includes asynchronous methods for sending requests to the Yandex GPT API, handling authentication, and processing responses. This SDK is designed to simplify the integration of Yandex GPT functionalities into Python applications.\n\n## Table of Contents\n- [Introduction](#Introduction)\n- [Features](#Features)\n- [Documentation](#Documentation)\n- [Installation using pip](#Installation-using-pip)\n- [Local installation using pip](#Local-installation-using-pip)\n- [Usage](#Usage)\n- [Configuration](#Configuration)\n- [Examples](#Examples)\n- [Troubleshooting](#Troubleshooting)\n- [Contributors](#Contributors)\n- [License](#License)\n\n## Features\n- Asynchronous API calls to Yandex GPT.\n- Easy configuration of API credentials and model parameters.\n- Supports multiple GPT models.\n- Includes utility for managing API request headers and payload.\n\nThe SDK depends on several Python libraries for its operation. These dependencies are specified in the [requirements.txt](requirements.txt) file.\n\n\n## Documentation\nFor more detailed information, including installation guides, usage examples, and API references, please visit the [YandexGPT Python SDK Documentation](https://yandexgpt-python.readthedocs.io/en/latest/).\n\n## Installation using pip\nTo install the YandexGPT Python SDK as a package using pip, run the following command:\n```shell\npip install yandexgpt-python\n```\n\n## Local installation using pip\nIf you want to install the SDK locally (for example, if you want to modify SDK code), you can do so by cloning the repository and running the setup script:\n```shell\ngit clone https://github.com/allseeteam/yandexgpt-python.git\ncd yandexgpt-python\npip install -e .\n```\n\n## Usage\nThe YandexGPT SDK is designed for asynchronous operation. To use it, instantiate the [YandexGPT](yandex_gpt/yandex_gpt.py) class with a configuration manager that includes your Yandex Cloud catalog ID, API key/IAM token, and the desired GPT model type. Currently, the supported model types are:\n- yandexgpt\n- yandexgpt-lite\n- summarization\n\n## Configuration\nConfiguration for the YandexGPT SDK involves setting up the model type, catalog ID, and API key/IAM token. This can be done through the [YandexGPTConfigManagerBase](yandex_gpt/config_manager.py) class or [its subclasses](yandex_gpt/config_manager.py), which allows for easy management of these settings either directly or via environment variables (see examples in [env](env) directory).\n\n## Examples\n### Using API key for authentication\n```python\nfrom yandex_gpt import YandexGPT, YandexGPTConfigManagerForAPIKey\n\n# Setup configuration (input fields may be empty if they are set in environment variables)\nconfig = YandexGPTConfigManagerForAPIKey(model_type=\"yandexgpt\", catalog_id=\"your_catalog_id\", api_key=\"your_api_key\")\n\n# Instantiate YandexGPT\nyandex_gpt = YandexGPT(config_manager=config)\n\n# Async function to get completion\nasync def get_completion():\n    messages = [{\"role\": \"user\", \"text\": \"Hello, world!\"}]\n    completion = await yandex_gpt.get_async_completion(messages=messages)\n    print(completion)\n\n# Run the async function\nimport asyncio\nasyncio.run(get_completion())\n```\n\n### Using IAM token for authentication\n```python\nfrom dotenv import load_dotenv\nfrom yandex_gpt import YandexGPT, YandexGPTConfigManagerForAPIKey\n\n# Load environment variables\nload_dotenv('../env/.env.iam_token_generation')\n\n# Setup configuration (input fields are empty, because iam_token will be generated from environment variables)\nconfig = YandexGPTConfigManagerForIAMToken()\n\n# Instantiate YandexGPT\nyandex_gpt = YandexGPT(config_manager=config)\n\n# Async function to get completion\nasync def get_completion():\n    messages = [{\"role\": \"user\", \"text\": \"Hello, world!\"}]\n    completion = await yandex_gpt.get_async_completion(messages=messages)\n    print(completion)\n\n# Run the async function\nimport asyncio\nasyncio.run(get_completion())\n```\n\n\n## Troubleshooting\nFor any issues related to the configuration or usage of the SDK, ensure that the catalog ID, API key, and model type are correctly set and that the environment variables (if used) are properly configured.\n\n## Contributors\nThis project is developed and maintained by ALL SEE LLC. Contributions are welcome.\n\n## License\nThis project is licensed under the MIT License. For more information, see the LICENSE file in the project's GitHub repository.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fallseeteam%2Fyandexgpt-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fallseeteam%2Fyandexgpt-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fallseeteam%2Fyandexgpt-python/lists"}