Files
email-classifier/docs/configuration.md
Lennie S. 760b56bfd6 Add MkDocs documentation
Covers: overview, setup, API reference, configuration,
testing, deployment, and known quirks.
2026-04-09 20:24:49 +00:00

109 lines
2.8 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Configuration
All configuration is driven by environment variables. There are no config files.
## LLM Provider Settings
### `LLM_PROVIDER`
- **Values:** `openai` | `anthropic`
- **Default:** `openai`
- Determines which adapter to use for API calls. Use `openai` for Ollama, LM Studio, and any OpenAI-compatible API. Use `anthropic` for MiniMax or any Anthropic-compatible API.
### `LLM_BASE_URL`
- **Default:** `http://ollama.internal.henryhosted.com:9292/v1`
- The base URL for the LLM API. Must include the `/v1` (OpenAI format) or `/anthropic` (Anthropic format) suffix as appropriate.
### `LLM_API_KEY`
- **Default:** `none`
- API key for the LLM provider. Set to `none` for local Ollama instances that don't require authentication.
### `LLM_MODEL`
- **Default:** `qwen2.5-7b-instruct.q4_k_m`
- The model name. Must match a model available on the target LLM backend.
### `LLM_TEMPERATURE`
- **Default:** `0.1`
- Sampling temperature (0.01.0). Lower values produce more deterministic outputs. A value around `0.1` is recommended for classification tasks.
### `LLM_TIMEOUT_SECONDS`
- **Default:** `60`
- Request timeout in seconds.
### `LLM_MAX_RETRIES`
- **Default:** `3`
- Maximum number of retries when a classification attempt fails to parse or returns an invalid result.
## Deduplication Settings
### `EMAIL_CLASSIFIER_DB_PATH`
- **Default:** `.data/email_classifier.db`
- Path to the SQLite database used for deduplication tracking. The directory will be created automatically.
---
## Provider-Specific Examples
### Ollama (local, OpenAI-compatible)
```bash
export LLM_PROVIDER=openai
export LLM_BASE_URL=http://localhost:11434/v1
export LLM_API_KEY=none
export LLM_MODEL=qwen2.5-7b-instruct.q4_k_m
export LLM_TEMPERATURE=0.1
```
### MiniMax (Anthropic-compatible API)
```bash
export LLM_PROVIDER=anthropic
export LLM_BASE_URL=https://api.minimax.io/anthropic
export LLM_API_KEY=your_minimax_key
export LLM_MODEL=MiniMax-M2.7
export LLM_TEMPERATURE=0.1
```
### LM Studio (local, OpenAI-compatible)
```bash
export LLM_PROVIDER=openai
export LLM_BASE_URL=http://localhost:1234/v1
export LLM_API_KEY=none
export LLM_MODEL=your-loaded-model-name
export LLM_TEMPERATURE=0.1
```
### OpenAI (cloud)
```bash
export LLM_PROVIDER=openai
export LLM_BASE_URL=https://api.openai.com/v1
export LLM_API_KEY=sk-...
export LLM_MODEL=gpt-4o-mini
export LLM_TEMPERATURE=0.1
```
---
## Per-Request Overrides
Any LLM setting can be overridden per-request by passing the field in the request body. This is useful when a single client needs to route to different providers dynamically (e.g., different email accounts with different LLM backends).
```json
{
"email_data": { "subject": "...", "body": "..." },
"provider": "anthropic",
"base_url": "https://api.minimax.io/anthropic",
"api_key": "minimax_key_here",
"model": "MiniMax-M2.7"
}
```