Spaces:
Runtime error
Runtime error
File size: 4,196 Bytes
13c6cad | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | Metadata-Version: 2.4
Name: kallam
Version: 0.1.0
Summary: KaLLaM: Multi-agent chatbot with orchestration, LLM evaluation, and SQLite persistence
Author: Koalar
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: python-dotenv>=1.0.1
Requires-Dist: strands-agents>=0.1.0
Requires-Dist: strands-agents-tools
Requires-Dist: strands-agents-builder
Requires-Dist: strands-agents[openai]>=1.0.0
Requires-Dist: google-genai
Requires-Dist: openai>=1.40.0
Requires-Dist: boto3>=1.34.0
Requires-Dist: numpy>=1.26.0
Requires-Dist: sentence-transformers>=2.6.0
Requires-Dist: transformers>=4.40.0
Requires-Dist: gradio>=4.0.0
Requires-Dist: pyngrok==7.3.0
Requires-Dist: matplotlib
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: pytest-cov>=4.0; extra == "dev"
Requires-Dist: ruff>=0.4.0; extra == "dev"
Requires-Dist: mypy>=1.10.0; extra == "dev"
Dynamic: license-file
---
# KaLLaM – Motivational-Therapeutic Advisor
> **Note to future stupid self**: You will forget everything. This file exists so you don’t scream at your computer in six months. Read it first.
---
## 🚀 Quickstart
1. **Create venv**
Windows (PowerShell):
```powershell
python -m venv .venv
.venv\Scripts\Activate.ps1
```
Linux/macOS:
```bash
python -m venv .venv
source .venv/bin/activate
```
2. **Upgrade pip**
```bash
python -m pip install -U pip
```
3. **Install project (runtime only)**
```bash
pip install -e .
```
4. **Install project + dev tools (pytest, mypy, ruff)**
```bash
pip install -e .[dev]
```
5. **Run tests**
```bash
pytest -q
```
---
## 📂 Project layout (don’t mess this up)
```
project-root/
├─ pyproject.toml # dependencies & config (editable mode uses src/)
├─ README.md # you are here
├─ src/
│ └─ kallam/
│ ├─ __init__.py
│ ├─ app/ # orchestrator wiring, chatbot manager
│ ├─ domain/ # agents, judges, orchestrator logic
│ └─ infra/ # db, llm clients, search, token counter
└─ tests/ # pytest lives here
```
* `app/` = entrypoint, wires everything.
* `domain/` = core logic (agents, judges, orchestrator rules).
* `infra/` = all the boring adapters (DB, APIs, token counting).
* `tests/` = if you don’t write them, you’ll break everything and blame Python.
---
## 🔑 Environment variables
Put these in `.env` at project root:
```
OPENAI_API_KEY=sk-...
SEA_LION_API_KEY=...
AWS_ROLE_ARN=...
AWS_DEFAULT_REGION=ap-southeast-2
TAVILY_API_KEY=...
```
Load automatically via `python-dotenv`.
---
## 🧪 Common commands
* Run chatbot manager manually:
```bash
python -m kallam.app.chatbot_manager
```
* Run lint:
```bash
ruff check src tests
```
* Run type check:
```bash
mypy src
```
* Export a session JSON (example):
```python
from kallam.app.chatbot_manager import ChatbotManager
mgr = ChatbotManager()
sid = mgr.start_session()
mgr.handle_message(sid, "hello world")
mgr.export_session_json(sid)
```
---
## 🧹 Rules for survival
* Always activate `.venv` before coding.
* Never `pip install` globally, always `pip install -e .[dev]` inside venv.
* If imports fail → you forgot editable install. Run `pip install -e .` again.
* If SQLite locks up → delete `*.db` files and start fresh.
* If you break `pyproject.toml` → copy it from git history, don’t wing it.
---
## ☠️ Known pitfalls
* **Windows error “source not recognized”** → you’re not on Linux. Use `.venv\Scripts\Activate.ps1`.
* **“No module named kallam”** → you didn’t install with `-e`.
* **Tests can’t import your code** → run `pytest` from project root, not inside `tests/`.
* **Pip complains about `[dev]`** → you typo’d in `pyproject.toml`. Fix the `[project.optional-dependencies]` block.
---
That’s it. If you follow this, future you won’t rage-quit.
---
|