@nano-step/nano-brain 2026.6.702 → 2026.6.704
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +128 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
- [Use Cases](#use-cases)
|
|
13
13
|
- [Key Features](#key-features)
|
|
14
14
|
- [Prerequisites](#prerequisites)
|
|
15
|
+
- [Recommended Models & Free Providers](#recommended-models--free-providers)
|
|
15
16
|
- [Quick Start](#quick-start)
|
|
16
17
|
- [Verifying Downloads](#verifying-downloads)
|
|
17
18
|
- [Configuration](#configuration)
|
|
@@ -99,6 +100,111 @@ Before pushing, run `memory_impact` on your changed files to discover what else
|
|
|
99
100
|
- **PostgreSQL 17** with **pgvector 0.8.2** extension
|
|
100
101
|
- **Embedding provider:** Ollama (default, local) or Voyage AI
|
|
101
102
|
|
|
103
|
+
## Recommended Models & Free Providers
|
|
104
|
+
|
|
105
|
+
nano-brain needs two types of AI models: **embedding** (for vector search) and **chat/completion** (for code summarization, session summarization). Both use standard APIs — any OpenAI-compatible provider works.
|
|
106
|
+
|
|
107
|
+
### Embedding Models (via Ollama — free, local)
|
|
108
|
+
|
|
109
|
+
| Model | Dims | Context | Size | Quality | Best For |
|
|
110
|
+
|-------|------|---------|------|---------|----------|
|
|
111
|
+
| **nomic-embed-text** | 768 | 8K tokens | 274 MB | ★★★ | Default choice — handles full functions, CPU-friendly |
|
|
112
|
+
| **mxbai-embed-large** | 1024 | 512 tokens | 670 MB | ★★★★ | Best precision for short code chunks (<500 tokens) |
|
|
113
|
+
| **qwen3-embedding:8b** | 4096 | 8K tokens | 4.9 GB | ★★★★★ | Maximum quality — needs GPU (5 GB+ VRAM) |
|
|
114
|
+
| **bge-m3** | 1024 | 8K tokens | 1.2 GB | ★★★★ | Multilingual codebases, hybrid retrieval |
|
|
115
|
+
| **all-minilm** | 384 | 256 tokens | 46 MB | ★★ | Extreme resource constraints only |
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
# Install your chosen model
|
|
119
|
+
ollama pull nomic-embed-text # recommended default
|
|
120
|
+
ollama pull mxbai-embed-large # upgrade for precision
|
|
121
|
+
ollama pull qwen3-embedding:8b # premium (GPU required)
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
> **Tip:** Start with `nomic-embed-text`. It handles long functions without truncation and runs on CPU. Upgrade only if retrieval quality matters for your use case.
|
|
125
|
+
|
|
126
|
+
### Chat/Completion Models (for code & session summarization)
|
|
127
|
+
|
|
128
|
+
These providers offer **free tiers** with OpenAI-compatible `/chat/completions` endpoints — plug directly into nano-brain's `code_summarization` and `summarization` config.
|
|
129
|
+
|
|
130
|
+
| Provider | Free Tier | Rate Limits | Best Model | Speed |
|
|
131
|
+
|----------|-----------|-------------|------------|-------|
|
|
132
|
+
| **[Cerebras](https://cerebras.ai)** | 1M tokens/day | 30 req/min | `llama3.1-8b` | ~2,000 tok/s |
|
|
133
|
+
| **[Groq](https://groq.com)** | Ongoing (no expiry) | 30 req/min, 14.4K req/day | `llama-3.3-70b-versatile` | ~400 tok/s |
|
|
134
|
+
| **[Together AI](https://together.ai)** | $25 free credits | 60 req/min | `meta-llama/Llama-3.3-70B-Instruct-Turbo` | ~200 tok/s |
|
|
135
|
+
| **[Google AI Studio](https://ai.google.dev)** | 1,500 req/day | 15 req/min | `gemini-2.0-flash` | ~300 tok/s |
|
|
136
|
+
| **Ollama (local)** | Unlimited | Hardware-bound | `qwen3:8b`, `llama3.1:8b` | Depends on GPU |
|
|
137
|
+
|
|
138
|
+
> **Note:** Google Gemini is NOT OpenAI-compatible natively — use it via a proxy like [9router](https://github.com/nano-step/9router) or [LiteLLM](https://github.com/BerriAI/litellm) to get a `/chat/completions` endpoint.
|
|
139
|
+
|
|
140
|
+
### Configuration Examples
|
|
141
|
+
|
|
142
|
+
**Cerebras (recommended — fastest free inference):**
|
|
143
|
+
|
|
144
|
+
```yaml
|
|
145
|
+
code_summarization:
|
|
146
|
+
enabled: true
|
|
147
|
+
provider_url: "https://api.cerebras.ai/v1"
|
|
148
|
+
api_key: "your-cerebras-key" # free signup, no credit card
|
|
149
|
+
model: "llama3.1-8b"
|
|
150
|
+
|
|
151
|
+
summarization:
|
|
152
|
+
enabled: true
|
|
153
|
+
provider_url: "https://api.cerebras.ai/v1"
|
|
154
|
+
api_key: "your-cerebras-key"
|
|
155
|
+
model: "llama3.1-8b"
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
**Groq (generous free tier, great for throughput):**
|
|
159
|
+
|
|
160
|
+
```yaml
|
|
161
|
+
code_summarization:
|
|
162
|
+
enabled: true
|
|
163
|
+
provider_url: "https://api.groq.com/openai/v1"
|
|
164
|
+
api_key: "your-groq-key" # free signup
|
|
165
|
+
model: "llama-3.3-70b-versatile"
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
**Together AI (200+ models, $25 free credits):**
|
|
169
|
+
|
|
170
|
+
```yaml
|
|
171
|
+
code_summarization:
|
|
172
|
+
enabled: true
|
|
173
|
+
provider_url: "https://api.together.ai/v1"
|
|
174
|
+
api_key: "your-together-key" # $25 free, no card required
|
|
175
|
+
model: "meta-llama/Llama-3.3-70B-Instruct-Turbo"
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
**Ollama (fully local, no API key needed):**
|
|
179
|
+
|
|
180
|
+
```yaml
|
|
181
|
+
code_summarization:
|
|
182
|
+
enabled: true
|
|
183
|
+
provider_url: "http://localhost:11434/v1"
|
|
184
|
+
api_key: ""
|
|
185
|
+
model: "qwen3:8b"
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
**Via 9router (proxy multiple providers):**
|
|
189
|
+
|
|
190
|
+
```yaml
|
|
191
|
+
code_summarization:
|
|
192
|
+
enabled: true
|
|
193
|
+
provider_url: "http://localhost:9090/v1" # 9router endpoint
|
|
194
|
+
api_key: ""
|
|
195
|
+
model: "nano-brain" # routed by 9router config
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
### Provider Selection Guide
|
|
199
|
+
|
|
200
|
+
| You want... | Use |
|
|
201
|
+
|-------------|-----|
|
|
202
|
+
| Zero cost, no API keys, full privacy | Ollama (local) |
|
|
203
|
+
| Free cloud, fastest inference | Cerebras |
|
|
204
|
+
| Free cloud, best model quality | Groq (`llama-3.3-70b`) |
|
|
205
|
+
| Many model options, startup-friendly | Together AI |
|
|
206
|
+
| Route through multiple providers | 9router / LiteLLM proxy |
|
|
207
|
+
|
|
102
208
|
## Quick Start
|
|
103
209
|
|
|
104
210
|
> **Let your AI agent set this up for you.** See [SETUP_AGENT.md](docs/SETUP_AGENT.md) — a step-by-step guide your agent can follow to install, configure, and verify nano-brain, checking for missing dependencies and asking before installing anything.
|
|
@@ -480,6 +586,28 @@ export NANO_BRAIN_SUMMARIZE_API_KEY="sk-..."
|
|
|
480
586
|
|
|
481
587
|
Large sessions (100K+ tokens) are handled via map-reduce chunking — no session is too large.
|
|
482
588
|
|
|
589
|
+
### Query Preprocessing (Search Quality)
|
|
590
|
+
|
|
591
|
+
When `search.query_preprocessing.enabled: true`, nano-brain uses an LLM to preprocess search queries before execution — translating non-English queries to English, expanding with related terms, and detecting temporal intent. This improves retrieval quality for natural language queries.
|
|
592
|
+
|
|
593
|
+
```yaml
|
|
594
|
+
search:
|
|
595
|
+
bm25_language: "english" # "english" (default) or "simple" (language-agnostic)
|
|
596
|
+
query_preprocessing:
|
|
597
|
+
enabled: false # set to true to activate
|
|
598
|
+
provider_url: "" # OpenAI-compatible endpoint (reuse summarization provider)
|
|
599
|
+
api_key: "" # or set NANO_BRAIN_SEARCH_PREPROCESS_API_KEY
|
|
600
|
+
model: "" # model for query preprocessing
|
|
601
|
+
max_latency_ms: 500 # timeout — falls back to raw query on timeout
|
|
602
|
+
|
|
603
|
+
watcher:
|
|
604
|
+
chunk_overlap: 600 # bytes of overlap between adjacent chunks (default: 600)
|
|
605
|
+
```
|
|
606
|
+
|
|
607
|
+
**How it works:** The preprocessor makes a single LLM call that returns: translated query (if non-English), 2-3 expansion terms, intent classification (keyword/conceptual/temporal), and optional time filter extraction. On timeout or error, the original query passes through unchanged.
|
|
608
|
+
|
|
609
|
+
**Multilingual note:** If you primarily query in English, `nomic-embed-text` is sufficient. For multilingual workspaces, consider switching to `bge-m3` (1024d) — this requires re-embedding all chunks (`POST /api/v1/update`).
|
|
610
|
+
|
|
483
611
|
### Environment Variables
|
|
484
612
|
|
|
485
613
|
| Variable | Description |
|