Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 56 additions & 6 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,12 +1,62 @@
# Copy to .env and fill in real values. Never commit .env.

OPENAI_MODEL_NAME=gpt-4o-mini
# ============================================================================
# LLM Configuration
# ============================================================================
LLM_PROVIDER=openai # openai | huggingface | azure_openai
OPENAI_API_KEY= # Required for openai provider
OPENAI_MODEL_NAME=gpt-4o
OPENAI_TEMPERATURE=0.0
OPENAI_MAX_TOKENS=1500
HF_TOKEN=
LLM_PROVIDER=openai
HF_TOKEN= # Required for huggingface provider

# Azure OpenAI (if LLM_PROVIDER=azure_openai)
AZURE_OPENAI_ENDPOINT=
AZURE_OPENAI_API_KEY=
AZURE_OPENAI_API_VERSION=2024-10-21
AZURE_OPENAI_CHAT_DEPLOYMENT_NAME=
AZURE_OPENAI_EMBEDDING_DEPLOYMENT_NAME=

# ============================================================================
# Embedding Configuration
# ============================================================================
EMBEDDING_PROVIDER=openai # openai | azure_openai
# Azure embedding config uses AZURE_OPENAI_* vars above

# ============================================================================
# Memory Configuration
# ============================================================================
MEMORY_PROVIDER=redis # redis | azure_redis
REDIS_URL=redis://localhost:6379/0 # Used by Docker Compose: redis://redis:6379/0
AZURE_REDIS_CONNECTION_STRING= # If MEMORY_PROVIDER=azure_redis

# ============================================================================
# Vector Store Configuration
# ============================================================================
VECTOR_STORE_PROVIDER=chroma # chroma | azure_search
CHAT_VECTOR_STORE_PROVIDER=chroma # chroma | azure_search

# Azure Search (if using azure_search provider)
AZURE_SEARCH_ENDPOINT=
AZURE_SEARCH_API_KEY=
AZURE_SEARCH_INDEX_NAME=cortex-rag-chunks
AZURE_SEARCH_EMBEDDING_DIM=1536

# ============================================================================
# Live Data Integration (NEW)
# ============================================================================
LIVE_DATA_PROVIDER=mock # mock (default) | duckduckgo | newsapi
NEWS_API_KEY= # Required if LIVE_DATA_PROVIDER=newsapi
# Get free key at: https://newsapi.org/register

# ============================================================================
# Unstructured Data (PDF ingestion)
# ============================================================================
UNSTRUCTURED_API_KEY=

# Used by the Docker Compose stack (Docker/docker-compose.yml)
REDIS_URL=redis://redis:6379/0
GRAFANA_ADMIN_PASSWORD=admin
# ============================================================================
# Docker / Infrastructure
# ============================================================================
GRAFANA_ADMIN_PASSWORD=admin # Used by Docker Compose stack
PROMETHEUS_SCRAPE_INTERVAL=15s
PROMETHEUS_EVALUATION_INTERVAL=15s
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ Temporary Items
.apdisk
data/rag_uploads/
data/rag_vectorstore/
data/library/

# Windows
Thumbs.db
Expand Down Expand Up @@ -244,4 +245,7 @@ src/ui/node_modules/

# Vite / build cache
.vite/
dist/
dist/
# Any env variant (e.g. .env2) holds real credentials. Keep a template tracked.
.env*
!.env.example
249 changes: 226 additions & 23 deletions CLAUDE.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Docker/alertmanager/alertmanager.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Alertmanager configuration for the personal-chatbot monitoring stack.
# Alertmanager configuration for the Cortex (personal-chatbot) monitoring stack.
#
# This ships with NO notification channel configured — alerts are grouped and
# de-duplicated but not delivered anywhere. Firing/resolved alerts are still
Expand Down
2 changes: 1 addition & 1 deletion Docker/grafana/provisioning/dashboards/dashboard.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: 1

providers:
- name: "personal-chatbot"
- name: "cortex"
orgId: 1
folder: ""
type: file
Expand Down
98 changes: 95 additions & 3 deletions Docker/grafana/provisioning/dashboards/json/api-overview.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"title": "Personal Chatbot - Overview",
"title": "Cortex - Overview",
"uid": "personal-chatbot-overview",
"schemaVersion": 39,
"version": 1,
"version": 2,
"editable": true,
"timezone": "browser",
"time": { "from": "now-6h", "to": "now" },
"refresh": "30s",
"tags": ["personal-chatbot"],
"tags": ["cortex", "personal-chatbot"],
"panels": [
{
"id": 1,
Expand Down Expand Up @@ -258,6 +258,98 @@
}
],
"fieldConfig": { "defaults": { "unit": "percentunit", "min": 0, "max": 1 }, "overrides": [] }
},
{
"id": 16,
"type": "stat",
"title": "Total LLM cost (USD)",
"gridPos": { "h": 6, "w": 6, "x": 0, "y": 46 },
"datasource": { "type": "prometheus", "uid": "prometheus" },
"targets": [
{ "expr": "sum(chat_cost_total)", "refId": "A" }
],
"fieldConfig": {
"defaults": { "unit": "currencyUSD", "decimals": 2 },
"overrides": []
}
},
{
"id": 17,
"type": "stat",
"title": "Total embedding cost (USD)",
"gridPos": { "h": 6, "w": 6, "x": 6, "y": 46 },
"datasource": { "type": "prometheus", "uid": "prometheus" },
"targets": [
{ "expr": "sum(embedding_cost_total)", "refId": "A" }
],
"fieldConfig": {
"defaults": { "unit": "currencyUSD", "decimals": 4 },
"overrides": []
}
},
{
"id": 18,
"type": "stat",
"title": "Cost per request (avg)",
"gridPos": { "h": 6, "w": 6, "x": 12, "y": 46 },
"datasource": { "type": "prometheus", "uid": "prometheus" },
"targets": [
{
"expr": "sum(chat_cost_total) / sum(chat_model_requests_total)",
"legendFormat": "USD/request",
"refId": "A"
}
],
"fieldConfig": {
"defaults": { "unit": "currencyUSD", "decimals": 6 },
"overrides": []
}
},
{
"id": 19,
"type": "stat",
"title": "Embedding requests (total)",
"gridPos": { "h": 6, "w": 6, "x": 18, "y": 46 },
"datasource": { "type": "prometheus", "uid": "prometheus" },
"targets": [
{ "expr": "sum(embedding_requests_total)", "refId": "A" }
]
},
{
"id": 20,
"type": "timeseries",
"title": "LLM cost over time by model",
"gridPos": { "h": 8, "w": 12, "x": 0, "y": 52 },
"datasource": { "type": "prometheus", "uid": "prometheus" },
"targets": [
{
"expr": "sum(rate(chat_cost_total[5m])) by (model)",
"legendFormat": "{{model}}",
"refId": "A"
}
],
"fieldConfig": {
"defaults": { "unit": "currencyUSD" },
"overrides": []
}
},
{
"id": 21,
"type": "timeseries",
"title": "Embedding cost over time",
"gridPos": { "h": 8, "w": 12, "x": 12, "y": 52 },
"datasource": { "type": "prometheus", "uid": "prometheus" },
"targets": [
{
"expr": "rate(embedding_cost_total[5m])",
"legendFormat": "cost/sec",
"refId": "A"
}
],
"fieldConfig": {
"defaults": { "unit": "currencyUSD" },
"overrides": []
}
}
]
}
4 changes: 2 additions & 2 deletions Docker/prometheus/alert_rules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ groups:
labels:
severity: critical
annotations:
summary: "Personal chatbot API is down"
summary: "Cortex API is down"
description: "Prometheus has not been able to scrape {{ $labels.instance }} (job {{ $labels.job }}) for 1 minute."

- alert: PrometheusTargetMissing
Expand All @@ -31,7 +31,7 @@ groups:
labels:
severity: critical
annotations:
summary: "High 5xx error rate on the chatbot API"
summary: "High 5xx error rate on the Cortex API"
description: "More than 5% of HTTP requests have returned 5xx over the last 5 minutes (current: {{ $value | humanizePercentage }})."

- alert: APIHighLatencyP95
Expand Down
Loading