vortexa 0.3.0__tar.gz → 0.3.1__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.
Files changed (37) hide show
  1. {vortexa-0.3.0 → vortexa-0.3.1}/PKG-INFO +1 -1
  2. {vortexa-0.3.0 → vortexa-0.3.1}/pyproject.toml +1 -1
  3. {vortexa-0.3.0 → vortexa-0.3.1}/src/vortexa/core/inference.py +70 -4
  4. {vortexa-0.3.0 → vortexa-0.3.1}/src/vortexa.egg-info/PKG-INFO +1 -1
  5. {vortexa-0.3.0 → vortexa-0.3.1}/LICENSE +0 -0
  6. {vortexa-0.3.0 → vortexa-0.3.1}/README.md +0 -0
  7. {vortexa-0.3.0 → vortexa-0.3.1}/setup.cfg +0 -0
  8. {vortexa-0.3.0 → vortexa-0.3.1}/src/vortexa/__init__.py +0 -0
  9. {vortexa-0.3.0 → vortexa-0.3.1}/src/vortexa/core/__init__.py +0 -0
  10. {vortexa-0.3.0 → vortexa-0.3.1}/src/vortexa/core/chunking.py +0 -0
  11. {vortexa-0.3.0 → vortexa-0.3.1}/src/vortexa/core/context_engine.py +0 -0
  12. {vortexa-0.3.0 → vortexa-0.3.1}/src/vortexa/core/embedding.py +0 -0
  13. {vortexa-0.3.0 → vortexa-0.3.1}/src/vortexa/core/graph.py +0 -0
  14. {vortexa-0.3.0 → vortexa-0.3.1}/src/vortexa/core/indexer.py +0 -0
  15. {vortexa-0.3.0 → vortexa-0.3.1}/src/vortexa/core/language.py +0 -0
  16. {vortexa-0.3.0 → vortexa-0.3.1}/src/vortexa/core/lf4_model.py +0 -0
  17. {vortexa-0.3.0 → vortexa-0.3.1}/src/vortexa/core/lf4_v4_model.py +0 -0
  18. {vortexa-0.3.0 → vortexa-0.3.1}/src/vortexa/core/types.py +0 -0
  19. {vortexa-0.3.0 → vortexa-0.3.1}/src/vortexa/core/v4_embedder.py +0 -0
  20. {vortexa-0.3.0 → vortexa-0.3.1}/src/vortexa/core/vortex_score.py +0 -0
  21. {vortexa-0.3.0 → vortexa-0.3.1}/src/vortexa/interfaces/__init__.py +0 -0
  22. {vortexa-0.3.0 → vortexa-0.3.1}/src/vortexa/interfaces/cli.py +0 -0
  23. {vortexa-0.3.0 → vortexa-0.3.1}/src/vortexa/interfaces/mcp_server.py +0 -0
  24. {vortexa-0.3.0 → vortexa-0.3.1}/src/vortexa/interfaces/watcher.py +0 -0
  25. {vortexa-0.3.0 → vortexa-0.3.1}/src/vortexa/search/__init__.py +0 -0
  26. {vortexa-0.3.0 → vortexa-0.3.1}/src/vortexa/search/ranking.py +0 -0
  27. {vortexa-0.3.0 → vortexa-0.3.1}/src/vortexa/search/search.py +0 -0
  28. {vortexa-0.3.0 → vortexa-0.3.1}/src/vortexa/search/tokens.py +0 -0
  29. {vortexa-0.3.0 → vortexa-0.3.1}/src/vortexa/storage/__init__.py +0 -0
  30. {vortexa-0.3.0 → vortexa-0.3.1}/src/vortexa/storage/bm25.py +0 -0
  31. {vortexa-0.3.0 → vortexa-0.3.1}/src/vortexa/storage/vector_store.py +0 -0
  32. {vortexa-0.3.0 → vortexa-0.3.1}/src/vortexa/storage/walker.py +0 -0
  33. {vortexa-0.3.0 → vortexa-0.3.1}/src/vortexa.egg-info/SOURCES.txt +0 -0
  34. {vortexa-0.3.0 → vortexa-0.3.1}/src/vortexa.egg-info/dependency_links.txt +0 -0
  35. {vortexa-0.3.0 → vortexa-0.3.1}/src/vortexa.egg-info/entry_points.txt +0 -0
  36. {vortexa-0.3.0 → vortexa-0.3.1}/src/vortexa.egg-info/requires.txt +0 -0
  37. {vortexa-0.3.0 → vortexa-0.3.1}/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.0
3
+ Version: 0.3.1
4
4
  Summary: Codebase indexing and semantic search engine
5
5
  Author-email: VortexAI <koulabhay25@gmail.com>
6
6
  License-Expression: Apache-2.0
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "vortexa"
7
- version = "0.3.0"
7
+ version = "0.3.1"
8
8
  description = "Codebase indexing and semantic search engine"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -28,8 +28,12 @@ Convenience function (stateless):
28
28
  from vortexa.core.inference import embed
29
29
 
30
30
  vec = embed("India is a diverse country", model="nano", dim=64)
31
- """
32
- from __future__ import annotations
31
+
32
+ Similarity:
33
+ from vortexa.core.inference import similarity
34
+
35
+ sim = similarity(embeddings1, embeddings2) # cosine similarity matrix
36
+ """; from __future__ import annotations
33
37
 
34
38
  from typing import List, Union
35
39
 
@@ -46,6 +50,36 @@ def _resolve_model_id(model: str) -> str:
46
50
  return _MODEL_ALIASES.get(model, model)
47
51
 
48
52
 
53
+ def similarity(
54
+ embeddings1: npt.NDArray[np.float32],
55
+ embeddings2: npt.NDArray[np.float32],
56
+ ) -> npt.NDArray[np.float32]:
57
+ """Compute cosine similarity between two sets of embeddings.
58
+
59
+ Since Vortex-Embed outputs are L2-normalized by default,
60
+ cosine similarity is equivalent to the dot product.
61
+
62
+ Args:
63
+ embeddings1: Array of shape ``(N, D)``.
64
+ embeddings2: Array of shape ``(M, D)``.
65
+
66
+ Returns:
67
+ A numpy array of shape ``(N, M)`` where each entry
68
+ ``[i, j]`` is the cosine similarity between
69
+ ``embeddings1[i]`` and ``embeddings2[j]``.
70
+
71
+ Example:
72
+ >>> from vortexa.core.inference import VortexEmbedInference
73
+ >>> model = VortexEmbedInference("mini")
74
+ >>> qvecs = model.encode(["India is diverse", "Chennai is a city"])
75
+ >>> dvecs = model.encode(["India has 28 states", "Mumbai is the capital of Maharashtra"])
76
+ >>> scores = similarity(qvecs, dvecs)
77
+ >>> scores.shape
78
+ (2, 2)
79
+ """
80
+ return embeddings1 @ embeddings2.T
81
+
82
+
49
83
  class VortexEmbedInference:
50
84
  """A sentence-transformers-style inference engine for Vortex-Embed models.
51
85
 
@@ -62,10 +96,10 @@ class VortexEmbedInference:
62
96
  Example:
63
97
  >>> from vortexa.core.inference import VortexEmbedInference
64
98
  >>> model = VortexEmbedInference("mini")
65
- >>> vec = model.encode("hello world")
99
+ >>> vec = model.encode("India is a diverse country")
66
100
  >>> vec.shape
67
101
  (1, 256)
68
- >>> vec = model.encode("hello world", dim=128)
102
+ >>> vec = model.encode("India has 28 states", dim=128)
69
103
  >>> vec.shape
70
104
  (1, 128)
71
105
  >>> model.dim
@@ -129,6 +163,38 @@ class VortexEmbedInference:
129
163
  truncate_dim=effective_dim,
130
164
  )
131
165
 
166
+ def similarity(
167
+ self,
168
+ a: Union[str, List[str], npt.NDArray[np.float32]],
169
+ b: Union[str, List[str], npt.NDArray[np.float32]],
170
+ *,
171
+ dim: int | None = None,
172
+ ) -> npt.NDArray[np.float32]:
173
+ """Compute cosine similarity between two sets of queries/documents.
174
+
175
+ Accepts raw strings, lists of strings, or pre-encoded arrays.
176
+ Strings are encoded first using the model's ``encode()`` method.
177
+
178
+ Args:
179
+ a: Query(s) — string, list of strings, or ``(N, D)`` array.
180
+ b: Document(s) — string, list of strings, or ``(M, D)`` array.
181
+ dim: If encoding strings, truncate to this dimension.
182
+
183
+ Returns:
184
+ An ``(N, M)`` similarity matrix where ``[i, j]`` is the
185
+ cosine similarity between ``a[i]`` and ``b[j]``.
186
+
187
+ Example:
188
+ >>> model = VortexEmbedInference(\"mini\")
189
+ >>> model.similarity(\"India is diverse\", [\"India has states\"])
190
+ array([[0.85...]])
191
+ """
192
+ if not isinstance(a, np.ndarray):
193
+ a = self.encode(a, dim=dim)
194
+ if not isinstance(b, np.ndarray):
195
+ b = self.encode(b, dim=dim)
196
+ return a @ b.T
197
+
132
198
 
133
199
  def embed(
134
200
  texts: Union[str, List[str]],
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: vortexa
3
- Version: 0.3.0
3
+ Version: 0.3.1
4
4
  Summary: Codebase indexing and semantic search engine
5
5
  Author-email: VortexAI <koulabhay25@gmail.com>
6
6
  License-Expression: Apache-2.0
File without changes
File without changes
File without changes
File without changes