Metadata-Version: 2.4
Name: olang-chatbot-resolvers
Version: 1.0.0
Summary: O-Lang Chatbot Resolver Pack — memory, intent, tone and LLM resolvers
Author-email: O-Lang team <info@olang.cloud>
License-Expression: MIT
Project-URL: Homepage, https://olang.cloud
Project-URL: Repository, https://github.com/o-lang/olang-chatbot-resolvers
Project-URL: Documentation, https://github.com/o-lang/olang-chatbot-resolvers#readme
Keywords: olang,chatbot,rag,resolver,llm,groq,memory,intent,tone,governance,ai
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Requires-Dist: fastapi>=0.115.0
Requires-Dist: uvicorn[standard]>=0.30.6
Requires-Dist: groq>=0.5.0
Requires-Dist: httpx>=0.27.0
Requires-Dist: python-dotenv>=1.0.0
Provides-Extra: postgres
Requires-Dist: asyncpg>=0.29.0; extra == "postgres"
Provides-Extra: anthropic
Requires-Dist: anthropic>=0.24.3; extra == "anthropic"
Provides-Extra: openai
Requires-Dist: openai>=1.0.0; extra == "openai"
Provides-Extra: all
Requires-Dist: asyncpg>=0.29.0; extra == "all"
Requires-Dist: anthropic>=0.24.3; extra == "all"
Requires-Dist: openai>=1.0.0; extra == "all"
Provides-Extra: dev
Requires-Dist: pytest>=7.0.0; extra == "dev"
Requires-Dist: pytest-asyncio>=0.23.0; extra == "dev"
Requires-Dist: httpx>=0.27.0; extra == "dev"

# olang-chatbot-resolvers

O-Lang Chatbot Resolver Pack — memory, intent, tone and LLM resolvers.

## Install
```bash
pip install olang-chatbot-resolvers
```

## Start
```bash
export GROQ_API_KEY=your_key_here
olang-chatbot-resolvers
# ✅ Running at http://localhost:8000
# ✅ Memory: sqlite (zero config)
```

## Upgrade to Postgres in production
```bash
pip install olang-chatbot-resolvers[postgres]
export DATABASE_URL=postgresql://user:pass@host/db
olang-chatbot-resolvers
# ✅ Memory: postgres
```

## Resolvers

| Resolver | Action | Input | Output |
|---|---|---|---|
| Memory read | `memory_read` | `session_id`, `last_n_turns` | `history` |
| Memory write | `memory_write` | `session_id`, `role`, `content` | `turn_index` |
| Intent classifier | `intent_classifier` | `message`, `allowed_topics` | `intent`, `topic`, `is_allowed`, `confidence` |
| Tone analyzer | `tone_analyzer` | `text`, `required_tone` | `score`, `violations` |
| LLM chat | `llm_chat` | `system_prompt`, `history`, `user_message` | `reply`, `token_usage`, `model` |

## Use in your .ol workflow
```yaml
tools:
  - name: memory_read
    protocol: http
    url: http://localhost:8000

  - name: memory_write
    protocol: http
    url: http://localhost:8000

  - name: intent_classifier
    protocol: http
    url: http://localhost:8000

  - name: tone_analyzer
    protocol: http
    url: http://localhost:8000

  - name: llm_chat
    protocol: http
    url: http://localhost:8000
```

## Environment variables
```bash
# Required
GROQ_API_KEY=your_groq_key

# Optional — production storage
DATABASE_URL=postgresql://user:pass@host/db

# Optional — custom SQLite path (dev)
SQLITE_PATH=./my_memory.db

# Optional — server config
RESOLVER_HOST=0.0.0.0
RESOLVER_PORT=8000

# Optional — model overrides
LLM_CHAT_MODEL=llama-3.3-70b-versatile
LLM_CHAT_MAX_TOKENS=1024
INTENT_MODEL=llama-3.1-8b-instant
TONE_MODEL=llama-3.1-8b-instant
```

## LLM models

| Constant | Model | Best for |
|---|---|---|
| `FAST` | `llama-3.1-8b-instant` | Classification, short answers |
| `SMART` | `llama-3.3-70b-versatile` | RAG, chatbots, document reasoning |
| `MIXTRAL` | `mixtral-8x7b-32768` | Complex synthesis, large context |

Default for `llm_chat`: `llama-3.3-70b-versatile`

## Running tests
```bash
pip install olang-chatbot-resolvers[dev]
pytest tests/ -v
# No API key or database required
```

## Contact

[info@olang.cloud](mailto:info@olang.cloud)
