beaver-db 0.5.2__py3-none-any.whl → 0.5.3__py3-none-any.whl

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.

Potentially problematic release.


This version of beaver-db might be problematic. Click here for more details.

beaver/collections.py CHANGED
@@ -331,7 +331,7 @@ class CollectionWrapper:
331
331
 
332
332
 
333
333
  def rerank(
334
- results: list[list[Document]],
334
+ *results: list[Document],
335
335
  weights: list[float] | None = None,
336
336
  k: int = 60
337
337
  ) -> list[Document]:
@@ -340,7 +340,7 @@ def rerank(
340
340
  This function is specifically designed to work with beaver.collections.Document objects.
341
341
 
342
342
  Args:
343
- results (list[list[Document]]): A list of search result lists, where each
343
+ results (sequence of list[Document]): A sequence of search result lists, where each
344
344
  inner list contains Document objects.
345
345
  weights (list[float], optional): A list of weights corresponding to each
346
346
  result list. If None, all lists are weighted equally. Defaults to None.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: beaver-db
3
- Version: 0.5.2
3
+ Version: 0.5.3
4
4
  Summary: Fast, embedded, and multi-modal DB based on SQLite for AI-powered applications.
5
5
  Requires-Python: >=3.13
6
6
  Description-Content-Type: text/markdown
@@ -94,14 +94,18 @@ docs.index(doc)
94
94
 
95
95
  # 1. Perform a vector search to find semantically similar documents
96
96
  query_vector = [0.7, 0.2, 0.2]
97
- vector_results = docs.search(vector=query_vector, top_k=1)
97
+ vector_results = docs.search(vector=query_vector, top_k=3)
98
98
  top_doc, distance = vector_results[0]
99
99
  print(f"Vector Search Result: {top_doc.content} (distance: {distance:.2f})")
100
100
 
101
101
  # 2. Perform a full-text search to find documents with specific words
102
- text_results = docs.match(query="database", top_k=1)
102
+ text_results = docs.match(query="database", top_k=3)
103
103
  top_doc, rank = text_results[0]
104
104
  print(f"Full-Text Search Result: {top_doc.content} (rank: {rank:.2f})")
105
+
106
+ # 3. Combine both vector and text search for refined results
107
+ from beaver.collections import rerank
108
+ combined_results = rerank([d for d,_ in vector_results], [d for d,_ in text_results], weights=[2,1])
105
109
  ```
106
110
 
107
111
  ### Graph Traversal
@@ -1,9 +1,9 @@
1
1
  beaver/__init__.py,sha256=-z5Gj6YKMOswpJOOn5Gej8z5i6k3c0Xs00DIYLA-bMI,75
2
- beaver/collections.py,sha256=4rdGMTD7ex4SQUH52WIHOZhOdeWe7Nqvm9TPg7flv_g,15059
2
+ beaver/collections.py,sha256=II26aeXelbtfs0zkcHImvPDtoyDhPCCP8bsosEqoKvw,15064
3
3
  beaver/core.py,sha256=sk0Z_k7EcORe6bN8CfPukGX7eAfmCGSX_B37KpJmQJ4,7279
4
4
  beaver/lists.py,sha256=JG1JOkaYCUldADUzPJhaNi93w-k3S8mUzcCw574uht4,5915
5
5
  beaver/subscribers.py,sha256=tCty2iDbeE9IXcPicbxj2CB5gqfLufMB9-nLQwqNBUU,1944
6
- beaver_db-0.5.2.dist-info/METADATA,sha256=ij6szwN6Ee0MutGlFgszF2vqddR5y8OlA9O4R5Y4Nbo,5904
7
- beaver_db-0.5.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
8
- beaver_db-0.5.2.dist-info/top_level.txt,sha256=FxA4XnX5Qm5VudEXCduFriqi4dQmDWpQ64d7g69VQKI,7
9
- beaver_db-0.5.2.dist-info/RECORD,,
6
+ beaver_db-0.5.3.dist-info/METADATA,sha256=MAtHrjLqdqBKTPzHGJiX4gORwcwQl38pZXr3mSFWsk4,6105
7
+ beaver_db-0.5.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
8
+ beaver_db-0.5.3.dist-info/top_level.txt,sha256=FxA4XnX5Qm5VudEXCduFriqi4dQmDWpQ64d7g69VQKI,7
9
+ beaver_db-0.5.3.dist-info/RECORD,,