Skip to content

Commit 23e7034

Browse files
author
vishal veerareddy
committed
Added llama.cpp and implemented long term memory wrt to TITANS Paper
1 parent 23f7871 commit 23e7034

25 files changed

Lines changed: 6218 additions & 28 deletions

.env

Lines changed: 77 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
# Primary model provider
3-
# Options: ollama, openrouter, azure-openai,openai, azure-anthropic, databricks
4-
MODEL_PROVIDER=azure-openai
3+
# Options: ollama, openrouter, azure-openai, openai, azure-anthropic, databricks, llamacpp
4+
MODEL_PROVIDER=llamacpp
55

66
# Ollama endpoint (local by default)
77
OLLAMA_ENDPOINT=http://localhost:11434
@@ -80,11 +80,29 @@ AZURE_OPENAI_DEPLOYMENT=Kimi-K2-Thinking
8080

8181
# OpenAI organization ID (optional, for organization-level API keys)
8282
# OPENAI_ORGANIZATION=org-your-org-id
83+
84+
# ==============================================================================
85+
# llama.cpp Configuration (Local GGUF Models)
86+
# ==============================================================================
87+
88+
# llama.cpp server endpoint (default: http://localhost:8080)
89+
# Start with: ./llama-server -m model.gguf --port 8080
90+
LLAMACPP_ENDPOINT=http://localhost:8080
91+
92+
# Model name (for logging purposes, llama.cpp uses the loaded model)
93+
LLAMACPP_MODEL=default
94+
95+
# Request timeout in milliseconds (default: 120000)
96+
LLAMACPP_TIMEOUT_MS=120000
97+
98+
# Optional API key (for secured llama.cpp servers)
99+
# LLAMACPP_API_KEY=
100+
83101
# ==============================================================================
84102
# Server Configuration
85103
# ==============================================================================
86104

87-
PORT=8080
105+
PORT=8081
88106
LOG_LEVEL=debug # Use 'debug' for detailed logs, 'info' for production
89107
WEB_SEARCH_ENDPOINT=http://localhost:8888/search
90108

@@ -93,6 +111,62 @@ WEB_SEARCH_ENDPOINT=http://localhost:8888/search
93111
# - passthrough/client: Return tool calls to CLI for local execution
94112
TOOL_EXECUTION_MODE=client
95113

114+
# ==============================================================================
115+
# Long-Term Memory System (Titans-Inspired)
116+
# ==============================================================================
117+
118+
# Enable/disable the entire memory system
119+
# When enabled, automatically extracts and retrieves conversation memories
120+
# Default: true
121+
MEMORY_ENABLED=true
122+
123+
# Maximum number of memories to inject into each request
124+
# Higher = more context but larger prompts
125+
# Default: 5, Range: 1-20
126+
MEMORY_RETRIEVAL_LIMIT=5
127+
128+
# Minimum surprise score (0.0-1.0) required to store a memory
129+
# Filters out redundant information
130+
# Lower (0.1-0.2) = store more memories
131+
# Higher (0.4-0.5) = only store highly novel information
132+
# Default: 0.3
133+
MEMORY_SURPRISE_THRESHOLD=0.3
134+
135+
# Auto-delete memories older than this many days
136+
# Prevents database bloat with stale information
137+
# Default: 90
138+
MEMORY_MAX_AGE_DAYS=90
139+
140+
# Maximum total memories to keep (prunes least important when exceeded)
141+
# Default: 10000
142+
MEMORY_MAX_COUNT=10000
143+
144+
# Enable importance decay over time (exponential decay)
145+
# Memories become less important as they age
146+
# Default: true
147+
MEMORY_DECAY_ENABLED=true
148+
149+
# Days for importance to decay by 50% (exponential half-life)
150+
# Shorter (7-14) = prefer recent info
151+
# Longer (60-90) = value historical context
152+
# Default: 30
153+
MEMORY_DECAY_HALF_LIFE=30
154+
155+
# Include memories with session_id=NULL (global memories) in all sessions
156+
# Global memories = project facts shared across all conversations
157+
# Default: true
158+
MEMORY_INCLUDE_GLOBAL=true
159+
160+
# Where to inject memories in the prompt
161+
# Options: system (recommended), assistant_preamble
162+
# Default: system
163+
MEMORY_INJECTION_FORMAT=system
164+
165+
# Enable automatic extraction of memories from assistant responses
166+
# Disable for read-only memory mode
167+
# Default: true
168+
MEMORY_EXTRACTION_ENABLED=true
169+
96170
# ==============================================================================
97171
# Performance Tuning (Optional)
98172
# ==============================================================================

.env.example

Lines changed: 75 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# ==============================================================================
77

88
# Primary model provider to use
9-
# Options: databricks, azure-anthropic, azure-openai, openrouter, openai, ollama
9+
# Options: databricks, azure-anthropic, azure-openai, openrouter, openai, ollama, llamacpp
1010
# Default: databricks
1111
# MODEL_PROVIDER=databricks
1212

@@ -22,7 +22,7 @@ PREFER_OLLAMA=true
2222
OLLAMA_MODEL=qwen2.5-coder:latest
2323

2424
# Fallback provider when primary provider fails or for complex requests
25-
# Options: databricks, azure-anthropic, azure-openai, openrouter, openai
25+
# Options: databricks, azure-anthropic, azure-openai, openrouter, openai, llamacpp
2626
FALLBACK_PROVIDER=databricks
2727

2828
# Enable automatic fallback (true = transparent fallback, false = fail on provider error)
@@ -84,6 +84,23 @@ OLLAMA_MAX_TOOLS_FOR_ROUTING=3
8484
# OpenAI organization ID (optional, for organization-level API keys)
8585
# OPENAI_ORGANIZATION=org-your-org-id
8686

87+
# ==============================================================================
88+
# llama.cpp Configuration (Local GGUF Models)
89+
# ==============================================================================
90+
91+
# llama.cpp server endpoint (default: http://localhost:8080)
92+
# Start with: ./llama-server -m model.gguf --port 8080
93+
# LLAMACPP_ENDPOINT=http://localhost:8080
94+
95+
# Model name (for logging purposes, llama.cpp uses the loaded model)
96+
# LLAMACPP_MODEL=default
97+
98+
# Request timeout in milliseconds (default: 120000)
99+
# LLAMACPP_TIMEOUT_MS=120000
100+
101+
# Optional API key (for secured llama.cpp servers)
102+
# LLAMACPP_API_KEY=your-optional-api-key
103+
87104
# ==============================================================================
88105
# Server Configuration
89106
# ==============================================================================
@@ -118,6 +135,62 @@ WEB_SEARCH_ENDPOINT=http://localhost:8888/search
118135
# Timeout per subagent (milliseconds)
119136
# AGENTS_TIMEOUT=120000
120137

138+
# ==============================================================================
139+
# Long-Term Memory System (Titans-Inspired)
140+
# ==============================================================================
141+
142+
# Enable/disable the entire memory system
143+
# When enabled, automatically extracts and retrieves conversation memories
144+
# Default: true
145+
# MEMORY_ENABLED=true
146+
147+
# Maximum number of memories to inject into each request
148+
# Higher = more context but larger prompts
149+
# Default: 5, Range: 1-20
150+
# MEMORY_RETRIEVAL_LIMIT=5
151+
152+
# Minimum surprise score (0.0-1.0) required to store a memory
153+
# Filters out redundant information
154+
# Lower (0.1-0.2) = store more memories
155+
# Higher (0.4-0.5) = only store highly novel information
156+
# Default: 0.3
157+
# MEMORY_SURPRISE_THRESHOLD=0.3
158+
159+
# Auto-delete memories older than this many days
160+
# Prevents database bloat with stale information
161+
# Default: 90
162+
# MEMORY_MAX_AGE_DAYS=90
163+
164+
# Maximum total memories to keep (prunes least important when exceeded)
165+
# Default: 10000
166+
# MEMORY_MAX_COUNT=10000
167+
168+
# Enable importance decay over time (exponential decay)
169+
# Memories become less important as they age
170+
# Default: true
171+
# MEMORY_DECAY_ENABLED=true
172+
173+
# Days for importance to decay by 50% (exponential half-life)
174+
# Shorter (7-14) = prefer recent info
175+
# Longer (60-90) = value historical context
176+
# Default: 30
177+
# MEMORY_DECAY_HALF_LIFE=30
178+
179+
# Include memories with session_id=NULL (global memories) in all sessions
180+
# Global memories = project facts shared across all conversations
181+
# Default: true
182+
# MEMORY_INCLUDE_GLOBAL=true
183+
184+
# Where to inject memories in the prompt
185+
# Options: system (recommended), assistant_preamble
186+
# Default: system
187+
# MEMORY_INJECTION_FORMAT=system
188+
189+
# Enable automatic extraction of memories from assistant responses
190+
# Disable for read-only memory mode
191+
# Default: true
192+
# MEMORY_EXTRACTION_ENABLED=true
193+
121194
# ==============================================================================
122195
# Performance & Security
123196
# ==============================================================================

0 commit comments

Comments
 (0)