sdk/README.md
mrmamongo 42b9f0e580 docs: add README and lock files
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-04-20 12:11:40 +03:00

66 lines
1.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# ErGPT SDK
Python SDK для работы с ErGPT API.
## Установка
```bash
pip install ergpt-kb
```
## Быстрый старт
### Синхронный клиент
```python
from ergpt.kb import KnowledgeBaseClient
client = KnowledgeBaseClient(api_token="your_token")
# Создать базу знаний
kb = client.create_knowledge_base(
name="Моя база",
description="Описание",
chunk_size=1000,
chunk_overlap=200,
)
# Загрузить документ
with open("doc.pdf", "rb") as f:
doc = client.upload_document(kb.id, f)
# Поиск
results = client.search(kb.id, "мой запрос", limit=5)
for r in results.chunks:
print(r.filename, r.chunks[0].score)
```
### Асинхронный клиент
```python
import asyncio
from ergpt.kb import AsyncKnowledgeBaseClient
async def main():
async with AsyncKnowledgeBaseClient(api_token="your_token") as client:
kb = await client.create_knowledge_base(...)
results = await client.search(kb.id, "запрос")
asyncio.run(main())
```
## Документация
См. [KB_API_Guide.md](KB_API_Guide.md) — подробное руководство по Knowledge Base API.
## Структура пакета
- `ergpt.kb` — Knowledge Base API (базы знаний, документы, поиск)
В будущем:
- `ergpt.chat` — Chat API
- `ergpt.users` — Users API
## Лицензия
MIT