https://github.com/savinrazvan/flexiai-toolsmith
Python framework for building AI Agents -> CLI & Quart-SSE UIs, Toolsmith RAG plug-ins, full Assistant-API workflows via the OpenAI SDK (OpenAI / Azure today). Support for DeepSeek & Qwen is pending Assistant endpoint access.
https://github.com/savinrazvan/flexiai-toolsmith
ai ai-assistant azure-openai chatbot-framework cli csv-tools deepseek event-driven github-azure-inference ocr openai quart qwen rag redis-pubsub security-audit spreadsheets sse streaming toolsmith
Last synced: 4 months ago
JSON representation
Python framework for building AI Agents -> CLI & Quart-SSE UIs, Toolsmith RAG plug-ins, full Assistant-API workflows via the OpenAI SDK (OpenAI / Azure today). Support for DeepSeek & Qwen is pending Assistant endpoint access.
- Host: GitHub
- URL: https://github.com/savinrazvan/flexiai-toolsmith
- Owner: SavinRazvan
- License: mit
- Created: 2025-05-17T08:26:02.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2025-06-08T16:40:01.000Z (8 months ago)
- Last Synced: 2025-06-08T17:30:02.667Z (8 months ago)
- Topics: ai, ai-assistant, azure-openai, chatbot-framework, cli, csv-tools, deepseek, event-driven, github-azure-inference, ocr, openai, quart, qwen, rag, redis-pubsub, security-audit, spreadsheets, sse, streaming, toolsmith
- Language: Python
- Homepage:
- Size: 1.17 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# FlexiAI Toolsmith
**FlexiAI Toolsmith** is a flexible, multi-channel Python framework for building AI-powered chat assistants. It supports both CLI and web (Quart + SSE) interfaces, integrates with multiple AI providers via the OpenAI Python SDK, and enables assistants to invoke powerful tool plug-insβincluding CSV / spreadsheet processing, YouTube search, security audits, dynamic forms, and (soon) OCR.
> **Provider Support Overview**
>
> * β
**OpenAI** and **Azure OpenAI** β full Assistant-API support
> * π‘ **DeepSeek** and **Qwen** β OpenAI SDK, but **chat-completions only** for now
> * β **GitHub Azure Inference** β chat-completions only
>
> βοΈ When any SDK-backed provider adds Assistant-API support, FlexiAI Toolsmith will pick it up automaticallyβno code changes required.
---
## Table of Contents
1. [Features](#features)
2. [Tutorials / Quick Demos](#tutorials--quick-demos)
3. [Architecture](#architecture)
4. [Prerequisites](#prerequisites)
5. [Installation](#installation)
6. [Configuration](#configuration)
7. [Usage](#usage)
* [CLI Chat (WSL or Linux)](#cli-chat-wsl-or-linux)
* [Web Chat (Quart -- SSE)](#web-chat-quart--sse)
8. [Contributing](#contributing)
9. [License](#license)
---
## Features
### Multi-Channel Publishing
Chat events can be streamed to:
* **CLI** (`CLIChannel`)
* **Redis Pub/Sub** (`RedisChannel`)
* **SSE Web clients** via Quart (`QuartChannel` + `SSEManager`)
---
## Tutorials / Quick Demos
---
## AI Provider Support
* **OpenAI & Azure OpenAI** β full Assistant-API (threads, deltas, tool calls)
* **DeepSeek & Qwen** β chat-completions via OpenAI SDK (Assistant-API pending)
* **GitHub Azure Inference** β chat-completions only
## Streaming Assistant API
* Thread life-cycle management (create β queue β in-progress β complete)
* Event routing via in-memory `EventBus` + `EventDispatcher`
* Delta-based message streaming with `MessageDeltaEvent`
## Dynamic RAG & Multi-Agent Tool Orchestration (via Toolsmith)
Toolsmith lets assistants **invoke dynamic tools via tool calls**, giving you a hybrid RAG + MAS system:
* **Agent coordination & delegation**
* `save_processed_content` / `load_processed_content`
* `initialize_agent` / `communicate_with_assistant`
## Built-in Tool Plug-ins
* **YouTube Search** β `search_youtube`, `search_on_youtube`
* **Product Filtering** β `filter_products` (`ai_custom_products`)
* **CSV Operations** β `csv_operations` (CRUD)
* **Subscriber Management** β `identify_subscriber`, `retrieve_billing_details`, `manage_services`
* **Spreadsheet Operations** β `file_operations`, `sheet_operations`, `data_entry_operations`, β¦
* **Security Audits** β `security_audit` (recon, port scans, defenses, updates)
* **Web Forms (Experimental)** β Generates interactive forms as Markdown in the Quart/SSE chat UI; submissions are sent via a POST to `/submit_user_info` and persisted to CSV
* **OCR (Coming Soon)** β `flexiai/toolsmith/_recycle/OCR.py`
## Configurable & Extensible
* Pydantic-based `.env` for credentials, channels, logging, β¦
* Modular factories for channels, credentials, handlers, tools
* Structured logging with rotating file + console outputs
---
## Architecture
```text
π¦ flexiai-toolsmith
β£ π flexiai
β β£ π channels
β β£ π config
β β£ π controllers
β β£ π core
β β β£ π events
β β β π handlers
β β£ π credentials
β β£ π database
β β£ π toolsmith
β β π utils
β£ π static
β£ π templates
β£ π .env
β£ π .env.template
β£ π .gitignore
β£ π app.py
β£ π chat.py
β£ π environment.yml
β£ π requirements.in
β π requirements.txt
```
---
## Prerequisites
* **Python 3.12+**
* **Redis** (if `redis` in `ACTIVE_CHANNELS`)
* **Conda** (Miniconda/Anaconda) *or* `pip` + `venv`
---
## Installation
1. **Clone the repository**
```bash
git clone https://github.com/SavinRazvan/flexiai-toolsmith.git
```
2. **Set up the environment (Conda recommended)**
```bash
conda env create -f environment.yml
conda activate .conda_flexiai
```
*Or use `venv` + `pip`:*
```bash
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
```
---
## Configuration
Copy `.env.template` β `.env`, then edit:
| Variable | Description | Example |
| ------------------------ | ------------------------------------------------------ | ----------------- |
| `CREDENTIAL_TYPE` | `openai`, `azure`, `deepseek`, `qwen`, `github_models` | `openai` |
| `OPENAI_API_KEY`, β¦ | Provider credentials | `sk-β¦` |
| `ACTIVE_CHANNELS` | `cli`, `redis`, `quart` (comma-separated) | `cli,quart` |
| `USER_PROJECT_ROOT_DIR` | Absolute project root path | `/home/user/code` |
| `YOUTUBE_API_KEY` (opt.) | Needed for YouTube search tool | `AIzaβ¦` |
> βΉοΈ Assistant-API features currently work on OpenAI & Azure OpenAI only; DeepSeek & Qwen auto-enable once their endpoints support it.
---
## Usage
### CLI Chat (WSL or Linux)
```bash
python chat.py
```
* Prompts show as `π€ You`
* Assistant messages stream as `πΊ Assistant`
### Web Chat (Quart + SSE)
```bash
hypercorn app:app --bind 127.0.0.1:8000 --workers 1
```
1. Browse to **[http://127.0.0.1:8000/chat/](http://127.0.0.1:8000/chat/)**
2. Start chatting in the live SSE UI
---
## Running with Docker
You can run FlexiAI Toolsmith in a container without installing Python or dependencies on your host.
### 1. Build the Docker image
```bash
docker build -t flexiai-toolsmith .
```
### 2. Run the container
```bash
docker run -p 8000:8000 flexiai-toolsmith
```
The web interface will be available at [http://localhost:8000/chat/](http://localhost:8000/chat/).
> **Note:**
> Make sure your `.env` file is present in the project root before building the image.
> For production, consider using `hypercorn` as the entrypoint.
---
## Contributing
1. **Fork** β create a feature branch
```bash
git checkout -b feature/my-feature
```
2. Commit with clear messages
3. Open a **pull request** explaining context & purpose
---
## License
Released under the **MIT License** β see [`LICENSE`](LICENSE) for full terms.