- Kotlin 51%
- Vue 30.3%
- JavaScript 13.5%
- HTML 4.1%
- CSS 0.8%
- Other 0.3%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
fix smaller issues with search index builder and set mcp to stateless protocol See merge request OE-7035/ssz-lod/melody-2.0!22 |
||
| .devcontainer | ||
| backend | ||
| demo | ||
| gradle/wrapper | ||
| minimal-chat | ||
| testing | ||
| .dockerignore | ||
| .gitattributes | ||
| .gitignore | ||
| .gitlab-ci.yml | ||
| ARCHITECTURE.md | ||
| CLAUDE.md | ||
| docker-compose.yaml | ||
| Dockerfile | ||
| LICENSE | ||
| README.md | ||
| TODO.md | ||
MeLODy 2.0
Project Summary
MeLODy is an AI-powered chatbot for Linked Data Cubes that allows users to ask natural-language questions about statistical data and receive data-driven answers (text, tables, charts). A core principle of MeLODy is transparency: every answer references its underlying data sources, and data can be combined across multiple providers (e.g. City of Zurich, Canton of St. Gallen).
Background & Project Status
- MeLODy 1.x started as a prototype based on a Custom GPT to evaluate whether a chatbot built on Linked Data statistics is feasible. The initial focus was on data from the City of Zurich.
- MeLODy 2.0 has been under development since September 2025. It runs independently of ChatGPT, is deployed on its own infrastructure, and is no longer limited to a single data provider. The current status is beta.
- The application is accessible via a web interface and can be used without registration.
Key Characteristics
- MeLODy consistently leverages the semantics of Linked Data: datasets are uniquely identified via URIs and modeled as triples.
- This enables the system to determine which indicators are truly comparable (same definition, same semantics) and to explicitly flag cases where comparisons are not valid.
- Answers are transparent and reproducible, as they are derived directly from structured data.
Technical Concept (High Level)
MeLODy 2.0 is designed as an agentic system:
- An LLM acts as an orchestrator/router that analyzes user queries, invokes tools, and aggregates results.
- A Cube Index supports discovery of relevant Linked Data Cubes based on the cube.link schema.
- A SPARQL Requester generates and executes SPARQL queries against external endpoints and returns structured results (e.g. tables).
- An Interpreter/Renderer processes query results, performs calculations or aggregations, and produces textual or visual output.
In contrast, MeLODy 1.x was tightly coupled to the constraints of Custom GPTs, with limited control over routing, data access, and scalability.
Data Requirements & Onboarding for New Providers
To integrate new data sources into MeLODy, the following conditions must be met:
- Data is published as Linked Data and follows the cube.link schema.
- Cubes are described using SHACL shapes and include an explicit time dimension.
- Data is provided via a performant SPARQL endpoint that supports real-time queries.
- For onboarding, the SPARQL endpoint and relevant Cube IDs are supplied; after a quality check, the data can be integrated.
Lessons Learned
- Agentic AI systems require iterative development and involve significant trial and error.
- Large data volumes must be offloaded; a single LLM context is insufficient.
- Too many tools increase system complexity—complex workflows should be encapsulated in clearly defined agents or modules.
- The focus shifts from pure intent recognition toward data flows and clean process design.
Admin Dashboard
MeLODy 2.0 includes a comprehensive admin dashboard for monitoring token usage, costs, and quota consumption in real-time.
Access
Dashboard URL: http://localhost:8080/admin/dashboard
Authentication: HTTP Basic Auth (credentials from environment variables)
# Set credentials in environment
export USER_NAME=admin
export USER_PASSWORD=your-secure-password
# Or use existing credentials from your .env file
Features
The dashboard provides:
📊 Current Usage Statistics
- Daily, monthly, and overall token usage
- Cost tracking in CHF
- Request counts
- Quota usage with visual progress bars (green/yellow/red)
📈 Usage History
- 30-day usage trend chart
- Cost breakdown by period (today, yesterday, week, month)
- Historical data for capacity planning
🔄 Session Monitoring
- Active sessions list
- Per-session token usage and costs
- Session activity status
💰 Cost Analysis
- Breakdown by token type (input/output/cached)
- Average cost per request
- Comparison across time periods
REST API
Programmatic access to usage statistics:
# Current usage (daily, monthly, overall)
curl -u admin:password http://localhost:8080/api/admin/quotas/usage/current
# Historical usage (last 30 days)
curl -u admin:password http://localhost:8080/api/admin/quotas/usage/history?days=30
# Active sessions
curl -u admin:password http://localhost:8080/api/admin/quotas/sessions?limit=20
# Cost breakdown
curl -u admin:password http://localhost:8080/api/admin/quotas/costs
Quota Configuration
Token quotas are configured in application.yml:
agent:
quotas:
session:
max-tokens: 100000 # 100k tokens per hour
max-price-chf: 5.0
daily:
max-tokens: 500000 # 500k tokens per day
max-price-chf: 25.0
monthly:
max-tokens: 5000000 # 5M tokens per month
max-price-chf: 500.0
When quotas are exceeded, requests are rejected with German error messages explaining when to retry.
Architecture
See ARCHITECTURE.md for details.
Development
License
This project is licensed under the Apache License 2.0 (Apache-2.0).
See the LICENSE file for details.