haiku.rag 0.6.0__py3-none-any.whl → 0.7.1__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 haiku.rag might be problematic. Click here for more details.
- haiku/rag/app.py +4 -4
- haiku/rag/cli.py +38 -27
- haiku/rag/client.py +19 -23
- haiku/rag/config.py +6 -2
- haiku/rag/logging.py +5 -0
- haiku/rag/mcp.py +12 -9
- haiku/rag/migration.py +316 -0
- haiku/rag/qa/agent.py +2 -2
- haiku/rag/reranking/__init__.py +0 -6
- haiku/rag/store/engine.py +173 -141
- haiku/rag/store/models/chunk.py +2 -2
- haiku/rag/store/models/document.py +1 -1
- haiku/rag/store/repositories/__init__.py +6 -2
- haiku/rag/store/repositories/chunk.py +279 -414
- haiku/rag/store/repositories/document.py +171 -205
- haiku/rag/store/repositories/settings.py +115 -49
- haiku/rag/store/upgrades/__init__.py +1 -3
- haiku/rag/utils.py +39 -31
- {haiku_rag-0.6.0.dist-info → haiku_rag-0.7.1.dist-info}/METADATA +21 -16
- haiku_rag-0.7.1.dist-info/RECORD +39 -0
- haiku/rag/reranking/ollama.py +0 -81
- haiku/rag/store/repositories/base.py +0 -40
- haiku/rag/store/upgrades/v0_3_4.py +0 -26
- haiku_rag-0.6.0.dist-info/RECORD +0 -41
- {haiku_rag-0.6.0.dist-info → haiku_rag-0.7.1.dist-info}/WHEEL +0 -0
- {haiku_rag-0.6.0.dist-info → haiku_rag-0.7.1.dist-info}/entry_points.txt +0 -0
- {haiku_rag-0.6.0.dist-info → haiku_rag-0.7.1.dist-info}/licenses/LICENSE +0 -0
haiku/rag/utils.py
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import asyncio
|
|
1
2
|
import sys
|
|
3
|
+
from collections.abc import Callable
|
|
4
|
+
from functools import wraps
|
|
2
5
|
from importlib import metadata
|
|
3
6
|
from io import BytesIO
|
|
4
7
|
from pathlib import Path
|
|
@@ -10,6 +13,42 @@ from docling_core.types.io import DocumentStream
|
|
|
10
13
|
from packaging.version import Version, parse
|
|
11
14
|
|
|
12
15
|
|
|
16
|
+
def debounce(wait: float) -> Callable:
|
|
17
|
+
"""
|
|
18
|
+
A decorator to debounce a function, ensuring it is called only after a specified delay
|
|
19
|
+
and always executes after the last call.
|
|
20
|
+
|
|
21
|
+
Args:
|
|
22
|
+
wait (float): The debounce delay in seconds.
|
|
23
|
+
|
|
24
|
+
Returns:
|
|
25
|
+
Callable: The decorated function.
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
def decorator(func: Callable) -> Callable:
|
|
29
|
+
last_call = None
|
|
30
|
+
task = None
|
|
31
|
+
|
|
32
|
+
@wraps(func)
|
|
33
|
+
async def debounced(*args, **kwargs):
|
|
34
|
+
nonlocal last_call, task
|
|
35
|
+
last_call = asyncio.get_event_loop().time()
|
|
36
|
+
|
|
37
|
+
if task:
|
|
38
|
+
task.cancel()
|
|
39
|
+
|
|
40
|
+
async def call_func():
|
|
41
|
+
await asyncio.sleep(wait)
|
|
42
|
+
if asyncio.get_event_loop().time() - last_call >= wait: # type: ignore
|
|
43
|
+
await func(*args, **kwargs)
|
|
44
|
+
|
|
45
|
+
task = asyncio.create_task(call_func())
|
|
46
|
+
|
|
47
|
+
return debounced
|
|
48
|
+
|
|
49
|
+
return decorator
|
|
50
|
+
|
|
51
|
+
|
|
13
52
|
def get_default_data_dir() -> Path:
|
|
14
53
|
"""Get the user data directory for the current system platform.
|
|
15
54
|
|
|
@@ -32,37 +71,6 @@ def get_default_data_dir() -> Path:
|
|
|
32
71
|
return data_path
|
|
33
72
|
|
|
34
73
|
|
|
35
|
-
def semantic_version_to_int(version: str) -> int:
|
|
36
|
-
"""Convert a semantic version string to an integer.
|
|
37
|
-
|
|
38
|
-
Args:
|
|
39
|
-
version: Semantic version string.
|
|
40
|
-
|
|
41
|
-
Returns:
|
|
42
|
-
Integer representation of semantic version.
|
|
43
|
-
"""
|
|
44
|
-
major, minor, patch = version.split(".")
|
|
45
|
-
major = int(major) << 16
|
|
46
|
-
minor = int(minor) << 8
|
|
47
|
-
patch = int(patch)
|
|
48
|
-
return major + minor + patch
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
def int_to_semantic_version(version: int) -> str:
|
|
52
|
-
"""Convert an integer to a semantic version string.
|
|
53
|
-
|
|
54
|
-
Args:
|
|
55
|
-
version: Integer representation of semantic version.
|
|
56
|
-
|
|
57
|
-
Returns:
|
|
58
|
-
Semantic version string.
|
|
59
|
-
"""
|
|
60
|
-
major = version >> 16
|
|
61
|
-
minor = (version >> 8) & 255
|
|
62
|
-
patch = version & 255
|
|
63
|
-
return f"{major}.{minor}.{patch}"
|
|
64
|
-
|
|
65
|
-
|
|
66
74
|
async def is_up_to_date() -> tuple[bool, Version, Version]:
|
|
67
75
|
"""Check whether haiku.rag is current.
|
|
68
76
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: haiku.rag
|
|
3
|
-
Version: 0.
|
|
4
|
-
Summary: Retrieval Augmented Generation (RAG) with
|
|
3
|
+
Version: 0.7.1
|
|
4
|
+
Summary: Retrieval Augmented Generation (RAG) with LanceDB
|
|
5
5
|
Author-email: Yiorgis Gozadinos <ggozadinos@gmail.com>
|
|
6
6
|
License: MIT
|
|
7
7
|
License-File: LICENSE
|
|
8
|
-
Keywords: RAG,mcp,ml,
|
|
8
|
+
Keywords: RAG,lancedb,mcp,ml,vector-database
|
|
9
9
|
Classifier: Development Status :: 4 - Beta
|
|
10
10
|
Classifier: Environment :: Console
|
|
11
11
|
Classifier: Intended Audience :: Developers
|
|
@@ -17,18 +17,18 @@ Classifier: Programming Language :: Python :: 3.10
|
|
|
17
17
|
Classifier: Programming Language :: Python :: 3.11
|
|
18
18
|
Classifier: Programming Language :: Python :: 3.12
|
|
19
19
|
Classifier: Typing :: Typed
|
|
20
|
-
Requires-Python: >=3.
|
|
21
|
-
Requires-Dist: docling>=2.
|
|
20
|
+
Requires-Python: >=3.12
|
|
21
|
+
Requires-Dist: docling>=2.49.0
|
|
22
22
|
Requires-Dist: fastmcp>=2.8.1
|
|
23
23
|
Requires-Dist: httpx>=0.28.1
|
|
24
|
+
Requires-Dist: lancedb>=0.24.3
|
|
24
25
|
Requires-Dist: ollama>=0.5.3
|
|
25
|
-
Requires-Dist: pydantic-ai>=0.
|
|
26
|
+
Requires-Dist: pydantic-ai>=0.8.1
|
|
26
27
|
Requires-Dist: pydantic>=2.11.7
|
|
27
28
|
Requires-Dist: python-dotenv>=1.1.0
|
|
28
|
-
Requires-Dist: rich>=14.
|
|
29
|
-
Requires-Dist:
|
|
30
|
-
Requires-Dist:
|
|
31
|
-
Requires-Dist: typer>=0.16.0
|
|
29
|
+
Requires-Dist: rich>=14.1.0
|
|
30
|
+
Requires-Dist: tiktoken>=0.11.0
|
|
31
|
+
Requires-Dist: typer>=0.16.1
|
|
32
32
|
Requires-Dist: watchfiles>=1.1.0
|
|
33
33
|
Provides-Extra: mxbai
|
|
34
34
|
Requires-Dist: mxbai-rerank>=0.1.6; extra == 'mxbai'
|
|
@@ -36,18 +36,20 @@ Provides-Extra: voyageai
|
|
|
36
36
|
Requires-Dist: voyageai>=0.3.2; extra == 'voyageai'
|
|
37
37
|
Description-Content-Type: text/markdown
|
|
38
38
|
|
|
39
|
-
# Haiku
|
|
39
|
+
# Haiku RAG
|
|
40
40
|
|
|
41
|
-
Retrieval-Augmented Generation (RAG) library on
|
|
41
|
+
Retrieval-Augmented Generation (RAG) library built on LanceDB.
|
|
42
42
|
|
|
43
|
-
`haiku.rag` is a Retrieval-Augmented Generation (RAG) library built to work
|
|
43
|
+
`haiku.rag` is a Retrieval-Augmented Generation (RAG) library built to work with LanceDB as a local vector database. It uses LanceDB for storing embeddings and performs semantic (vector) search as well as full-text search combined through native hybrid search with Reciprocal Rank Fusion. Both open-source (Ollama) as well as commercial (OpenAI, VoyageAI) embedding providers are supported.
|
|
44
|
+
|
|
45
|
+
> **Note**: Starting with version 0.7.0, haiku.rag uses LanceDB instead of SQLite. If you have an existing SQLite database, use `haiku-rag migrate old_database.sqlite` to migrate your data safely.
|
|
44
46
|
|
|
45
47
|
## Features
|
|
46
48
|
|
|
47
|
-
- **Local
|
|
49
|
+
- **Local LanceDB**: No external servers required, supports also LanceDB cloud storage, S3, Google Cloud & Azure
|
|
48
50
|
- **Multiple embedding providers**: Ollama, VoyageAI, OpenAI
|
|
49
51
|
- **Multiple QA providers**: Any provider/model supported by Pydantic AI
|
|
50
|
-
- **
|
|
52
|
+
- **Native hybrid search**: Vector + full-text search with native LanceDB RRF reranking
|
|
51
53
|
- **Reranking**: Default search result reranking with MixedBread AI or Cohere
|
|
52
54
|
- **Question answering**: Built-in QA agents on your documents
|
|
53
55
|
- **File monitoring**: Auto-index files when run as server
|
|
@@ -77,6 +79,9 @@ haiku-rag ask "Who is the author of haiku.rag?" --cite
|
|
|
77
79
|
# Rebuild database (re-chunk and re-embed all documents)
|
|
78
80
|
haiku-rag rebuild
|
|
79
81
|
|
|
82
|
+
# Migrate from SQLite to LanceDB
|
|
83
|
+
haiku-rag migrate old_database.sqlite
|
|
84
|
+
|
|
80
85
|
# Start server with file monitoring
|
|
81
86
|
export MONITOR_DIRECTORIES="/path/to/docs"
|
|
82
87
|
haiku-rag serve
|
|
@@ -87,7 +92,7 @@ haiku-rag serve
|
|
|
87
92
|
```python
|
|
88
93
|
from haiku.rag.client import HaikuRAG
|
|
89
94
|
|
|
90
|
-
async with HaikuRAG("database.
|
|
95
|
+
async with HaikuRAG("database.lancedb") as client:
|
|
91
96
|
# Add document
|
|
92
97
|
doc = await client.create_document("Your content")
|
|
93
98
|
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
haiku/rag/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
haiku/rag/app.py,sha256=GmuZxH7BMutWt8Mdu0RSateRBaKiqXh7Z9tV7cZX6n0,7655
|
|
3
|
+
haiku/rag/chunker.py,sha256=PVe6ysv8UlacUd4Zb3_8RFWIaWDXnzBAy2VDJ4TaUsE,1555
|
|
4
|
+
haiku/rag/cli.py,sha256=UY9Vh5RsIxSCV14eQbNOiwToKmbFAvqTOAnxjieaYBs,6399
|
|
5
|
+
haiku/rag/client.py,sha256=N4zkWjE9Rsw9YgPvNo83xptHUQR2ognfOnjkoV_w6hc,20999
|
|
6
|
+
haiku/rag/config.py,sha256=9Mv0QJ3c6VF1oVRSXJlSsG234dCd_sKnJO-ybMaTpDQ,1690
|
|
7
|
+
haiku/rag/logging.py,sha256=DOQi9QMpQRl8h17Vu4nQh8HxpHdeIu29n8-HZaT3SRQ,786
|
|
8
|
+
haiku/rag/mcp.py,sha256=bR9Y-Nz-hvjiql20Y0KE0hwNGwyjmPGX8K9d-qmXptY,4683
|
|
9
|
+
haiku/rag/migration.py,sha256=gWxQwiKo0YulRhogYz4K8N98kHN9LQXIx9FeTmT24v4,10915
|
|
10
|
+
haiku/rag/monitor.py,sha256=r386nkhdlsU8UECwIuVwnrSlgMk3vNIuUZGNIzkZuec,2770
|
|
11
|
+
haiku/rag/reader.py,sha256=qkPTMJuQ_o4sK-8zpDl9WFYe_MJ7aL_gUw6rczIpW-g,3274
|
|
12
|
+
haiku/rag/utils.py,sha256=c8F0ECsFSqvQxzxINAOAnvShoOnJPLsOaNE3JEY2JSc,3230
|
|
13
|
+
haiku/rag/embeddings/__init__.py,sha256=n7aHW3BxHlpGxU4ze4YYDOsljzFpEep8dwVE2n45JoE,1218
|
|
14
|
+
haiku/rag/embeddings/base.py,sha256=NTQvuzbZPu0LBo5wAu3qGyJ4xXUaRAt1fjBO0ygWn_Y,465
|
|
15
|
+
haiku/rag/embeddings/ollama.py,sha256=y6-lp0XpbnyIjoOEdtSzMdEVkU5glOwnWQ1FkpUZnpI,370
|
|
16
|
+
haiku/rag/embeddings/openai.py,sha256=iA-DewCOSip8PLU_RhEJHFHBle4DtmCCIGNfGs58Wvk,357
|
|
17
|
+
haiku/rag/embeddings/voyageai.py,sha256=0hiRTIqu-bpl-4OaCtMHvWfPdgbrzhnfZJowSV8pLRA,415
|
|
18
|
+
haiku/rag/qa/__init__.py,sha256=Sl7Kzrg9CuBOcMF01wc1NtQhUNWjJI0MhIHfCWrb8V4,434
|
|
19
|
+
haiku/rag/qa/agent.py,sha256=gZ12vLUSHHCMl0HyPoLlPDbhUWoyEUydXG7u8lG1eqg,2602
|
|
20
|
+
haiku/rag/qa/prompts.py,sha256=xdT4cyrOrAK9UDgVqyev1wHF49jD57Bh40gx2sH4NPI,3341
|
|
21
|
+
haiku/rag/reranking/__init__.py,sha256=IRXHs4qPu6VbGJQpzSwhgtVWWumURH_vEoVFE-extlo,894
|
|
22
|
+
haiku/rag/reranking/base.py,sha256=LM9yUSSJ414UgBZhFTgxGprlRqzfTe4I1vgjricz2JY,405
|
|
23
|
+
haiku/rag/reranking/cohere.py,sha256=1iTdiaa8vvb6oHVB2qpWzUOVkyfUcimVSZp6Qr4aq4c,1049
|
|
24
|
+
haiku/rag/reranking/mxbai.py,sha256=46sVTsTIkzIX9THgM3u8HaEmgY7evvEyB-N54JTHvK8,867
|
|
25
|
+
haiku/rag/store/__init__.py,sha256=hq0W0DAC7ysqhWSP2M2uHX8cbG6kbr-sWHxhq6qQcY0,103
|
|
26
|
+
haiku/rag/store/engine.py,sha256=XHGo5Xl-dCFdQHrOdMo64xVK5n0k8-LoUl5V-tlA0HI,7131
|
|
27
|
+
haiku/rag/store/models/__init__.py,sha256=s0E72zneGlowvZrFWaNxHYjOAUjgWdLxzdYsnvNRVlY,88
|
|
28
|
+
haiku/rag/store/models/chunk.py,sha256=ZNyTfO6lh3rXWLVYO3TZcitbL4LSUGr42fR6jQQ5iQc,364
|
|
29
|
+
haiku/rag/store/models/document.py,sha256=zSSpt6pyrMJAIXGQvIcqojcqUzwZnhp3WxVokaWxNRc,396
|
|
30
|
+
haiku/rag/store/repositories/__init__.py,sha256=Olv5dLfBQINRV3HrsfUpjzkZ7Qm7goEYyMNykgo_DaY,291
|
|
31
|
+
haiku/rag/store/repositories/chunk.py,sha256=5S77mGh6pWxPHjaXriJGmvbSOhoNM8tLwygE2GXPlbU,13586
|
|
32
|
+
haiku/rag/store/repositories/document.py,sha256=lP8Lo82KTP-qwXFRpYZ46WjeAdAsHwZ5pJcrXdz4g0U,6988
|
|
33
|
+
haiku/rag/store/repositories/settings.py,sha256=dqnAvm-98nQrWpLBbf9QghJw673QD80-iqQhRMP5t0c,5025
|
|
34
|
+
haiku/rag/store/upgrades/__init__.py,sha256=wUiEoSiHTahvuagx93E4FB07v123AhdbOjwUkPusiIg,14
|
|
35
|
+
haiku_rag-0.7.1.dist-info/METADATA,sha256=yIz4nATa_b2vDstrCZe9CzV_77Vw74QIhRWqCZCdaes,4597
|
|
36
|
+
haiku_rag-0.7.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
37
|
+
haiku_rag-0.7.1.dist-info/entry_points.txt,sha256=G1U3nAkNd5YDYd4v0tuYFbriz0i-JheCsFuT9kIoGCI,48
|
|
38
|
+
haiku_rag-0.7.1.dist-info/licenses/LICENSE,sha256=eXZrWjSk9PwYFNK9yUczl3oPl95Z4V9UXH7bPN46iPo,1065
|
|
39
|
+
haiku_rag-0.7.1.dist-info/RECORD,,
|
haiku/rag/reranking/ollama.py
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
from pydantic import BaseModel
|
|
2
|
-
from pydantic_ai import Agent
|
|
3
|
-
from pydantic_ai.models.openai import OpenAIModel
|
|
4
|
-
from pydantic_ai.providers.ollama import OllamaProvider
|
|
5
|
-
|
|
6
|
-
from haiku.rag.config import Config
|
|
7
|
-
from haiku.rag.reranking.base import RerankerBase
|
|
8
|
-
from haiku.rag.store.models.chunk import Chunk
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
class RerankResult(BaseModel):
|
|
12
|
-
"""Individual rerank result with index and relevance score."""
|
|
13
|
-
|
|
14
|
-
index: int
|
|
15
|
-
relevance_score: float
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
class RerankResponse(BaseModel):
|
|
19
|
-
"""Response from the reranking model containing ranked results."""
|
|
20
|
-
|
|
21
|
-
results: list[RerankResult]
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
class OllamaReranker(RerankerBase):
|
|
25
|
-
def __init__(self, model: str = Config.RERANK_MODEL):
|
|
26
|
-
self._model = model
|
|
27
|
-
|
|
28
|
-
# Create the reranking prompt
|
|
29
|
-
system_prompt = """You are a document reranking assistant. Given a query and a list of document chunks, you must rank them by relevance to the query.
|
|
30
|
-
|
|
31
|
-
Return your response as a JSON object with a "results" array. Each result should have:
|
|
32
|
-
- "index": the original index of the document (integer)
|
|
33
|
-
- "relevance_score": a score between 0.0 and 1.0 indicating relevance (float, where 1.0 is most relevant)
|
|
34
|
-
|
|
35
|
-
Only return the top documents up to the requested limit, ordered by decreasing relevance score.
|
|
36
|
-
/no_think
|
|
37
|
-
"""
|
|
38
|
-
|
|
39
|
-
model_obj = OpenAIModel(
|
|
40
|
-
model_name=model,
|
|
41
|
-
provider=OllamaProvider(base_url=f"{Config.OLLAMA_BASE_URL}/v1"),
|
|
42
|
-
)
|
|
43
|
-
|
|
44
|
-
self._agent = Agent(
|
|
45
|
-
model=model_obj,
|
|
46
|
-
output_type=RerankResponse,
|
|
47
|
-
system_prompt=system_prompt,
|
|
48
|
-
)
|
|
49
|
-
|
|
50
|
-
async def rerank(
|
|
51
|
-
self, query: str, chunks: list[Chunk], top_n: int = 10
|
|
52
|
-
) -> list[tuple[Chunk, float]]:
|
|
53
|
-
if not chunks:
|
|
54
|
-
return []
|
|
55
|
-
|
|
56
|
-
documents = []
|
|
57
|
-
for i, chunk in enumerate(chunks):
|
|
58
|
-
documents.append({"index": i, "content": chunk.content})
|
|
59
|
-
|
|
60
|
-
documents_text = ""
|
|
61
|
-
for doc in documents:
|
|
62
|
-
documents_text += f"Index {doc['index']}: {doc['content']}\n\n"
|
|
63
|
-
|
|
64
|
-
user_prompt = f"""Query: {query}
|
|
65
|
-
|
|
66
|
-
Documents to rerank:
|
|
67
|
-
{documents_text.strip()}
|
|
68
|
-
|
|
69
|
-
Rank these documents by relevance to the query and return the top {top_n} results as JSON."""
|
|
70
|
-
|
|
71
|
-
try:
|
|
72
|
-
result = await self._agent.run(user_prompt)
|
|
73
|
-
|
|
74
|
-
return [
|
|
75
|
-
(chunks[result_item.index], result_item.relevance_score)
|
|
76
|
-
for result_item in result.output.results[:top_n]
|
|
77
|
-
]
|
|
78
|
-
|
|
79
|
-
except Exception:
|
|
80
|
-
# Fallback: return chunks in original order with same score
|
|
81
|
-
return [(chunks[i], 1.0) for i in range(min(top_n, len(chunks)))]
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
from abc import ABC, abstractmethod
|
|
2
|
-
from typing import Generic, TypeVar
|
|
3
|
-
|
|
4
|
-
from haiku.rag.store.engine import Store
|
|
5
|
-
|
|
6
|
-
T = TypeVar("T")
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class BaseRepository(ABC, Generic[T]):
|
|
10
|
-
"""Base repository interface for database operations."""
|
|
11
|
-
|
|
12
|
-
def __init__(self, store: Store):
|
|
13
|
-
self.store = store
|
|
14
|
-
|
|
15
|
-
@abstractmethod
|
|
16
|
-
async def create(self, entity: T) -> T:
|
|
17
|
-
"""Create a new entity in the database."""
|
|
18
|
-
pass
|
|
19
|
-
|
|
20
|
-
@abstractmethod
|
|
21
|
-
async def get_by_id(self, entity_id: int) -> T | None:
|
|
22
|
-
"""Get an entity by its ID."""
|
|
23
|
-
pass
|
|
24
|
-
|
|
25
|
-
@abstractmethod
|
|
26
|
-
async def update(self, entity: T) -> T:
|
|
27
|
-
"""Update an existing entity."""
|
|
28
|
-
pass
|
|
29
|
-
|
|
30
|
-
@abstractmethod
|
|
31
|
-
async def delete(self, entity_id: int) -> bool:
|
|
32
|
-
"""Delete an entity by its ID."""
|
|
33
|
-
pass
|
|
34
|
-
|
|
35
|
-
@abstractmethod
|
|
36
|
-
async def list_all(
|
|
37
|
-
self, limit: int | None = None, offset: int | None = None
|
|
38
|
-
) -> list[T]:
|
|
39
|
-
"""List all entities with optional pagination."""
|
|
40
|
-
pass
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
from collections.abc import Callable
|
|
2
|
-
from sqlite3 import Connection
|
|
3
|
-
|
|
4
|
-
from haiku.rag.config import Config
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
def add_settings_table(db: Connection) -> None:
|
|
8
|
-
"""Create settings table for storing current configuration"""
|
|
9
|
-
db.execute("""
|
|
10
|
-
CREATE TABLE settings (
|
|
11
|
-
id INTEGER PRIMARY KEY DEFAULT 1,
|
|
12
|
-
settings TEXT NOT NULL DEFAULT '{}'
|
|
13
|
-
)
|
|
14
|
-
""")
|
|
15
|
-
|
|
16
|
-
settings_json = Config.model_dump_json()
|
|
17
|
-
db.execute(
|
|
18
|
-
"INSERT INTO settings (id, settings) VALUES (1, ?)",
|
|
19
|
-
(settings_json,),
|
|
20
|
-
)
|
|
21
|
-
db.commit()
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
upgrades: list[tuple[str, list[Callable[[Connection], None]]]] = [
|
|
25
|
-
("0.3.4", [add_settings_table])
|
|
26
|
-
]
|
haiku_rag-0.6.0.dist-info/RECORD
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
haiku/rag/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
haiku/rag/app.py,sha256=k45EOz-rbYg_8RSII3btqsZo2TpGqj3ysamFehhaCGo,7673
|
|
3
|
-
haiku/rag/chunker.py,sha256=PVe6ysv8UlacUd4Zb3_8RFWIaWDXnzBAy2VDJ4TaUsE,1555
|
|
4
|
-
haiku/rag/cli.py,sha256=mGpdnEH8rS-rZLGmE4MbcDci8uexci7UkGTdCxrz1Lg,5987
|
|
5
|
-
haiku/rag/client.py,sha256=rpMKVxtb3Q2kuDM1pHaZsGX_w0TC1zxotsooNwI3Jbg,21129
|
|
6
|
-
haiku/rag/config.py,sha256=oLrmwGp1OjcKPpJFnf9GgTpoBSOXalFWO6PCKFwQe0w,1615
|
|
7
|
-
haiku/rag/logging.py,sha256=zTTGpGq5tPdcd7RpCbd9EGw1IZlQDbYkrCg9t9pqRc4,580
|
|
8
|
-
haiku/rag/mcp.py,sha256=tMN6fNX7ZtAER1R6DL1GkC9HZozTC4HzuQs199p7icI,4551
|
|
9
|
-
haiku/rag/monitor.py,sha256=r386nkhdlsU8UECwIuVwnrSlgMk3vNIuUZGNIzkZuec,2770
|
|
10
|
-
haiku/rag/reader.py,sha256=qkPTMJuQ_o4sK-8zpDl9WFYe_MJ7aL_gUw6rczIpW-g,3274
|
|
11
|
-
haiku/rag/utils.py,sha256=g-uNTG60iBLgkeHHuah6eVZEkX3NFLs-LZU1YnzJzLQ,2967
|
|
12
|
-
haiku/rag/embeddings/__init__.py,sha256=n7aHW3BxHlpGxU4ze4YYDOsljzFpEep8dwVE2n45JoE,1218
|
|
13
|
-
haiku/rag/embeddings/base.py,sha256=NTQvuzbZPu0LBo5wAu3qGyJ4xXUaRAt1fjBO0ygWn_Y,465
|
|
14
|
-
haiku/rag/embeddings/ollama.py,sha256=y6-lp0XpbnyIjoOEdtSzMdEVkU5glOwnWQ1FkpUZnpI,370
|
|
15
|
-
haiku/rag/embeddings/openai.py,sha256=iA-DewCOSip8PLU_RhEJHFHBle4DtmCCIGNfGs58Wvk,357
|
|
16
|
-
haiku/rag/embeddings/voyageai.py,sha256=0hiRTIqu-bpl-4OaCtMHvWfPdgbrzhnfZJowSV8pLRA,415
|
|
17
|
-
haiku/rag/qa/__init__.py,sha256=Sl7Kzrg9CuBOcMF01wc1NtQhUNWjJI0MhIHfCWrb8V4,434
|
|
18
|
-
haiku/rag/qa/agent.py,sha256=r6tYKvOW4W1HxBRHH1kmzlzb1bIJcQSuHd6cG9ANqXY,2594
|
|
19
|
-
haiku/rag/qa/prompts.py,sha256=xdT4cyrOrAK9UDgVqyev1wHF49jD57Bh40gx2sH4NPI,3341
|
|
20
|
-
haiku/rag/reranking/__init__.py,sha256=fwC3pauteJwh9Ulm2270QvwAdwr4NMr4RUEuolC-wKU,1063
|
|
21
|
-
haiku/rag/reranking/base.py,sha256=LM9yUSSJ414UgBZhFTgxGprlRqzfTe4I1vgjricz2JY,405
|
|
22
|
-
haiku/rag/reranking/cohere.py,sha256=1iTdiaa8vvb6oHVB2qpWzUOVkyfUcimVSZp6Qr4aq4c,1049
|
|
23
|
-
haiku/rag/reranking/mxbai.py,sha256=46sVTsTIkzIX9THgM3u8HaEmgY7evvEyB-N54JTHvK8,867
|
|
24
|
-
haiku/rag/reranking/ollama.py,sha256=Q3dJepxFyB9CRCtrZvcwX-Drrpa2-8TMO7YGhxD1Qcs,2610
|
|
25
|
-
haiku/rag/store/__init__.py,sha256=hq0W0DAC7ysqhWSP2M2uHX8cbG6kbr-sWHxhq6qQcY0,103
|
|
26
|
-
haiku/rag/store/engine.py,sha256=cOMBToLilI1Di1qQrFzGLqtRMsuvtiX0Q5RNIEzQy9w,6232
|
|
27
|
-
haiku/rag/store/models/__init__.py,sha256=s0E72zneGlowvZrFWaNxHYjOAUjgWdLxzdYsnvNRVlY,88
|
|
28
|
-
haiku/rag/store/models/chunk.py,sha256=9-vIxW75-kMTelIhgVIMd_WhP-Drc1q65vjaWMP8w1E,364
|
|
29
|
-
haiku/rag/store/models/document.py,sha256=TVXVY-nQs-1vCORQEs9rA7zOtndeGC4dgCoujLAS054,396
|
|
30
|
-
haiku/rag/store/repositories/__init__.py,sha256=uIBhxjQh-4o3O-ck8b7BQ58qXQTuJdPvrDIHVhY5T1A,263
|
|
31
|
-
haiku/rag/store/repositories/base.py,sha256=cm3VyQXhtxvRfk1uJHpA0fDSxMpYN-mjQmRiDiLsQ68,1008
|
|
32
|
-
haiku/rag/store/repositories/chunk.py,sha256=R8dvNy3po2FspZvkWKZTGlqccbekLjY39GroXRfAU18,18808
|
|
33
|
-
haiku/rag/store/repositories/document.py,sha256=ki8LiDukwU1469Yw51i0rQFvBzUQeYkFYWs3Ly83akc,8815
|
|
34
|
-
haiku/rag/store/repositories/settings.py,sha256=qZLXvLsErnCWL0nBQQNfRnatHzCKhtUDLvUK9k-W_fU,2463
|
|
35
|
-
haiku/rag/store/upgrades/__init__.py,sha256=kKS1YWT_P-CYKhKtokOLTIFNKf9jlfjFFr8lyIMeogM,100
|
|
36
|
-
haiku/rag/store/upgrades/v0_3_4.py,sha256=GLogKZdZ40NX1vBHKdOJju7fFzNUCHoEnjSZg17Hm2U,663
|
|
37
|
-
haiku_rag-0.6.0.dist-info/METADATA,sha256=oLxNtf0pFMyLwc9sVsiztYbrpiyVNkg0wsX0TZdUYFw,4283
|
|
38
|
-
haiku_rag-0.6.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
39
|
-
haiku_rag-0.6.0.dist-info/entry_points.txt,sha256=G1U3nAkNd5YDYd4v0tuYFbriz0i-JheCsFuT9kIoGCI,48
|
|
40
|
-
haiku_rag-0.6.0.dist-info/licenses/LICENSE,sha256=eXZrWjSk9PwYFNK9yUczl3oPl95Z4V9UXH7bPN46iPo,1065
|
|
41
|
-
haiku_rag-0.6.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|