vortexa 0.3.4__tar.gz → 0.3.5__tar.gz
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.
- {vortexa-0.3.4 → vortexa-0.3.5}/PKG-INFO +58 -13
- {vortexa-0.3.4 → vortexa-0.3.5}/README.md +57 -12
- {vortexa-0.3.4 → vortexa-0.3.5}/pyproject.toml +1 -1
- {vortexa-0.3.4 → vortexa-0.3.5}/src/vortexa/core/indexer.py +2 -2
- {vortexa-0.3.4 → vortexa-0.3.5}/src/vortexa/core/inference.py +46 -11
- vortexa-0.3.5/src/vortexa/core/lf2_model.py +320 -0
- {vortexa-0.3.4 → vortexa-0.3.5}/src/vortexa/core/v4_embedder.py +46 -10
- {vortexa-0.3.4 → vortexa-0.3.5}/src/vortexa/interfaces/cli.py +29 -25
- {vortexa-0.3.4 → vortexa-0.3.5}/src/vortexa/interfaces/mcp_server.py +55 -4
- {vortexa-0.3.4 → vortexa-0.3.5}/src/vortexa.egg-info/PKG-INFO +58 -13
- {vortexa-0.3.4 → vortexa-0.3.5}/src/vortexa.egg-info/SOURCES.txt +4 -1
- vortexa-0.3.5/tests/test_lf2_model.py +121 -0
- vortexa-0.3.5/tests/test_mcp_server.py +10 -0
- {vortexa-0.3.4 → vortexa-0.3.5}/LICENSE +0 -0
- {vortexa-0.3.4 → vortexa-0.3.5}/setup.cfg +0 -0
- {vortexa-0.3.4 → vortexa-0.3.5}/src/vortexa/__init__.py +0 -0
- {vortexa-0.3.4 → vortexa-0.3.5}/src/vortexa/core/__init__.py +0 -0
- {vortexa-0.3.4 → vortexa-0.3.5}/src/vortexa/core/chunking.py +0 -0
- {vortexa-0.3.4 → vortexa-0.3.5}/src/vortexa/core/context_engine.py +0 -0
- {vortexa-0.3.4 → vortexa-0.3.5}/src/vortexa/core/embedding.py +0 -0
- {vortexa-0.3.4 → vortexa-0.3.5}/src/vortexa/core/graph.py +0 -0
- {vortexa-0.3.4 → vortexa-0.3.5}/src/vortexa/core/language.py +0 -0
- {vortexa-0.3.4 → vortexa-0.3.5}/src/vortexa/core/lf4_v4_model.py +0 -0
- {vortexa-0.3.4 → vortexa-0.3.5}/src/vortexa/core/types.py +0 -0
- {vortexa-0.3.4 → vortexa-0.3.5}/src/vortexa/core/vortex_score.py +0 -0
- {vortexa-0.3.4 → vortexa-0.3.5}/src/vortexa/interfaces/__init__.py +0 -0
- {vortexa-0.3.4 → vortexa-0.3.5}/src/vortexa/interfaces/watcher.py +0 -0
- {vortexa-0.3.4 → vortexa-0.3.5}/src/vortexa/search/__init__.py +0 -0
- {vortexa-0.3.4 → vortexa-0.3.5}/src/vortexa/search/ranking.py +0 -0
- {vortexa-0.3.4 → vortexa-0.3.5}/src/vortexa/search/search.py +0 -0
- {vortexa-0.3.4 → vortexa-0.3.5}/src/vortexa/search/tokens.py +0 -0
- {vortexa-0.3.4 → vortexa-0.3.5}/src/vortexa/storage/__init__.py +0 -0
- {vortexa-0.3.4 → vortexa-0.3.5}/src/vortexa/storage/bm25.py +0 -0
- {vortexa-0.3.4 → vortexa-0.3.5}/src/vortexa/storage/vector_store.py +0 -0
- {vortexa-0.3.4 → vortexa-0.3.5}/src/vortexa/storage/walker.py +0 -0
- {vortexa-0.3.4 → vortexa-0.3.5}/src/vortexa.egg-info/dependency_links.txt +0 -0
- {vortexa-0.3.4 → vortexa-0.3.5}/src/vortexa.egg-info/entry_points.txt +0 -0
- {vortexa-0.3.4 → vortexa-0.3.5}/src/vortexa.egg-info/requires.txt +0 -0
- {vortexa-0.3.4 → vortexa-0.3.5}/src/vortexa.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: vortexa
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.5
|
|
4
4
|
Summary: Codebase indexing and semantic search engine
|
|
5
5
|
Author-email: VortexAI <koulabhay25@gmail.com>
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -63,6 +63,7 @@ _Dense + sparse hybrid retrieval · AST-aware chunking · LMDB persistence · MC
|
|
|
63
63
|
- [CLI Search](#cli-search)
|
|
64
64
|
- [MCP Server](#mcp-server)
|
|
65
65
|
- [Usage with Claude Code / Cursor](#usage-with-claude-code--cursor)
|
|
66
|
+
- [Agent Skill](#agent-skill)
|
|
66
67
|
- [Architecture](#architecture)
|
|
67
68
|
- [Dependencies](#dependencies)
|
|
68
69
|
- [License](#license)
|
|
@@ -77,7 +78,7 @@ _Dense + sparse hybrid retrieval · AST-aware chunking · LMDB persistence · MC
|
|
|
77
78
|
|
|
78
79
|
vortexa is a standalone **codebase indexing and semantic search engine** designed for AI agents and developers. It builds a persistent, hybrid search index over source code using:
|
|
79
80
|
|
|
80
|
-
- **Dense retrieval** via VortexEmbedderV4 (
|
|
81
|
+
- **Dense retrieval** via VortexEmbedderV4 (native LF2/LF4 dequant, SIF+PC, Matryoshka) or static embeddings (Model2Vec / SentenceTransformers)
|
|
81
82
|
- **Sparse retrieval** via BM25 keyword scoring
|
|
82
83
|
- **AST-aware chunking** that respects function and class boundaries via tree-sitter
|
|
83
84
|
- **LMDB-backed storage** for fast, persistent vector and chunk storage
|
|
@@ -126,7 +127,7 @@ vortexa can run as a **standalone Python library**, be embedded into any agent,
|
|
|
126
127
|
</tr>
|
|
127
128
|
<tr>
|
|
128
129
|
<td><strong>MCP server</strong></td>
|
|
129
|
-
<td>Expose
|
|
130
|
+
<td>Expose <code>search</code>, <code>resolve</code>, and <code>explain</code> tools for MCP-compatible agents (Claude Code, Cursor, etc.)</td>
|
|
130
131
|
</tr>
|
|
131
132
|
<tr>
|
|
132
133
|
<td><strong>Zero mandatory heavy deps</strong></td>
|
|
@@ -310,7 +311,8 @@ Useful flags:
|
|
|
310
311
|
| `--force` | Force a full re-index before searching. |
|
|
311
312
|
| `--no-index` | Search the existing index only. |
|
|
312
313
|
| `--plain` | Print human-readable results instead of JSON. |
|
|
313
|
-
| `--model` | Embedding model ID or alias (`mini`, `nano
|
|
314
|
+
| `--model` | Embedding model ID or alias (`mini`, `nano`; both use LF2 by default). Use `mini-full` or `nano-full` for LF4. |
|
|
315
|
+
| `-f`, `--fast` | Explicitly select LF2 for a full-model alias. The `mini` and `nano` aliases already use LF2. |
|
|
314
316
|
|
|
315
317
|
By default CLI output is JSON:
|
|
316
318
|
|
|
@@ -338,14 +340,18 @@ vortexa-serve
|
|
|
338
340
|
|
|
339
341
|
## Model Configuration
|
|
340
342
|
|
|
341
|
-
vortexa supports configurable embedding models. The default is `mini`
|
|
343
|
+
vortexa supports configurable embedding models. The default is `mini`
|
|
344
|
+
(`VTXAI/vtx-embed-7M-lf2`), using the native LF2 2-bit checkpoint. Use
|
|
345
|
+
`mini-full` or `nano-full` to select the original LF4 checkpoints.
|
|
342
346
|
|
|
343
347
|
### Available Models
|
|
344
348
|
|
|
345
349
|
| Alias | Model ID | Description |
|
|
346
350
|
|-------|----------|-------------|
|
|
347
|
-
| `mini` | `VTXAI/vtx-embed-7M` | Default
|
|
348
|
-
| `nano` | `VTXAI/vtx-embed-1M` |
|
|
351
|
+
| `mini` | `VTXAI/vtx-embed-7M-lf2` | Default native 2-bit 7M model. 256-dimensional embeddings. |
|
|
352
|
+
| `nano` | `VTXAI/vtx-embed-1M-lf2` | Default native 2-bit 1M model. 64-dimensional embeddings. |
|
|
353
|
+
| `mini-full` | `VTXAI/vtx-embed-7M` | Original LF4 checkpoint for maximum quality. |
|
|
354
|
+
| `nano-full` | `VTXAI/vtx-embed-1M` | Original LF4 lightweight checkpoint. |
|
|
349
355
|
|
|
350
356
|
### CLI Usage
|
|
351
357
|
|
|
@@ -365,11 +371,14 @@ vortexa -q "authentication" --model VTXAI/vtx-embed-1M /path/to/project
|
|
|
365
371
|
```python
|
|
366
372
|
from vortexa.core.indexer import CodebaseIndexer
|
|
367
373
|
|
|
368
|
-
# Use nano model
|
|
369
|
-
indexer = CodebaseIndexer(root="/path/to/project", model_id="
|
|
374
|
+
# Use nano model (LF2 by default)
|
|
375
|
+
indexer = CodebaseIndexer(root="/path/to/project", model_id="nano")
|
|
370
376
|
|
|
371
|
-
# Use mini model (default)
|
|
372
|
-
indexer = CodebaseIndexer(root="/path/to/project", model_id="
|
|
377
|
+
# Use mini model (LF2 by default)
|
|
378
|
+
indexer = CodebaseIndexer(root="/path/to/project", model_id="mini")
|
|
379
|
+
|
|
380
|
+
# Opt into the original LF4 checkpoint
|
|
381
|
+
indexer = CodebaseIndexer(root="/path/to/project", model_id="mini-full")
|
|
373
382
|
```
|
|
374
383
|
|
|
375
384
|
### Alternative Embedders
|
|
@@ -441,11 +450,17 @@ On startup it indexes the current working directory and prints stats to stderr:
|
|
|
441
450
|
[vortexa] Auto-reindex watcher started (polling every 3s)
|
|
442
451
|
```
|
|
443
452
|
|
|
444
|
-
The server exposes
|
|
453
|
+
The server exposes three tools:
|
|
445
454
|
|
|
446
455
|
| Tool | Description | Arguments |
|
|
447
456
|
|------|-------------|-----------|
|
|
448
457
|
| `search` | Semantic + BM25 hybrid code search | `query` (str), `top_k` (int, default 10) |
|
|
458
|
+
| `resolve` | Feature-level search with graph context, tests, imports, callers, and callees | `query` (str), `top_k` (int, default 5) |
|
|
459
|
+
| `explain` | Explain a file, `file:line` location, or symbol | `location` (str) |
|
|
460
|
+
|
|
461
|
+
Use `search` for discovery, `resolve` when you need feature context, and
|
|
462
|
+
`explain` when the file or symbol is already known. The server indexes the
|
|
463
|
+
current directory and auto-reindexes it while running.
|
|
449
464
|
|
|
450
465
|
### Usage with Claude Code / Cursor
|
|
451
466
|
|
|
@@ -469,6 +484,36 @@ The agent will now have access to semantic code search — it can find functions
|
|
|
469
484
|
|
|
470
485
|
<div align="center">
|
|
471
486
|
|
|
487
|
+
## Agent Skill
|
|
488
|
+
|
|
489
|
+
</div>
|
|
490
|
+
|
|
491
|
+
Vortexa ships with an Agent Skills-compatible skill at
|
|
492
|
+
[`skills/vortexa/SKILL.md`](skills/vortexa/SKILL.md). It teaches compatible
|
|
493
|
+
agents when to prefer Vortexa, how to choose between `search`, `resolve`, and
|
|
494
|
+
`explain`, and how to interpret returned file paths, line ranges, scores, and
|
|
495
|
+
graph context.
|
|
496
|
+
|
|
497
|
+
The skill follows the standard `SKILL.md` structure: YAML frontmatter with a
|
|
498
|
+
lowercase hyphenated name and trigger-oriented description, followed by
|
|
499
|
+
workflow instructions. Copy or link the `skills/vortexa` directory into the
|
|
500
|
+
skills directory used by your agent environment.
|
|
501
|
+
|
|
502
|
+
```markdown
|
|
503
|
+
---
|
|
504
|
+
name: vortexa
|
|
505
|
+
description: Use Vortexa to index and semantically search local codebases...
|
|
506
|
+
---
|
|
507
|
+
```
|
|
508
|
+
|
|
509
|
+
Use the installed MCP server when available; otherwise the same workflow is
|
|
510
|
+
available through the `vortexa search`, `vortexa resolve`, and
|
|
511
|
+
`vortexa explain` commands.
|
|
512
|
+
|
|
513
|
+
---
|
|
514
|
+
|
|
515
|
+
<div align="center">
|
|
516
|
+
|
|
472
517
|
## Architecture
|
|
473
518
|
|
|
474
519
|
</div>
|
|
@@ -613,7 +658,7 @@ graph TD
|
|
|
613
658
|
| `bm25s` | Yes | Fast BM25 keyword index and persistence |
|
|
614
659
|
| `pathspec` | Yes | `.gitignore` pattern matching in file walker |
|
|
615
660
|
| `model2vec` | Optional | Alternative static embeddings |
|
|
616
|
-
| `huggingface-hub` | Yes (default model) | Loading `VTXAI/vtx-embed-7M
|
|
661
|
+
| `huggingface-hub` | Yes (default model) | Loading LF2 defaults (`VTXAI/vtx-embed-7M-lf2`, `VTXAI/vtx-embed-1M-lf2`) |
|
|
617
662
|
| `tokenizers` | Yes (default model) | HF tokenizer for embedding model |
|
|
618
663
|
| `safetensors` | Yes (default model) | Safe tensor loading for 4-bit weights |
|
|
619
664
|
| `sentence-transformers` | Optional | Transformer-based dense embeddings |
|
|
@@ -28,6 +28,7 @@ _Dense + sparse hybrid retrieval · AST-aware chunking · LMDB persistence · MC
|
|
|
28
28
|
- [CLI Search](#cli-search)
|
|
29
29
|
- [MCP Server](#mcp-server)
|
|
30
30
|
- [Usage with Claude Code / Cursor](#usage-with-claude-code--cursor)
|
|
31
|
+
- [Agent Skill](#agent-skill)
|
|
31
32
|
- [Architecture](#architecture)
|
|
32
33
|
- [Dependencies](#dependencies)
|
|
33
34
|
- [License](#license)
|
|
@@ -42,7 +43,7 @@ _Dense + sparse hybrid retrieval · AST-aware chunking · LMDB persistence · MC
|
|
|
42
43
|
|
|
43
44
|
vortexa is a standalone **codebase indexing and semantic search engine** designed for AI agents and developers. It builds a persistent, hybrid search index over source code using:
|
|
44
45
|
|
|
45
|
-
- **Dense retrieval** via VortexEmbedderV4 (
|
|
46
|
+
- **Dense retrieval** via VortexEmbedderV4 (native LF2/LF4 dequant, SIF+PC, Matryoshka) or static embeddings (Model2Vec / SentenceTransformers)
|
|
46
47
|
- **Sparse retrieval** via BM25 keyword scoring
|
|
47
48
|
- **AST-aware chunking** that respects function and class boundaries via tree-sitter
|
|
48
49
|
- **LMDB-backed storage** for fast, persistent vector and chunk storage
|
|
@@ -91,7 +92,7 @@ vortexa can run as a **standalone Python library**, be embedded into any agent,
|
|
|
91
92
|
</tr>
|
|
92
93
|
<tr>
|
|
93
94
|
<td><strong>MCP server</strong></td>
|
|
94
|
-
<td>Expose
|
|
95
|
+
<td>Expose <code>search</code>, <code>resolve</code>, and <code>explain</code> tools for MCP-compatible agents (Claude Code, Cursor, etc.)</td>
|
|
95
96
|
</tr>
|
|
96
97
|
<tr>
|
|
97
98
|
<td><strong>Zero mandatory heavy deps</strong></td>
|
|
@@ -275,7 +276,8 @@ Useful flags:
|
|
|
275
276
|
| `--force` | Force a full re-index before searching. |
|
|
276
277
|
| `--no-index` | Search the existing index only. |
|
|
277
278
|
| `--plain` | Print human-readable results instead of JSON. |
|
|
278
|
-
| `--model` | Embedding model ID or alias (`mini`, `nano
|
|
279
|
+
| `--model` | Embedding model ID or alias (`mini`, `nano`; both use LF2 by default). Use `mini-full` or `nano-full` for LF4. |
|
|
280
|
+
| `-f`, `--fast` | Explicitly select LF2 for a full-model alias. The `mini` and `nano` aliases already use LF2. |
|
|
279
281
|
|
|
280
282
|
By default CLI output is JSON:
|
|
281
283
|
|
|
@@ -303,14 +305,18 @@ vortexa-serve
|
|
|
303
305
|
|
|
304
306
|
## Model Configuration
|
|
305
307
|
|
|
306
|
-
vortexa supports configurable embedding models. The default is `mini`
|
|
308
|
+
vortexa supports configurable embedding models. The default is `mini`
|
|
309
|
+
(`VTXAI/vtx-embed-7M-lf2`), using the native LF2 2-bit checkpoint. Use
|
|
310
|
+
`mini-full` or `nano-full` to select the original LF4 checkpoints.
|
|
307
311
|
|
|
308
312
|
### Available Models
|
|
309
313
|
|
|
310
314
|
| Alias | Model ID | Description |
|
|
311
315
|
|-------|----------|-------------|
|
|
312
|
-
| `mini` | `VTXAI/vtx-embed-7M` | Default
|
|
313
|
-
| `nano` | `VTXAI/vtx-embed-1M` |
|
|
316
|
+
| `mini` | `VTXAI/vtx-embed-7M-lf2` | Default native 2-bit 7M model. 256-dimensional embeddings. |
|
|
317
|
+
| `nano` | `VTXAI/vtx-embed-1M-lf2` | Default native 2-bit 1M model. 64-dimensional embeddings. |
|
|
318
|
+
| `mini-full` | `VTXAI/vtx-embed-7M` | Original LF4 checkpoint for maximum quality. |
|
|
319
|
+
| `nano-full` | `VTXAI/vtx-embed-1M` | Original LF4 lightweight checkpoint. |
|
|
314
320
|
|
|
315
321
|
### CLI Usage
|
|
316
322
|
|
|
@@ -330,11 +336,14 @@ vortexa -q "authentication" --model VTXAI/vtx-embed-1M /path/to/project
|
|
|
330
336
|
```python
|
|
331
337
|
from vortexa.core.indexer import CodebaseIndexer
|
|
332
338
|
|
|
333
|
-
# Use nano model
|
|
334
|
-
indexer = CodebaseIndexer(root="/path/to/project", model_id="
|
|
339
|
+
# Use nano model (LF2 by default)
|
|
340
|
+
indexer = CodebaseIndexer(root="/path/to/project", model_id="nano")
|
|
335
341
|
|
|
336
|
-
# Use mini model (default)
|
|
337
|
-
indexer = CodebaseIndexer(root="/path/to/project", model_id="
|
|
342
|
+
# Use mini model (LF2 by default)
|
|
343
|
+
indexer = CodebaseIndexer(root="/path/to/project", model_id="mini")
|
|
344
|
+
|
|
345
|
+
# Opt into the original LF4 checkpoint
|
|
346
|
+
indexer = CodebaseIndexer(root="/path/to/project", model_id="mini-full")
|
|
338
347
|
```
|
|
339
348
|
|
|
340
349
|
### Alternative Embedders
|
|
@@ -406,11 +415,17 @@ On startup it indexes the current working directory and prints stats to stderr:
|
|
|
406
415
|
[vortexa] Auto-reindex watcher started (polling every 3s)
|
|
407
416
|
```
|
|
408
417
|
|
|
409
|
-
The server exposes
|
|
418
|
+
The server exposes three tools:
|
|
410
419
|
|
|
411
420
|
| Tool | Description | Arguments |
|
|
412
421
|
|------|-------------|-----------|
|
|
413
422
|
| `search` | Semantic + BM25 hybrid code search | `query` (str), `top_k` (int, default 10) |
|
|
423
|
+
| `resolve` | Feature-level search with graph context, tests, imports, callers, and callees | `query` (str), `top_k` (int, default 5) |
|
|
424
|
+
| `explain` | Explain a file, `file:line` location, or symbol | `location` (str) |
|
|
425
|
+
|
|
426
|
+
Use `search` for discovery, `resolve` when you need feature context, and
|
|
427
|
+
`explain` when the file or symbol is already known. The server indexes the
|
|
428
|
+
current directory and auto-reindexes it while running.
|
|
414
429
|
|
|
415
430
|
### Usage with Claude Code / Cursor
|
|
416
431
|
|
|
@@ -434,6 +449,36 @@ The agent will now have access to semantic code search — it can find functions
|
|
|
434
449
|
|
|
435
450
|
<div align="center">
|
|
436
451
|
|
|
452
|
+
## Agent Skill
|
|
453
|
+
|
|
454
|
+
</div>
|
|
455
|
+
|
|
456
|
+
Vortexa ships with an Agent Skills-compatible skill at
|
|
457
|
+
[`skills/vortexa/SKILL.md`](skills/vortexa/SKILL.md). It teaches compatible
|
|
458
|
+
agents when to prefer Vortexa, how to choose between `search`, `resolve`, and
|
|
459
|
+
`explain`, and how to interpret returned file paths, line ranges, scores, and
|
|
460
|
+
graph context.
|
|
461
|
+
|
|
462
|
+
The skill follows the standard `SKILL.md` structure: YAML frontmatter with a
|
|
463
|
+
lowercase hyphenated name and trigger-oriented description, followed by
|
|
464
|
+
workflow instructions. Copy or link the `skills/vortexa` directory into the
|
|
465
|
+
skills directory used by your agent environment.
|
|
466
|
+
|
|
467
|
+
```markdown
|
|
468
|
+
---
|
|
469
|
+
name: vortexa
|
|
470
|
+
description: Use Vortexa to index and semantically search local codebases...
|
|
471
|
+
---
|
|
472
|
+
```
|
|
473
|
+
|
|
474
|
+
Use the installed MCP server when available; otherwise the same workflow is
|
|
475
|
+
available through the `vortexa search`, `vortexa resolve`, and
|
|
476
|
+
`vortexa explain` commands.
|
|
477
|
+
|
|
478
|
+
---
|
|
479
|
+
|
|
480
|
+
<div align="center">
|
|
481
|
+
|
|
437
482
|
## Architecture
|
|
438
483
|
|
|
439
484
|
</div>
|
|
@@ -578,7 +623,7 @@ graph TD
|
|
|
578
623
|
| `bm25s` | Yes | Fast BM25 keyword index and persistence |
|
|
579
624
|
| `pathspec` | Yes | `.gitignore` pattern matching in file walker |
|
|
580
625
|
| `model2vec` | Optional | Alternative static embeddings |
|
|
581
|
-
| `huggingface-hub` | Yes (default model) | Loading `VTXAI/vtx-embed-7M
|
|
626
|
+
| `huggingface-hub` | Yes (default model) | Loading LF2 defaults (`VTXAI/vtx-embed-7M-lf2`, `VTXAI/vtx-embed-1M-lf2`) |
|
|
582
627
|
| `tokenizers` | Yes (default model) | HF tokenizer for embedding model |
|
|
583
628
|
| `safetensors` | Yes (default model) | Safe tensor loading for 4-bit weights |
|
|
584
629
|
| `sentence-transformers` | Optional | Transformer-based dense embeddings |
|
|
@@ -87,7 +87,7 @@ class CodebaseIndexer:
|
|
|
87
87
|
self,
|
|
88
88
|
root: str | Path,
|
|
89
89
|
model: Encoder | Embedder | None = None,
|
|
90
|
-
model_id: str = "VTXAI/vtx-embed-7M",
|
|
90
|
+
model_id: str = "VTXAI/vtx-embed-7M-lf2",
|
|
91
91
|
index_dir: str | Path | None = None,
|
|
92
92
|
chunk_config: ChunkConfig | None = None,
|
|
93
93
|
) -> None:
|
|
@@ -113,7 +113,7 @@ class CodebaseIndexer:
|
|
|
113
113
|
self._model = model
|
|
114
114
|
else:
|
|
115
115
|
from vortexa.core.v4_embedder import VortexEmbedderV4
|
|
116
|
-
self._embedder = VortexEmbedderV4(model_id or "VTXAI/vtx-embed-7M")
|
|
116
|
+
self._embedder = VortexEmbedderV4(model_id or "VTXAI/vtx-embed-7M-lf2")
|
|
117
117
|
self._model = self._embedder
|
|
118
118
|
|
|
119
119
|
# In-memory state
|
|
@@ -24,6 +24,10 @@ Quick start:
|
|
|
24
24
|
nano = VortexEmbedInference("nano")
|
|
25
25
|
print(nano.dim) # nano's native dim
|
|
26
26
|
|
|
27
|
+
# Use LF2 models (native 2-bit quantization)
|
|
28
|
+
mini_lf2 = VortexEmbedInference("mini-lf2")
|
|
29
|
+
nano_lf2 = VortexEmbedInference("nano-lf2")
|
|
30
|
+
|
|
27
31
|
Convenience function (stateless):
|
|
28
32
|
from vortexa.core.inference import embed
|
|
29
33
|
|
|
@@ -41,12 +45,24 @@ import numpy as np
|
|
|
41
45
|
import numpy.typing as npt
|
|
42
46
|
|
|
43
47
|
_MODEL_ALIASES = {
|
|
44
|
-
"mini": "VTXAI/vtx-embed-7M",
|
|
45
|
-
"nano": "VTXAI/vtx-embed-1M",
|
|
48
|
+
"mini": "VTXAI/vtx-embed-7M-lf2",
|
|
49
|
+
"nano": "VTXAI/vtx-embed-1M-lf2",
|
|
50
|
+
"mini-lf2": "VTXAI/vtx-embed-7M-lf2",
|
|
51
|
+
"nano-lf2": "VTXAI/vtx-embed-1M-lf2",
|
|
52
|
+
"mini-full": "VTXAI/vtx-embed-7M",
|
|
53
|
+
"nano-full": "VTXAI/vtx-embed-1M",
|
|
54
|
+
}
|
|
55
|
+
_FAST_MODEL_IDS = {
|
|
56
|
+
"mini-full": _MODEL_ALIASES["mini-lf2"],
|
|
57
|
+
"nano-full": _MODEL_ALIASES["nano-lf2"],
|
|
58
|
+
_MODEL_ALIASES["mini-full"]: _MODEL_ALIASES["mini-lf2"],
|
|
59
|
+
_MODEL_ALIASES["nano-full"]: _MODEL_ALIASES["nano-lf2"],
|
|
46
60
|
}
|
|
47
61
|
|
|
48
62
|
|
|
49
|
-
def _resolve_model_id(model: str) -> str:
|
|
63
|
+
def _resolve_model_id(model: str, *, fast: bool = False) -> str:
|
|
64
|
+
if fast and model in _FAST_MODEL_IDS:
|
|
65
|
+
return _FAST_MODEL_IDS[model]
|
|
50
66
|
return _MODEL_ALIASES.get(model, model)
|
|
51
67
|
|
|
52
68
|
|
|
@@ -83,15 +99,18 @@ def similarity(
|
|
|
83
99
|
class VortexEmbedInference:
|
|
84
100
|
"""A sentence-transformers-style inference engine for Vortex-Embed models.
|
|
85
101
|
|
|
86
|
-
Supports on-the-fly LF4
|
|
102
|
+
Supports on-the-fly LF4/LF2 dequantization, SIF+PC weighting, and
|
|
87
103
|
Matryoshka representation learning for dimension truncation.
|
|
88
104
|
|
|
89
105
|
Args:
|
|
90
|
-
model: Model ID or alias (``mini``, ``nano``, or any
|
|
91
|
-
HuggingFace model name).
|
|
106
|
+
model: Model ID or alias (``mini``, ``nano``, ``mini-full``, ``nano-full``, or any
|
|
107
|
+
HuggingFace model name). ``mini`` and ``nano`` use LF2 by default.
|
|
108
|
+
Default: ``mini``.
|
|
92
109
|
dim: If set, truncate all output embeddings to this number of
|
|
93
110
|
dimensions via Matryoshka truncation. Can be overridden per-call
|
|
94
111
|
in ``encode()``.
|
|
112
|
+
fast: Explicitly select LF2 for a full-model alias. This is already
|
|
113
|
+
the default for ``mini`` and ``nano``.
|
|
95
114
|
|
|
96
115
|
Example:
|
|
97
116
|
>>> from vortexa.core.inference import VortexEmbedInference
|
|
@@ -104,10 +123,19 @@ class VortexEmbedInference:
|
|
|
104
123
|
(1, 128)
|
|
105
124
|
>>> model.dim
|
|
106
125
|
256
|
|
126
|
+
>>> # Use fast native 2-bit inference
|
|
127
|
+
>>> lf2 = VortexEmbedInference("mini", fast=True)
|
|
128
|
+
>>> vec = lf2.encode("Native 2-bit embedding text...")
|
|
107
129
|
"""
|
|
108
130
|
|
|
109
|
-
def __init__(
|
|
110
|
-
self
|
|
131
|
+
def __init__(
|
|
132
|
+
self,
|
|
133
|
+
model: str = "mini",
|
|
134
|
+
*,
|
|
135
|
+
dim: int | None = None,
|
|
136
|
+
fast: bool = False,
|
|
137
|
+
) -> None:
|
|
138
|
+
self._model_id = _resolve_model_id(model, fast=fast)
|
|
111
139
|
from vortexa.core.v4_embedder import VortexEmbedderV4
|
|
112
140
|
|
|
113
141
|
self._embedder = VortexEmbedderV4(self._model_id)
|
|
@@ -202,6 +230,7 @@ def embed(
|
|
|
202
230
|
model: str = "mini",
|
|
203
231
|
dim: int | None = None,
|
|
204
232
|
normalize: bool = True,
|
|
233
|
+
fast: bool = False,
|
|
205
234
|
) -> npt.NDArray[np.float32]:
|
|
206
235
|
"""Encode text strings into dense vector embeddings (stateless convenience).
|
|
207
236
|
|
|
@@ -210,12 +239,15 @@ def embed(
|
|
|
210
239
|
|
|
211
240
|
Args:
|
|
212
241
|
texts: A single string or a list of strings to encode.
|
|
213
|
-
model: Model ID or alias (``mini``, ``nano``, or any
|
|
214
|
-
HuggingFace model name).
|
|
242
|
+
model: Model ID or alias (``mini``, ``nano``, ``mini-full``, ``nano-full``, or any
|
|
243
|
+
HuggingFace model name). ``mini`` and ``nano`` use LF2 by default.
|
|
244
|
+
Default: ``mini``.
|
|
215
245
|
dim: If set, truncate embeddings to this dimension via
|
|
216
246
|
Matryoshka truncation. Default: ``None`` (full dimension).
|
|
217
247
|
normalize: Whether to L2-normalize the output vectors.
|
|
218
248
|
Default: ``True``.
|
|
249
|
+
fast: Use the corresponding native 2-bit LF2 checkpoint when
|
|
250
|
+
``model`` is ``mini`` or ``nano``.
|
|
219
251
|
|
|
220
252
|
Returns:
|
|
221
253
|
A numpy array of shape ``(N, D)`` where ``N`` is the number
|
|
@@ -229,8 +261,11 @@ def embed(
|
|
|
229
261
|
>>> vec = embed(["Indian cricket team is strong", "Chennai is a major city"], model="nano", dim=64)
|
|
230
262
|
>>> vec.shape
|
|
231
263
|
(2, 64)
|
|
264
|
+
>>> # Use LF2 models (native 2-bit embeddings)
|
|
265
|
+
>>> vec = embed("Native 2-bit embedding text...", model="mini-lf2")
|
|
266
|
+
|
|
232
267
|
"""
|
|
233
|
-
model_id = _resolve_model_id(model)
|
|
268
|
+
model_id = _resolve_model_id(model, fast=fast)
|
|
234
269
|
from vortexa.core.v4_embedder import VortexEmbedderV4
|
|
235
270
|
|
|
236
271
|
embedder = VortexEmbedderV4(model_id)
|