quantumrag 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.
- quantumrag-0.1.0/.editorconfig +15 -0
- quantumrag-0.1.0/.env.example +45 -0
- quantumrag-0.1.0/.gitignore +45 -0
- quantumrag-0.1.0/.pre-commit-config.yaml +7 -0
- quantumrag-0.1.0/CHANGELOG.md +100 -0
- quantumrag-0.1.0/CODE_OF_CONDUCT.md +54 -0
- quantumrag-0.1.0/CONTRIBUTING.md +109 -0
- quantumrag-0.1.0/Dockerfile +32 -0
- quantumrag-0.1.0/LICENSE +190 -0
- quantumrag-0.1.0/PKG-INFO +413 -0
- quantumrag-0.1.0/README.ko.md +355 -0
- quantumrag-0.1.0/README.md +355 -0
- quantumrag-0.1.0/ROADMAP.md +35 -0
- quantumrag-0.1.0/SECURITY.md +42 -0
- quantumrag-0.1.0/pyproject.toml +142 -0
- quantumrag-0.1.0/quantumrag/__init__.py +16 -0
- quantumrag-0.1.0/quantumrag/_version.py +1 -0
- quantumrag-0.1.0/quantumrag/api/__init__.py +5 -0
- quantumrag-0.1.0/quantumrag/api/middleware.py +244 -0
- quantumrag-0.1.0/quantumrag/api/models.py +119 -0
- quantumrag-0.1.0/quantumrag/api/playground.py +990 -0
- quantumrag-0.1.0/quantumrag/api/server.py +472 -0
- quantumrag-0.1.0/quantumrag/api/sse.py +28 -0
- quantumrag-0.1.0/quantumrag/cli/__init__.py +0 -0
- quantumrag-0.1.0/quantumrag/cli/commands/__init__.py +0 -0
- quantumrag-0.1.0/quantumrag/cli/main.py +417 -0
- quantumrag-0.1.0/quantumrag/connectors/__init__.py +7 -0
- quantumrag-0.1.0/quantumrag/connectors/base.py +46 -0
- quantumrag-0.1.0/quantumrag/connectors/file.py +107 -0
- quantumrag-0.1.0/quantumrag/connectors/gdrive.py +244 -0
- quantumrag-0.1.0/quantumrag/connectors/notion.py +234 -0
- quantumrag-0.1.0/quantumrag/connectors/s3.py +174 -0
- quantumrag-0.1.0/quantumrag/connectors/url.py +197 -0
- quantumrag-0.1.0/quantumrag/core/__init__.py +0 -0
- quantumrag-0.1.0/quantumrag/core/batch.py +198 -0
- quantumrag-0.1.0/quantumrag/core/cache/__init__.py +1 -0
- quantumrag-0.1.0/quantumrag/core/cache/semantic.py +325 -0
- quantumrag-0.1.0/quantumrag/core/config.py +321 -0
- quantumrag-0.1.0/quantumrag/core/engine.py +1065 -0
- quantumrag-0.1.0/quantumrag/core/errors.py +232 -0
- quantumrag-0.1.0/quantumrag/core/eval/__init__.py +0 -0
- quantumrag-0.1.0/quantumrag/core/evaluate/__init__.py +26 -0
- quantumrag-0.1.0/quantumrag/core/evaluate/evaluator.py +400 -0
- quantumrag-0.1.0/quantumrag/core/evaluate/metrics.py +236 -0
- quantumrag-0.1.0/quantumrag/core/evaluate/models.py +15 -0
- quantumrag-0.1.0/quantumrag/core/evaluate/synthetic.py +232 -0
- quantumrag-0.1.0/quantumrag/core/generate/__init__.py +0 -0
- quantumrag-0.1.0/quantumrag/core/generate/decomposer.py +81 -0
- quantumrag-0.1.0/quantumrag/core/generate/evidence_extractor.py +345 -0
- quantumrag-0.1.0/quantumrag/core/generate/generator.py +456 -0
- quantumrag-0.1.0/quantumrag/core/generate/map_reduce.py +175 -0
- quantumrag-0.1.0/quantumrag/core/generate/query_expander.py +136 -0
- quantumrag-0.1.0/quantumrag/core/generate/rewriter.py +478 -0
- quantumrag-0.1.0/quantumrag/core/generate/router.py +214 -0
- quantumrag-0.1.0/quantumrag/core/generate/self_correct.py +111 -0
- quantumrag-0.1.0/quantumrag/core/generate/speculative.py +172 -0
- quantumrag-0.1.0/quantumrag/core/generate/topic_tracker.py +140 -0
- quantumrag-0.1.0/quantumrag/core/ingest/__init__.py +5 -0
- quantumrag-0.1.0/quantumrag/core/ingest/chunker/__init__.py +18 -0
- quantumrag-0.1.0/quantumrag/core/ingest/chunker/auto.py +129 -0
- quantumrag-0.1.0/quantumrag/core/ingest/chunker/base.py +79 -0
- quantumrag-0.1.0/quantumrag/core/ingest/chunker/context.py +179 -0
- quantumrag-0.1.0/quantumrag/core/ingest/chunker/fixed.py +145 -0
- quantumrag-0.1.0/quantumrag/core/ingest/chunker/semantic.py +197 -0
- quantumrag-0.1.0/quantumrag/core/ingest/chunker/structural.py +289 -0
- quantumrag-0.1.0/quantumrag/core/ingest/indexer/__init__.py +0 -0
- quantumrag-0.1.0/quantumrag/core/ingest/indexer/chunk_graph.py +243 -0
- quantumrag-0.1.0/quantumrag/core/ingest/indexer/derived_index.py +215 -0
- quantumrag-0.1.0/quantumrag/core/ingest/indexer/entity_index.py +159 -0
- quantumrag-0.1.0/quantumrag/core/ingest/indexer/fact_extractor.py +314 -0
- quantumrag-0.1.0/quantumrag/core/ingest/indexer/incremental.py +213 -0
- quantumrag-0.1.0/quantumrag/core/ingest/indexer/multi_resolution.py +232 -0
- quantumrag-0.1.0/quantumrag/core/ingest/indexer/triple_index_builder.py +339 -0
- quantumrag-0.1.0/quantumrag/core/ingest/parser/__init__.py +23 -0
- quantumrag-0.1.0/quantumrag/core/ingest/parser/base.py +192 -0
- quantumrag-0.1.0/quantumrag/core/ingest/parser/hwp.py +224 -0
- quantumrag-0.1.0/quantumrag/core/ingest/parser/office.py +209 -0
- quantumrag-0.1.0/quantumrag/core/ingest/parser/pdf.py +94 -0
- quantumrag-0.1.0/quantumrag/core/ingest/parser/text.py +278 -0
- quantumrag-0.1.0/quantumrag/core/ingest/quality.py +249 -0
- quantumrag-0.1.0/quantumrag/core/llm/__init__.py +21 -0
- quantumrag-0.1.0/quantumrag/core/llm/base.py +205 -0
- quantumrag-0.1.0/quantumrag/core/llm/providers/__init__.py +3 -0
- quantumrag-0.1.0/quantumrag/core/llm/providers/anthropic.py +281 -0
- quantumrag-0.1.0/quantumrag/core/llm/providers/gemini.py +318 -0
- quantumrag-0.1.0/quantumrag/core/llm/providers/local_embedding.py +94 -0
- quantumrag-0.1.0/quantumrag/core/llm/providers/ollama.py +301 -0
- quantumrag-0.1.0/quantumrag/core/llm/providers/openai.py +326 -0
- quantumrag-0.1.0/quantumrag/core/logging.py +62 -0
- quantumrag-0.1.0/quantumrag/core/models.py +148 -0
- quantumrag-0.1.0/quantumrag/core/multitenancy/__init__.py +1 -0
- quantumrag-0.1.0/quantumrag/core/multitenancy/tenant.py +212 -0
- quantumrag-0.1.0/quantumrag/core/observability/__init__.py +1 -0
- quantumrag-0.1.0/quantumrag/core/observability/tracer.py +403 -0
- quantumrag-0.1.0/quantumrag/core/pipeline/__init__.py +34 -0
- quantumrag-0.1.0/quantumrag/core/pipeline/context.py +358 -0
- quantumrag-0.1.0/quantumrag/core/pipeline/profiler.py +430 -0
- quantumrag-0.1.0/quantumrag/core/pipeline/signals.py +375 -0
- quantumrag-0.1.0/quantumrag/core/retrieve/__init__.py +0 -0
- quantumrag-0.1.0/quantumrag/core/retrieve/compressor.py +123 -0
- quantumrag-0.1.0/quantumrag/core/retrieve/constellation.py +121 -0
- quantumrag-0.1.0/quantumrag/core/retrieve/diversity.py +102 -0
- quantumrag-0.1.0/quantumrag/core/retrieve/entity_detector.py +129 -0
- quantumrag-0.1.0/quantumrag/core/retrieve/fusion.py +178 -0
- quantumrag-0.1.0/quantumrag/core/retrieve/reranker.py +291 -0
- quantumrag-0.1.0/quantumrag/core/retrieve/retriever.py +339 -0
- quantumrag-0.1.0/quantumrag/core/security/__init__.py +5 -0
- quantumrag-0.1.0/quantumrag/core/security/acl.py +110 -0
- quantumrag-0.1.0/quantumrag/core/storage/__init__.py +19 -0
- quantumrag-0.1.0/quantumrag/core/storage/backends/__init__.py +0 -0
- quantumrag-0.1.0/quantumrag/core/storage/backends/bm25_store.py +174 -0
- quantumrag-0.1.0/quantumrag/core/storage/backends/lancedb_store.py +198 -0
- quantumrag-0.1.0/quantumrag/core/storage/backends/sqlite.py +284 -0
- quantumrag-0.1.0/quantumrag/core/storage/base.py +171 -0
- quantumrag-0.1.0/quantumrag/core/storage/factory.py +99 -0
- quantumrag-0.1.0/quantumrag/core/utils/__init__.py +1 -0
- quantumrag-0.1.0/quantumrag/core/utils/text.py +247 -0
- quantumrag-0.1.0/quantumrag/core/watcher.py +267 -0
- quantumrag-0.1.0/quantumrag/korean/__init__.py +6 -0
- quantumrag-0.1.0/quantumrag/korean/encoding.py +121 -0
- quantumrag-0.1.0/quantumrag/korean/morphology.py +89 -0
- quantumrag-0.1.0/quantumrag/plugins/__init__.py +1 -0
- quantumrag-0.1.0/quantumrag/plugins/registry.py +311 -0
- quantumrag-0.1.0/quantumrag-local.yaml.example +59 -0
- quantumrag-0.1.0/quantumrag.yaml.example +116 -0
- quantumrag-0.1.0/uv.lock +3241 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
root = true
|
|
2
|
+
|
|
3
|
+
[*]
|
|
4
|
+
indent_style = space
|
|
5
|
+
indent_size = 4
|
|
6
|
+
end_of_line = lf
|
|
7
|
+
charset = utf-8
|
|
8
|
+
trim_trailing_whitespace = true
|
|
9
|
+
insert_final_newline = true
|
|
10
|
+
|
|
11
|
+
[*.{yaml,yml,toml}]
|
|
12
|
+
indent_size = 2
|
|
13
|
+
|
|
14
|
+
[*.md]
|
|
15
|
+
trim_trailing_whitespace = false
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# QuantumRAG 환경 변수 설정
|
|
2
|
+
# 이 파일을 복사하여 .env 파일을 만드세요:
|
|
3
|
+
# cp .env.example .env
|
|
4
|
+
|
|
5
|
+
# ============================================================
|
|
6
|
+
# LLM API 키 (방법 1: SDK 기본 환경 변수)
|
|
7
|
+
# ============================================================
|
|
8
|
+
# OpenAI — embedding, generation(simple/medium), hype 에서 사용
|
|
9
|
+
OPENAI_API_KEY="sk-proj-your-openai-key-here"
|
|
10
|
+
|
|
11
|
+
# Anthropic — generation(complex) 티어에서 사용
|
|
12
|
+
ANTHROPIC_API_KEY=sk-ant-your-anthropic-key-here
|
|
13
|
+
|
|
14
|
+
# Gemini — generation(complex) 티어에서 사용
|
|
15
|
+
GOOGLE_API_KEY="AIza-your-google-api-key-here"
|
|
16
|
+
|
|
17
|
+
# ============================================================
|
|
18
|
+
# LLM API 키 (방법 2: QuantumRAG 전용 환경 변수)
|
|
19
|
+
# 위 SDK 기본 변수보다 우선순위가 높습니다.
|
|
20
|
+
# 프로바이더별로 다른 키를 사용해야 할 때 유용합니다.
|
|
21
|
+
# ============================================================
|
|
22
|
+
# QUANTUMRAG_MODELS__EMBEDDING__API_KEY=sk-proj-...
|
|
23
|
+
# QUANTUMRAG_MODELS__EMBEDDING__BASE_URL=https://your-azure-endpoint.com
|
|
24
|
+
# QUANTUMRAG_MODELS__GENERATION__SIMPLE__API_KEY=sk-proj-...
|
|
25
|
+
# QUANTUMRAG_MODELS__GENERATION__MEDIUM__API_KEY=sk-proj-...
|
|
26
|
+
# QUANTUMRAG_MODELS__GENERATION__COMPLEX__API_KEY=sk-ant-...
|
|
27
|
+
# QUANTUMRAG_MODELS__GENERATION__COMPLEX__API_KEY=AIza-... # Gemini 사용 시
|
|
28
|
+
# QUANTUMRAG_MODELS__HYPE__API_KEY=sk-proj-...
|
|
29
|
+
|
|
30
|
+
# ============================================================
|
|
31
|
+
# Reranker API 키 (유료 reranker 사용 시)
|
|
32
|
+
# ============================================================
|
|
33
|
+
# COHERE_API_KEY=your-cohere-key-here
|
|
34
|
+
# JINA_API_KEY=your-jina-key-here
|
|
35
|
+
|
|
36
|
+
# ============================================================
|
|
37
|
+
# Ollama (로컬 LLM 사용 시)
|
|
38
|
+
# ============================================================
|
|
39
|
+
# OLLAMA_HOST=http://localhost:11434
|
|
40
|
+
|
|
41
|
+
# ============================================================
|
|
42
|
+
# QuantumRAG HTTP API 서버
|
|
43
|
+
# ============================================================
|
|
44
|
+
# QUANTUMRAG_API_KEY=your-secret-api-key-for-http-server
|
|
45
|
+
# QUANTUMRAG_CORS_ORIGINS=https://myapp.com,https://admin.myapp.com
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
*.so
|
|
6
|
+
*.egg-info/
|
|
7
|
+
dist/
|
|
8
|
+
build/
|
|
9
|
+
*.egg
|
|
10
|
+
|
|
11
|
+
# Virtual environments
|
|
12
|
+
.venv/
|
|
13
|
+
venv/
|
|
14
|
+
env/
|
|
15
|
+
|
|
16
|
+
# IDE
|
|
17
|
+
.idea/
|
|
18
|
+
.vscode/
|
|
19
|
+
*.swp
|
|
20
|
+
*.swo
|
|
21
|
+
*~
|
|
22
|
+
|
|
23
|
+
# Testing
|
|
24
|
+
.pytest_cache/
|
|
25
|
+
.coverage
|
|
26
|
+
htmlcov/
|
|
27
|
+
.mypy_cache/
|
|
28
|
+
.ruff_cache/
|
|
29
|
+
|
|
30
|
+
# QuantumRAG data
|
|
31
|
+
quantumrag_data/
|
|
32
|
+
test_scenario_data/
|
|
33
|
+
*.db
|
|
34
|
+
*.lance/
|
|
35
|
+
|
|
36
|
+
# Config with secrets (*.example 파일은 추적됨)
|
|
37
|
+
.env
|
|
38
|
+
quantumrag.yaml
|
|
39
|
+
quantumrag-local.yaml
|
|
40
|
+
|
|
41
|
+
# OS
|
|
42
|
+
.DS_Store
|
|
43
|
+
Thumbs.db
|
|
44
|
+
|
|
45
|
+
.claude
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to QuantumRAG will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [0.1.0] - 2026-03-25
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
**Core Engine**
|
|
13
|
+
- Engine class as single entry point for all RAG functionality
|
|
14
|
+
- Sync and async interfaces for all operations
|
|
15
|
+
- Adaptive complexity routing (Simple/Medium/Complex query paths)
|
|
16
|
+
- Configurable via YAML, environment variables, and code arguments
|
|
17
|
+
|
|
18
|
+
**Triple Index Architecture**
|
|
19
|
+
- Original Embedding index (cosine similarity via LanceDB)
|
|
20
|
+
- HyPE (Hypothetical Prompt Embeddings) index for question-to-question matching
|
|
21
|
+
- Contextual BM25 index (tantivy-py) with Korean morphology support
|
|
22
|
+
- Reciprocal Rank Fusion (RRF) with configurable weights
|
|
23
|
+
|
|
24
|
+
**Document Ingestion**
|
|
25
|
+
- Multi-format parsing: PDF, DOCX, PPTX, XLSX, HTML, Markdown, CSV, HWP/HWPX, plain text
|
|
26
|
+
- Three chunking strategies: fixed-size, semantic, structural (auto-detection)
|
|
27
|
+
- Contextual prefix generation for enhanced BM25 indexing
|
|
28
|
+
- Quality scoring (0.0-1.0) for parsed documents
|
|
29
|
+
- Incremental indexing (hash-based change detection)
|
|
30
|
+
|
|
31
|
+
**Retrieval Pipeline**
|
|
32
|
+
- Triple Index fusion search with RRF scoring
|
|
33
|
+
- FlashRank reranking (CPU, free)
|
|
34
|
+
- Extractive context compression
|
|
35
|
+
- Metadata-based filtering
|
|
36
|
+
- Full processing trace for debugging
|
|
37
|
+
|
|
38
|
+
**Generation**
|
|
39
|
+
- Source-grounded generation with inline citations [1], [2]
|
|
40
|
+
- Korean/English bilingual prompt system
|
|
41
|
+
- Confidence assessment (strongly_supported, partially_supported, insufficient_evidence)
|
|
42
|
+
- "I don't know" responses when evidence is insufficient
|
|
43
|
+
- Streaming support (SSE)
|
|
44
|
+
|
|
45
|
+
**LLM Providers**
|
|
46
|
+
- OpenAI (GPT-4.1 family, embeddings)
|
|
47
|
+
- Anthropic (Claude family)
|
|
48
|
+
- Ollama (local models, no API key needed)
|
|
49
|
+
- Automatic retry with exponential backoff
|
|
50
|
+
- Cost tracking and usage monitoring
|
|
51
|
+
|
|
52
|
+
**Korean Language Support**
|
|
53
|
+
- HWP/HWPX document parsing
|
|
54
|
+
- Kiwi morphology analyzer integration
|
|
55
|
+
- EUC-KR/CP949 encoding detection and conversion
|
|
56
|
+
- Korean-aware query routing (substring matching for agglutinative morphology)
|
|
57
|
+
|
|
58
|
+
**HTTP API (FastAPI)**
|
|
59
|
+
- POST /v1/ingest, /v1/query, /v1/query/stream
|
|
60
|
+
- GET /v1/documents, /v1/status
|
|
61
|
+
- DELETE /v1/documents/:id
|
|
62
|
+
- POST /v1/evaluate, /v1/feedback
|
|
63
|
+
- API key authentication
|
|
64
|
+
- Rate limiting
|
|
65
|
+
- CORS configuration
|
|
66
|
+
|
|
67
|
+
**Evaluation System**
|
|
68
|
+
- Synthetic QA pair generation (template-based, zero cost)
|
|
69
|
+
- Retrieval Recall@K metric
|
|
70
|
+
- Faithfulness metric (sentence-level)
|
|
71
|
+
- Answer Relevancy metric
|
|
72
|
+
- Latency percentiles (P50, P95, P99)
|
|
73
|
+
- Weakness analysis with improvement suggestions
|
|
74
|
+
|
|
75
|
+
**CLI (Typer)**
|
|
76
|
+
- `quantumrag init` - Initialize project
|
|
77
|
+
- `quantumrag ingest <path>` - Ingest documents
|
|
78
|
+
- `quantumrag query "<question>"` - Query with citations
|
|
79
|
+
- `quantumrag status` - Show index status
|
|
80
|
+
- `quantumrag serve` - Start HTTP API server
|
|
81
|
+
- Rich progress bars and formatted output
|
|
82
|
+
|
|
83
|
+
**Advanced Features**
|
|
84
|
+
- Plugin system with hook-based extensibility
|
|
85
|
+
- Multi-tenant support with isolated storage
|
|
86
|
+
- Semantic cache with TTL and similarity matching
|
|
87
|
+
- Batch query processing with concurrency control
|
|
88
|
+
- Query tracing and cost tracking (observability)
|
|
89
|
+
- Access control (ACL) at document level
|
|
90
|
+
|
|
91
|
+
**Connectors**
|
|
92
|
+
- Local file system
|
|
93
|
+
- URL/web page
|
|
94
|
+
- Google Drive (OAuth2)
|
|
95
|
+
- Notion (API)
|
|
96
|
+
- AWS S3
|
|
97
|
+
|
|
98
|
+
**Cloud Connectors**
|
|
99
|
+
- Query decomposition for complex multi-hop queries
|
|
100
|
+
- Speculative RAG for parallel sub-query processing
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our
|
|
6
|
+
community a harassment-free experience for everyone, regardless of age, body
|
|
7
|
+
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
|
8
|
+
identity and expression, level of experience, education, socio-economic status,
|
|
9
|
+
nationality, personal appearance, race, caste, color, religion, or sexual
|
|
10
|
+
identity and orientation.
|
|
11
|
+
|
|
12
|
+
## Our Standards
|
|
13
|
+
|
|
14
|
+
Examples of behavior that contributes to a positive environment:
|
|
15
|
+
|
|
16
|
+
- Using welcoming and inclusive language
|
|
17
|
+
- Being respectful of differing viewpoints and experiences
|
|
18
|
+
- Gracefully accepting constructive criticism
|
|
19
|
+
- Focusing on what is best for the community
|
|
20
|
+
- Showing empathy towards other community members
|
|
21
|
+
|
|
22
|
+
Examples of unacceptable behavior:
|
|
23
|
+
|
|
24
|
+
- The use of sexualized language or imagery, and sexual attention or advances
|
|
25
|
+
- Trolling, insulting or derogatory comments, and personal or political attacks
|
|
26
|
+
- Public or private harassment
|
|
27
|
+
- Publishing others' private information without explicit permission
|
|
28
|
+
- Other conduct which could reasonably be considered inappropriate
|
|
29
|
+
|
|
30
|
+
## Enforcement Responsibilities
|
|
31
|
+
|
|
32
|
+
Community leaders are responsible for clarifying and enforcing our standards of
|
|
33
|
+
acceptable behavior and will take appropriate and fair corrective action in
|
|
34
|
+
response to any behavior that they deem inappropriate, threatening, offensive,
|
|
35
|
+
or harmful.
|
|
36
|
+
|
|
37
|
+
## Scope
|
|
38
|
+
|
|
39
|
+
This Code of Conduct applies within all community spaces, and also applies when
|
|
40
|
+
an individual is officially representing the community in public spaces.
|
|
41
|
+
|
|
42
|
+
## Enforcement
|
|
43
|
+
|
|
44
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
45
|
+
reported to the community leaders responsible for enforcement at
|
|
46
|
+
**conduct@quantumrag.dev**.
|
|
47
|
+
|
|
48
|
+
All complaints will be reviewed and investigated promptly and fairly.
|
|
49
|
+
|
|
50
|
+
## Attribution
|
|
51
|
+
|
|
52
|
+
This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org),
|
|
53
|
+
version 2.1, available at
|
|
54
|
+
https://www.contributor-covenant.org/version/2/1/code_of_conduct.html.
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# Contributing to QuantumRAG
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing to QuantumRAG! This guide will help you get started.
|
|
4
|
+
|
|
5
|
+
## Development Setup
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Clone the repository
|
|
9
|
+
git clone https://github.com/quantumrag/quantumrag.git
|
|
10
|
+
cd quantumrag
|
|
11
|
+
|
|
12
|
+
# Create a virtual environment
|
|
13
|
+
python -m venv .venv
|
|
14
|
+
source .venv/bin/activate # or .venv\Scripts\activate on Windows
|
|
15
|
+
|
|
16
|
+
# Install in development mode
|
|
17
|
+
pip install -e ".[dev]"
|
|
18
|
+
|
|
19
|
+
# Run tests
|
|
20
|
+
pytest tests/
|
|
21
|
+
|
|
22
|
+
# Run linting
|
|
23
|
+
ruff check quantumrag/ tests/
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Project Structure
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
quantumrag/
|
|
30
|
+
core/ # Core engine (models, config, storage, ingest, retrieve, generate)
|
|
31
|
+
api/ # FastAPI HTTP server
|
|
32
|
+
cli/ # Typer CLI interface
|
|
33
|
+
connectors/ # External data source connectors
|
|
34
|
+
korean/ # Korean language support (morphology, encoding)
|
|
35
|
+
plugins/ # Plugin system
|
|
36
|
+
tests/
|
|
37
|
+
unit/ # Unit tests
|
|
38
|
+
integration/ # Integration tests (require external services)
|
|
39
|
+
benchmarks/ # Performance benchmarks
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Making Changes
|
|
43
|
+
|
|
44
|
+
1. **Create a branch** from `main`:
|
|
45
|
+
```bash
|
|
46
|
+
git checkout -b feature/your-feature-name
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
2. **Write code** following existing patterns:
|
|
50
|
+
- Use type hints everywhere
|
|
51
|
+
- Follow the existing code style (ruff enforced)
|
|
52
|
+
- Add docstrings for public APIs
|
|
53
|
+
- Use lazy imports for optional dependencies
|
|
54
|
+
|
|
55
|
+
3. **Write tests** for new functionality:
|
|
56
|
+
- Unit tests go in `tests/unit/`
|
|
57
|
+
- Mock external services (LLM, embedding APIs)
|
|
58
|
+
- Aim for >80% coverage on new code
|
|
59
|
+
|
|
60
|
+
4. **Run checks** before submitting:
|
|
61
|
+
```bash
|
|
62
|
+
ruff check quantumrag/ tests/
|
|
63
|
+
pytest tests/ -q
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
5. **Submit a Pull Request** with:
|
|
67
|
+
- Clear description of what changed and why
|
|
68
|
+
- Link to related issue (if any)
|
|
69
|
+
- Test results
|
|
70
|
+
|
|
71
|
+
## Code Style
|
|
72
|
+
|
|
73
|
+
- **Python 3.10+** — use modern syntax (`X | Y` unions, not `Optional[X]`)
|
|
74
|
+
- **Pydantic v2** for data models
|
|
75
|
+
- **structlog** for logging
|
|
76
|
+
- **Protocol classes** for interfaces (not ABCs)
|
|
77
|
+
- **Lazy imports** for optional dependencies (lancedb, tantivy, etc.)
|
|
78
|
+
|
|
79
|
+
## Adding a New Parser
|
|
80
|
+
|
|
81
|
+
```python
|
|
82
|
+
# quantumrag/core/ingest/parser/my_format.py
|
|
83
|
+
from quantumrag.core.models import Document
|
|
84
|
+
|
|
85
|
+
class MyFormatParser:
|
|
86
|
+
supported_extensions = {".myext"}
|
|
87
|
+
|
|
88
|
+
def parse(self, path: Path) -> Document:
|
|
89
|
+
# Parse your format and return a Document
|
|
90
|
+
...
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Adding a Plugin
|
|
94
|
+
|
|
95
|
+
See the plugin system documentation in `quantumrag/plugins/registry.py`.
|
|
96
|
+
|
|
97
|
+
## Reporting Issues
|
|
98
|
+
|
|
99
|
+
- Use GitHub Issues
|
|
100
|
+
- Include Python version, OS, and QuantumRAG version
|
|
101
|
+
- Provide minimal reproduction steps
|
|
102
|
+
|
|
103
|
+
## Code of Conduct
|
|
104
|
+
|
|
105
|
+
Be respectful, constructive, and inclusive. We welcome contributions from everyone regardless of background or experience level.
|
|
106
|
+
|
|
107
|
+
## License
|
|
108
|
+
|
|
109
|
+
By contributing, you agree that your contributions will be licensed under the Apache License 2.0.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
FROM python:3.12-slim
|
|
2
|
+
|
|
3
|
+
WORKDIR /app
|
|
4
|
+
|
|
5
|
+
# Install system dependencies
|
|
6
|
+
RUN apt-get update && \
|
|
7
|
+
apt-get install -y --no-install-recommends build-essential && \
|
|
8
|
+
rm -rf /var/lib/apt/lists/*
|
|
9
|
+
|
|
10
|
+
# Copy project files
|
|
11
|
+
COPY pyproject.toml README.md LICENSE ./
|
|
12
|
+
COPY quantumrag/ quantumrag/
|
|
13
|
+
|
|
14
|
+
# Install QuantumRAG with all dependencies
|
|
15
|
+
RUN pip install --no-cache-dir ".[all,api]"
|
|
16
|
+
|
|
17
|
+
# Create data directory
|
|
18
|
+
RUN mkdir -p /data/quantumrag
|
|
19
|
+
|
|
20
|
+
# Default config
|
|
21
|
+
ENV QUANTUMRAG_STORAGE__DATA_DIR=/data/quantumrag
|
|
22
|
+
ENV QUANTUMRAG_LANGUAGE=auto
|
|
23
|
+
|
|
24
|
+
# Expose API port
|
|
25
|
+
EXPOSE 8000
|
|
26
|
+
|
|
27
|
+
# Health check
|
|
28
|
+
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
|
29
|
+
CMD python -c "import httpx; httpx.get('http://localhost:8000/v1/status').raise_for_status()" || exit 1
|
|
30
|
+
|
|
31
|
+
# Run the API server
|
|
32
|
+
CMD ["quantumrag", "serve", "--host", "0.0.0.0", "--port", "8000"]
|
quantumrag-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to the Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by the Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding any notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
Copyright 2026 QuantumRAG Team
|
|
179
|
+
|
|
180
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
181
|
+
you may not use this file except in compliance with the License.
|
|
182
|
+
You may obtain a copy of the License at
|
|
183
|
+
|
|
184
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
185
|
+
|
|
186
|
+
Unless required by applicable law or agreed to in writing, software
|
|
187
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
188
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
189
|
+
See the License for the specific language governing permissions and
|
|
190
|
+
limitations under the License.
|