Name | ocht JSON |
Version |
0.1.1
JSON |
| download |
home_page | None |
Summary | Modulare Python-TUI zur Steuerung von LLMs via LangChain |
upload_time | 2025-08-06 08:37:30 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.9 |
license | None |
keywords |
tui
langchain
llm
cli
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# OChaT
[](https://pypi.org/project/ocht/) [](https://github.com/dein-username/OChaT/actions/workflows/ci.yml) [](LICENSE)
**OChaT** is a modular Python TUI application that orchestrates Large Language Models (LLMs) via LangChain. It supports both local models (Ollama) and cloud providers (ChatGPT, Claude, Grok).
---
## ๐ฆ Installation
1. **Clone the repository**
```bash
git clone https://github.com/dein-username/OChaT.git
cd OChaT
```
2. **Install dependencies**
```bash
uv sync
```
3. **Install package in development mode**
```bash
uv install -e .
```
> **Note:** By default, `uv sync` installs all dependencies from `pyproject.toml`, including:
>
> * `alembic>=1.15.2`
> * `click>=8.1.8`
> * `langchain>=0.3.26`
> * `langchain-ollama>=0.3.3`
> * `ollama>=0.4.8`
> * `rich>=14.0.0`
> * `sqlmodel>=0.0.24`
> * `textual>=3.2.0`
---
## โก Quick Start
Launch the TUI application:
```bash
uv run ocht
```
Or use specific commands:
* **`uv run ocht init <workspace>`** - Create new workspace
* **`uv run ocht chat`** - Start interactive chat
* **`uv run ocht list-models`** - List available models
* **`uv run ocht sync-models`** - Sync model metadata
* **`uv run ocht config`** - Open configuration editor
* **`uv run ocht migrate <version>`** - Run database migrations
### Available CLI Commands
| Command | Description |
|---------|-------------|
| `init <name>` | Creates a new chat workspace with configuration file and history |
| `chat` | Starts interactive chat session based on current workspace |
| `config` | Opens configuration in default editor |
| `export-config <file>` | Exports current settings as YAML or JSON file |
| `import-config <file>` | Imports settings from YAML or JSON file |
| `list-models` | Lists available LLM models via LangChain |
| `sync-models` | Synchronizes model metadata from external providers |
| `migrate <version>` | Runs Alembic migrations to specified target version |
| `version` | Shows current CLI/package version |
| `help [command]` | Shows detailed help for a command |
<details>
<summary>Example Usage</summary>
```bash
# Create new chat workspace
uv run ocht init my-workspace
# Start chat session
uv run ocht chat
# List available models
uv run ocht list-models
# Sync model metadata
uv run ocht sync-models
```
</details>
---
## ๐๏ธ Architecture
### Core Components
**Database Layer (`core/`)**
- `models.py` - SQLModel entities: Workspace, Message, LLMProviderConfig, Model, Setting, PromptTemplate
- `db.py` - Database engine, session management, and initialization
- `migration.py` - Alembic integration for schema migrations
**Repository Layer (`repositories/`)**
- CRUD operations for each entity
- Direct database access abstraction
- Files: `workspace.py`, `message.py`, `llm_provider_config.py`, `model.py`, `setting.py`, `prompt_template.py`
**Service Layer (`services/`)**
- Business logic and use cases
- Orchestrates repositories and external APIs
- Files: `workspace.py`, `chat.py`, `config.py`, `model_manager.py`, `provider_manager.py`, `prompt_manager.py`
**Adapter Layer (`adapters/`)**
- LangChain integration
- `base.py` - Abstract LLMAdapter interface
- `ollama.py` - Ollama-specific implementation
**TUI Layer (`tui/`)**
- Textual-based user interface
- `app.py` - Main TUI application
- `screens/` - UI screens for model/provider management
- `widgets/` - Custom UI components (chat bubbles, etc.)
- `styles/` - TCSS styling files
## ๐๏ธ Project Structure
```text
OChaT/
โโโ .gitignore
โโโ LICENSE
โโโ pyproject.toml
โโโ README.md
โโโ CLAUDE.md # Claude Code project instructions
โโโ alembic.ini # Alembic configuration
โโโ migrations/ # Database migration files
โโโ docs/
โโโ tests/ # Test files
โโโ src/
โ โโโ ocht/
โ โโโ __init__.py
โ โโโ cli.py # CLI entry point (Click commands)
โ โโโ core/ # Database engine, sessions & models
โ โ โโโ db.py # Engine & session factory
โ โ โโโ migration.py # Alembic integration
โ โ โโโ models.py # SQLModel entities
โ โ โโโ version.py # Version management
โ โโโ repositories/ # CRUD logic per entity
โ โ โโโ workspace.py
โ โ โโโ message.py
โ โ โโโ llm_provider_config.py
โ โ โโโ model.py
โ โ โโโ setting.py
โ โ โโโ prompt_template.py
โ โโโ services/ # Business logic / use cases
โ โ โโโ workspace.py
โ โ โโโ chat.py
โ โ โโโ config.py
โ โ โโโ model_manager.py
โ โ โโโ provider_manager.py
โ โ โโโ prompt_manager.py
โ โ โโโ settings_manager.py
โ โ โโโ adapter_manager.py
โ โโโ adapters/ # LangChain adapters
โ โ โโโ base.py # Abstract adapter interface
โ โ โโโ ollama.py # Ollama implementation
โ โโโ tui/ # Text-based UI components
โ โ โโโ app.py # Main TUI application
โ โ โโโ screens/ # UI screens
โ โ โโโ widgets/ # Custom widgets
โ โ โโโ styles/ # TCSS styling
โ โโโ data/ # SQLite database
โโโ uv.lock
```
---
## ๐งช Testing
Run tests using pytest:
```bash
uv run pytest
```
---
## ๐ค Contributing
Contributions are welcome!
1. **Fork** the repository
2. **Create feature branch**:
```bash
git checkout -b feature/my-feature
```
3. **Commit changes**:
```bash
git commit -m "feat: description of my feature"
```
4. **Push to fork**:
```bash
git push origin feature/my-feature
```
5. **Open Pull Request**
Please follow our coding guidelines and add tests for new features.
---
## ๐ License
This project is licensed under the [MIT License](LICENSE).
Raw data
{
"_id": null,
"home_page": null,
"name": "ocht",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "tui, langchain, llm, cli",
"author": null,
"author_email": "Roman Thimian <roman.thimian@me.com>",
"download_url": "https://files.pythonhosted.org/packages/d2/c6/30180d8e0780b303c53278440191f3f73b89c89460d39cd19cd73ae23e9c/ocht-0.1.1.tar.gz",
"platform": null,
"description": "# OChaT\n\n[](https://pypi.org/project/ocht/) [](https://github.com/dein-username/OChaT/actions/workflows/ci.yml) [](LICENSE)\n\n**OChaT** is a modular Python TUI application that orchestrates Large Language Models (LLMs) via LangChain. It supports both local models (Ollama) and cloud providers (ChatGPT, Claude, Grok).\n\n---\n\n## \ud83d\udce6 Installation\n\n1. **Clone the repository**\n\n ```bash\n git clone https://github.com/dein-username/OChaT.git\n cd OChaT\n ```\n\n2. **Install dependencies**\n\n ```bash\n uv sync\n ```\n\n3. **Install package in development mode**\n\n ```bash\n uv install -e .\n ```\n\n> **Note:** By default, `uv sync` installs all dependencies from `pyproject.toml`, including:\n>\n> * `alembic>=1.15.2`\n> * `click>=8.1.8`\n> * `langchain>=0.3.26`\n> * `langchain-ollama>=0.3.3`\n> * `ollama>=0.4.8`\n> * `rich>=14.0.0`\n> * `sqlmodel>=0.0.24`\n> * `textual>=3.2.0`\n\n---\n\n## \u26a1 Quick Start\n\nLaunch the TUI application:\n\n```bash\nuv run ocht\n```\n\nOr use specific commands:\n\n* **`uv run ocht init <workspace>`** - Create new workspace\n* **`uv run ocht chat`** - Start interactive chat\n* **`uv run ocht list-models`** - List available models\n* **`uv run ocht sync-models`** - Sync model metadata\n* **`uv run ocht config`** - Open configuration editor\n* **`uv run ocht migrate <version>`** - Run database migrations\n\n### Available CLI Commands\n\n| Command | Description |\n|---------|-------------|\n| `init <name>` | Creates a new chat workspace with configuration file and history |\n| `chat` | Starts interactive chat session based on current workspace |\n| `config` | Opens configuration in default editor |\n| `export-config <file>` | Exports current settings as YAML or JSON file |\n| `import-config <file>` | Imports settings from YAML or JSON file |\n| `list-models` | Lists available LLM models via LangChain |\n| `sync-models` | Synchronizes model metadata from external providers |\n| `migrate <version>` | Runs Alembic migrations to specified target version |\n| `version` | Shows current CLI/package version |\n| `help [command]` | Shows detailed help for a command |\n\n<details>\n<summary>Example Usage</summary>\n\n```bash\n# Create new chat workspace\nuv run ocht init my-workspace\n\n# Start chat session\nuv run ocht chat\n\n# List available models\nuv run ocht list-models\n\n# Sync model metadata\nuv run ocht sync-models\n```\n\n</details>\n\n---\n\n## \ud83c\udfd7\ufe0f Architecture\n\n### Core Components\n\n**Database Layer (`core/`)**\n- `models.py` - SQLModel entities: Workspace, Message, LLMProviderConfig, Model, Setting, PromptTemplate\n- `db.py` - Database engine, session management, and initialization\n- `migration.py` - Alembic integration for schema migrations\n\n**Repository Layer (`repositories/`)**\n- CRUD operations for each entity\n- Direct database access abstraction\n- Files: `workspace.py`, `message.py`, `llm_provider_config.py`, `model.py`, `setting.py`, `prompt_template.py`\n\n**Service Layer (`services/`)**\n- Business logic and use cases\n- Orchestrates repositories and external APIs\n- Files: `workspace.py`, `chat.py`, `config.py`, `model_manager.py`, `provider_manager.py`, `prompt_manager.py`\n\n**Adapter Layer (`adapters/`)**\n- LangChain integration\n- `base.py` - Abstract LLMAdapter interface\n- `ollama.py` - Ollama-specific implementation\n\n**TUI Layer (`tui/`)**\n- Textual-based user interface\n- `app.py` - Main TUI application\n- `screens/` - UI screens for model/provider management\n- `widgets/` - Custom UI components (chat bubbles, etc.)\n- `styles/` - TCSS styling files\n\n## \ud83d\uddc2\ufe0f Project Structure\n\n```text\nOChaT/\n\u251c\u2500\u2500 .gitignore\n\u251c\u2500\u2500 LICENSE\n\u251c\u2500\u2500 pyproject.toml\n\u251c\u2500\u2500 README.md\n\u251c\u2500\u2500 CLAUDE.md # Claude Code project instructions\n\u251c\u2500\u2500 alembic.ini # Alembic configuration\n\u251c\u2500\u2500 migrations/ # Database migration files\n\u251c\u2500\u2500 docs/\n\u251c\u2500\u2500 tests/ # Test files\n\u251c\u2500\u2500 src/\n\u2502 \u2514\u2500\u2500 ocht/\n\u2502 \u251c\u2500\u2500 __init__.py\n\u2502 \u251c\u2500\u2500 cli.py # CLI entry point (Click commands)\n\u2502 \u251c\u2500\u2500 core/ # Database engine, sessions & models\n\u2502 \u2502 \u251c\u2500\u2500 db.py # Engine & session factory\n\u2502 \u2502 \u251c\u2500\u2500 migration.py # Alembic integration\n\u2502 \u2502 \u251c\u2500\u2500 models.py # SQLModel entities\n\u2502 \u2502 \u2514\u2500\u2500 version.py # Version management\n\u2502 \u251c\u2500\u2500 repositories/ # CRUD logic per entity\n\u2502 \u2502 \u251c\u2500\u2500 workspace.py\n\u2502 \u2502 \u251c\u2500\u2500 message.py\n\u2502 \u2502 \u251c\u2500\u2500 llm_provider_config.py\n\u2502 \u2502 \u251c\u2500\u2500 model.py\n\u2502 \u2502 \u251c\u2500\u2500 setting.py\n\u2502 \u2502 \u2514\u2500\u2500 prompt_template.py\n\u2502 \u251c\u2500\u2500 services/ # Business logic / use cases\n\u2502 \u2502 \u251c\u2500\u2500 workspace.py\n\u2502 \u2502 \u251c\u2500\u2500 chat.py\n\u2502 \u2502 \u251c\u2500\u2500 config.py\n\u2502 \u2502 \u251c\u2500\u2500 model_manager.py\n\u2502 \u2502 \u251c\u2500\u2500 provider_manager.py\n\u2502 \u2502 \u251c\u2500\u2500 prompt_manager.py\n\u2502 \u2502 \u251c\u2500\u2500 settings_manager.py\n\u2502 \u2502 \u2514\u2500\u2500 adapter_manager.py\n\u2502 \u251c\u2500\u2500 adapters/ # LangChain adapters\n\u2502 \u2502 \u251c\u2500\u2500 base.py # Abstract adapter interface\n\u2502 \u2502 \u2514\u2500\u2500 ollama.py # Ollama implementation\n\u2502 \u251c\u2500\u2500 tui/ # Text-based UI components\n\u2502 \u2502 \u251c\u2500\u2500 app.py # Main TUI application\n\u2502 \u2502 \u251c\u2500\u2500 screens/ # UI screens\n\u2502 \u2502 \u251c\u2500\u2500 widgets/ # Custom widgets\n\u2502 \u2502 \u2514\u2500\u2500 styles/ # TCSS styling\n\u2502 \u2514\u2500\u2500 data/ # SQLite database\n\u2514\u2500\u2500 uv.lock\n```\n\n---\n\n## \ud83e\uddea Testing\n\nRun tests using pytest:\n\n```bash\nuv run pytest\n```\n\n---\n\n## \ud83e\udd1d Contributing\n\nContributions are welcome!\n\n1. **Fork** the repository\n2. **Create feature branch**: \n ```bash\n git checkout -b feature/my-feature\n ```\n3. **Commit changes**:\n ```bash\n git commit -m \"feat: description of my feature\"\n ```\n4. **Push to fork**:\n ```bash\n git push origin feature/my-feature\n ```\n5. **Open Pull Request**\n\nPlease follow our coding guidelines and add tests for new features.\n\n---\n\n## \ud83d\udcc4 License\n\nThis project is licensed under the [MIT License](LICENSE).\n\n",
"bugtrack_url": null,
"license": null,
"summary": "Modulare Python-TUI zur Steuerung von LLMs via LangChain",
"version": "0.1.1",
"project_urls": null,
"split_keywords": [
"tui",
" langchain",
" llm",
" cli"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "b60727ef529f7b2df051f5a207654ab9828ba2dd101e4a2d881636ec4c912182",
"md5": "3c24275c45cada43f0c5faf3468bf2af",
"sha256": "5b58f1f5cbec82141d2e2f2882393753502ef7502ceb94840026b4521494050a"
},
"downloads": -1,
"filename": "ocht-0.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "3c24275c45cada43f0c5faf3468bf2af",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 57476,
"upload_time": "2025-08-06T08:37:29",
"upload_time_iso_8601": "2025-08-06T08:37:29.080516Z",
"url": "https://files.pythonhosted.org/packages/b6/07/27ef529f7b2df051f5a207654ab9828ba2dd101e4a2d881636ec4c912182/ocht-0.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "d2c630180d8e0780b303c53278440191f3f73b89c89460d39cd19cd73ae23e9c",
"md5": "1fb06543044e484784be53d9a59b1c38",
"sha256": "f9ffd6ad6de22dbcca6fa2f89a51aa5136d57d54998ad0780de9c179e4fe78e2"
},
"downloads": -1,
"filename": "ocht-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "1fb06543044e484784be53d9a59b1c38",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 40497,
"upload_time": "2025-08-06T08:37:30",
"upload_time_iso_8601": "2025-08-06T08:37:30.008245Z",
"url": "https://files.pythonhosted.org/packages/d2/c6/30180d8e0780b303c53278440191f3f73b89c89460d39cd19cd73ae23e9c/ocht-0.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-06 08:37:30",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "ocht"
}