siare 1.0.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.
- siare-1.0.0/LICENSE +21 -0
- siare-1.0.0/PKG-INFO +244 -0
- siare-1.0.0/README.md +189 -0
- siare-1.0.0/examples/clinical_trials/main.py +361 -0
- siare-1.0.0/examples/quickstart/main.py +302 -0
- siare-1.0.0/pyproject.toml +196 -0
- siare-1.0.0/setup.cfg +4 -0
- siare-1.0.0/siare/__init__.py +83 -0
- siare-1.0.0/siare/adapters/__init__.py +15 -0
- siare-1.0.0/siare/adapters/base.py +178 -0
- siare-1.0.0/siare/adapters/vector_search.py +538 -0
- siare-1.0.0/siare/adapters/web_search.py +453 -0
- siare-1.0.0/siare/adapters/wikipedia_search.py +193 -0
- siare-1.0.0/siare/benchmarks/__init__.py +193 -0
- siare-1.0.0/siare/benchmarks/adapters.py +65 -0
- siare-1.0.0/siare/benchmarks/base.py +156 -0
- siare-1.0.0/siare/benchmarks/comparison/__init__.py +19 -0
- siare-1.0.0/siare/benchmarks/comparison/baselines.py +302 -0
- siare-1.0.0/siare/benchmarks/corpus/__init__.py +15 -0
- siare-1.0.0/siare/benchmarks/corpus/index_manager.py +321 -0
- siare-1.0.0/siare/benchmarks/corpus/loader.py +298 -0
- siare-1.0.0/siare/benchmarks/corpus/wikipedia_loader.py +301 -0
- siare-1.0.0/siare/benchmarks/datasets/__init__.py +6 -0
- siare-1.0.0/siare/benchmarks/datasets/beir.py +182 -0
- siare-1.0.0/siare/benchmarks/datasets/frames.py +131 -0
- siare-1.0.0/siare/benchmarks/evolution_runner.py +739 -0
- siare-1.0.0/siare/benchmarks/hotpotqa.py +100 -0
- siare-1.0.0/siare/benchmarks/metrics/__init__.py +61 -0
- siare-1.0.0/siare/benchmarks/metrics/evolution_metrics.py +532 -0
- siare-1.0.0/siare/benchmarks/metrics/integration.py +159 -0
- siare-1.0.0/siare/benchmarks/metrics/retrieval.py +181 -0
- siare-1.0.0/siare/benchmarks/metrics/retrieval_evolution.py +223 -0
- siare-1.0.0/siare/benchmarks/natural_questions.py +98 -0
- siare-1.0.0/siare/benchmarks/publication_suite.py +1135 -0
- siare-1.0.0/siare/benchmarks/quality_gate_suite.py +637 -0
- siare-1.0.0/siare/benchmarks/rag_runner.py +315 -0
- siare-1.0.0/siare/benchmarks/reporter.py +998 -0
- siare-1.0.0/siare/benchmarks/reports/__init__.py +9 -0
- siare-1.0.0/siare/benchmarks/reports/evolution_value_report.py +362 -0
- siare-1.0.0/siare/benchmarks/reports/self_improvement_report.py +764 -0
- siare-1.0.0/siare/benchmarks/reproducibility.py +461 -0
- siare-1.0.0/siare/benchmarks/runner.py +723 -0
- siare-1.0.0/siare/benchmarks/scripts/__init__.py +1 -0
- siare-1.0.0/siare/benchmarks/scripts/demonstrate_evolution_value.py +490 -0
- siare-1.0.0/siare/benchmarks/scripts/download_beir_corpus.py +148 -0
- siare-1.0.0/siare/benchmarks/scripts/run_baseline.py +181 -0
- siare-1.0.0/siare/benchmarks/scripts/run_evolution_benchmark.py +372 -0
- siare-1.0.0/siare/benchmarks/scripts/run_publication_benchmark.py +677 -0
- siare-1.0.0/siare/benchmarks/scripts/run_rag_benchmark.py +284 -0
- siare-1.0.0/siare/benchmarks/scripts/run_self_improvement_benchmark.py +470 -0
- siare-1.0.0/siare/benchmarks/scripts/verify_benchmark.py +211 -0
- siare-1.0.0/siare/benchmarks/self_improvement_benchmark.py +1180 -0
- siare-1.0.0/siare/benchmarks/sops/__init__.py +47 -0
- siare-1.0.0/siare/benchmarks/sops/evolvable_rag.py +262 -0
- siare-1.0.0/siare/benchmarks/sops/multihop_rag.py +206 -0
- siare-1.0.0/siare/benchmarks/sops/rag_retriever.py +111 -0
- siare-1.0.0/siare/benchmarks/sops/simple_qa.py +69 -0
- siare-1.0.0/siare/benchmarks/tracking/__init__.py +29 -0
- siare-1.0.0/siare/benchmarks/tracking/learning_curve_tracker.py +392 -0
- siare-1.0.0/siare/benchmarks/tracking/prompt_diff_tracker.py +322 -0
- siare-1.0.0/siare/benchmarks/visualization/__init__.py +3 -0
- siare-1.0.0/siare/benchmarks/visualization/matplotlib_charts.py +146 -0
- siare-1.0.0/siare/benchmarks/visualization/plotly_charts.py +507 -0
- siare-1.0.0/siare/builders.py +246 -0
- siare-1.0.0/siare/cli.py +1114 -0
- siare-1.0.0/siare/core/__init__.py +57 -0
- siare-1.0.0/siare/core/config.py +139 -0
- siare-1.0.0/siare/core/constants.py +52 -0
- siare-1.0.0/siare/core/hooks.py +589 -0
- siare-1.0.0/siare/core/models.py +1639 -0
- siare-1.0.0/siare/py.typed +0 -0
- siare-1.0.0/siare/services/__init__.py +26 -0
- siare-1.0.0/siare/services/circuit_breaker.py +399 -0
- siare-1.0.0/siare/services/config_store.py +443 -0
- siare-1.0.0/siare/services/director.py +2077 -0
- siare-1.0.0/siare/services/error_classifier.py +322 -0
- siare-1.0.0/siare/services/evaluation_service.py +881 -0
- siare-1.0.0/siare/services/execution_engine.py +1331 -0
- siare-1.0.0/siare/services/gene_pool.py +905 -0
- siare-1.0.0/siare/services/hallucination/__init__.py +44 -0
- siare-1.0.0/siare/services/hallucination/citation_accuracy.py +176 -0
- siare-1.0.0/siare/services/hallucination/claims.py +181 -0
- siare-1.0.0/siare/services/hallucination/faithfulness.py +171 -0
- siare-1.0.0/siare/services/hallucination/groundedness.py +95 -0
- siare-1.0.0/siare/services/hallucination/ragas_adapter.py +197 -0
- siare-1.0.0/siare/services/hallucination/types.py +60 -0
- siare-1.0.0/siare/services/llm_cache.py +294 -0
- siare-1.0.0/siare/services/llm_provider.py +528 -0
- siare-1.0.0/siare/services/prompt_evolution/__init__.py +70 -0
- siare-1.0.0/siare/services/prompt_evolution/constraint_validator.py +288 -0
- siare-1.0.0/siare/services/prompt_evolution/critic.py +717 -0
- siare-1.0.0/siare/services/prompt_evolution/feedback_extractor.py +281 -0
- siare-1.0.0/siare/services/prompt_evolution/feedback_injector.py +191 -0
- siare-1.0.0/siare/services/prompt_evolution/orchestrator.py +260 -0
- siare-1.0.0/siare/services/prompt_evolution/parser.py +501 -0
- siare-1.0.0/siare/services/prompt_evolution/section_mutator.py +209 -0
- siare-1.0.0/siare/services/prompt_evolution/selector.py +379 -0
- siare-1.0.0/siare/services/prompt_evolution/strategies/__init__.py +33 -0
- siare-1.0.0/siare/services/prompt_evolution/strategies/base.py +127 -0
- siare-1.0.0/siare/services/prompt_evolution/strategies/evoprompt.py +803 -0
- siare-1.0.0/siare/services/prompt_evolution/strategies/metaprompt.py +575 -0
- siare-1.0.0/siare/services/prompt_evolution/strategies/textgrad.py +619 -0
- siare-1.0.0/siare/services/qd_grid.py +892 -0
- siare-1.0.0/siare/services/retry_handler.py +294 -0
- siare-1.0.0/siare/services/scheduler.py +1541 -0
- siare-1.0.0/siare/services/selection/__init__.py +46 -0
- siare-1.0.0/siare/services/selection/factory.py +99 -0
- siare-1.0.0/siare/services/selection/strategies.py +515 -0
- siare-1.0.0/siare/utils/__init__.py +0 -0
- siare-1.0.0/siare/utils/diff.py +192 -0
- siare-1.0.0/siare/utils/file_utils.py +84 -0
- siare-1.0.0/siare/utils/graph_viz.py +308 -0
- siare-1.0.0/siare/utils/multiple_comparison.py +300 -0
- siare-1.0.0/siare/utils/sampling.py +62 -0
- siare-1.0.0/siare/utils/statistics.py +519 -0
- siare-1.0.0/siare/utils/weighted_aggregation.py +159 -0
- siare-1.0.0/siare.egg-info/PKG-INFO +244 -0
- siare-1.0.0/siare.egg-info/SOURCES.txt +138 -0
- siare-1.0.0/siare.egg-info/dependency_links.txt +1 -0
- siare-1.0.0/siare.egg-info/entry_points.txt +2 -0
- siare-1.0.0/siare.egg-info/requires.txt +32 -0
- siare-1.0.0/siare.egg-info/top_level.txt +5 -0
- siare-1.0.0/tests/__init__.py +0 -0
- siare-1.0.0/tests/mocks/__init__.py +11 -0
- siare-1.0.0/tests/mocks/mock_embeddings.py +41 -0
- siare-1.0.0/tests/mocks/mock_llm_provider.py +77 -0
- siare-1.0.0/tests/unit/__init__.py +0 -0
- siare-1.0.0/tests/unit/test_config_store.py +145 -0
- siare-1.0.0/tests/unit/test_crossover_mutations.py +948 -0
- siare-1.0.0/tests/unit/test_director.py +354 -0
- siare-1.0.0/tests/unit/test_error_handling.py +563 -0
- siare-1.0.0/tests/unit/test_evaluation_service.py +424 -0
- siare-1.0.0/tests/unit/test_execution_engine.py +678 -0
- siare-1.0.0/tests/unit/test_helpers.py +70 -0
- siare-1.0.0/tests/unit/test_models.py +348 -0
- siare-1.0.0/tests/unit/test_qd_grid.py +337 -0
- siare-1.0.0/tests/unit/test_scheduler.py +203 -0
- siare-1.0.0/tests/unit/test_statistics.py +490 -0
- siare-1.0.0/tests/unit/test_topology_mutations.py +629 -0
- siare-1.0.0/tests/unit/test_vector_search.py +233 -0
siare-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Synapti.ai
|
|
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.
|
siare-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: siare
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Self-Improving Agentic RAG Engine - Evolve multi-agent RAG pipelines using Quality-Diversity optimization
|
|
5
|
+
Author-email: Daniel Bentes <daniel@synapti.ai>
|
|
6
|
+
Maintainer-email: Daniel Bentes <daniel@synapti.ai>
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
Project-URL: Homepage, https://siare.dev
|
|
9
|
+
Project-URL: Documentation, https://github.com/synaptiai/siare#readme
|
|
10
|
+
Project-URL: Repository, https://github.com/synaptiai/siare
|
|
11
|
+
Project-URL: Issues, https://github.com/synaptiai/siare/issues
|
|
12
|
+
Project-URL: Changelog, https://github.com/synaptiai/siare/blob/main/CHANGELOG.md
|
|
13
|
+
Keywords: rag,retrieval-augmented-generation,evolutionary-algorithms,quality-diversity,map-elites,llm,agents,multi-agent,prompt-optimization
|
|
14
|
+
Classifier: Development Status :: 4 - Beta
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: Intended Audience :: Science/Research
|
|
17
|
+
Classifier: Operating System :: OS Independent
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
22
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
23
|
+
Classifier: Typing :: Typed
|
|
24
|
+
Requires-Python: >=3.12
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
License-File: LICENSE
|
|
27
|
+
Requires-Dist: pydantic>=2.0.0
|
|
28
|
+
Requires-Dist: numpy>=1.24.0
|
|
29
|
+
Requires-Dist: pyyaml>=6.0
|
|
30
|
+
Requires-Dist: python-dateutil>=2.8.0
|
|
31
|
+
Requires-Dist: typing-extensions>=4.0.0
|
|
32
|
+
Requires-Dist: click>=8.0.0
|
|
33
|
+
Requires-Dist: rich>=13.0.0
|
|
34
|
+
Requires-Dist: questionary>=2.0.0
|
|
35
|
+
Provides-Extra: llm
|
|
36
|
+
Requires-Dist: openai>=1.0.0; extra == "llm"
|
|
37
|
+
Requires-Dist: anthropic>=0.18.0; extra == "llm"
|
|
38
|
+
Provides-Extra: embeddings
|
|
39
|
+
Requires-Dist: sentence-transformers>=2.2.0; extra == "embeddings"
|
|
40
|
+
Provides-Extra: full
|
|
41
|
+
Requires-Dist: siare[embeddings,llm]; extra == "full"
|
|
42
|
+
Requires-Dist: scikit-learn>=1.3.0; extra == "full"
|
|
43
|
+
Provides-Extra: benchmarks
|
|
44
|
+
Requires-Dist: datasets>=2.14.0; extra == "benchmarks"
|
|
45
|
+
Requires-Dist: beir>=2.0.0; extra == "benchmarks"
|
|
46
|
+
Requires-Dist: plotly>=5.18.0; extra == "benchmarks"
|
|
47
|
+
Requires-Dist: matplotlib>=3.7.0; extra == "benchmarks"
|
|
48
|
+
Provides-Extra: dev
|
|
49
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
50
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
|
51
|
+
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
|
|
52
|
+
Requires-Dist: ruff>=0.1.0; extra == "dev"
|
|
53
|
+
Requires-Dist: pyright>=1.1.0; extra == "dev"
|
|
54
|
+
Dynamic: license-file
|
|
55
|
+
|
|
56
|
+
# SIARE - Self-Improving Agentic RAG Engine
|
|
57
|
+
|
|
58
|
+
[](https://badge.fury.io/py/siare)
|
|
59
|
+
[](https://opensource.org/licenses/MIT)
|
|
60
|
+
[](https://www.python.org/downloads/)
|
|
61
|
+
|
|
62
|
+
**Stop tuning RAG pipelines. Let them evolve.**
|
|
63
|
+
|
|
64
|
+
SIARE is the first self-improving RAG engine that treats pipeline configuration as evolvable genetic material. Instead of manually tuning prompts, retrieval strategies, and agent topologies, SIARE uses **Quality-Diversity optimization** to automatically discover and maintain diverse high-performing multi-agent RAG strategies.
|
|
65
|
+
|
|
66
|
+
## The Problem
|
|
67
|
+
|
|
68
|
+
Building RAG systems today means endless iteration:
|
|
69
|
+
- Tweak prompts → benchmark → repeat
|
|
70
|
+
- Try different chunking strategies → benchmark → repeat
|
|
71
|
+
- Adjust retrieval parameters → benchmark → repeat
|
|
72
|
+
- Add more agents → debug interactions → repeat
|
|
73
|
+
|
|
74
|
+
This process is **expensive**, **brittle**, and **never-ending** as your data and requirements change.
|
|
75
|
+
|
|
76
|
+
## The Solution
|
|
77
|
+
|
|
78
|
+
SIARE treats your RAG pipeline as a **living system that evolves**:
|
|
79
|
+
|
|
80
|
+
1. **Define your goals** - accuracy, latency, cost, or custom metrics
|
|
81
|
+
2. **Let evolution work** - SIARE mutates prompts, tools, and even agent topology
|
|
82
|
+
3. **Get diverse solutions** - Quality-Diversity ensures you have multiple good options
|
|
83
|
+
4. **Adapt continuously** - As your data changes, your pipeline evolves
|
|
84
|
+
|
|
85
|
+
## Quick Start
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
pip install siare
|
|
89
|
+
|
|
90
|
+
# Initialize a new project
|
|
91
|
+
siare init
|
|
92
|
+
|
|
93
|
+
# Run evolution (10 generations)
|
|
94
|
+
siare evolve
|
|
95
|
+
|
|
96
|
+
# Query your evolved pipeline
|
|
97
|
+
siare run "How do I reset my password?"
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## How It Works
|
|
101
|
+
|
|
102
|
+
```
|
|
103
|
+
┌─────────────────────────────────────────────────────────────────┐
|
|
104
|
+
│ SIARE Evolution Loop │
|
|
105
|
+
├─────────────────────────────────────────────────────────────────┤
|
|
106
|
+
│ │
|
|
107
|
+
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
|
|
108
|
+
│ │ Execute │───▶│ Evaluate │───▶│ Diagnose │───▶│ Mutate │ │
|
|
109
|
+
│ │ SOP │ │ Metrics │ │ Weakness │ │ SOP │ │
|
|
110
|
+
│ └──────────┘ └──────────┘ └──────────┘ └──────────┘ │
|
|
111
|
+
│ ▲ │ │
|
|
112
|
+
│ │ │ │
|
|
113
|
+
│ └────────────────────────────────────────────────┘ │
|
|
114
|
+
│ │
|
|
115
|
+
│ Mutation Types: │
|
|
116
|
+
│ • PROMPT_CHANGE - Evolve prompts based on failure patterns │
|
|
117
|
+
│ • PARAM_TWEAK - Adjust model parameters (temp, tokens) │
|
|
118
|
+
│ • ADD_ROLE - Add new agents to the pipeline │
|
|
119
|
+
│ • REMOVE_ROLE - Simplify by removing agents │
|
|
120
|
+
│ • REWIRE_GRAPH - Change how agents connect and communicate │
|
|
121
|
+
│ • CROSSOVER - Combine successful strategies │
|
|
122
|
+
│ │
|
|
123
|
+
└─────────────────────────────────────────────────────────────────┘
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Key Features
|
|
127
|
+
|
|
128
|
+
### 🧬 Topology Evolution
|
|
129
|
+
Unlike prompt-only optimizers, SIARE can evolve the **structure** of your pipeline - adding, removing, and rewiring agents to find optimal architectures.
|
|
130
|
+
|
|
131
|
+
### 🎯 Quality-Diversity Optimization
|
|
132
|
+
Using MAP-Elites, SIARE maintains a diverse population of high-performing solutions. You don't just get one answer - you get a range of options trading off different metrics.
|
|
133
|
+
|
|
134
|
+
### 🔌 Extensible Hooks
|
|
135
|
+
Enterprise features integrate cleanly via hooks without modifying core code:
|
|
136
|
+
- Audit logging
|
|
137
|
+
- Usage billing
|
|
138
|
+
- Approval gates
|
|
139
|
+
- Custom metrics
|
|
140
|
+
|
|
141
|
+
### 📊 Built-in Benchmarks
|
|
142
|
+
Evaluate your pipelines against standard datasets:
|
|
143
|
+
- HotpotQA (multi-hop reasoning)
|
|
144
|
+
- Natural Questions
|
|
145
|
+
- Custom evaluation suites
|
|
146
|
+
|
|
147
|
+
## Installation
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
# Core package
|
|
151
|
+
pip install siare
|
|
152
|
+
|
|
153
|
+
# With LLM providers
|
|
154
|
+
pip install siare[llm]
|
|
155
|
+
|
|
156
|
+
# With embeddings support
|
|
157
|
+
pip install siare[embeddings]
|
|
158
|
+
|
|
159
|
+
# Everything
|
|
160
|
+
pip install siare[full]
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
## Programmatic Usage
|
|
164
|
+
|
|
165
|
+
```python
|
|
166
|
+
from siare import ProcessConfig, Role, GraphEdge
|
|
167
|
+
from siare.services import DirectorService, ExecutionEngine, GenePool
|
|
168
|
+
|
|
169
|
+
# Define your pipeline
|
|
170
|
+
config = ProcessConfig(
|
|
171
|
+
name="customer-support",
|
|
172
|
+
version="1.0.0",
|
|
173
|
+
roles=[
|
|
174
|
+
Role(
|
|
175
|
+
name="retriever",
|
|
176
|
+
model="gpt-4o-mini",
|
|
177
|
+
system_prompt="Find relevant documents...",
|
|
178
|
+
tools=["vector_search"],
|
|
179
|
+
),
|
|
180
|
+
Role(
|
|
181
|
+
name="answerer",
|
|
182
|
+
model="gpt-4o-mini",
|
|
183
|
+
system_prompt="Answer based on retrieved context...",
|
|
184
|
+
),
|
|
185
|
+
],
|
|
186
|
+
graph=[
|
|
187
|
+
GraphEdge(source="retriever", target="answerer"),
|
|
188
|
+
],
|
|
189
|
+
)
|
|
190
|
+
|
|
191
|
+
# Run evolution
|
|
192
|
+
director = DirectorService(llm_provider)
|
|
193
|
+
gene_pool = GenePool()
|
|
194
|
+
|
|
195
|
+
for generation in range(10):
|
|
196
|
+
# Execute and evaluate
|
|
197
|
+
trace = await engine.execute(config, task)
|
|
198
|
+
evaluation = await evaluator.evaluate(trace)
|
|
199
|
+
|
|
200
|
+
# Diagnose and mutate
|
|
201
|
+
diagnosis = await director.diagnose(evaluation)
|
|
202
|
+
mutated = await director.mutate_sop(config, diagnosis)
|
|
203
|
+
|
|
204
|
+
# Track in gene pool
|
|
205
|
+
gene_pool.add(mutated, evaluation)
|
|
206
|
+
|
|
207
|
+
# Get best solution
|
|
208
|
+
best = gene_pool.get_pareto_frontier()[0]
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
## Why SIARE?
|
|
212
|
+
|
|
213
|
+
| Feature | SIARE | DSPy | AutoRAG | LangChain |
|
|
214
|
+
|---------|-------|------|---------|-----------|
|
|
215
|
+
| Prompt optimization | ✅ | ✅ | ✅ | ❌ |
|
|
216
|
+
| Parameter tuning | ✅ | ❌ | ✅ | ❌ |
|
|
217
|
+
| **Topology evolution** | ✅ | ❌ | ❌ | ❌ |
|
|
218
|
+
| **Quality-Diversity** | ✅ | ❌ | ❌ | ❌ |
|
|
219
|
+
| Multi-agent support | ✅ | Limited | ❌ | ✅ |
|
|
220
|
+
| Extensible hooks | ✅ | ❌ | ❌ | ✅ |
|
|
221
|
+
|
|
222
|
+
## Examples
|
|
223
|
+
|
|
224
|
+
- [Customer Support](examples/quickstart/) - Simple Q&A over documents
|
|
225
|
+
- [Clinical Trials](examples/clinical_trials/) - Complex multi-agent research assistant
|
|
226
|
+
|
|
227
|
+
## Documentation
|
|
228
|
+
|
|
229
|
+
- [Getting Started](docs/getting-started.md)
|
|
230
|
+
- [CLI Reference](docs/cli-reference.md)
|
|
231
|
+
- [Architecture](docs/architecture.md)
|
|
232
|
+
- [API Reference](docs/api-reference.md)
|
|
233
|
+
|
|
234
|
+
## Contributing
|
|
235
|
+
|
|
236
|
+
We welcome contributions! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
|
|
237
|
+
|
|
238
|
+
## License
|
|
239
|
+
|
|
240
|
+
MIT License - see [LICENSE](LICENSE) for details.
|
|
241
|
+
|
|
242
|
+
---
|
|
243
|
+
|
|
244
|
+
Built with ❤️ by [Synapti.ai](https://synapti.ai)
|
siare-1.0.0/README.md
ADDED
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
# SIARE - Self-Improving Agentic RAG Engine
|
|
2
|
+
|
|
3
|
+
[](https://badge.fury.io/py/siare)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
[](https://www.python.org/downloads/)
|
|
6
|
+
|
|
7
|
+
**Stop tuning RAG pipelines. Let them evolve.**
|
|
8
|
+
|
|
9
|
+
SIARE is the first self-improving RAG engine that treats pipeline configuration as evolvable genetic material. Instead of manually tuning prompts, retrieval strategies, and agent topologies, SIARE uses **Quality-Diversity optimization** to automatically discover and maintain diverse high-performing multi-agent RAG strategies.
|
|
10
|
+
|
|
11
|
+
## The Problem
|
|
12
|
+
|
|
13
|
+
Building RAG systems today means endless iteration:
|
|
14
|
+
- Tweak prompts → benchmark → repeat
|
|
15
|
+
- Try different chunking strategies → benchmark → repeat
|
|
16
|
+
- Adjust retrieval parameters → benchmark → repeat
|
|
17
|
+
- Add more agents → debug interactions → repeat
|
|
18
|
+
|
|
19
|
+
This process is **expensive**, **brittle**, and **never-ending** as your data and requirements change.
|
|
20
|
+
|
|
21
|
+
## The Solution
|
|
22
|
+
|
|
23
|
+
SIARE treats your RAG pipeline as a **living system that evolves**:
|
|
24
|
+
|
|
25
|
+
1. **Define your goals** - accuracy, latency, cost, or custom metrics
|
|
26
|
+
2. **Let evolution work** - SIARE mutates prompts, tools, and even agent topology
|
|
27
|
+
3. **Get diverse solutions** - Quality-Diversity ensures you have multiple good options
|
|
28
|
+
4. **Adapt continuously** - As your data changes, your pipeline evolves
|
|
29
|
+
|
|
30
|
+
## Quick Start
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
pip install siare
|
|
34
|
+
|
|
35
|
+
# Initialize a new project
|
|
36
|
+
siare init
|
|
37
|
+
|
|
38
|
+
# Run evolution (10 generations)
|
|
39
|
+
siare evolve
|
|
40
|
+
|
|
41
|
+
# Query your evolved pipeline
|
|
42
|
+
siare run "How do I reset my password?"
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## How It Works
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
┌─────────────────────────────────────────────────────────────────┐
|
|
49
|
+
│ SIARE Evolution Loop │
|
|
50
|
+
├─────────────────────────────────────────────────────────────────┤
|
|
51
|
+
│ │
|
|
52
|
+
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
|
|
53
|
+
│ │ Execute │───▶│ Evaluate │───▶│ Diagnose │───▶│ Mutate │ │
|
|
54
|
+
│ │ SOP │ │ Metrics │ │ Weakness │ │ SOP │ │
|
|
55
|
+
│ └──────────┘ └──────────┘ └──────────┘ └──────────┘ │
|
|
56
|
+
│ ▲ │ │
|
|
57
|
+
│ │ │ │
|
|
58
|
+
│ └────────────────────────────────────────────────┘ │
|
|
59
|
+
│ │
|
|
60
|
+
│ Mutation Types: │
|
|
61
|
+
│ • PROMPT_CHANGE - Evolve prompts based on failure patterns │
|
|
62
|
+
│ • PARAM_TWEAK - Adjust model parameters (temp, tokens) │
|
|
63
|
+
│ • ADD_ROLE - Add new agents to the pipeline │
|
|
64
|
+
│ • REMOVE_ROLE - Simplify by removing agents │
|
|
65
|
+
│ • REWIRE_GRAPH - Change how agents connect and communicate │
|
|
66
|
+
│ • CROSSOVER - Combine successful strategies │
|
|
67
|
+
│ │
|
|
68
|
+
└─────────────────────────────────────────────────────────────────┘
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Key Features
|
|
72
|
+
|
|
73
|
+
### 🧬 Topology Evolution
|
|
74
|
+
Unlike prompt-only optimizers, SIARE can evolve the **structure** of your pipeline - adding, removing, and rewiring agents to find optimal architectures.
|
|
75
|
+
|
|
76
|
+
### 🎯 Quality-Diversity Optimization
|
|
77
|
+
Using MAP-Elites, SIARE maintains a diverse population of high-performing solutions. You don't just get one answer - you get a range of options trading off different metrics.
|
|
78
|
+
|
|
79
|
+
### 🔌 Extensible Hooks
|
|
80
|
+
Enterprise features integrate cleanly via hooks without modifying core code:
|
|
81
|
+
- Audit logging
|
|
82
|
+
- Usage billing
|
|
83
|
+
- Approval gates
|
|
84
|
+
- Custom metrics
|
|
85
|
+
|
|
86
|
+
### 📊 Built-in Benchmarks
|
|
87
|
+
Evaluate your pipelines against standard datasets:
|
|
88
|
+
- HotpotQA (multi-hop reasoning)
|
|
89
|
+
- Natural Questions
|
|
90
|
+
- Custom evaluation suites
|
|
91
|
+
|
|
92
|
+
## Installation
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
# Core package
|
|
96
|
+
pip install siare
|
|
97
|
+
|
|
98
|
+
# With LLM providers
|
|
99
|
+
pip install siare[llm]
|
|
100
|
+
|
|
101
|
+
# With embeddings support
|
|
102
|
+
pip install siare[embeddings]
|
|
103
|
+
|
|
104
|
+
# Everything
|
|
105
|
+
pip install siare[full]
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Programmatic Usage
|
|
109
|
+
|
|
110
|
+
```python
|
|
111
|
+
from siare import ProcessConfig, Role, GraphEdge
|
|
112
|
+
from siare.services import DirectorService, ExecutionEngine, GenePool
|
|
113
|
+
|
|
114
|
+
# Define your pipeline
|
|
115
|
+
config = ProcessConfig(
|
|
116
|
+
name="customer-support",
|
|
117
|
+
version="1.0.0",
|
|
118
|
+
roles=[
|
|
119
|
+
Role(
|
|
120
|
+
name="retriever",
|
|
121
|
+
model="gpt-4o-mini",
|
|
122
|
+
system_prompt="Find relevant documents...",
|
|
123
|
+
tools=["vector_search"],
|
|
124
|
+
),
|
|
125
|
+
Role(
|
|
126
|
+
name="answerer",
|
|
127
|
+
model="gpt-4o-mini",
|
|
128
|
+
system_prompt="Answer based on retrieved context...",
|
|
129
|
+
),
|
|
130
|
+
],
|
|
131
|
+
graph=[
|
|
132
|
+
GraphEdge(source="retriever", target="answerer"),
|
|
133
|
+
],
|
|
134
|
+
)
|
|
135
|
+
|
|
136
|
+
# Run evolution
|
|
137
|
+
director = DirectorService(llm_provider)
|
|
138
|
+
gene_pool = GenePool()
|
|
139
|
+
|
|
140
|
+
for generation in range(10):
|
|
141
|
+
# Execute and evaluate
|
|
142
|
+
trace = await engine.execute(config, task)
|
|
143
|
+
evaluation = await evaluator.evaluate(trace)
|
|
144
|
+
|
|
145
|
+
# Diagnose and mutate
|
|
146
|
+
diagnosis = await director.diagnose(evaluation)
|
|
147
|
+
mutated = await director.mutate_sop(config, diagnosis)
|
|
148
|
+
|
|
149
|
+
# Track in gene pool
|
|
150
|
+
gene_pool.add(mutated, evaluation)
|
|
151
|
+
|
|
152
|
+
# Get best solution
|
|
153
|
+
best = gene_pool.get_pareto_frontier()[0]
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
## Why SIARE?
|
|
157
|
+
|
|
158
|
+
| Feature | SIARE | DSPy | AutoRAG | LangChain |
|
|
159
|
+
|---------|-------|------|---------|-----------|
|
|
160
|
+
| Prompt optimization | ✅ | ✅ | ✅ | ❌ |
|
|
161
|
+
| Parameter tuning | ✅ | ❌ | ✅ | ❌ |
|
|
162
|
+
| **Topology evolution** | ✅ | ❌ | ❌ | ❌ |
|
|
163
|
+
| **Quality-Diversity** | ✅ | ❌ | ❌ | ❌ |
|
|
164
|
+
| Multi-agent support | ✅ | Limited | ❌ | ✅ |
|
|
165
|
+
| Extensible hooks | ✅ | ❌ | ❌ | ✅ |
|
|
166
|
+
|
|
167
|
+
## Examples
|
|
168
|
+
|
|
169
|
+
- [Customer Support](examples/quickstart/) - Simple Q&A over documents
|
|
170
|
+
- [Clinical Trials](examples/clinical_trials/) - Complex multi-agent research assistant
|
|
171
|
+
|
|
172
|
+
## Documentation
|
|
173
|
+
|
|
174
|
+
- [Getting Started](docs/getting-started.md)
|
|
175
|
+
- [CLI Reference](docs/cli-reference.md)
|
|
176
|
+
- [Architecture](docs/architecture.md)
|
|
177
|
+
- [API Reference](docs/api-reference.md)
|
|
178
|
+
|
|
179
|
+
## Contributing
|
|
180
|
+
|
|
181
|
+
We welcome contributions! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
|
|
182
|
+
|
|
183
|
+
## License
|
|
184
|
+
|
|
185
|
+
MIT License - see [LICENSE](LICENSE) for details.
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
Built with ❤️ by [Synapti.ai](https://synapti.ai)
|