Skip to content
This repository was archived by the owner on Apr 12, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .github/workflows/code-linting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Code linting

on:
pull_request:
branches: [master]

jobs:
black:
runs-on: ubuntu-latest
steps:
- name: Check Out Repository
uses: actions/checkout@v4

- name: Run black
uses: psf/black@stable
with:
options: "--check --diff --config pyproject.toml"

isort:
runs-on: ubuntu-latest
steps:
- name: Check Out Repository
uses: actions/checkout@v4

- name: Run isort
uses: isort/isort-action@master

mypy:
runs-on: ubuntu-latest
permissions:
pull-requests: write
contents: read
steps:
- name: Check Out Repository
uses: actions/checkout@v4

- name: Set up python
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install Poetry
uses: snok/install-poetry@v1

- name: Install dependencies
run: poetry install --no-interaction --no-root --all-extras

- name: Check
run: poetry run mypy . --config-file pyproject.toml
30 changes: 30 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Release
on:
release:
types:
- published

jobs:
publish:
strategy:
fail-fast: false
matrix:
python-version: [3.12]
poetry-version: [1.8.2]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Run image
uses: abatilo/actions-poetry@v2.0.0
with:
poetry-version: ${{ matrix.poetry-version }}
- name: Publish
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
run: |
poetry config pypi-token.pypi $PYPI_TOKEN
poetry publish --build
26 changes: 17 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

## About SuvvyAPI 📘

SuvvyAPI is an asynchronous Python API wrapper built on top of `httpx` and `pydantic` for the Suvvy AI API, offering an easy and Pythonic way to interact with the Suvvy AI services.
SuvvyAPI is an asynchronous Python API wrapper built on top of `httpx` for the Suvvy AI API, offering an easy and Pythonic way to interact with the Suvvy AI services.

## Installation 🛠️

Expand All @@ -25,18 +25,26 @@ pip install -U suvvyapi

## Usage 🚀

### Synchronous Usage
### Asynchronous Usage

You can use SuvvyAPI synchronously as follows:
You can use SuvvyAPI asynchronously as follows:

```python
from suvvyapi import Suvvy, Message
import asyncio
from suvvyapi import AsyncSuvvy


async def main():
async with AsyncSuvvy(
token="<your token>",
) as suvvy:
await suvvy.send_message(chat_id="somechat1", text="Привет!", source="Иван")


asyncio.run(main())

suvvy = Suvvy("YOUR_TOKEN")
history = suvvy.as_history("random_id")
response = history.predict_add_message(Message(text="Say hello to Python!"))
```
*Note: Replace "YOUR_TOKEN" with your actual token from [Suvvy AI](https://home.suvvy.ai/).*
*Note: Replace "your token" with your actual token from [Suvvy AI](https://app.suvvy.ai/).*

### [More in documentation](https://github.com/suvvyai/suvvyapi/wiki)

Expand All @@ -50,4 +58,4 @@ Contributions are welcome. Please fork the repository, make your changes, and su

## License 📄

SuvvyAPI is released under the [MIT License](https://github.com/suvvyai/suvvyapi/blob/main/LICENSE).
SuvvyAPI is released under the [MIT License](https://github.com/suvvyai/suvvyapi/blob/main/LICENSE).
Loading