ragfallback 0.1.0__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.
- ragfallback-0.1.0/INSTALL_AND_RUN.md +102 -0
- ragfallback-0.1.0/LICENSE +21 -0
- ragfallback-0.1.0/MANIFEST.in +10 -0
- ragfallback-0.1.0/PKG-INFO +878 -0
- ragfallback-0.1.0/README.md +810 -0
- ragfallback-0.1.0/examples/basic_usage.py +127 -0
- ragfallback-0.1.0/examples/complete_example.py +231 -0
- ragfallback-0.1.0/examples/financial_risk_analysis.py +169 -0
- ragfallback-0.1.0/examples/huggingface_example.py +164 -0
- ragfallback-0.1.0/examples/legal_document_analysis.py +165 -0
- ragfallback-0.1.0/examples/medical_research_synthesis.py +158 -0
- ragfallback-0.1.0/examples/multi_domain_synthesis.py +185 -0
- ragfallback-0.1.0/examples/open_source_example.py +137 -0
- ragfallback-0.1.0/examples/paid_llm_example.py +140 -0
- ragfallback-0.1.0/examples/python_docs_example.py +146 -0
- ragfallback-0.1.0/examples/tech_support_example.py +135 -0
- ragfallback-0.1.0/pytest.ini +7 -0
- ragfallback-0.1.0/ragfallback/__init__.py +24 -0
- ragfallback-0.1.0/ragfallback/core/__init__.py +6 -0
- ragfallback-0.1.0/ragfallback/core/adaptive_retriever.py +387 -0
- ragfallback-0.1.0/ragfallback/py.typed +2 -0
- ragfallback-0.1.0/ragfallback/strategies/__init__.py +7 -0
- ragfallback-0.1.0/ragfallback/strategies/base.py +37 -0
- ragfallback-0.1.0/ragfallback/strategies/query_variations.py +146 -0
- ragfallback-0.1.0/ragfallback/tracking/__init__.py +7 -0
- ragfallback-0.1.0/ragfallback/tracking/cost_tracker.py +128 -0
- ragfallback-0.1.0/ragfallback/tracking/metrics.py +107 -0
- ragfallback-0.1.0/ragfallback/utils/__init__.py +36 -0
- ragfallback-0.1.0/ragfallback/utils/confidence_scorer.py +138 -0
- ragfallback-0.1.0/ragfallback/utils/embedding_factory.py +119 -0
- ragfallback-0.1.0/ragfallback/utils/llm_factory.py +231 -0
- ragfallback-0.1.0/ragfallback/utils/vector_store_factory.py +163 -0
- ragfallback-0.1.0/ragfallback.egg-info/PKG-INFO +878 -0
- ragfallback-0.1.0/ragfallback.egg-info/SOURCES.txt +45 -0
- ragfallback-0.1.0/ragfallback.egg-info/dependency_links.txt +1 -0
- ragfallback-0.1.0/ragfallback.egg-info/requires.txt +56 -0
- ragfallback-0.1.0/ragfallback.egg-info/top_level.txt +2 -0
- ragfallback-0.1.0/requirements-dev.txt +12 -0
- ragfallback-0.1.0/setup.cfg +4 -0
- ragfallback-0.1.0/setup.py +74 -0
- ragfallback-0.1.0/tests/__init__.py +2 -0
- ragfallback-0.1.0/tests/conftest.py +88 -0
- ragfallback-0.1.0/tests/test_confidence_scorer.py +79 -0
- ragfallback-0.1.0/tests/test_cost_tracker.py +55 -0
- ragfallback-0.1.0/tests/test_integration.py +108 -0
- ragfallback-0.1.0/tests/test_metrics.py +70 -0
- ragfallback-0.1.0/tests/test_query_variations.py +81 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# Install and Run ragfallback
|
|
2
|
+
|
|
3
|
+
## Quick Start
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
# 1. Install library
|
|
7
|
+
pip install -e .
|
|
8
|
+
|
|
9
|
+
# 2. Verify installation
|
|
10
|
+
python verify_library.py
|
|
11
|
+
|
|
12
|
+
# 3. Run all examples
|
|
13
|
+
python run_all_examples.py
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
### Basic Installation
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
pip install -e .
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### With Optional Dependencies
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
# Open-source components (recommended)
|
|
28
|
+
pip install -e .[sentence-transformers,faiss]
|
|
29
|
+
|
|
30
|
+
# Or install manually
|
|
31
|
+
pip install sentence-transformers faiss-cpu huggingface-hub
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Verification
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
# Verify library installation and core functionality
|
|
38
|
+
python verify_library.py
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
**Expected:** All 6 tests pass ✅
|
|
42
|
+
|
|
43
|
+
## Run Examples
|
|
44
|
+
|
|
45
|
+
### Run All Examples
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
python run_all_examples.py
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Run Individual Examples
|
|
52
|
+
|
|
53
|
+
**Simple Examples:**
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
python examples/python_docs_example.py
|
|
57
|
+
python examples/tech_support_example.py
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
**Advanced Examples:**
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
python examples/legal_document_analysis.py
|
|
64
|
+
python examples/medical_research_synthesis.py
|
|
65
|
+
python examples/financial_risk_analysis.py
|
|
66
|
+
python examples/multi_domain_synthesis.py
|
|
67
|
+
python examples/complete_example.py
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Run Tests
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
# Install test dependencies
|
|
74
|
+
pip install -r requirements-dev.txt
|
|
75
|
+
|
|
76
|
+
# Run unit tests
|
|
77
|
+
pytest tests/ -v
|
|
78
|
+
|
|
79
|
+
# Run with coverage
|
|
80
|
+
pytest --cov=ragfallback --cov-report=html
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Library Structure
|
|
84
|
+
|
|
85
|
+
```
|
|
86
|
+
ragfallback/
|
|
87
|
+
├── ragfallback/ # Core library
|
|
88
|
+
├── examples/ # 11 example files
|
|
89
|
+
├── tests/ # Unit tests
|
|
90
|
+
├── verify_library.py # Installation verification
|
|
91
|
+
├── run_all_examples.py # Run all examples
|
|
92
|
+
├── pyproject.toml # Package config
|
|
93
|
+
├── requirements-dev.txt # Dev dependencies
|
|
94
|
+
└── README.md # Documentation
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Success Criteria
|
|
98
|
+
|
|
99
|
+
✅ `python verify_library.py` passes all tests
|
|
100
|
+
✅ `pytest tests/` passes all unit tests
|
|
101
|
+
✅ At least 3 examples run successfully
|
|
102
|
+
✅ Library can be imported: `from ragfallback import AdaptiveRAGRetriever`
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Irfan Ali
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|