haiku.rag 0.4.2__tar.gz → 0.4.3__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.

Potentially problematic release.


This version of haiku.rag might be problematic. Click here for more details.

Files changed (77) hide show
  1. {haiku_rag-0.4.2 → haiku_rag-0.4.3}/PKG-INFO +3 -3
  2. {haiku_rag-0.4.2 → haiku_rag-0.4.3}/README.md +1 -1
  3. {haiku_rag-0.4.2 → haiku_rag-0.4.3}/docs/index.md +1 -1
  4. {haiku_rag-0.4.2 → haiku_rag-0.4.3}/docs/server.md +2 -1
  5. {haiku_rag-0.4.2 → haiku_rag-0.4.3}/pyproject.toml +2 -2
  6. {haiku_rag-0.4.2 → haiku_rag-0.4.3}/src/haiku/rag/cli.py +17 -1
  7. haiku_rag-0.4.3/src/haiku/rag/reader.py +109 -0
  8. {haiku_rag-0.4.2 → haiku_rag-0.4.3}/src/haiku/rag/store/engine.py +5 -0
  9. {haiku_rag-0.4.2 → haiku_rag-0.4.3}/uv.lock +1004 -294
  10. haiku_rag-0.4.2/src/haiku/rag/reader.py +0 -52
  11. {haiku_rag-0.4.2 → haiku_rag-0.4.3}/.github/FUNDING.yml +0 -0
  12. {haiku_rag-0.4.2 → haiku_rag-0.4.3}/.github/workflows/build-docs.yml +0 -0
  13. {haiku_rag-0.4.2 → haiku_rag-0.4.3}/.github/workflows/build-publish.yml +0 -0
  14. {haiku_rag-0.4.2 → haiku_rag-0.4.3}/.gitignore +0 -0
  15. {haiku_rag-0.4.2 → haiku_rag-0.4.3}/.pre-commit-config.yaml +0 -0
  16. {haiku_rag-0.4.2 → haiku_rag-0.4.3}/.python-version +0 -0
  17. {haiku_rag-0.4.2 → haiku_rag-0.4.3}/LICENSE +0 -0
  18. {haiku_rag-0.4.2 → haiku_rag-0.4.3}/docs/benchmarks.md +0 -0
  19. {haiku_rag-0.4.2 → haiku_rag-0.4.3}/docs/cli.md +0 -0
  20. {haiku_rag-0.4.2 → haiku_rag-0.4.3}/docs/configuration.md +0 -0
  21. {haiku_rag-0.4.2 → haiku_rag-0.4.3}/docs/installation.md +0 -0
  22. {haiku_rag-0.4.2 → haiku_rag-0.4.3}/docs/mcp.md +0 -0
  23. {haiku_rag-0.4.2 → haiku_rag-0.4.3}/docs/python.md +0 -0
  24. {haiku_rag-0.4.2 → haiku_rag-0.4.3}/mkdocs.yml +0 -0
  25. {haiku_rag-0.4.2 → haiku_rag-0.4.3}/src/haiku/rag/__init__.py +0 -0
  26. {haiku_rag-0.4.2 → haiku_rag-0.4.3}/src/haiku/rag/app.py +0 -0
  27. {haiku_rag-0.4.2 → haiku_rag-0.4.3}/src/haiku/rag/chunker.py +0 -0
  28. {haiku_rag-0.4.2 → haiku_rag-0.4.3}/src/haiku/rag/client.py +0 -0
  29. {haiku_rag-0.4.2 → haiku_rag-0.4.3}/src/haiku/rag/config.py +0 -0
  30. {haiku_rag-0.4.2 → haiku_rag-0.4.3}/src/haiku/rag/embeddings/__init__.py +0 -0
  31. {haiku_rag-0.4.2 → haiku_rag-0.4.3}/src/haiku/rag/embeddings/base.py +0 -0
  32. {haiku_rag-0.4.2 → haiku_rag-0.4.3}/src/haiku/rag/embeddings/ollama.py +0 -0
  33. {haiku_rag-0.4.2 → haiku_rag-0.4.3}/src/haiku/rag/embeddings/openai.py +0 -0
  34. {haiku_rag-0.4.2 → haiku_rag-0.4.3}/src/haiku/rag/embeddings/voyageai.py +0 -0
  35. {haiku_rag-0.4.2 → haiku_rag-0.4.3}/src/haiku/rag/logging.py +0 -0
  36. {haiku_rag-0.4.2 → haiku_rag-0.4.3}/src/haiku/rag/mcp.py +0 -0
  37. {haiku_rag-0.4.2 → haiku_rag-0.4.3}/src/haiku/rag/monitor.py +0 -0
  38. {haiku_rag-0.4.2 → haiku_rag-0.4.3}/src/haiku/rag/qa/__init__.py +0 -0
  39. {haiku_rag-0.4.2 → haiku_rag-0.4.3}/src/haiku/rag/qa/anthropic.py +0 -0
  40. {haiku_rag-0.4.2 → haiku_rag-0.4.3}/src/haiku/rag/qa/base.py +0 -0
  41. {haiku_rag-0.4.2 → haiku_rag-0.4.3}/src/haiku/rag/qa/ollama.py +0 -0
  42. {haiku_rag-0.4.2 → haiku_rag-0.4.3}/src/haiku/rag/qa/openai.py +0 -0
  43. {haiku_rag-0.4.2 → haiku_rag-0.4.3}/src/haiku/rag/qa/prompts.py +0 -0
  44. {haiku_rag-0.4.2 → haiku_rag-0.4.3}/src/haiku/rag/reranking/__init__.py +0 -0
  45. {haiku_rag-0.4.2 → haiku_rag-0.4.3}/src/haiku/rag/reranking/base.py +0 -0
  46. {haiku_rag-0.4.2 → haiku_rag-0.4.3}/src/haiku/rag/reranking/cohere.py +0 -0
  47. {haiku_rag-0.4.2 → haiku_rag-0.4.3}/src/haiku/rag/reranking/mxbai.py +0 -0
  48. {haiku_rag-0.4.2 → haiku_rag-0.4.3}/src/haiku/rag/store/__init__.py +0 -0
  49. {haiku_rag-0.4.2 → haiku_rag-0.4.3}/src/haiku/rag/store/models/__init__.py +0 -0
  50. {haiku_rag-0.4.2 → haiku_rag-0.4.3}/src/haiku/rag/store/models/chunk.py +0 -0
  51. {haiku_rag-0.4.2 → haiku_rag-0.4.3}/src/haiku/rag/store/models/document.py +0 -0
  52. {haiku_rag-0.4.2 → haiku_rag-0.4.3}/src/haiku/rag/store/repositories/__init__.py +0 -0
  53. {haiku_rag-0.4.2 → haiku_rag-0.4.3}/src/haiku/rag/store/repositories/base.py +0 -0
  54. {haiku_rag-0.4.2 → haiku_rag-0.4.3}/src/haiku/rag/store/repositories/chunk.py +0 -0
  55. {haiku_rag-0.4.2 → haiku_rag-0.4.3}/src/haiku/rag/store/repositories/document.py +0 -0
  56. {haiku_rag-0.4.2 → haiku_rag-0.4.3}/src/haiku/rag/store/repositories/settings.py +0 -0
  57. {haiku_rag-0.4.2 → haiku_rag-0.4.3}/src/haiku/rag/store/upgrades/__init__.py +0 -0
  58. {haiku_rag-0.4.2 → haiku_rag-0.4.3}/src/haiku/rag/store/upgrades/v0_3_4.py +0 -0
  59. {haiku_rag-0.4.2 → haiku_rag-0.4.3}/src/haiku/rag/utils.py +0 -0
  60. {haiku_rag-0.4.2 → haiku_rag-0.4.3}/tests/__init__.py +0 -0
  61. {haiku_rag-0.4.2 → haiku_rag-0.4.3}/tests/conftest.py +0 -0
  62. {haiku_rag-0.4.2 → haiku_rag-0.4.3}/tests/generate_benchmark_db.py +0 -0
  63. {haiku_rag-0.4.2 → haiku_rag-0.4.3}/tests/llm_judge.py +0 -0
  64. {haiku_rag-0.4.2 → haiku_rag-0.4.3}/tests/test_app.py +0 -0
  65. {haiku_rag-0.4.2 → haiku_rag-0.4.3}/tests/test_chunk.py +0 -0
  66. {haiku_rag-0.4.2 → haiku_rag-0.4.3}/tests/test_chunker.py +0 -0
  67. {haiku_rag-0.4.2 → haiku_rag-0.4.3}/tests/test_cli.py +0 -0
  68. {haiku_rag-0.4.2 → haiku_rag-0.4.3}/tests/test_client.py +0 -0
  69. {haiku_rag-0.4.2 → haiku_rag-0.4.3}/tests/test_document.py +0 -0
  70. {haiku_rag-0.4.2 → haiku_rag-0.4.3}/tests/test_embedder.py +0 -0
  71. {haiku_rag-0.4.2 → haiku_rag-0.4.3}/tests/test_monitor.py +0 -0
  72. {haiku_rag-0.4.2 → haiku_rag-0.4.3}/tests/test_qa.py +0 -0
  73. {haiku_rag-0.4.2 → haiku_rag-0.4.3}/tests/test_rebuild.py +0 -0
  74. {haiku_rag-0.4.2 → haiku_rag-0.4.3}/tests/test_reranker.py +0 -0
  75. {haiku_rag-0.4.2 → haiku_rag-0.4.3}/tests/test_search.py +0 -0
  76. {haiku_rag-0.4.2 → haiku_rag-0.4.3}/tests/test_settings.py +0 -0
  77. {haiku_rag-0.4.2 → haiku_rag-0.4.3}/tests/test_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: haiku.rag
3
- Version: 0.4.2
3
+ Version: 0.4.3
4
4
  Summary: Retrieval Augmented Generation (RAG) with SQLite
5
5
  Author-email: Yiorgis Gozadinos <ggozadinos@gmail.com>
6
6
  License: MIT
@@ -18,9 +18,9 @@ Classifier: Programming Language :: Python :: 3.11
18
18
  Classifier: Programming Language :: Python :: 3.12
19
19
  Classifier: Typing :: Typed
20
20
  Requires-Python: >=3.10
21
+ Requires-Dist: docling>=2.15.0
21
22
  Requires-Dist: fastmcp>=2.8.1
22
23
  Requires-Dist: httpx>=0.28.1
23
- Requires-Dist: markitdown[audio-transcription,docx,pdf,pptx,xlsx]>=0.1.2
24
24
  Requires-Dist: mxbai-rerank>=0.1.6
25
25
  Requires-Dist: ollama>=0.5.1
26
26
  Requires-Dist: pydantic>=2.11.7
@@ -55,7 +55,7 @@ Retrieval-Augmented Generation (RAG) library on SQLite.
55
55
  - **Reranking**: Default search result reranking with MixedBread AI or Cohere
56
56
  - **Question answering**: Built-in QA agents on your documents
57
57
  - **File monitoring**: Auto-index files when run as server
58
- - **40+ file formats**: PDF, DOCX, HTML, Markdown, audio, URLs
58
+ - **40+ file formats**: PDF, DOCX, HTML, Markdown, code files, URLs
59
59
  - **MCP server**: Expose as tools for AI assistants
60
60
  - **CLI & Python API**: Use from command line or Python
61
61
 
@@ -13,7 +13,7 @@ Retrieval-Augmented Generation (RAG) library on SQLite.
13
13
  - **Reranking**: Default search result reranking with MixedBread AI or Cohere
14
14
  - **Question answering**: Built-in QA agents on your documents
15
15
  - **File monitoring**: Auto-index files when run as server
16
- - **40+ file formats**: PDF, DOCX, HTML, Markdown, audio, URLs
16
+ - **40+ file formats**: PDF, DOCX, HTML, Markdown, code files, URLs
17
17
  - **MCP server**: Expose as tools for AI assistants
18
18
  - **CLI & Python API**: Use from command line or Python
19
19
 
@@ -10,7 +10,7 @@
10
10
  - **Reranking**: Optional result reranking with MixedBread AI or Cohere
11
11
  - **Question Answering**: Built-in QA agents using Ollama, OpenAI, or Anthropic.
12
12
  - **File monitoring**: Automatically index files when run as a server
13
- - **Extended file format support**: Parse 40+ file formats including PDF, DOCX, HTML, Markdown, audio and more. Or add a URL!
13
+ - **Extended file format support**: Parse 40+ file formats including PDF, DOCX, HTML, Markdown, code files and more. Or add a URL!
14
14
  - **MCP server**: Exposes functionality as MCP tools
15
15
  - **CLI commands**: Access all functionality from your terminal
16
16
  - **Python client**: Call `haiku.rag` from your own python applications
@@ -35,7 +35,8 @@ The server can parse 40+ file formats including:
35
35
  - Microsoft Office (DOCX, XLSX, PPTX)
36
36
  - HTML and Markdown
37
37
  - Plain text files
38
- - Audio files
38
+ - Code files (Python, JavaScript, etc.)
39
+ - Images (processed via OCR)
39
40
  - And more...
40
41
 
41
42
  URLs are also supported for web content.
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "haiku.rag"
3
- version = "0.4.2"
3
+ version = "0.4.3"
4
4
  description = "Retrieval Augmented Generation (RAG) with SQLite"
5
5
  authors = [{ name = "Yiorgis Gozadinos", email = "ggozadinos@gmail.com" }]
6
6
  license = { text = "MIT" }
@@ -22,9 +22,9 @@ classifiers = [
22
22
  ]
23
23
 
24
24
  dependencies = [
25
+ "docling>=2.15.0",
25
26
  "fastmcp>=2.8.1",
26
27
  "httpx>=0.28.1",
27
- "markitdown[audio-transcription,docx,pdf,pptx,xlsx]>=0.1.2",
28
28
  "mxbai-rerank>=0.1.6",
29
29
  "ollama>=0.5.1",
30
30
  "pydantic>=2.11.7",
@@ -1,4 +1,5 @@
1
1
  import asyncio
2
+ from importlib.metadata import version
2
3
  from pathlib import Path
3
4
 
4
5
  import typer
@@ -26,8 +27,23 @@ async def check_version():
26
27
  console.print("[yellow]Please update.[/yellow]")
27
28
 
28
29
 
30
+ def version_callback(value: bool):
31
+ if value:
32
+ v = version("haiku.rag")
33
+ console.print(f"haiku.rag version {v}")
34
+ raise typer.Exit()
35
+
36
+
29
37
  @cli.callback()
30
- def main():
38
+ def main(
39
+ _version: bool = typer.Option(
40
+ False,
41
+ "-v",
42
+ "--version",
43
+ callback=version_callback,
44
+ help="Show version and exit",
45
+ ),
46
+ ):
31
47
  """haiku.rag CLI - SQLite-based RAG system"""
32
48
  # Run version check before any command
33
49
  event_loop.run_until_complete(check_version())
@@ -0,0 +1,109 @@
1
+ from pathlib import Path
2
+ from typing import ClassVar
3
+
4
+ from docling.document_converter import DocumentConverter
5
+
6
+
7
+ class FileReader:
8
+ # Extensions supported by docling
9
+ docling_extensions: ClassVar[list[str]] = [
10
+ ".asciidoc",
11
+ ".bmp",
12
+ ".csv",
13
+ ".docx",
14
+ ".html",
15
+ ".xhtml",
16
+ ".jpeg",
17
+ ".jpg",
18
+ ".md",
19
+ ".pdf.png",
20
+ ".pptx",
21
+ ".tiff",
22
+ ".xlsx",
23
+ ".xml",
24
+ ".webp",
25
+ ]
26
+
27
+ # Plain text extensions that we'll read directly
28
+ text_extensions: ClassVar[list[str]] = [
29
+ ".astro",
30
+ ".c",
31
+ ".cpp",
32
+ ".css",
33
+ ".go",
34
+ ".h",
35
+ ".hpp",
36
+ ".java",
37
+ ".js",
38
+ ".json",
39
+ ".kt",
40
+ ".mdx",
41
+ ".mjs",
42
+ ".php",
43
+ ".py",
44
+ ".rb",
45
+ ".rs",
46
+ ".svelte",
47
+ ".swift",
48
+ ".ts",
49
+ ".tsx",
50
+ ".txt",
51
+ ".vue",
52
+ ".yaml",
53
+ ".yml",
54
+ ]
55
+
56
+ # Code file extensions with their markdown language identifiers for syntax highlighting
57
+ code_markdown_identifier: ClassVar[dict[str, str]] = {
58
+ ".astro": "astro",
59
+ ".c": "c",
60
+ ".cpp": "cpp",
61
+ ".css": "css",
62
+ ".go": "go",
63
+ ".h": "c",
64
+ ".hpp": "cpp",
65
+ ".java": "java",
66
+ ".js": "javascript",
67
+ ".json": "json",
68
+ ".kt": "kotlin",
69
+ ".mjs": "javascript",
70
+ ".php": "php",
71
+ ".py": "python",
72
+ ".rb": "ruby",
73
+ ".rs": "rust",
74
+ ".svelte": "svelte",
75
+ ".swift": "swift",
76
+ ".ts": "typescript",
77
+ ".tsx": "tsx",
78
+ ".vue": "vue",
79
+ ".yaml": "yaml",
80
+ ".yml": "yaml",
81
+ }
82
+
83
+ extensions: ClassVar[list[str]] = docling_extensions + text_extensions
84
+
85
+ @staticmethod
86
+ def parse_file(path: Path) -> str:
87
+ try:
88
+ file_extension = path.suffix.lower()
89
+
90
+ if file_extension in FileReader.docling_extensions:
91
+ # Use docling for complex document formats
92
+ converter = DocumentConverter()
93
+ result = converter.convert(path)
94
+ return result.document.export_to_markdown()
95
+ elif file_extension in FileReader.text_extensions:
96
+ # Read plain text files directly
97
+ content = path.read_text(encoding="utf-8")
98
+
99
+ # Wrap code files (but not plain txt) in markdown code blocks for better presentation
100
+ if file_extension in FileReader.code_markdown_identifier:
101
+ language = FileReader.code_markdown_identifier[file_extension]
102
+ return f"```{language}\n{content}\n```"
103
+
104
+ return content
105
+ else:
106
+ # Fallback: try to read as text
107
+ return path.read_text(encoding="utf-8")
108
+ except Exception:
109
+ raise ValueError(f"Failed to parse file: {path}")
@@ -37,6 +37,11 @@ class Store:
37
37
  db = sqlite3.connect(self.db_path)
38
38
  db.enable_load_extension(True)
39
39
  sqlite_vec.load(db)
40
+
41
+ # Enable WAL mode for better concurrency (skip for in-memory databases)
42
+ if self.db_path != ":memory:":
43
+ db.execute("PRAGMA journal_mode=WAL")
44
+
40
45
  self._connection = db
41
46
  existing_tables = [
42
47
  row[0]