rag-python 0.2.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.
- rag_python-0.3.1/PKG-INFO +205 -0
- rag_python-0.3.1/README.md +152 -0
- {rag_python-0.2.0 → rag_python-0.3.1}/pyproject.toml +7 -5
- {rag_python-0.2.0 → rag_python-0.3.1}/src/rag_python/__init__.py +19 -4
- rag_python-0.3.1/src/rag_python/cli.py +266 -0
- {rag_python-0.2.0 → rag_python-0.3.1}/src/rag_python/client.py +22 -1
- rag_python-0.3.1/src/rag_python/document_loaders.py +146 -0
- rag_python-0.3.1/src/rag_python/generation.py +65 -0
- rag_python-0.3.1/src/rag_python/help_text.py +229 -0
- rag_python-0.3.1/src/rag_python/hybrid_search.py +51 -0
- rag_python-0.3.1/src/rag_python/log.py +21 -0
- {rag_python-0.2.0 → rag_python-0.3.1}/src/rag_python/options.py +3 -2
- {rag_python-0.2.0 → rag_python-0.3.1}/src/rag_python/providers/anthropic_provider.py +23 -0
- {rag_python-0.2.0 → rag_python-0.3.1}/src/rag_python/providers/azure_openai_provider.py +26 -0
- {rag_python-0.2.0 → rag_python-0.3.1}/src/rag_python/providers/base.py +11 -0
- {rag_python-0.2.0 → rag_python-0.3.1}/src/rag_python/providers/ollama_provider.py +37 -0
- {rag_python-0.2.0 → rag_python-0.3.1}/src/rag_python/providers/openai_provider.py +26 -0
- rag_python-0.3.1/src/rag_python/providers/streaming.py +35 -0
- rag_python-0.3.1/src/rag_python/rag_pipeline.py +460 -0
- rag_python-0.3.1/src/rag_python/retrieval.py +101 -0
- {rag_python-0.2.0 → rag_python-0.3.1}/src/rag_python/vector_store.py +13 -0
- rag_python-0.3.1/src/rag_python.egg-info/PKG-INFO +205 -0
- {rag_python-0.2.0 → rag_python-0.3.1}/src/rag_python.egg-info/SOURCES.txt +9 -1
- {rag_python-0.2.0 → rag_python-0.3.1}/src/rag_python.egg-info/requires.txt +5 -1
- rag_python-0.3.1/tests/test_cli.py +52 -0
- rag_python-0.3.1/tests/test_hybrid_search.py +35 -0
- {rag_python-0.2.0 → rag_python-0.3.1}/tests/test_import.py +1 -1
- {rag_python-0.2.0 → rag_python-0.3.1}/tests/test_loaders.py +26 -0
- {rag_python-0.2.0 → rag_python-0.3.1}/tests/test_package.py +1 -1
- rag_python-0.3.1/tests/test_retrieval.py +52 -0
- rag_python-0.3.1/tests/test_streaming.py +38 -0
- rag_python-0.2.0/PKG-INFO +0 -162
- rag_python-0.2.0/README.md +0 -113
- rag_python-0.2.0/src/rag_python/cli.py +0 -92
- rag_python-0.2.0/src/rag_python/document_loaders.py +0 -74
- rag_python-0.2.0/src/rag_python/generation.py +0 -35
- rag_python-0.2.0/src/rag_python/rag_pipeline.py +0 -241
- rag_python-0.2.0/src/rag_python/retrieval.py +0 -61
- rag_python-0.2.0/src/rag_python.egg-info/PKG-INFO +0 -162
- {rag_python-0.2.0 → rag_python-0.3.1}/LICENSE +0 -0
- {rag_python-0.2.0 → rag_python-0.3.1}/setup.cfg +0 -0
- {rag_python-0.2.0 → rag_python-0.3.1}/src/rag_python/chunking.py +0 -0
- {rag_python-0.2.0 → rag_python-0.3.1}/src/rag_python/cleaning.py +0 -0
- {rag_python-0.2.0 → rag_python-0.3.1}/src/rag_python/config.py +0 -0
- {rag_python-0.2.0 → rag_python-0.3.1}/src/rag_python/evaluation.py +0 -0
- {rag_python-0.2.0 → rag_python-0.3.1}/src/rag_python/guardrails.py +0 -0
- {rag_python-0.2.0 → rag_python-0.3.1}/src/rag_python/providers/__init__.py +0 -0
- {rag_python-0.2.0 → rag_python-0.3.1}/src/rag_python/providers/factory.py +0 -0
- {rag_python-0.2.0 → rag_python-0.3.1}/src/rag_python/providers/gemini_provider.py +0 -0
- {rag_python-0.2.0 → rag_python-0.3.1}/src/rag_python/providers/local_provider.py +0 -0
- {rag_python-0.2.0 → rag_python-0.3.1}/src/rag_python/py.typed +0 -0
- {rag_python-0.2.0 → rag_python-0.3.1}/src/rag_python/query_rewriting.py +0 -0
- {rag_python-0.2.0 → rag_python-0.3.1}/src/rag_python/reranker.py +0 -0
- {rag_python-0.2.0 → rag_python-0.3.1}/src/rag_python.egg-info/dependency_links.txt +0 -0
- {rag_python-0.2.0 → rag_python-0.3.1}/src/rag_python.egg-info/entry_points.txt +0 -0
- {rag_python-0.2.0 → rag_python-0.3.1}/src/rag_python.egg-info/top_level.txt +0 -0
- {rag_python-0.2.0 → rag_python-0.3.1}/tests/test_chunking.py +0 -0
- {rag_python-0.2.0 → rag_python-0.3.1}/tests/test_config.py +0 -0
- {rag_python-0.2.0 → rag_python-0.3.1}/tests/test_pipeline.py +0 -0
- {rag_python-0.2.0 → rag_python-0.3.1}/tests/test_providers.py +0 -0
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
|
+
Name: rag-python
|
|
3
|
+
Version: 0.3.1
|
|
4
|
+
Summary: Production-grade RAG for Python: ingest documents, hybrid search, streaming, multi-LLM, guardrails. CLI + Python API.
|
|
5
|
+
Author-email: Raghav Singla <04raghavsingla28@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/RaghavOG/rag-python
|
|
8
|
+
Project-URL: Repository, https://github.com/RaghavOG/rag-python
|
|
9
|
+
Project-URL: Documentation, https://github.com/RaghavOG/rag-python/tree/main/docs
|
|
10
|
+
Project-URL: Changelog, https://github.com/RaghavOG/rag-python/blob/main/CHANGELOG.md
|
|
11
|
+
Project-URL: Issues, https://github.com/RaghavOG/rag-python/issues
|
|
12
|
+
Keywords: rag,llm,embeddings,chromadb,openai,rag-python,retrieval-augmented-generation
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
21
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
22
|
+
Requires-Python: >=3.10
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
License-File: LICENSE
|
|
25
|
+
Requires-Dist: openai>=1.12.0
|
|
26
|
+
Requires-Dist: tiktoken>=0.5.0
|
|
27
|
+
Requires-Dist: chromadb>=0.4.22
|
|
28
|
+
Requires-Dist: pypdf>=3.17.0
|
|
29
|
+
Requires-Dist: python-docx>=1.1.0
|
|
30
|
+
Requires-Dist: langdetect>=1.0.9
|
|
31
|
+
Requires-Dist: regex>=2023.0.0
|
|
32
|
+
Requires-Dist: python-dotenv>=1.0.0
|
|
33
|
+
Requires-Dist: requests>=2.31.0
|
|
34
|
+
Provides-Extra: rerank
|
|
35
|
+
Requires-Dist: sentence-transformers>=2.2.0; extra == "rerank"
|
|
36
|
+
Requires-Dist: torch>=2.0.0; extra == "rerank"
|
|
37
|
+
Provides-Extra: local
|
|
38
|
+
Requires-Dist: sentence-transformers>=2.2.0; extra == "local"
|
|
39
|
+
Provides-Extra: hybrid
|
|
40
|
+
Requires-Dist: rank-bm25>=0.2.2; extra == "hybrid"
|
|
41
|
+
Provides-Extra: anthropic
|
|
42
|
+
Requires-Dist: anthropic>=0.20.0; extra == "anthropic"
|
|
43
|
+
Provides-Extra: gemini
|
|
44
|
+
Requires-Dist: google-genai>=0.3.0; extra == "gemini"
|
|
45
|
+
Provides-Extra: dev
|
|
46
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
47
|
+
Requires-Dist: ruff>=0.1.0; extra == "dev"
|
|
48
|
+
Requires-Dist: build; extra == "dev"
|
|
49
|
+
Requires-Dist: twine; extra == "dev"
|
|
50
|
+
Requires-Dist: rank-bm25>=0.2.2; extra == "dev"
|
|
51
|
+
Provides-Extra: all
|
|
52
|
+
Requires-Dist: rag-python[anthropic,gemini,hybrid,local,rerank]; extra == "all"
|
|
53
|
+
|
|
54
|
+
# rag-python
|
|
55
|
+
|
|
56
|
+
[](https://pypi.org/project/rag-python/)
|
|
57
|
+
[](https://pypi.org/project/rag-python/)
|
|
58
|
+
[](https://www.python.org/downloads/)
|
|
59
|
+
[](LICENSE)
|
|
60
|
+
[](https://github.com/RaghavOG/rag-python/tree/main/docs)
|
|
61
|
+
|
|
62
|
+
**Production-grade Retrieval-Augmented Generation (RAG) for Python** — ingest documents, ask questions, get grounded answers with multi-LLM support, hybrid search, streaming, and guardrails.
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
pip install rag-python
|
|
66
|
+
export OPENAI_API_KEY=sk-...
|
|
67
|
+
rag-python ingest ./docs --reindex
|
|
68
|
+
rag-python query "What is our leave policy?"
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
**Author:** [Raghav Singla](https://github.com/RaghavOG) · **Repo:** [github.com/RaghavOG/rag-python](https://github.com/RaghavOG/rag-python)
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## Why rag-python?
|
|
76
|
+
|
|
77
|
+
| Capability | What you get |
|
|
78
|
+
|------------|--------------|
|
|
79
|
+
| **Ingest** | TXT, MD, PDF, DOCX, CSV, JSON, HTML → chunk → embed → ChromaDB |
|
|
80
|
+
| **Retrieve** | Multi-query rewriting, **hybrid BM25+vector**, reranking, metadata filters |
|
|
81
|
+
| **Generate** | Multi-LLM answers with guardrails, evaluation, and retry loop |
|
|
82
|
+
| **Stream** | `rag.query_stream()` and `--stream` CLI for responsive UX |
|
|
83
|
+
| **Offline** | Local embeddings via sentence-transformers |
|
|
84
|
+
| **CLI** | `rag-python ingest`, `query`, `docs` — no code required |
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## Install
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
pip install rag-python
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
| Extra | Install | Enables |
|
|
95
|
+
|-------|---------|---------|
|
|
96
|
+
| `local` | `pip install rag-python[local]` | Offline embeddings (sentence-transformers) |
|
|
97
|
+
| `hybrid` | `pip install rag-python[hybrid]` | BM25 + vector hybrid retrieval |
|
|
98
|
+
| `rerank` | `pip install rag-python[rerank]` | Cross-encoder reranking |
|
|
99
|
+
| `anthropic` | `pip install rag-python[anthropic]` | Claude LLM |
|
|
100
|
+
| `gemini` | `pip install rag-python[gemini]` | Gemini LLM |
|
|
101
|
+
| `all` | `pip install rag-python[all]` | All optional features |
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## Quickstart (Python)
|
|
106
|
+
|
|
107
|
+
```python
|
|
108
|
+
from rag_python import RAG
|
|
109
|
+
|
|
110
|
+
rag = RAG(llm_model="gpt-4o-mini")
|
|
111
|
+
rag.ingest(["./data"], reindex=True)
|
|
112
|
+
|
|
113
|
+
answer = rag.query("How many days of annual leave?")
|
|
114
|
+
print(answer.text)
|
|
115
|
+
print(answer.sources)
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Streaming
|
|
119
|
+
|
|
120
|
+
```python
|
|
121
|
+
stream = rag.query_stream("How many days of annual leave?")
|
|
122
|
+
for token in stream:
|
|
123
|
+
print(token, end="", flush=True)
|
|
124
|
+
print(stream.result.evaluation)
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Hybrid search + metadata filter
|
|
128
|
+
|
|
129
|
+
```python
|
|
130
|
+
rag = RAG(
|
|
131
|
+
retriever="hybrid", # pip install rag-python[hybrid]
|
|
132
|
+
metadata_filter={"filename": "leave-policy.pdf"},
|
|
133
|
+
)
|
|
134
|
+
rag.ingest(["./policies/"])
|
|
135
|
+
print(rag.query("annual leave policy").text)
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## Quickstart (CLI)
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
export OPENAI_API_KEY=sk-...
|
|
144
|
+
|
|
145
|
+
rag-python ingest ./data --reindex
|
|
146
|
+
rag-python query "How many days of annual leave?"
|
|
147
|
+
rag-python query "PTO policy" --stream -v
|
|
148
|
+
rag-python query "benefits" --retriever hybrid
|
|
149
|
+
|
|
150
|
+
# Built-in terminal docs
|
|
151
|
+
rag-python docs quickstart
|
|
152
|
+
rag-python docs --list
|
|
153
|
+
rag-python --help
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
## Documentation
|
|
159
|
+
|
|
160
|
+
| Guide | Description |
|
|
161
|
+
|-------|-------------|
|
|
162
|
+
| [**Docs index**](docs/README.md) | Start here |
|
|
163
|
+
| [Usage](docs/USAGE.md) | Python API, streaming, retrieval |
|
|
164
|
+
| [CLI reference](docs/CLI.md) | All `rag-python` commands and flags |
|
|
165
|
+
| [Configuration](docs/CONFIGURATION.md) | Env vars and `RAGConfig` |
|
|
166
|
+
| [Providers](docs/PROVIDERS.md) | OpenAI, Azure, Anthropic, Gemini, Ollama, local |
|
|
167
|
+
| [Changelog](CHANGELOG.md) | Release notes |
|
|
168
|
+
|
|
169
|
+
**In the terminal:** `rag-python docs [topic]` — topics: `quickstart`, `install`, `cli`, `config`, `providers`, `features`
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## Environment variables
|
|
174
|
+
|
|
175
|
+
| Variable | Description |
|
|
176
|
+
|----------|-------------|
|
|
177
|
+
| `OPENAI_API_KEY` | Default LLM + embeddings |
|
|
178
|
+
| `ANTHROPIC_API_KEY` | Claude |
|
|
179
|
+
| `GEMINI_API_KEY` | Gemini |
|
|
180
|
+
| `AZURE_OPENAI_ENDPOINT` / `AZURE_OPENAI_API_KEY` | Azure OpenAI |
|
|
181
|
+
| `OLLAMA_BASE_URL` | Local Ollama (default `http://localhost:11434`) |
|
|
182
|
+
| `RAG_PYTHON_DATA_DIR` | Document dir (default `./data`) |
|
|
183
|
+
| `RAG_PYTHON_CHROMA_DIR` | Vector store (default `./chroma_db`) |
|
|
184
|
+
|
|
185
|
+
See [Configuration](docs/CONFIGURATION.md) and [`.env.example`](.env.example).
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
## Project layout
|
|
190
|
+
|
|
191
|
+
```text
|
|
192
|
+
src/rag_python/ # pip install rag-python → import rag_python
|
|
193
|
+
client.py # RAG, RAGAnswer, query_stream
|
|
194
|
+
rag_pipeline.py # ingest / query pipeline
|
|
195
|
+
providers/ # OpenAI, Azure, Anthropic, Gemini, Ollama, local
|
|
196
|
+
docs/ # User documentation (linked from PyPI README)
|
|
197
|
+
tests/
|
|
198
|
+
examples/
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
## License
|
|
204
|
+
|
|
205
|
+
MIT © [Raghav Singla](https://github.com/RaghavOG)
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
# rag-python
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/rag-python/)
|
|
4
|
+
[](https://pypi.org/project/rag-python/)
|
|
5
|
+
[](https://www.python.org/downloads/)
|
|
6
|
+
[](LICENSE)
|
|
7
|
+
[](https://github.com/RaghavOG/rag-python/tree/main/docs)
|
|
8
|
+
|
|
9
|
+
**Production-grade Retrieval-Augmented Generation (RAG) for Python** — ingest documents, ask questions, get grounded answers with multi-LLM support, hybrid search, streaming, and guardrails.
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
pip install rag-python
|
|
13
|
+
export OPENAI_API_KEY=sk-...
|
|
14
|
+
rag-python ingest ./docs --reindex
|
|
15
|
+
rag-python query "What is our leave policy?"
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
**Author:** [Raghav Singla](https://github.com/RaghavOG) · **Repo:** [github.com/RaghavOG/rag-python](https://github.com/RaghavOG/rag-python)
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Why rag-python?
|
|
23
|
+
|
|
24
|
+
| Capability | What you get |
|
|
25
|
+
|------------|--------------|
|
|
26
|
+
| **Ingest** | TXT, MD, PDF, DOCX, CSV, JSON, HTML → chunk → embed → ChromaDB |
|
|
27
|
+
| **Retrieve** | Multi-query rewriting, **hybrid BM25+vector**, reranking, metadata filters |
|
|
28
|
+
| **Generate** | Multi-LLM answers with guardrails, evaluation, and retry loop |
|
|
29
|
+
| **Stream** | `rag.query_stream()` and `--stream` CLI for responsive UX |
|
|
30
|
+
| **Offline** | Local embeddings via sentence-transformers |
|
|
31
|
+
| **CLI** | `rag-python ingest`, `query`, `docs` — no code required |
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## Install
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
pip install rag-python
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
| Extra | Install | Enables |
|
|
42
|
+
|-------|---------|---------|
|
|
43
|
+
| `local` | `pip install rag-python[local]` | Offline embeddings (sentence-transformers) |
|
|
44
|
+
| `hybrid` | `pip install rag-python[hybrid]` | BM25 + vector hybrid retrieval |
|
|
45
|
+
| `rerank` | `pip install rag-python[rerank]` | Cross-encoder reranking |
|
|
46
|
+
| `anthropic` | `pip install rag-python[anthropic]` | Claude LLM |
|
|
47
|
+
| `gemini` | `pip install rag-python[gemini]` | Gemini LLM |
|
|
48
|
+
| `all` | `pip install rag-python[all]` | All optional features |
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## Quickstart (Python)
|
|
53
|
+
|
|
54
|
+
```python
|
|
55
|
+
from rag_python import RAG
|
|
56
|
+
|
|
57
|
+
rag = RAG(llm_model="gpt-4o-mini")
|
|
58
|
+
rag.ingest(["./data"], reindex=True)
|
|
59
|
+
|
|
60
|
+
answer = rag.query("How many days of annual leave?")
|
|
61
|
+
print(answer.text)
|
|
62
|
+
print(answer.sources)
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Streaming
|
|
66
|
+
|
|
67
|
+
```python
|
|
68
|
+
stream = rag.query_stream("How many days of annual leave?")
|
|
69
|
+
for token in stream:
|
|
70
|
+
print(token, end="", flush=True)
|
|
71
|
+
print(stream.result.evaluation)
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Hybrid search + metadata filter
|
|
75
|
+
|
|
76
|
+
```python
|
|
77
|
+
rag = RAG(
|
|
78
|
+
retriever="hybrid", # pip install rag-python[hybrid]
|
|
79
|
+
metadata_filter={"filename": "leave-policy.pdf"},
|
|
80
|
+
)
|
|
81
|
+
rag.ingest(["./policies/"])
|
|
82
|
+
print(rag.query("annual leave policy").text)
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## Quickstart (CLI)
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
export OPENAI_API_KEY=sk-...
|
|
91
|
+
|
|
92
|
+
rag-python ingest ./data --reindex
|
|
93
|
+
rag-python query "How many days of annual leave?"
|
|
94
|
+
rag-python query "PTO policy" --stream -v
|
|
95
|
+
rag-python query "benefits" --retriever hybrid
|
|
96
|
+
|
|
97
|
+
# Built-in terminal docs
|
|
98
|
+
rag-python docs quickstart
|
|
99
|
+
rag-python docs --list
|
|
100
|
+
rag-python --help
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## Documentation
|
|
106
|
+
|
|
107
|
+
| Guide | Description |
|
|
108
|
+
|-------|-------------|
|
|
109
|
+
| [**Docs index**](docs/README.md) | Start here |
|
|
110
|
+
| [Usage](docs/USAGE.md) | Python API, streaming, retrieval |
|
|
111
|
+
| [CLI reference](docs/CLI.md) | All `rag-python` commands and flags |
|
|
112
|
+
| [Configuration](docs/CONFIGURATION.md) | Env vars and `RAGConfig` |
|
|
113
|
+
| [Providers](docs/PROVIDERS.md) | OpenAI, Azure, Anthropic, Gemini, Ollama, local |
|
|
114
|
+
| [Changelog](CHANGELOG.md) | Release notes |
|
|
115
|
+
|
|
116
|
+
**In the terminal:** `rag-python docs [topic]` — topics: `quickstart`, `install`, `cli`, `config`, `providers`, `features`
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## Environment variables
|
|
121
|
+
|
|
122
|
+
| Variable | Description |
|
|
123
|
+
|----------|-------------|
|
|
124
|
+
| `OPENAI_API_KEY` | Default LLM + embeddings |
|
|
125
|
+
| `ANTHROPIC_API_KEY` | Claude |
|
|
126
|
+
| `GEMINI_API_KEY` | Gemini |
|
|
127
|
+
| `AZURE_OPENAI_ENDPOINT` / `AZURE_OPENAI_API_KEY` | Azure OpenAI |
|
|
128
|
+
| `OLLAMA_BASE_URL` | Local Ollama (default `http://localhost:11434`) |
|
|
129
|
+
| `RAG_PYTHON_DATA_DIR` | Document dir (default `./data`) |
|
|
130
|
+
| `RAG_PYTHON_CHROMA_DIR` | Vector store (default `./chroma_db`) |
|
|
131
|
+
|
|
132
|
+
See [Configuration](docs/CONFIGURATION.md) and [`.env.example`](.env.example).
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## Project layout
|
|
137
|
+
|
|
138
|
+
```text
|
|
139
|
+
src/rag_python/ # pip install rag-python → import rag_python
|
|
140
|
+
client.py # RAG, RAGAnswer, query_stream
|
|
141
|
+
rag_pipeline.py # ingest / query pipeline
|
|
142
|
+
providers/ # OpenAI, Azure, Anthropic, Gemini, Ollama, local
|
|
143
|
+
docs/ # User documentation (linked from PyPI README)
|
|
144
|
+
tests/
|
|
145
|
+
examples/
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## License
|
|
151
|
+
|
|
152
|
+
MIT © [Raghav Singla](https://github.com/RaghavOG)
|
|
@@ -4,8 +4,8 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "rag-python"
|
|
7
|
-
version = "0.
|
|
8
|
-
description = "Production-grade RAG for Python:
|
|
7
|
+
version = "0.3.1"
|
|
8
|
+
description = "Production-grade RAG for Python: ingest documents, hybrid search, streaming, multi-LLM, guardrails. CLI + Python API."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = { text = "MIT" }
|
|
11
11
|
requires-python = ">=3.10"
|
|
@@ -39,10 +39,11 @@ dependencies = [
|
|
|
39
39
|
[project.optional-dependencies]
|
|
40
40
|
rerank = ["sentence-transformers>=2.2.0", "torch>=2.0.0"]
|
|
41
41
|
local = ["sentence-transformers>=2.2.0"]
|
|
42
|
+
hybrid = ["rank-bm25>=0.2.2"]
|
|
42
43
|
anthropic = ["anthropic>=0.20.0"]
|
|
43
44
|
gemini = ["google-genai>=0.3.0"]
|
|
44
|
-
dev = ["pytest>=7.0", "ruff>=0.1.0", "build", "twine"]
|
|
45
|
-
all = ["rag-python[rerank,local,anthropic,gemini]"]
|
|
45
|
+
dev = ["pytest>=7.0", "ruff>=0.1.0", "build", "twine", "rank-bm25>=0.2.2"]
|
|
46
|
+
all = ["rag-python[rerank,local,hybrid,anthropic,gemini]"]
|
|
46
47
|
|
|
47
48
|
[project.scripts]
|
|
48
49
|
rag-python = "rag_python.cli:main"
|
|
@@ -50,7 +51,8 @@ rag-python = "rag_python.cli:main"
|
|
|
50
51
|
[project.urls]
|
|
51
52
|
Homepage = "https://github.com/RaghavOG/rag-python"
|
|
52
53
|
Repository = "https://github.com/RaghavOG/rag-python"
|
|
53
|
-
Documentation = "https://github.com/RaghavOG/rag-python
|
|
54
|
+
Documentation = "https://github.com/RaghavOG/rag-python/tree/main/docs"
|
|
55
|
+
Changelog = "https://github.com/RaghavOG/rag-python/blob/main/CHANGELOG.md"
|
|
54
56
|
Issues = "https://github.com/RaghavOG/rag-python/issues"
|
|
55
57
|
|
|
56
58
|
[tool.setuptools.packages.find]
|
|
@@ -2,18 +2,29 @@
|
|
|
2
2
|
|
|
3
3
|
Quick start::
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
pip install rag-python
|
|
6
|
+
export OPENAI_API_KEY=sk-...
|
|
7
|
+
|
|
8
|
+
# CLI
|
|
9
|
+
rag-python ingest ./docs --reindex
|
|
10
|
+
rag-python query "What is our leave policy?"
|
|
11
|
+
rag-python docs quickstart
|
|
6
12
|
|
|
7
|
-
|
|
13
|
+
# Python
|
|
14
|
+
from rag_python import RAG
|
|
15
|
+
rag = RAG()
|
|
8
16
|
rag.ingest(["./docs"], reindex=True)
|
|
9
17
|
print(rag.query("What is our leave policy?").text)
|
|
18
|
+
|
|
19
|
+
Documentation: https://github.com/RaghavOG/rag-python/tree/main/docs
|
|
10
20
|
"""
|
|
11
21
|
|
|
12
|
-
__version__ = "0.
|
|
22
|
+
__version__ = "0.3.1"
|
|
13
23
|
|
|
14
24
|
from .client import RAG, RAGAnswer
|
|
15
|
-
from .rag_pipeline import ingest, query, RAGResponse
|
|
25
|
+
from .rag_pipeline import ingest, query, query_stream, RAGResponse, RAGStream
|
|
16
26
|
from .providers import make_llm_provider, make_embedding_provider
|
|
27
|
+
from .log import configure_logging, get_logger
|
|
17
28
|
from .options import (
|
|
18
29
|
ChunkingConfig,
|
|
19
30
|
DocumentConfig,
|
|
@@ -33,7 +44,11 @@ __all__ = [
|
|
|
33
44
|
"QueryConfig",
|
|
34
45
|
"ingest",
|
|
35
46
|
"query",
|
|
47
|
+
"query_stream",
|
|
48
|
+
"RAGStream",
|
|
36
49
|
"RAGResponse",
|
|
50
|
+
"configure_logging",
|
|
51
|
+
"get_logger",
|
|
37
52
|
"make_llm_provider",
|
|
38
53
|
"make_embedding_provider",
|
|
39
54
|
]
|