-
Notifications
You must be signed in to change notification settings - Fork 1
features_chain_of_thought
Reasoning-Chain für LLM-Interaktionen und strukturierte Abfragelösungen mit Transparenz und Audit-Trail.
- 📋 Übersicht
- ✨ Features
- 🚀 Schnellstart
- 📖 Detaillierte Dokumentation
- 💡 Best Practices
- 🔧 Troubleshooting
- 📚 Siehe auch
- 📝 Changelog
Das Chain-of-Thought Reasoning-System ermöglicht transparente, nachvollziehbare Entscheidungsfindung durch LLM-Interaktionen mit vollständiger Audit-Trail:
- Reasoning Transparency: Schritt-für-Schritt Nachvollziehbarkeit von LLM-Antworten
- Audit Trail: Vollständige Historie aller LLM-Interaktionen und Reasoning Steps
- Performance Analytics: Token-Verbrauch, Latenz-Tracking und Metriken
- Prompt Engineering: Template-Versioning und A/B-Testing von Prompts
- Enterprise Security: Verschlüsselte Speicherung mit audit-log Protection
| Feature | Beschreibung | Status |
|---|---|---|
| Reasoning Chains | Strukturierte Speicherung von Multi-Step Reasoning | ✅ Produktiv |
| LLM Interaction Store | Persistente Speicherung mit UUID-Tracking | ✅ Produktiv |
| Audit Trail | Unveränderbare Historisierung aller Interaktionen | ✅ Produktiv |
| Token Analytics | Tracking von Token-Verbrauch und Kosten | ✅ Produktiv |
| Latency Metrics | Performance-Monitoring für Antwortzeiten | ✅ Produktiv |
| Template Versioning | A/B-Testing und Prompt-Versionierung | ✅ Produktiv |
# 1. Server starten
cd build/Release
./themis_server.exe --config ../../config/config.json
# 2. LLM Interaction Store aktivieren
export THEMIS_LLM_STORE_ENABLED=true
export THEMIS_LLM_STORE_PATH=/var/lib/themis/llm_interactionscurl -X POST http://localhost:8080/llm/interaction \
-H "Content-Type: application/json" \
-d '{
"prompt": "Was ist die Hauptstadt von Deutschland?",
"reasoning_chain": [
"Deutschland ist ein Land in Europa",
"Berlin ist die größte Stadt in Deutschland",
"Berlin ist seit 1990 Hauptstadt"
],
"response": "Die Hauptstadt von Deutschland ist Berlin",
"model_version": "gpt-4",
"latency_ms": 500,
"token_count": 25,
"metadata": {"user_id": "user123"}
}'-
Header:
include/llm/llm_interaction_store.h -
Implementation:
src/llm/llm_interaction_store.cpp -
HTTP Handlers:
src/server/http_server.cpp(handleLlmInteractionPost, handleLlmInteractionList, handleLlmInteractionGet)
struct Interaction {
std::string id; // Auto-generated UUID
std::string prompt_template_id; // Template reference (optional)
std::string prompt; // Actual prompt sent to LLM
std::vector<std::string> reasoning_chain; // CoT steps
std::string response; // Final LLM response
std::string model_version; // e.g., "gpt-4", "gpt-3.5"
int64_t timestamp_ms; // Creation timestamp
int latency_ms; // Response time in ms
int token_count; // Total tokens used
nlohmann::json metadata; // Custom fields (user_id, session_id, etc.)
};- RocksDB: Default Column Family
-
Key Format:
"llm_interaction:{interaction_id}" - Value Format: JSON serialization
-
ID Generation:
{timestamp_hex}-{random_hex}(UUID-like)
Purpose: Create new LLM interaction with reasoning chain
Request:
{
"prompt": "Explain the capital of France",
"reasoning_chain": [
"Step 1: France is a country in Europe",
"Step 2: Paris is the largest city in France",
"Step 3: Paris has been the capital since the 12th century"
],
"response": "The capital of France is Paris.",
"model_version": "gpt-4",
"latency_ms": 1200,
"token_count": 45,
"metadata": {
"user_id": "test_user",
"session_id": "abc123"
}
}Response (201 Created):
{
"success": true,
"interaction": {
"id": "019a3545f06b-f2f8d28537acc860",
"prompt": "Explain the capital of France",
"reasoning_chain": ["Step 1: ...", "Step 2: ...", "Step 3: ..."],
"response": "The capital of France is Paris.",
"model_version": "gpt-4",
"timestamp_ms": 1761830233433,
"latency_ms": 1200,
"token_count": 45,
"metadata": {"user_id": "test_user", "session_id": "abc123"}
}
}Purpose: Retrieve specific interaction by ID
Response (200 OK):
{
"id": "019a3545f06b-f2f8d28537acc860",
"prompt": "Explain the capital of France",
"reasoning_chain": [
"Step 1: France is a country in Europe",
"Step 2: Paris is the largest city in France",
"Step 3: Paris has been the capital since the 12th century"
],
"response": "The capital of France is Paris.",
"model_version": "gpt-4",
"timestamp_ms": 1761830233433,
"latency_ms": 1200,
"token_count": 45,
"metadata": {"user_id": "test_user", "session_id": "abc123"}
}Purpose: List interactions with optional filtering
Query Parameters:
-
limit(default: 100) - Max interactions to return -
start_after_id- Pagination cursor -
filter_model- Filter by model version -
since_timestamp_ms- Filter by time
Response (200 OK):
{
"interactions": [
{
"id": "019a3545f06b-f2f8d28537acc860",
"prompt": "...",
"reasoning_chain": ["..."],
"response": "...",
"model_version": "gpt-4",
"timestamp_ms": 1761830233433,
"latency_ms": 1200,
"token_count": 45,
"metadata": {}
}
],
"total_count": 5
}| Test | Ergebnis | Details |
|---|---|---|
| POST /llm/interaction | ✅ Success | Created interaction with 3-step reasoning chain |
| GET /llm/interaction/:id | ✅ Success | Retrieved interaction with all fields intact |
| Batch Creation | ✅ Success | Created 3 additional interactions |
| List Interactions | ✅ Success | Retrieved 5 interactions total |
| Complex CoT (6 steps) | ✅ Success | Reasoning chain with 6 steps preserved perfectly |
- ✅ Auto-ID Generation: UUID-like IDs
{timestamp}-{random} - ✅ Timestamp Auto-Set: Millisecond precision
- ✅ Reasoning Chain Storage: Arrays preserved exactly
- ✅ Metadata Flexibility: Arbitrary JSON supported
- ✅ Pagination: Cursor-based listing works
- ✅ JSON Serialization: Round-trip without data loss
{
"prompt": "Solve: 8x + 7 = 23",
"reasoning_chain": [
"Subtract 7 from both sides: 8x = 16",
"Divide both sides by 8: x = 2",
"Verify: 8(2) + 7 = 16 + 7 = 23 ✓"
],
"response": "x = 2"
}{
"prompt": "Complex reasoning task",
"reasoning_chain": [
"Analyze problem",
"Break into subproblems",
"Solve step 1: Data gathering",
"Solve step 2: Processing",
"Solve step 3: Synthesis",
"Conclusion"
],
"response": "Final answer after 6 reasoning steps",
"metadata": {"complexity": "high", "domain": "mathematics"}
}{
"prompt_template_id": "summarize_v2.3",
"prompt": "Summarize: {text}",
"model_version": "gpt-4-turbo",
"metadata": {
"template_version": "2.3",
"experiment_id": "ab_test_42"
}
}Tracked Metrics:
-
token_count- Cost estimation and quota management -
latency_ms- Response time analysis -
model_version- Model performance comparison -
timestamp_ms- Time-series analysis
Statistics API (getStats):
struct Stats {
size_t total_interactions;
int64_t total_tokens;
double avg_latency_ms;
size_t total_size_bytes;
};- Privacy-Safe: No PII required in metadata
- Exportierbar: JSON format enables easy data export
- Audit Trail: Complete immutable history
-
Retention Control: Manual cleanup via
deleteInteraction(),clear()
graph LR
A[User Query] --> B[Prompt Template]
B --> C[LLM API]
C --> D[Chain-of-Thought Response]
D --> E[LLMInteractionStore]
E --> F[POST /llm/interaction]
F --> G[RocksDB]
H[Analytics Dashboard] --> I[GET /llm/interaction]
I --> G
- ✅ Implementierung vollständig
- ✅ HTTP API validiert
- ✅ Reasoning Chain Storage funktional
- ⏳ Statistics API Testing
- ⏳ Prometheus Metrics (token_usage, latency_histogram)
- ⏳ Bulk Export API (CSV/JSONL)
- ⏳ Dedicated Column Family (
llm_interactions)
Der LLM Interaction Store ist produktionsbereit und bietet:
- ✅ Strukturierte Chain-of-Thought Speicherung
- ✅ Flexibles Metadata-Schema
- ✅ Vollständige HTTP API (Create, Read, List)
- ✅ Auto-ID & Timestamp Generation
- ✅ Token & Latency Tracking
- ✅ Template Versioning Support
Deployment: Server startet mit aktiviertem LLM Store, Endpoints unter /llm/interaction verfügbar.
ThemisDB v1.3.4 | GitHub | Documentation | Discussions | License
Last synced: January 02, 2026 | Commit: 6add659
Version: 1.3.0 | Stand: Dezember 2025
- Übersicht
- Home
- Dokumentations-Index
- Quick Reference
- Sachstandsbericht 2025
- Features
- Roadmap
- Ecosystem Overview
- Strategische Übersicht
- Geo/Relational Storage
- RocksDB Storage
- MVCC Design
- Transaktionen
- Time-Series
- Memory Tuning
- Chain of Thought Storage
- Query Engine & AQL
- AQL Syntax
- Explain & Profile
- Rekursive Pfadabfragen
- Temporale Graphen
- Zeitbereichs-Abfragen
- Semantischer Cache
- Hybrid Queries (Phase 1.5)
- AQL Hybrid Queries
- Hybrid Queries README
- Hybrid Query Benchmarks
- Subquery Quick Reference
- Subquery Implementation
- Content Pipeline
- Architektur-Details
- Ingestion
- JSON Ingestion Spec
- Enterprise Ingestion Interface
- Geo-Processor Design
- Image-Processor Design
- Hybrid Search Design
- Fulltext API
- Hybrid Fusion API
- Stemming
- Performance Tuning
- Migration Guide
- Future Work
- Pagination Benchmarks
- Enterprise README
- Scalability Features
- HTTP Client Pool
- Build Guide
- Implementation Status
- Final Report
- Integration Analysis
- Enterprise Strategy
- Verschlüsselungsstrategie
- Verschlüsselungsdeployment
- Spaltenverschlüsselung
- Encryption Next Steps
- Multi-Party Encryption
- Key Rotation Strategy
- Security Encryption Gap Analysis
- Audit Logging
- Audit & Retention
- Compliance Audit
- Compliance
- Extended Compliance Features
- Governance-Strategie
- Compliance-Integration
- Governance Usage
- Security/Compliance Review
- Threat Model
- Security Hardening Guide
- Security Audit Checklist
- Security Audit Report
- Security Implementation
- Development README
- Code Quality Pipeline
- Developers Guide
- Cost Models
- Todo Liste
- Tool Todo
- Core Feature Todo
- Priorities
- Implementation Status
- Roadmap
- Future Work
- Next Steps Analysis
- AQL LET Implementation
- Development Audit
- Sprint Summary (2025-11-17)
- WAL Archiving
- Search Gap Analysis
- Source Documentation Plan
- Changefeed README
- Changefeed CMake Patch
- Changefeed OpenAPI
- Changefeed OpenAPI Auth
- Changefeed SSE Examples
- Changefeed Test Harness
- Changefeed Tests
- Dokumentations-Inventar
- Documentation Summary
- Documentation TODO
- Documentation Gap Analysis
- Documentation Consolidation
- Documentation Final Status
- Documentation Phase 3
- Documentation Cleanup Validation
- API
- Authentication
- Cache
- CDC
- Content
- Geo
- Governance
- Index
- LLM
- Query
- Security
- Server
- Storage
- Time Series
- Transaction
- Utils
Vollständige Dokumentation: https://makr-code.github.io/ThemisDB/