Metadata-Version: 2.1
Name: llmkira
Version: 1.0.4
Summary: A chain message bot based on OpenAI
Keywords: llmbot,llmkira,openai,chatgpt,llm
Home-page: https://llmkira.github.io/Docs/
Author-Email: sudoskys <me@dianas.cyou>, llmkira <me@dianas.cyou>
License: Apache-2.0
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Project-URL: Homepage, https://llmkira.github.io/Docs/
Project-URL: Repository, https://github.com/LlmKira/Openaibot
Requires-Python: <3.12,>=3.9
Requires-Dist: pathlib>=1.0.1
Requires-Dist: pydantic>=2.0.0
Requires-Dist: loguru>=0.5.3
Requires-Dist: httpx>=0.24.1
Requires-Dist: socksio<2.0.0,>=1.0.0
Requires-Dist: python-dotenv<2.0.0,>=1.0.0
Requires-Dist: redis>=4.5.4
Requires-Dist: aio-pika<10.0.0,>=9.3.0
Requires-Dist: arclet-alconna<2.0.0,>=1.7.26
Requires-Dist: shortuuid<2.0.0,>=1.0.11
Requires-Dist: tiktoken<1.0.0,>=0.5.1
Requires-Dist: contextvars<3.0,>=2.4
Requires-Dist: pytz<2024.0.0,>=2023.3.post1
Requires-Dist: numpy<2.0.0,>=1.24.0
Requires-Dist: fasttext-wheel<1.0.0,>=0.9.2
Requires-Dist: tenacity<9.0.0,>=8.2.3
Requires-Dist: pysocks<2.0.0,>=1.7.1
Requires-Dist: flask-sqlalchemy<4.0.0,>=3.1.1
Requires-Dist: emoji<3.0.0,>=2.8.0
Requires-Dist: websocket<1.0.0,>=0.2.1
Requires-Dist: wrapt<2.0.0,>=1.11.0
Requires-Dist: dynaconf<4.0.0,>=3.2.3
Requires-Dist: rich<14.0.0,>=13.6.0
Requires-Dist: importlib-metadata<7.0.0,>=6.8.0
Requires-Dist: sentry-sdk<2.0.0,>=1.34.0
Requires-Dist: boltons<24.0.0,>=23.1.1
Requires-Dist: orjson<4.0.0,>=3.9.10
Requires-Dist: pydantic-settings<3.0.0,>=2.0.3
Requires-Dist: docstring-parser<1.0,>=0.15
Requires-Dist: polling<1.0.0,>=0.3.2
Requires-Dist: elara<1.0.0,>=0.5.5
Requires-Dist: tzlocal<6.0,>=5.2
Requires-Dist: nltk<4.0.0,>=3.8.1
Requires-Dist: jieba<1.0.0,>=0.42.1
Requires-Dist: scikit-learn<2.0.0,>=1.3.2
Requires-Dist: cjieba<1.0.0,>=0.4.4
Requires-Dist: requests[socks]<3.0.0,>=2.31.0
Requires-Dist: feedparser<7.0.0,>=6.0.10
Requires-Dist: pillow<11.0.0,>=10.1.0
Requires-Dist: inscriptis<3.0.0,>=2.3.2
Requires-Dist: aiohttp<4.0.0,>=3.8.6
Requires-Dist: pytelegrambotapi<5.0.0,>=4.14.0
Requires-Dist: ffmpeg-python<1.0.0,>=0.2.0
Requires-Dist: duckduckgo-search>=5.3.0
Requires-Dist: flask<4.0.0,>=3.0.0
Requires-Dist: telegramify-markdown>=0.1.2
Requires-Dist: json-repair>=0.13.0
Requires-Dist: curl-cffi>=0.6.2
Requires-Dist: deprecated>=1.2.14
Requires-Dist: aiofile>=3.8.8
Requires-Dist: file-read-backwards>=3.0.0
Requires-Dist: apscheduler>=3.10.4
Requires-Dist: montydb[lmdb]>=2.5.2
Requires-Dist: pymongo>=4.6.3
Requires-Dist: fast-langdetect>=0.1.0
Requires-Dist: lmdb>=1.4.1
Requires-Dist: e2b>=0.14.14
Requires-Dist: e2b-code-interpreter>=0.0.3
Requires-Dist: gTTS>=2.5.1
Requires-Dist: hikari==2.0.0.dev121; extra == "bot"
Requires-Dist: hikari-crescent<1.0.0,>=0.6.4; extra == "bot"
Requires-Dist: khl-py<1.0.0,>=0.3.17; extra == "bot"
Requires-Dist: slack-bolt<2.0.0,>=1.18.0; extra == "bot"
Requires-Dist: hikari==2.0.0.dev121; extra == "testing"
Requires-Dist: hikari-crescent<1.0.0,>=0.6.4; extra == "testing"
Requires-Dist: khl-py<1.0.0,>=0.3.17; extra == "testing"
Requires-Dist: slack-bolt<2.0.0,>=1.18.0; extra == "testing"
Requires-Dist: pre-commit<3.5.0,>=2.15.0; extra == "testing"
Provides-Extra: bot
Provides-Extra: testing
Description-Content-Type: text/markdown

![cover](https://raw.githubusercontent.com/LlmKira/.github/main/llmbot/project_cover.png)

------------------

<p align="center">
<a href="https://hub.docker.com/repository/docker/sudoskys/llmbot/general">
    <img src="https://img.shields.io/docker/pulls/sudoskys/llmbot" alt="docker">
</a>
<a href="https://badge.fury.io/py/llmkira">
    <img src="https://badge.fury.io/py/llmkira.svg" alt="docker workflow">
</a>
<br />
<a href="https://t.me/Openai_LLM">
    <img src="https://img.shields.io/badge/Join-Telegram-blue" alt="telegram">
</a>
<a href="https://discord.gg/6QHNdwhdE5">
    <img src="https://img.shields.io/badge/Join-Discord-blue" alt="discord">
</a>
<br/>
<a href="https://raw.githubusercontent.com/llmkira/openaibot/main/LICENSE">
    <img src="https://img.shields.io/github/license/llmkira/openaibot" alt="license">
</a>
<a href="https://hub.docker.com/repository/docker/sudoskys/llmbot/builds">
    <img src="https://img.shields.io/docker/v/sudoskys/llmbot" alt="docker build">
</a>
</p>

<p align="center">
  <a href="https://llmkira.github.io/Docs/">🍩 Deploy Docs</a>
  &
  <a href="https://llmkira.github.io/Docs/dev/basic">🧀 Dev Docs</a>
  &
  <a href=".github/CONTRIBUTING.md">🤝 Contribute</a>
</p>

> Don't hesitate to Star ⭐️, Issue 📝, and PR 🛠️

> Python>=3.9

This project uses the ToolCall feature.

It integrates a message queuing and snapshot system, offering plugin mechanisms and authentication prior to plugin
execution.

The bot adheres to the **Openai Format Schema**. Please adapt using [gateway](https://github.com/Portkey-AI/gateway)
or [one-api](https://github.com/songquanpeng/one-api) independently.

| Demo                                                                          | Vision With Voice                                                        | Code Interpreter                                                                      |
|-------------------------------------------------------------------------------|--------------------------------------------------------------------------|---------------------------------------------------------------------------------------|
| ![sticker](https://github.com/LlmKira/Openaibot/raw/main/docs/chain_chat.gif) | ![vision](https://github.com/LlmKira/Openaibot/raw/main/docs/vision.gif) | ![code](https://github.com/LlmKira/Openaibot/raw/main/docs/code_interpreter_func.gif) |

## 🔨 Roadmap

> The program has iterated to its fourth generation.

- [x] Removal of legacy code
- [x] Deletion of metric system
- [x] Deletion of model selection system, unified to OpenAI Schema
- [x] Implementation of a more robust plugin system
- [x] Project structure simplification
- [x] Elimination of the Provider system
- [x] Hook support
- [x] Access to TTS
- [x] Add standalone support for gpt-4-turbo and vision
- [ ] Add LLM reference support to the plugin environment. (extract && search in text)

## 📦 Features

- 🍪 A comprehensive plugin development ecosystem, adopting a classic design, and seamless integration with plugins
  through `pip` installation
- 📝 Message system with no time or sender constraints, offering fully decoupled logics
- 📬 Offers Login via a URL mechanism, providing a flexible and expandable authentication development solution
- 🍰 Empowers users to authorize plugin execution. Users can configure plugin environment variables at their discretion
- 📦 Support for plugins to access files
- 🍟 Multi-platform support – extend new platforms by inheriting the base class
- 🍔 Plugins can determine their appearance in new sessions dynamically, preventing performance degradation despite large
  amounts of plugins

### 🍔 Login Modes

- `Login via url`: Use `/login <a token>$<something like https://provider.com/login>` to Login. The program posts the token to the interface to
  retrieve configuration
  information, [how to develop this](https://github.com/LlmKira/Openaibot/blob/81eddbff0f136697d5ad6e13ee1a7477b26624ed/app/components/credential.py#L20).
- `Login`: Use `/login https://<api endpoint>/v1$<api key>$<the model>$<tool model such as gpt-3.5-turbo>` to login

### 🧀 Plugin Can Do More

| Sticker Converter                   | Timer Function(built-in)        |
|-------------------------------------|---------------------------------|
| ![sticker](./docs/sticker_func.gif) | ![timer](./docs/timer_func.gif) |

### 🎬 Platform Support

| Platform | Support | File System | Remarks                                |
|----------|---------|-------------|----------------------------------------|
| Telegram | ✅       | ✅           |                                        |
| Discord  | ✅       | ✅           |                                        |
| Kook     | ✅       | ✅           | Does not support `triggering by reply` |
| Slack    | ✅       | ✅           | Does not support `triggering by reply` |
| Line     | ❌       |             |                                        |
| QQ       | ❌       |             |                                        |
| Wechat   | ❌       |             |                                        |
| Twitter  | ❌       |             |                                        |
| Matrix   | ❌       |             |                                        |
| IRC      | ❌       |             |                                        |
| ...      |         |             | Create Issue/PR                        |

## 📦 Quick Start

Refer to the [🧀 Deployment Document](https://llmkira.github.io/Docs/) for more information.

### 📦 One-click Deployment

If you are using a brand-new server, you can use the following shell to automatically install this project.

```shell
curl -sSL https://raw.githubusercontent.com/LLMKira/Openaibot/main/deploy.sh | bash
```

### 📦 Manual Installation

```shell
# Install Voice dependencies
apt install ffmpeg
# Install RabbitMQ
docker pull rabbitmq:3.10-management
docker run -d -p 5672:5672 -p 15672:15672 \
  -e RABBITMQ_DEFAULT_USER=admin \
  -e RABBITMQ_DEFAULT_PASS=8a8a8a \
  --hostname myRabbit \
  --name rabbitmq \
  rabbitmq:3.10-management
docker ps -l
# Install Project
git clone https://github.com/LlmKira/Openaibot/
cd Openaibot
pip install pdm
pdm install -G bot
cp .env.exp .env && nano .env
# Test
pdm run python3 start_sender.py
pdm run python3 start_receiver.py
# Host
apt install npm
npm install pm2 -g
pm2 start pm2.json
```

> **Be sure to change the default password for the command, or disable open ports to prevent the database from being
scanned and attacked.**

### 🥣 Docker

Build Hub: [sudoskys/llmbot](https://hub.docker.com/repository/docker/sudoskys/llmbot/general)

> Note that if you run this project using Docker, you will start Redis, MongoDB, and RabbitMQ. But if you're running
> locally, just RabbitMQ

#### Manual Docker-compose Installation

```shell
git clone https://github.com/LlmKira/Openaibot.git
cd Openaibot
cp .env.exp .env&&nano .env
docker-compose -f docker-compose.yml up -d
```

The Docker configuration file `docker-compose.yml` contains all databases. In fact, Redis and MongoDB are not required.
You can remove these databases yourself and use the local file system.

Update image using `docker-compose pull`.

Use `docker exec -it llmbot /bin/bash` to view Shell in Docker, enter `exit` to exit.

## 🍪 Slash Commands

```shell
clear - Deletes chat records
help - Displays documentation
chat - Conversation
task - Use a function to converse
ask - Disable function-based conversations
tool - Lists all functions
login - Login
auth - Authorize a function
env - Environment variables of the function
```

## 💻 How to Develop Plugins?

Refer to the example plugins in the `plugins` directory and
the [🧀 Plugin Development Document](https://llmkira.github.io/Docs/dev/basic) for plugin development documentation.

### Hooks

Hooks control the EventMessage in sender and receiver. For example, we have `voice_hook` in built-in hooks.

you can enable it by setting `VOICE_REPLY_ME=true` in `.env`.

```shell
/env VOICE_REPLY_ME=yes
# must

/env REECHO_VOICE_KEY=<key in dev.reecho.ai>
# not must
```

use `/env VOICE_REPLY_ME=NONE` to disable this env.

check the source code in `llmkira/extra/voice_hook.py`, learn to write your own hooks.

## 🧀 Sponsor

[![sponsor](./.github/sponsor_ohmygpt.png)](https://www.ohmygpt.com)

## 📜 Notice

> This project, named OpenAiBot, signifying "Open Artificial Intelligence Robot", is not officially affiliated with
> OpenAI.


[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fsudoskys%2FOpenaibot.svg?type=small)](https://app.fossa.com/projects/git%2Bgithub.com%2Fsudoskys%2FOpenaibot?ref=badge_small)
