Skip to content

Commit 5bde44c

Browse files
committed
Refactor: Remove performance optimizer and server startup scripts
- Deleted `performance-optimizer.ts` which contained the PerformanceOptimizer class and related functionality for query optimization, caching, and metrics tracking. - Removed `start-server.ts` script responsible for initializing the Enhanced MCP server with command line options and event listeners. - Updated test script `test_mcp_tools.py` to reflect changes in tool calls and configuration. - Added new Rust dependency `semchunk-rs` for lightweight semantic chunking, including its Cargo.toml and implementation in `src/lib.rs`.
1 parent 3d21318 commit 5bde44c

File tree

202 files changed

+318225
-241928
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

202 files changed

+318225
-241928
lines changed

.codegraph.toml.example

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,12 @@ batch_size = 64
4242
# Set to false for maximum speed if using an external agent
4343
enabled = false
4444

45-
# LLM provider: "ollama", "lmstudio", "anthropic", "openai", or "openai-compatible"
45+
# LLM provider: "ollama", "lmstudio", "anthropic", "openai", "xai", or "openai-compatible"
4646
# - "lmstudio": Local LLMs via LM Studio (recommended for MLX + Flash Attention 2 on macOS)
4747
# - "ollama": Local LLMs via Ollama
4848
# - "anthropic": Anthropic Claude API (requires API key)
4949
# - "openai": OpenAI GPT API (requires API key)
50+
# - "xai": xAI Grok API (2M context, $0.50-$1.50/M tokens, requires API key)
5051
# - "openai-compatible": Any OpenAI-compatible API endpoint
5152
provider = "lmstudio"
5253

@@ -55,6 +56,7 @@ provider = "lmstudio"
5556
# For Ollama: Model name (e.g., "qwen2.5-coder:14b", "codellama:13b")
5657
# For Anthropic: Model name (e.g., "claude-3-5-sonnet-20241022", "claude-3-5-haiku-20241022")
5758
# For OpenAI: Model name (e.g., "gpt-4o", "gpt-4o-mini", "gpt-4-turbo")
59+
# For xAI: Model name (e.g., "grok-4-fast", "grok-4-turbo")
5860
# For OpenAI-compatible: Custom model name
5961
# Recommended: DeepSeek Coder v2 Lite Instruct Q4_K_M (local), or Claude 3.5 Sonnet (cloud)
6062
model = "lmstudio-community/DeepSeek-Coder-V2-Lite-Instruct-GGUF"
@@ -77,21 +79,30 @@ ollama_url = "http://localhost:11434"
7779
# Can also be set via OPENAI_API_KEY environment variable
7880
# openai_api_key = "sk-..."
7981

82+
# xAI API key (only used if provider is "xai")
83+
# Can also be set via XAI_API_KEY environment variable
84+
# xai_api_key = "xai-..."
85+
86+
# xAI base URL (only used if provider is "xai")
87+
# Default: "https://api.x.ai/v1"
88+
# xai_base_url = "https://api.x.ai/v1"
89+
8090
# Context window size (tokens)
8191
# DeepSeek Coder v2 Lite: 32768 tokens
8292
# Claude 3.5 Sonnet: 200000 tokens
8393
# GPT-4o: 128000 tokens
94+
# Grok-4 (xAI): 2000000 tokens (2M!)
8495
context_window = 32000
8596

8697
# Temperature for generation (0.0 = deterministic, 2.0 = very creative)
8798
temperature = 0.1
8899

89-
# Maximum tokens to generate in responses (legacy parameter, use max_output_tokens for Responses API)
100+
# Maximum tokens to generate in responses (legacy parameter, use max_completion_token for Responses API)
90101
max_tokens = 4096
91102

92103
# Maximum output tokens for Responses API and reasoning models
93104
# If not set, falls back to max_tokens
94-
# max_output_tokens = 4096
105+
# max_completion_token = 4096
95106

96107
# Reasoning effort for reasoning models (o1, o3, o4-mini, GPT-5)
97108
# Options: "minimal", "low", "medium", "high"

.env.example

Lines changed: 38 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,16 @@ CODEGRAPH_EMBEDDING_PROVIDER=auto
3535

3636
# Jina AI: Cloud embeddings with reranking (requires JINA_API_KEY)
3737
# CODEGRAPH_EMBEDDING_PROVIDER=jina
38+
# JINA_EMBEDDING_MODEL=jina-code-embeddings-1.5b
3839
# JINA_API_KEY=your-jina-api-key-here
39-
40+
# JINA_MAX_TEXTS=512 # Leverage Jina API Batch functionality max 512 documents with 8192 tokens each remember to set --max-concurrent 1 when indexing
41+
# JINA_MAX_TOKENS=7000
42+
# CODEGRAPH_RERANK_CANDIDATES=512 # Leverage Jina API Batch functionality also here
43+
# JINA_API_BASE=https://api.jina.ai/v1
44+
# JINA_ENABLE_RERANKING=true
45+
# JINA_RERANKING_MODEL=jina-reranker-v3
46+
# JINA_REQUEST_DELAY_MS=600 # small delay not to throttle the API when batching
47+
# JINA_TRUNCATE=true # truncate texts and embeddings if over limit
4048
# ============================================================================
4149
# Dual-Mode Search Configuration
4250
# ============================================================================
@@ -54,7 +62,8 @@ CODEGRAPH_EMBEDDING_PROVIDER=auto
5462
# Cloud Mode (SurrealDB HNSW + Jina embeddings + reranking)
5563
# ----------------------------------------------------------
5664
# - Uses SurrealDB HNSW indexes for scalable vector search
57-
# - Embeddings: Jina AI (2048 dimensions)
65+
# - Embeddings: Jina AI (Variable Matryosha dimensions - check what the model outputs and adjust schema/codegraph.surql HNSW vector dims)
66+
# - Supported Jina AI embedding models are jina-code-embeddings-1.5b and jina-code-embeddings-0.5b
5867
# - Reranking: Jina reranker-v3 for improved relevance
5968
# - Best for: Cloud deployments, multi-user systems, scalability
6069
# - Requires: SurrealDB instance, Jina API key
@@ -70,7 +79,8 @@ CODEGRAPH_EMBEDDING_PROVIDER=auto
7079
# SURREALDB_PASSWORD=root
7180
#
7281
# Important: HNSW index dimension must match embedding provider
73-
# - Jina v4: 2048 dimensions
82+
# - Jina: Variable Matryoska dimensions depending on model
83+
# - OpenAI: Small 1536 dimensions, Large 3072 dimensions
7484
# - Local ONNX: typically 384 or 768 dimensions
7585
# - Update schema/codegraph.surql if changing providers
7686

@@ -79,25 +89,41 @@ CODEGRAPH_EMBEDDING_PROVIDER=auto
7989
# Leave empty to use context-only mode (fastest, recommended for agents like Claude/GPT-4)
8090
# Set to enable local LLM insights generation
8191

82-
# LM Studio with DeepSeek Coder v2 Lite Instruct (recommended)
92+
# LM Studio with DeepSeek Coder v2 Lite Instruct (or what ever fits in your vGPU memory)
8393
# Supported LLM provider options: "auto", "onnx", "lmstudio", "openai", "claude" or "ollama"
84-
# Superior MLX support and Flash Attention 2 on macOS
94+
# Superior MLX support, Flash Attention 2, KV-cache and Distillation model support on macOS
8595
# CODEGRAPH_LLM_PROVIDER=lmstudio
8696
# CODEGRAPH_MODEL=lmstudio-community/DeepSeek-Coder-V2-Lite-Instruct-GGUF/DeepSeek-Coder-V2-Lite-Instruct-Q4_K_M.gguf
8797
# CODEGRAPH_LMSTUDIO_URL=http://localhost:1234
8898
# CODEGRAPH_CONTEXT_WINDOW=32000
8999
# CODEGRAPH_TEMPERATURE=0.1
90100

91101
# Ollama (alternative)
92-
# LLM model (e.g., "qwen2.5-coder:14b", "codellama:13b")
102+
# LLM model (e.g., "qwen2.5-coder:14b", "Kimi-K2-Instruct")
93103
# CODEGRAPH_MODEL=qwen2.5-coder:14b
94104
# CODEGRAPH_OLLAMA_URL=http://localhost:11434
95-
96-
# LLM context window size (tokens)
97-
# CODEGRAPH_CONTEXT_WINDOW=32000
98-
99-
# LLM temperature (0.0 = deterministic, 1.0 = creative)
100-
# CODEGRAPH_TEMPERATURE=0.1
105+
# CODEGRAPH_CONTEXT_WINDOW=252000 # Max for Ollama depends on the model though
106+
107+
# Anthropic (cloud - 200K/1M tokens)
108+
# CODEGRAPH_LLM_PROVIDER=anthropic
109+
# CODEGRAPH_MODEL=sonnet[1m]
110+
# ANTHROPIC_API_KEY=sk-ant-your-key-here
111+
# CODEGRAPH_CONTEXT_WINDOW=1000000 # 200K/1M tokens
112+
113+
# OpenAI (cloud - 200K/400K tokens)
114+
# CODEGRAPH_LLM_PROVIDER=openai
115+
# CODEGRAPH_MODEL=gpt-5-codex-mini
116+
# OPENAI_API_KEY=sk-your-key-here
117+
# OPENAI_ORG_ID=your_fabulous_org
118+
# CODEGRAPH_CONTEXT_WINDOW=200000 # 400K tokens
119+
# CODEGRAPH_REASONING_BUDGET=medium
120+
121+
# xAI (cloud - 252K/2M context window, $0.50-$1.50/M tokens!)
122+
# CODEGRAPH_LLM_PROVIDER=xai
123+
# CODEGRAPH_MODEL=grok-4-fast # or grok-code-fast-1 252K tokens the price is same
124+
# XAI_API_KEY=xai-your-key-here
125+
# CODEGRAPH_CONTEXT_WINDOW=2000000 # 2M tokens!
126+
# CODEGRAPH_REASONING_BUDGET=high
101127

102128
# Logging
103129
# -------
@@ -151,10 +177,6 @@ LOG_FORMAT=json
151177
METRICS_ENABLED=true
152178
PROMETHEUS_PORT=9090
153179

154-
# OpenAI API (if using external AI services)
155-
# OPENAI_API_KEY=your_openai_api_key_here
156-
# OPENAI_ORG_ID=your_org_id_here
157-
158180
# External Services
159181
# SENTRY_DSN=https://your-sentry-dsn
160182
# ANALYTICS_KEY=your_analytics_key

0 commit comments

Comments
 (0)