swarmauri_vectorstore_doc2vec 0.9.0.dev50__tar.gz → 0.11.0.dev1__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.
@@ -1,43 +1,43 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: swarmauri_vectorstore_doc2vec
3
- Version: 0.9.0.dev50
3
+ Version: 0.11.0.dev1
4
4
  Summary: A Doc2Vec based Vector Store and Doc2Vec Based Embedding Model.
5
5
  License-Expression: Apache-2.0
6
6
  License-File: LICENSE
7
7
  Keywords: swarmauri,sdk,standards,vectorstore,doc2vec,machine-learning
8
8
  Author: Jacob Stewart
9
9
  Author-email: jacob@swarmauri.com
10
- Requires-Python: >=3.10,<3.13
10
+ Requires-Python: >=3.10,<3.15
11
11
  Classifier: License :: OSI Approved :: Apache Software License
12
- Classifier: Programming Language :: Python :: 3.10
13
- Classifier: Programming Language :: Python :: 3.11
14
- Classifier: Programming Language :: Python :: 3.12
15
12
  Classifier: Programming Language :: Python
16
13
  Classifier: Programming Language :: Python :: 3
17
14
  Classifier: Programming Language :: Python :: 3 :: Only
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Programming Language :: Python :: 3.14
18
20
  Requires-Dist: swarmauri_base
19
21
  Requires-Dist: swarmauri_core
20
22
  Requires-Dist: swarmauri_embedding_doc2vec
21
23
  Requires-Dist: swarmauri_standard
22
24
  Description-Content-Type: text/markdown
23
25
 
24
-
25
- ![Swarmauri Logo](https://github.com/swarmauri/swarmauri-sdk/blob/3d4d1cfa949399d7019ae9d8f296afba773dfb7f/assets/swarmauri.brand.theme.svg)
26
+ ![Swarmauri Logo](https://raw.githubusercontent.com/swarmauri/swarmauri-sdk/master/assets/swarmauri_sdk_brand.png)
26
27
 
27
28
  <p align="center">
28
- <a href="https://pypi.org/project/swarmauri_vectorstore_doc2vec/">
29
- <img src="https://img.shields.io/pypi/dm/swarmauri_vectorstore_doc2vec" alt="PyPI - Downloads"/></a>
29
+ <a href="https://pepy.tech/project/swarmauri_vectorstore_doc2vec/">
30
+ <img src="https://static.pepy.tech/badge/swarmauri_vectorstore_doc2vec/month" alt="PyPI - Downloads"/></a>
30
31
  <a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_vectorstore_doc2vec/">
31
32
  <img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_vectorstore_doc2vec.svg"/></a>
32
33
  <a href="https://pypi.org/project/swarmauri_vectorstore_doc2vec/">
33
- <img src="https://img.shields.io/pypi/pyversions/swarmauri_vectorstore_doc2vec" alt="PyPI - Python Version"/></a>
34
+ <img src="https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12%20%7C%203.13%20%7C%203.14-blue" alt="PyPI - Python Version"/></a>
34
35
  <a href="https://pypi.org/project/swarmauri_vectorstore_doc2vec/">
35
36
  <img src="https://img.shields.io/pypi/l/swarmauri_vectorstore_doc2vec" alt="PyPI - License"/></a>
36
37
  <a href="https://pypi.org/project/swarmauri_vectorstore_doc2vec/">
37
38
  <img src="https://img.shields.io/pypi/v/swarmauri_vectorstore_doc2vec?label=swarmauri_vectorstore_doc2vec&color=green" alt="PyPI - swarmauri_vectorstore_doc2vec"/></a>
38
- </p>
39
-
40
- ---
39
+ <a href="https://discord.gg/N4UpBuQv8T">
40
+ <img src="https://img.shields.io/badge/Discord-Join%20Chat-5865F2?logo=discord&logoColor=white" alt="Discord"/></a></p>
41
41
 
42
42
  # Swarmauri Vectorstore Doc2vec
43
43
 
@@ -76,3 +76,5 @@ results = vector_store.retrieve(query="document", top_k=2)
76
76
  If you want to contribute to swarmauri-sdk, read up on our [guidelines for contributing](https://github.com/swarmauri/swarmauri-sdk/blob/master/contributing.md) that will help you get started.
77
77
 
78
78
 
79
+
80
+
@@ -1,20 +1,18 @@
1
-
2
- ![Swarmauri Logo](https://github.com/swarmauri/swarmauri-sdk/blob/3d4d1cfa949399d7019ae9d8f296afba773dfb7f/assets/swarmauri.brand.theme.svg)
1
+ ![Swarmauri Logo](https://raw.githubusercontent.com/swarmauri/swarmauri-sdk/master/assets/swarmauri_sdk_brand.png)
3
2
 
4
3
  <p align="center">
5
- <a href="https://pypi.org/project/swarmauri_vectorstore_doc2vec/">
6
- <img src="https://img.shields.io/pypi/dm/swarmauri_vectorstore_doc2vec" alt="PyPI - Downloads"/></a>
4
+ <a href="https://pepy.tech/project/swarmauri_vectorstore_doc2vec/">
5
+ <img src="https://static.pepy.tech/badge/swarmauri_vectorstore_doc2vec/month" alt="PyPI - Downloads"/></a>
7
6
  <a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_vectorstore_doc2vec/">
8
7
  <img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/standards/swarmauri_vectorstore_doc2vec.svg"/></a>
9
8
  <a href="https://pypi.org/project/swarmauri_vectorstore_doc2vec/">
10
- <img src="https://img.shields.io/pypi/pyversions/swarmauri_vectorstore_doc2vec" alt="PyPI - Python Version"/></a>
9
+ <img src="https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12%20%7C%203.13%20%7C%203.14-blue" alt="PyPI - Python Version"/></a>
11
10
  <a href="https://pypi.org/project/swarmauri_vectorstore_doc2vec/">
12
11
  <img src="https://img.shields.io/pypi/l/swarmauri_vectorstore_doc2vec" alt="PyPI - License"/></a>
13
12
  <a href="https://pypi.org/project/swarmauri_vectorstore_doc2vec/">
14
13
  <img src="https://img.shields.io/pypi/v/swarmauri_vectorstore_doc2vec?label=swarmauri_vectorstore_doc2vec&color=green" alt="PyPI - swarmauri_vectorstore_doc2vec"/></a>
15
- </p>
16
-
17
- ---
14
+ <a href="https://discord.gg/N4UpBuQv8T">
15
+ <img src="https://img.shields.io/badge/Discord-Join%20Chat-5865F2?logo=discord&logoColor=white" alt="Discord"/></a></p>
18
16
 
19
17
  # Swarmauri Vectorstore Doc2vec
20
18
 
@@ -52,3 +50,5 @@ results = vector_store.retrieve(query="document", top_k=2)
52
50
 
53
51
  If you want to contribute to swarmauri-sdk, read up on our [guidelines for contributing](https://github.com/swarmauri/swarmauri-sdk/blob/master/contributing.md) that will help you get started.
54
52
 
53
+
54
+
@@ -1,19 +1,21 @@
1
1
  [project]
2
2
  name = "swarmauri_vectorstore_doc2vec"
3
- version = "0.9.0.dev50"
3
+ version = "0.11.0.dev1"
4
4
  description = "A Doc2Vec based Vector Store and Doc2Vec Based Embedding Model."
5
5
  license = "Apache-2.0"
6
6
  readme = "README.md"
7
7
  repository = "http://github.com/swarmauri/swarmauri-sdk"
8
- requires-python = ">=3.10,<3.13"
8
+ requires-python = ">=3.10,<3.15"
9
9
  classifiers = [
10
10
  "License :: OSI Approved :: Apache Software License",
11
- "Programming Language :: Python :: 3.10",
12
- "Programming Language :: Python :: 3.11",
13
- "Programming Language :: Python :: 3.12",
14
11
  "Programming Language :: Python",
15
12
  "Programming Language :: Python :: 3",
16
13
  "Programming Language :: Python :: 3 :: Only",
14
+ "Programming Language :: Python :: 3.10",
15
+ "Programming Language :: Python :: 3.11",
16
+ "Programming Language :: Python :: 3.12",
17
+ "Programming Language :: Python :: 3.13",
18
+ "Programming Language :: Python :: 3.14",
17
19
  ]
18
20
  authors = [{ name = "Jacob Stewart", email = "jacob@swarmauri.com" }]
19
21
  dependencies = [
@@ -71,7 +73,7 @@ dev = [
71
73
  "pytest-xdist>=3.6.1",
72
74
  "pytest-json-report>=1.5.0",
73
75
  "python-dotenv",
74
- "requests>=2.32.3",
76
+ "httpx>=0.27",
75
77
  "flake8>=7.0",
76
78
  "pytest-timeout>=2.3.1",
77
79
  "ruff>=0.9.9",
@@ -1,7 +1,6 @@
1
1
  from typing import List, Union, Literal
2
2
 
3
3
  from swarmauri_standard.documents.Document import Document
4
- from swarmauri_standard.distances.CosineDistance import CosineDistance
5
4
  from swarmauri_base.vector_stores.VectorStoreBase import VectorStoreBase
6
5
  from swarmauri_base.vector_stores.VectorStoreRetrieveMixin import (
7
6
  VectorStoreRetrieveMixin,
@@ -13,6 +12,9 @@ from swarmauri_embedding_doc2vec.Doc2VecEmbedding import (
13
12
  Doc2VecEmbedding,
14
13
  )
15
14
  from swarmauri_base.ComponentBase import ComponentBase
15
+ from swarmauri_standard.vector_stores.CosineSimilarityComparator import (
16
+ CosineSimilarityComparator,
17
+ )
16
18
 
17
19
 
18
20
  @ComponentBase.register_type(VectorStoreBase, "Doc2VecVectorStore")
@@ -24,7 +26,7 @@ class Doc2VecVectorStore(
24
26
  def __init__(self, **kwargs):
25
27
  super().__init__(**kwargs)
26
28
  self._embedder = Doc2VecEmbedding()
27
- self._distance = CosineDistance()
29
+ self._comparator = CosineSimilarityComparator()
28
30
 
29
31
  def add_document(self, document: Document) -> None:
30
32
  self._embedder.fit([document.content])
@@ -47,13 +49,10 @@ class Doc2VecVectorStore(
47
49
  [doc.content for doc in self.documents]
48
50
  )
49
51
 
50
- # Calculate cosine distances between the query vector and document vectors
51
- distances = self._distance.distances(query_vector, document_vectors)
52
-
53
- # Get the indices of the top_k closest documents
54
- top_k_indices = sorted(range(len(distances)), key=lambda i: distances[i])[
55
- :top_k
56
- ]
52
+ # Rank documents by descending cosine similarity.
53
+ top_k_indices = self._comparator.top_k_indices(
54
+ query_vector, document_vectors, top_k
55
+ )
57
56
 
58
57
  return [self.documents[i] for i in top_k_indices]
59
58