raglib-py 2.1.0__tar.gz → 2.2.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.
- {raglib_py-2.1.0 → raglib_py-2.2.1}/PKG-INFO +85 -31
- {raglib_py-2.1.0 → raglib_py-2.2.1}/README.md +82 -4
- {raglib_py-2.1.0 → raglib_py-2.2.1}/pyproject.toml +131 -142
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/__init__.py +136 -126
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/__main__.py +5 -5
- raglib_py-2.2.1/raglib/access.py +10 -0
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/cli.py +22 -1
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/components/generator.py +247 -234
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/components/grader.py +4 -2
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/components/hybrid_retriever.py +2 -2
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/components/multi_hop_retriever.py +50 -50
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/components/multi_query_retriever.py +87 -55
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/components/query_expander.py +6 -2
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/components/retriever.py +11 -5
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/components/router_retriever.py +16 -5
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/components/sql_tool.py +11 -1
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/components/tools.py +59 -59
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/components/web_retriever.py +86 -6
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/core/__init__.py +19 -19
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/core/base.py +408 -408
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/core/fusion.py +103 -103
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/core/intents.py +71 -71
- raglib_py-2.2.1/raglib/core/parsing.py +121 -0
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/core/runtime.py +123 -123
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/core/text.py +199 -199
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/core/tracing.py +55 -55
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/embedding/__init__.py +27 -27
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/embedding/embedding_factory.py +19 -4
- raglib_py-2.2.1/raglib/embedding/google_embedding.py +78 -0
- raglib_py-2.2.1/raglib/embedding/huggingface_embedding.py +62 -0
- raglib_py-2.2.1/raglib/embedding/ollama_embedding.py +59 -0
- raglib_py-2.2.1/raglib/embedding/openai_embedding.py +106 -0
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/facade.py +1358 -1151
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/graph_context/engine.py +1109 -1099
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/graphrag/__init__.py +35 -35
- raglib_py-2.2.1/raglib/graphrag/background.py +182 -0
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/graphrag/extractor.py +211 -201
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/graphrag/indexer.py +362 -254
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/graphrag/schemas.py +161 -161
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/graphrag/search.py +22 -5
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/graphrag/store/__init__.py +39 -39
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/graphrag/store/base.py +111 -111
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/graphrag/store/neo4j_store.py +295 -295
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/graphrag/store/networkx_store.py +264 -264
- raglib_py-2.2.1/raglib/llm/__init__.py +30 -0
- raglib_py-2.2.1/raglib/llm/clients.py +714 -0
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/llm/constants.py +40 -39
- raglib_py-2.2.1/raglib/llm/http.py +183 -0
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/llm/langchain_adapter.py +22 -171
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/llm/mock_client.py +218 -218
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/llm/provider_detector.py +23 -16
- raglib_py-2.2.1/raglib/llm/providers.py +555 -0
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/llm/resilience.py +205 -195
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/loaders/html_text.py +147 -147
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/loaders/structured_loaders.py +253 -253
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/providers/base_provider.py +73 -73
- raglib_py-2.2.1/raglib/providers/duckduckgo_provider.py +125 -0
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/providers/factory.py +142 -142
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/quick.py +34 -34
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/rag_types/__init__.py +31 -31
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/rag_types/advanced_rag.py +29 -29
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/rag_types/agentic_rag.py +3 -2
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/rag_types/corrective_rag.py +10 -1
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/rag_types/graph_rag.py +87 -70
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/rag_types/hybrid_rag.py +44 -43
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/rag_types/memory_rag.py +33 -33
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/rag_types/multi_hop_rag.py +39 -39
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/rag_types/naive_rag.py +28 -28
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/rag_types/routing_rag.py +28 -28
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/rag_types/web_rag.py +26 -25
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/schemas.py +74 -74
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/vectorstores/base_store.py +128 -128
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/vectorstores/chroma_store.py +215 -215
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/vectorstores/in_memory_store.py +290 -213
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/vectorstores/pgvector_store.py +9 -7
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/vectorstores/qdrant_store.py +3 -0
- raglib_py-2.2.1/raglib/vision/anthropic_vision.py +41 -0
- raglib_py-2.2.1/raglib/vision/base_vision.py +27 -0
- raglib_py-2.2.1/raglib/vision/chat_vision.py +27 -0
- raglib_py-2.2.1/raglib/vision/google_vision.py +41 -0
- raglib_py-2.2.1/raglib/vision/openai_vision.py +41 -0
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/vision/vision_factory.py +2 -2
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/visualize.py +299 -299
- raglib_py-2.1.0/raglib/core/parsing.py +0 -67
- raglib_py-2.1.0/raglib/embedding/google_embedding.py +0 -53
- raglib_py-2.1.0/raglib/embedding/huggingface_embedding.py +0 -56
- raglib_py-2.1.0/raglib/embedding/ollama_embedding.py +0 -62
- raglib_py-2.1.0/raglib/embedding/openai_embedding.py +0 -91
- raglib_py-2.1.0/raglib/llm/__init__.py +0 -6
- raglib_py-2.1.0/raglib/llm/providers.py +0 -205
- raglib_py-2.1.0/raglib/providers/duckduckgo_provider.py +0 -280
- raglib_py-2.1.0/raglib/vision/anthropic_vision.py +0 -82
- raglib_py-2.1.0/raglib/vision/base_vision.py +0 -16
- raglib_py-2.1.0/raglib/vision/google_vision.py +0 -75
- raglib_py-2.1.0/raglib/vision/openai_vision.py +0 -77
- raglib_py-2.1.0/site/README.md +0 -22
- raglib_py-2.1.0/site/node_modules/@babel/code-frame/LICENSE +0 -22
- raglib_py-2.1.0/site/node_modules/@babel/code-frame/README.md +0 -19
- raglib_py-2.1.0/site/node_modules/@babel/compat-data/LICENSE +0 -22
- raglib_py-2.1.0/site/node_modules/@babel/compat-data/README.md +0 -19
- raglib_py-2.1.0/site/node_modules/@babel/core/LICENSE +0 -22
- raglib_py-2.1.0/site/node_modules/@babel/core/README.md +0 -19
- raglib_py-2.1.0/site/node_modules/@babel/generator/LICENSE +0 -22
- raglib_py-2.1.0/site/node_modules/@babel/generator/README.md +0 -19
- raglib_py-2.1.0/site/node_modules/@babel/helper-compilation-targets/LICENSE +0 -22
- raglib_py-2.1.0/site/node_modules/@babel/helper-compilation-targets/README.md +0 -19
- raglib_py-2.1.0/site/node_modules/@babel/helper-globals/LICENSE +0 -22
- raglib_py-2.1.0/site/node_modules/@babel/helper-globals/README.md +0 -19
- raglib_py-2.1.0/site/node_modules/@babel/helper-module-imports/LICENSE +0 -22
- raglib_py-2.1.0/site/node_modules/@babel/helper-module-imports/README.md +0 -19
- raglib_py-2.1.0/site/node_modules/@babel/helper-module-transforms/LICENSE +0 -22
- raglib_py-2.1.0/site/node_modules/@babel/helper-module-transforms/README.md +0 -19
- raglib_py-2.1.0/site/node_modules/@babel/helper-plugin-utils/LICENSE +0 -22
- raglib_py-2.1.0/site/node_modules/@babel/helper-plugin-utils/README.md +0 -19
- raglib_py-2.1.0/site/node_modules/@babel/helper-string-parser/LICENSE +0 -22
- raglib_py-2.1.0/site/node_modules/@babel/helper-string-parser/README.md +0 -19
- raglib_py-2.1.0/site/node_modules/@babel/helper-validator-identifier/LICENSE +0 -22
- raglib_py-2.1.0/site/node_modules/@babel/helper-validator-identifier/README.md +0 -19
- raglib_py-2.1.0/site/node_modules/@babel/helper-validator-option/LICENSE +0 -22
- raglib_py-2.1.0/site/node_modules/@babel/helper-validator-option/README.md +0 -19
- raglib_py-2.1.0/site/node_modules/@babel/helpers/LICENSE +0 -23
- raglib_py-2.1.0/site/node_modules/@babel/helpers/README.md +0 -19
- raglib_py-2.1.0/site/node_modules/@babel/parser/LICENSE +0 -19
- raglib_py-2.1.0/site/node_modules/@babel/parser/README.md +0 -19
- raglib_py-2.1.0/site/node_modules/@babel/plugin-transform-react-jsx-self/LICENSE +0 -22
- raglib_py-2.1.0/site/node_modules/@babel/plugin-transform-react-jsx-self/README.md +0 -19
- raglib_py-2.1.0/site/node_modules/@babel/plugin-transform-react-jsx-source/LICENSE +0 -22
- raglib_py-2.1.0/site/node_modules/@babel/plugin-transform-react-jsx-source/README.md +0 -19
- raglib_py-2.1.0/site/node_modules/@babel/template/LICENSE +0 -22
- raglib_py-2.1.0/site/node_modules/@babel/template/README.md +0 -19
- raglib_py-2.1.0/site/node_modules/@babel/traverse/LICENSE +0 -22
- raglib_py-2.1.0/site/node_modules/@babel/traverse/README.md +0 -19
- raglib_py-2.1.0/site/node_modules/@babel/types/LICENSE +0 -22
- raglib_py-2.1.0/site/node_modules/@babel/types/README.md +0 -19
- raglib_py-2.1.0/site/node_modules/@esbuild/win32-x64/README.md +0 -3
- raglib_py-2.1.0/site/node_modules/@jridgewell/gen-mapping/LICENSE +0 -19
- raglib_py-2.1.0/site/node_modules/@jridgewell/gen-mapping/README.md +0 -227
- raglib_py-2.1.0/site/node_modules/@jridgewell/remapping/LICENSE +0 -19
- raglib_py-2.1.0/site/node_modules/@jridgewell/remapping/README.md +0 -218
- raglib_py-2.1.0/site/node_modules/@jridgewell/resolve-uri/LICENSE +0 -19
- raglib_py-2.1.0/site/node_modules/@jridgewell/resolve-uri/README.md +0 -40
- raglib_py-2.1.0/site/node_modules/@jridgewell/sourcemap-codec/LICENSE +0 -19
- raglib_py-2.1.0/site/node_modules/@jridgewell/sourcemap-codec/README.md +0 -264
- raglib_py-2.1.0/site/node_modules/@jridgewell/trace-mapping/LICENSE +0 -19
- raglib_py-2.1.0/site/node_modules/@jridgewell/trace-mapping/README.md +0 -348
- raglib_py-2.1.0/site/node_modules/@rolldown/pluginutils/LICENSE +0 -25
- raglib_py-2.1.0/site/node_modules/@rollup/rollup-win32-x64-gnu/README.md +0 -3
- raglib_py-2.1.0/site/node_modules/@rollup/rollup-win32-x64-msvc/README.md +0 -3
- raglib_py-2.1.0/site/node_modules/@types/babel__core/LICENSE +0 -21
- raglib_py-2.1.0/site/node_modules/@types/babel__core/README.md +0 -15
- raglib_py-2.1.0/site/node_modules/@types/babel__generator/LICENSE +0 -21
- raglib_py-2.1.0/site/node_modules/@types/babel__generator/README.md +0 -15
- raglib_py-2.1.0/site/node_modules/@types/babel__template/LICENSE +0 -21
- raglib_py-2.1.0/site/node_modules/@types/babel__template/README.md +0 -15
- raglib_py-2.1.0/site/node_modules/@types/babel__traverse/LICENSE +0 -21
- raglib_py-2.1.0/site/node_modules/@types/babel__traverse/README.md +0 -15
- raglib_py-2.1.0/site/node_modules/@types/estree/LICENSE +0 -21
- raglib_py-2.1.0/site/node_modules/@types/estree/README.md +0 -15
- raglib_py-2.1.0/site/node_modules/@types/prop-types/LICENSE +0 -21
- raglib_py-2.1.0/site/node_modules/@types/prop-types/README.md +0 -15
- raglib_py-2.1.0/site/node_modules/@types/react/LICENSE +0 -21
- raglib_py-2.1.0/site/node_modules/@types/react/README.md +0 -15
- raglib_py-2.1.0/site/node_modules/@types/react-dom/LICENSE +0 -21
- raglib_py-2.1.0/site/node_modules/@types/react-dom/README.md +0 -15
- raglib_py-2.1.0/site/node_modules/@vitejs/plugin-react/LICENSE +0 -21
- raglib_py-2.1.0/site/node_modules/@vitejs/plugin-react/README.md +0 -142
- raglib_py-2.1.0/site/node_modules/baseline-browser-mapping/README.md +0 -545
- raglib_py-2.1.0/site/node_modules/browserslist/LICENSE +0 -20
- raglib_py-2.1.0/site/node_modules/browserslist/README.md +0 -66
- raglib_py-2.1.0/site/node_modules/caniuse-lite/LICENSE +0 -395
- raglib_py-2.1.0/site/node_modules/caniuse-lite/README.md +0 -3
- raglib_py-2.1.0/site/node_modules/convert-source-map/LICENSE +0 -23
- raglib_py-2.1.0/site/node_modules/convert-source-map/README.md +0 -206
- raglib_py-2.1.0/site/node_modules/csstype/LICENSE +0 -19
- raglib_py-2.1.0/site/node_modules/csstype/README.md +0 -291
- raglib_py-2.1.0/site/node_modules/debug/LICENSE +0 -20
- raglib_py-2.1.0/site/node_modules/debug/README.md +0 -481
- raglib_py-2.1.0/site/node_modules/electron-to-chromium/LICENSE +0 -5
- raglib_py-2.1.0/site/node_modules/electron-to-chromium/README.md +0 -186
- raglib_py-2.1.0/site/node_modules/esbuild/README.md +0 -3
- raglib_py-2.1.0/site/node_modules/gensync/LICENSE +0 -7
- raglib_py-2.1.0/site/node_modules/gensync/README.md +0 -196
- raglib_py-2.1.0/site/node_modules/js-tokens/LICENSE +0 -21
- raglib_py-2.1.0/site/node_modules/js-tokens/README.md +0 -240
- raglib_py-2.1.0/site/node_modules/jsesc/README.md +0 -422
- raglib_py-2.1.0/site/node_modules/json5/README.md +0 -282
- raglib_py-2.1.0/site/node_modules/loose-envify/LICENSE +0 -21
- raglib_py-2.1.0/site/node_modules/loose-envify/README.md +0 -45
- raglib_py-2.1.0/site/node_modules/lru-cache/LICENSE +0 -15
- raglib_py-2.1.0/site/node_modules/lru-cache/README.md +0 -166
- raglib_py-2.1.0/site/node_modules/nanoid/LICENSE +0 -20
- raglib_py-2.1.0/site/node_modules/nanoid/README.md +0 -39
- raglib_py-2.1.0/site/node_modules/node-releases/LICENSE +0 -21
- raglib_py-2.1.0/site/node_modules/node-releases/README.md +0 -32
- raglib_py-2.1.0/site/node_modules/picocolors/LICENSE +0 -15
- raglib_py-2.1.0/site/node_modules/picocolors/README.md +0 -21
- raglib_py-2.1.0/site/node_modules/postcss/LICENSE +0 -20
- raglib_py-2.1.0/site/node_modules/postcss/README.md +0 -27
- raglib_py-2.1.0/site/node_modules/react/LICENSE +0 -21
- raglib_py-2.1.0/site/node_modules/react/README.md +0 -37
- raglib_py-2.1.0/site/node_modules/react-dom/LICENSE +0 -21
- raglib_py-2.1.0/site/node_modules/react-dom/README.md +0 -60
- raglib_py-2.1.0/site/node_modules/react-refresh/LICENSE +0 -21
- raglib_py-2.1.0/site/node_modules/react-refresh/README.md +0 -5
- raglib_py-2.1.0/site/node_modules/rollup/README.md +0 -134
- raglib_py-2.1.0/site/node_modules/scheduler/LICENSE +0 -21
- raglib_py-2.1.0/site/node_modules/scheduler/README.md +0 -9
- raglib_py-2.1.0/site/node_modules/semver/LICENSE +0 -15
- raglib_py-2.1.0/site/node_modules/semver/README.md +0 -443
- raglib_py-2.1.0/site/node_modules/source-map-js/LICENSE +0 -28
- raglib_py-2.1.0/site/node_modules/source-map-js/README.md +0 -765
- raglib_py-2.1.0/site/node_modules/typescript/README.md +0 -50
- raglib_py-2.1.0/site/node_modules/update-browserslist-db/LICENSE +0 -20
- raglib_py-2.1.0/site/node_modules/update-browserslist-db/README.md +0 -41
- raglib_py-2.1.0/site/node_modules/vite/README.md +0 -20
- raglib_py-2.1.0/site/node_modules/yallist/LICENSE +0 -15
- raglib_py-2.1.0/site/node_modules/yallist/README.md +0 -204
- {raglib_py-2.1.0 → raglib_py-2.2.1}/.gitignore +0 -0
- {raglib_py-2.1.0 → raglib_py-2.2.1}/LICENSE +0 -0
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/components/__init__.py +0 -0
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/components/bm25.py +0 -0
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/components/context_reducer.py +0 -0
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/components/decision.py +0 -0
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/components/deduplicator.py +0 -0
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/components/evaluator.py +0 -0
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/components/memory.py +0 -0
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/components/planner.py +0 -0
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/components/query_rewriter.py +0 -0
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/components/refiner.py +0 -0
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/components/reflection.py +0 -0
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/components/reranker.py +0 -0
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/constants.py +0 -0
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/core/concurrency.py +0 -0
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/embedding/base_embedding.py +0 -0
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/embedding/cached_embedding.py +0 -0
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/embedding/mock_embedding.py +0 -0
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/eval/__init__.py +0 -0
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/graph_context/__init__.py +0 -0
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/graph_context/schemas.py +0 -0
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/graphrag/communities.py +0 -0
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/llm/base_client.py +0 -0
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/loaders/__init__.py +0 -0
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/loaders/chunk_splitter.py +0 -0
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/loaders/document_loader.py +0 -0
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/loaders/exceptions.py +0 -0
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/loaders/pdf_loader.py +0 -0
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/loaders/pptx_loader.py +0 -0
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/loaders/text_loader.py +0 -0
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/loaders/web_loader.py +0 -0
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/loaders/word_loader.py +0 -0
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/preprocessing/__init__.py +0 -0
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/preprocessing/chunk_splitter.py +0 -0
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/providers/__init__.py +0 -0
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/providers/bing_provider.py +0 -0
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/providers/brave_provider.py +0 -0
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/providers/exa_provider.py +0 -0
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/providers/google_cse_provider.py +0 -0
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/providers/searxng_provider.py +0 -0
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/providers/serpapi_provider.py +0 -0
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/providers/tavily_provider.py +0 -0
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/rag_types/multi_query_rag.py +0 -0
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/rag_types/self_rag.py +0 -0
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/rag_types/tool_augmented_rag.py +0 -0
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/session/__init__.py +0 -0
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/session/interactive.py +0 -0
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/vectorstores/__init__.py +0 -0
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/vectorstores/factory.py +0 -0
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/vision/__init__.py +0 -0
- {raglib_py-2.1.0 → raglib_py-2.2.1}/raglib/vision/mock_vision.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: raglib-py
|
|
3
|
-
Version: 2.1
|
|
3
|
+
Version: 2.2.1
|
|
4
4
|
Summary: Modular Retrieval-Augmented Generation: hybrid search, reranking, CRAG, Self-RAG, agentic and GraphRAG pipelines
|
|
5
5
|
Project-URL: Homepage, https://github.com/himanshuhs9011/raglib
|
|
6
6
|
Project-URL: Documentation, https://github.com/himanshuhs9011/raglib/blob/main/docs/USAGE.md
|
|
@@ -44,13 +44,6 @@ Requires-Python: >=3.9
|
|
|
44
44
|
Provides-Extra: all
|
|
45
45
|
Requires-Dist: chromadb>=0.5.0; extra == 'all'
|
|
46
46
|
Requires-Dist: ddgs>=6.0.0; extra == 'all'
|
|
47
|
-
Requires-Dist: langchain-anthropic>=0.1.0; extra == 'all'
|
|
48
|
-
Requires-Dist: langchain-core>=0.2.0; extra == 'all'
|
|
49
|
-
Requires-Dist: langchain-google-genai>=1.0.0; extra == 'all'
|
|
50
|
-
Requires-Dist: langchain-groq>=0.1.0; extra == 'all'
|
|
51
|
-
Requires-Dist: langchain-huggingface>=0.0.3; extra == 'all'
|
|
52
|
-
Requires-Dist: langchain-ollama>=0.1.0; extra == 'all'
|
|
53
|
-
Requires-Dist: langchain-openai>=0.1.0; extra == 'all'
|
|
54
47
|
Requires-Dist: networkx>=3.0; extra == 'all'
|
|
55
48
|
Requires-Dist: numpy>=1.24; extra == 'all'
|
|
56
49
|
Requires-Dist: openpyxl>=3.1; extra == 'all'
|
|
@@ -60,15 +53,7 @@ Requires-Dist: python-pptx>=0.6.21; extra == 'all'
|
|
|
60
53
|
Requires-Dist: sentence-transformers>=2.6.0; extra == 'all'
|
|
61
54
|
Requires-Dist: tiktoken>=0.5.0; extra == 'all'
|
|
62
55
|
Provides-Extra: all-llm
|
|
63
|
-
Requires-Dist: langchain-anthropic>=0.1.0; extra == 'all-llm'
|
|
64
|
-
Requires-Dist: langchain-core>=0.2.0; extra == 'all-llm'
|
|
65
|
-
Requires-Dist: langchain-google-genai>=1.0.0; extra == 'all-llm'
|
|
66
|
-
Requires-Dist: langchain-groq>=0.1.0; extra == 'all-llm'
|
|
67
|
-
Requires-Dist: langchain-ollama>=0.1.0; extra == 'all-llm'
|
|
68
|
-
Requires-Dist: langchain-openai>=0.1.0; extra == 'all-llm'
|
|
69
56
|
Provides-Extra: anthropic
|
|
70
|
-
Requires-Dist: langchain-anthropic>=0.1.0; extra == 'anthropic'
|
|
71
|
-
Requires-Dist: langchain-core>=0.2.0; extra == 'anthropic'
|
|
72
57
|
Provides-Extra: chroma
|
|
73
58
|
Requires-Dist: chromadb>=0.5.0; extra == 'chroma'
|
|
74
59
|
Provides-Extra: cohere
|
|
@@ -87,16 +72,13 @@ Provides-Extra: fast
|
|
|
87
72
|
Requires-Dist: numpy>=1.24; extra == 'fast'
|
|
88
73
|
Requires-Dist: tiktoken>=0.5.0; extra == 'fast'
|
|
89
74
|
Provides-Extra: google
|
|
90
|
-
Requires-Dist: langchain-core>=0.2.0; extra == 'google'
|
|
91
|
-
Requires-Dist: langchain-google-genai>=1.0.0; extra == 'google'
|
|
92
75
|
Provides-Extra: graph
|
|
93
76
|
Requires-Dist: networkx>=3.0; extra == 'graph'
|
|
94
77
|
Provides-Extra: groq
|
|
95
|
-
Requires-Dist: langchain-core>=0.2.0; extra == 'groq'
|
|
96
|
-
Requires-Dist: langchain-groq>=0.1.0; extra == 'groq'
|
|
97
78
|
Provides-Extra: hf
|
|
98
|
-
Requires-Dist: langchain-huggingface>=0.0.3; extra == 'hf'
|
|
99
79
|
Requires-Dist: sentence-transformers>=2.6.0; extra == 'hf'
|
|
80
|
+
Provides-Extra: langchain
|
|
81
|
+
Requires-Dist: langchain-core>=0.2.0; extra == 'langchain'
|
|
100
82
|
Provides-Extra: leiden
|
|
101
83
|
Requires-Dist: graspologic>=3.3; extra == 'leiden'
|
|
102
84
|
Requires-Dist: networkx>=3.0; extra == 'leiden'
|
|
@@ -107,14 +89,8 @@ Provides-Extra: ocr
|
|
|
107
89
|
Requires-Dist: pillow>=10.0.0; extra == 'ocr'
|
|
108
90
|
Requires-Dist: pytesseract>=0.3.10; extra == 'ocr'
|
|
109
91
|
Provides-Extra: ollama
|
|
110
|
-
Requires-Dist: langchain-core>=0.2.0; extra == 'ollama'
|
|
111
|
-
Requires-Dist: langchain-ollama>=0.1.0; extra == 'ollama'
|
|
112
92
|
Provides-Extra: openai
|
|
113
|
-
Requires-Dist: langchain-core>=0.2.0; extra == 'openai'
|
|
114
|
-
Requires-Dist: langchain-openai>=0.1.0; extra == 'openai'
|
|
115
93
|
Provides-Extra: openrouter
|
|
116
|
-
Requires-Dist: langchain-core>=0.2.0; extra == 'openrouter'
|
|
117
|
-
Requires-Dist: langchain-openai>=0.1.0; extra == 'openrouter'
|
|
118
94
|
Provides-Extra: pdf
|
|
119
95
|
Requires-Dist: pymupdf>=1.23.0; extra == 'pdf'
|
|
120
96
|
Provides-Extra: pgvector
|
|
@@ -184,7 +160,8 @@ pip install raglib-py
|
|
|
184
160
|
pip install "raglib-py[all]"
|
|
185
161
|
|
|
186
162
|
# Or pick what you need:
|
|
187
|
-
|
|
163
|
+
# Chat and embedding providers (OpenAI, Anthropic, Gemini, OpenRouter, Groq, Ollama, ...) need no extra:
|
|
164
|
+
# raglib calls their HTTP APIs directly. The [openai], [anthropic], ... extras still install (as no-ops).
|
|
188
165
|
pip install "raglib-py[hf]" # local HuggingFace / SentenceTransformers embeddings
|
|
189
166
|
pip install "raglib-py[rerank]" # cross-encoder reranker (bge-reranker)
|
|
190
167
|
pip install "raglib-py[fast]" # numpy vector math + tiktoken token counting
|
|
@@ -544,6 +521,14 @@ rag.save("./graph_index") # graph + extraction cache + vectors
|
|
|
544
521
|
|
|
545
522
|
Neo4j: `RAG(..., rag_type="graph", graph_store="neo4j", graph_kwargs={"store_options": {"uri": "bolt://localhost:7687", "user": "neo4j", "password": "...", "namespace": "papers"}})`.
|
|
546
523
|
|
|
524
|
+
**Indexing cost.** Building the graph takes one LLM call per chunk, plus one per community report. That is thousands of calls for a few hundred long documents, and indexing is the dominant GraphRAG cost. Use a cheaper or faster model for it with `graph_llm`; answers still use `llm`:
|
|
525
|
+
|
|
526
|
+
```python
|
|
527
|
+
rag = RAG("docs/", rag_type="graph", llm="openai/gpt-4.1", graph_llm="openai/gpt-4.1-nano")
|
|
528
|
+
```
|
|
529
|
+
|
|
530
|
+
`graph_llm` builds the graph (entity extraction, community reports, the global-search map step). Its key comes from `chat_api_key` only when it is the same provider, otherwise from its environment variable. With a reasoning model, turning thinking off for extraction is about 10× faster (see *Custom Providers*, `extra_body`).
|
|
531
|
+
|
|
547
532
|
To give **agentic** or **routing** pipelines a `graph_search` tool / route, pass `enable_graph=True`.
|
|
548
533
|
|
|
549
534
|
---
|
|
@@ -664,11 +649,13 @@ Hosted OpenAI-compatible APIs only need `pip install "raglib-py[openai]"`.
|
|
|
664
649
|
| **xAI Grok** | `"xai"` / `"grok"` | `grok-3-mini` | `XAI_API_KEY` | – |
|
|
665
650
|
| **Perplexity** | `"perplexity"` | `sonar` | `PERPLEXITY_API_KEY` | – |
|
|
666
651
|
| **Cerebras** | `"cerebras"` | `llama-3.3-70b` | `CEREBRAS_API_KEY` | – |
|
|
652
|
+
| **NVIDIA NIM** (build.nvidia.com or self-hosted via `NVIDIA_BASE_URL`) | `"nvidia"` / `"nim"` | `nvidia/nemotron-3.5-lightning-30b-a3b` | `NVIDIA_API_KEY` | yes (`nvidia/nemotron-3-embed-1b`); OCR with `nvidia/nemotron-3.5-super-vl-120b-a12b` |
|
|
667
653
|
| **Azure OpenAI** | `"azure/<deployment>"` | – | `AZURE_OPENAI_API_KEY` + `AZURE_OPENAI_ENDPOINT` | yes (deployment) |
|
|
668
654
|
| **Ollama** (local) | `"ollama"` | `llama3.1` | – | yes |
|
|
669
655
|
| **LM Studio** (local) | `"lmstudio/<model>"` | – | – | with `embedding_model` |
|
|
670
656
|
| **vLLM** (self-hosted) | `"vllm/<model>"` + `chat_base_url` | – | – | with `embedding_model` |
|
|
671
657
|
| **Any OpenAI-compatible API** | `"openai_compatible/<model>"` + `chat_base_url` | – | `OPENAI_COMPATIBLE_API_KEY` | with `embedding_model` |
|
|
658
|
+
| **Your own provider** (`register_provider` / JSON file) | `"<id>/<model>"` | first listed model | your choice | with `embedding_model` |
|
|
672
659
|
| **Any LangChain chat model / `BaseLLMClient`** | the object | – | – | – |
|
|
673
660
|
| **Mock (offline)** | `"mock"` or `offline=True` | templated | – | mock |
|
|
674
661
|
|
|
@@ -688,6 +675,73 @@ rag = RAG("docs/", llm="vllm/Qwen/Qwen2.5-7B-Instruct", chat_base_url="http://gp
|
|
|
688
675
|
|
|
689
676
|
All provider calls get a timeout (`llm_timeout`), retries with jittered exponential backoff on rate limits / 5xx (`llm_max_retries`) and an LRU response cache (`llm_cache`).
|
|
690
677
|
|
|
678
|
+
raglib needs no SDK and no LangChain for any of these providers. `raglib.llm.clients` speaks the three wire protocols directly with the Python standard library: **OpenAI Chat Completions** (OpenAI, Azure, Groq, Ollama, OpenRouter and every other compatible API), **Anthropic Messages** and **Gemini `generateContent`**, including SSE streaming, JSON mode and real token usage. Build one directly with `from raglib.llm import build_chat_client; llm = build_chat_client("anthropic")`. A LangChain chat model you already have still works: pass it as `chat_llm=` and raglib wraps it with its retries and usage tracking.
|
|
679
|
+
|
|
680
|
+
### Custom Providers (any third-party or self-hosted API)
|
|
681
|
+
|
|
682
|
+
Register any provider that speaks one of the three supported APIs (`openai` Chat Completions, `anthropic` Messages, `gemini` generateContent), then use it like a built-in one:
|
|
683
|
+
|
|
684
|
+
```python
|
|
685
|
+
from raglib import RAG, register_provider
|
|
686
|
+
|
|
687
|
+
register_provider(
|
|
688
|
+
"myprovider", # lowercase letters, numbers, - or _
|
|
689
|
+
name="My AI Provider", # shown by `raglib providers`
|
|
690
|
+
api="openai", # "openai" | "anthropic" | "gemini"
|
|
691
|
+
base_url="https://api.myprovider.com/v1",
|
|
692
|
+
api_key="{env:MYPROVIDER_API_KEY}", # optional; leave out when auth is in headers
|
|
693
|
+
headers={"X-Team": "{env:MY_TEAM_ID}"}, # optional extra headers ({env:NAME} is expanded)
|
|
694
|
+
models=[
|
|
695
|
+
{"id": "model-id", "name": "Display Name"},
|
|
696
|
+
{"id": "model-r1", "name": "Reasoner", "reasoning": True},
|
|
697
|
+
{"id": "model-vl", "name": "Vision", "image": True},
|
|
698
|
+
],
|
|
699
|
+
embedding_model="embed-v1", # optional: semantic search through the same provider
|
|
700
|
+
)
|
|
701
|
+
|
|
702
|
+
rag = RAG("docs/", llm="myprovider/model-id") # or llm="myprovider" for the first listed model
|
|
703
|
+
```
|
|
704
|
+
|
|
705
|
+
| Model flag | Effect |
|
|
706
|
+
| :--- | :--- |
|
|
707
|
+
| `reasoning: true` | No `temperature` is sent (many reasoning endpoints reject it). A leading `<think>...</think>` block is removed from answers and streams for every model, so citations and JSON parsing keep working. |
|
|
708
|
+
| `image: true` | The model can read scanned PDF pages: it is used for OCR when it is the chat model, or with `vision_llm="myprovider/model-vl"`. |
|
|
709
|
+
|
|
710
|
+
Models you don't list still work (`llm="myprovider/any-model"`). The list sets the default model and the flags.
|
|
711
|
+
|
|
712
|
+
Reasoning models spend completion tokens on thinking before they answer. A small `llm_max_tokens` can be used up entirely by the thinking, which leaves the answer empty, so leave it unset or generous for these models.
|
|
713
|
+
|
|
714
|
+
More options for servers with their own conventions:
|
|
715
|
+
|
|
716
|
+
| Option | Example | Use |
|
|
717
|
+
| :--- | :--- | :--- |
|
|
718
|
+
| `extra_body` | `{"chat_template_kwargs": {"enable_thinking": False}}` | Extra JSON fields for every chat request (vLLM / NVIDIA NIM sampling or template options). Turning thinking off for NVIDIA Nemotron cut a lookup answer from 357 to 10 completion tokens and from 2.7 s to 0.5 s in testing. |
|
|
719
|
+
| `embedding_input_types` | `["passage", "query"]` | Asymmetric embedding models that require an `input_type` field: documents get the first value, search queries the second. |
|
|
720
|
+
| `embedding_params` | `{"truncate": "END"}` | Extra JSON fields for embedding requests. |
|
|
721
|
+
| `stream_usage` | `true` | The server accepts `stream_options.include_usage`, so streamed answers report real token counts. |
|
|
722
|
+
|
|
723
|
+
**From a JSON file** (no code). Use `load_providers("providers.json")`, set `RAGLIB_PROVIDERS_FILE=providers.json`, or pass `raglib ask ... --providers providers.json`:
|
|
724
|
+
|
|
725
|
+
```json
|
|
726
|
+
{
|
|
727
|
+
"providers": {
|
|
728
|
+
"myprovider": {
|
|
729
|
+
"name": "My AI Provider",
|
|
730
|
+
"api": "openai",
|
|
731
|
+
"base_url": "https://api.myprovider.com/v1",
|
|
732
|
+
"api_key": "{env:MYPROVIDER_API_KEY}",
|
|
733
|
+
"headers": {"X-Team": "search"},
|
|
734
|
+
"models": {
|
|
735
|
+
"model-id": {"name": "Display Name", "reasoning": false, "image": false}
|
|
736
|
+
},
|
|
737
|
+
"embedding_model": "embed-v1"
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
```
|
|
742
|
+
|
|
743
|
+
Keep keys out of the file with `{env:NAME}`; raglib warns when a file holds a literal key. A key given for one provider is never sent to another provider's host. Built-in provider ids can't be redefined, and `raglib providers` lists custom providers with their models.
|
|
744
|
+
|
|
691
745
|
### Supported Embedding Providers (`embedding_llm`)
|
|
692
746
|
|
|
693
747
|
| Provider | `embedding_llm` Value | Default Model | Notes |
|
|
@@ -774,13 +828,13 @@ rag.chat() # interactive terminal session with memory
|
|
|
774
828
|
```python
|
|
775
829
|
from raglib import RAG
|
|
776
830
|
from raglib.eval import evaluate
|
|
777
|
-
from raglib.llm
|
|
831
|
+
from raglib.llm import build_chat_client
|
|
778
832
|
|
|
779
833
|
rag = RAG("docs/", chat_llm="openai", embedding_llm="openai")
|
|
780
834
|
dataset = [
|
|
781
835
|
{"question": "What is the refund window?", "relevant_ids": ["docs/refunds.md"], "reference": "30 days"},
|
|
782
836
|
]
|
|
783
|
-
judge =
|
|
837
|
+
judge = build_chat_client("openai", model_name="gpt-4.1") # use a strong judge model
|
|
784
838
|
report = evaluate(rag, dataset, judge_llm=judge, k=5)
|
|
785
839
|
print(report) # hit_rate@5, mrr@5, recall@5, ndcg@5, faithfulness, answer_relevance, context_precision, correctness, latency_ms
|
|
786
840
|
```
|
|
@@ -810,7 +864,7 @@ corpus = [
|
|
|
810
864
|
Document(id="d2", content="Corrective RAG grades chunks and refines knowledge strips."),
|
|
811
865
|
]
|
|
812
866
|
|
|
813
|
-
llm = MockLLMClient() # use
|
|
867
|
+
llm = MockLLMClient() # use build_chat_client("openai") in production
|
|
814
868
|
pipeline = CorrectiveRAG(
|
|
815
869
|
retriever=Retriever(documents=corpus, top_k=4), # BM25 only; pass embedding=... for hybrid
|
|
816
870
|
grader=RelevanceGrader(llm_client=llm),
|
|
@@ -47,7 +47,8 @@ pip install raglib-py
|
|
|
47
47
|
pip install "raglib-py[all]"
|
|
48
48
|
|
|
49
49
|
# Or pick what you need:
|
|
50
|
-
|
|
50
|
+
# Chat and embedding providers (OpenAI, Anthropic, Gemini, OpenRouter, Groq, Ollama, ...) need no extra:
|
|
51
|
+
# raglib calls their HTTP APIs directly. The [openai], [anthropic], ... extras still install (as no-ops).
|
|
51
52
|
pip install "raglib-py[hf]" # local HuggingFace / SentenceTransformers embeddings
|
|
52
53
|
pip install "raglib-py[rerank]" # cross-encoder reranker (bge-reranker)
|
|
53
54
|
pip install "raglib-py[fast]" # numpy vector math + tiktoken token counting
|
|
@@ -407,6 +408,14 @@ rag.save("./graph_index") # graph + extraction cache + vectors
|
|
|
407
408
|
|
|
408
409
|
Neo4j: `RAG(..., rag_type="graph", graph_store="neo4j", graph_kwargs={"store_options": {"uri": "bolt://localhost:7687", "user": "neo4j", "password": "...", "namespace": "papers"}})`.
|
|
409
410
|
|
|
411
|
+
**Indexing cost.** Building the graph takes one LLM call per chunk, plus one per community report. That is thousands of calls for a few hundred long documents, and indexing is the dominant GraphRAG cost. Use a cheaper or faster model for it with `graph_llm`; answers still use `llm`:
|
|
412
|
+
|
|
413
|
+
```python
|
|
414
|
+
rag = RAG("docs/", rag_type="graph", llm="openai/gpt-4.1", graph_llm="openai/gpt-4.1-nano")
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
`graph_llm` builds the graph (entity extraction, community reports, the global-search map step). Its key comes from `chat_api_key` only when it is the same provider, otherwise from its environment variable. With a reasoning model, turning thinking off for extraction is about 10× faster (see *Custom Providers*, `extra_body`).
|
|
418
|
+
|
|
410
419
|
To give **agentic** or **routing** pipelines a `graph_search` tool / route, pass `enable_graph=True`.
|
|
411
420
|
|
|
412
421
|
---
|
|
@@ -527,11 +536,13 @@ Hosted OpenAI-compatible APIs only need `pip install "raglib-py[openai]"`.
|
|
|
527
536
|
| **xAI Grok** | `"xai"` / `"grok"` | `grok-3-mini` | `XAI_API_KEY` | – |
|
|
528
537
|
| **Perplexity** | `"perplexity"` | `sonar` | `PERPLEXITY_API_KEY` | – |
|
|
529
538
|
| **Cerebras** | `"cerebras"` | `llama-3.3-70b` | `CEREBRAS_API_KEY` | – |
|
|
539
|
+
| **NVIDIA NIM** (build.nvidia.com or self-hosted via `NVIDIA_BASE_URL`) | `"nvidia"` / `"nim"` | `nvidia/nemotron-3.5-lightning-30b-a3b` | `NVIDIA_API_KEY` | yes (`nvidia/nemotron-3-embed-1b`); OCR with `nvidia/nemotron-3.5-super-vl-120b-a12b` |
|
|
530
540
|
| **Azure OpenAI** | `"azure/<deployment>"` | – | `AZURE_OPENAI_API_KEY` + `AZURE_OPENAI_ENDPOINT` | yes (deployment) |
|
|
531
541
|
| **Ollama** (local) | `"ollama"` | `llama3.1` | – | yes |
|
|
532
542
|
| **LM Studio** (local) | `"lmstudio/<model>"` | – | – | with `embedding_model` |
|
|
533
543
|
| **vLLM** (self-hosted) | `"vllm/<model>"` + `chat_base_url` | – | – | with `embedding_model` |
|
|
534
544
|
| **Any OpenAI-compatible API** | `"openai_compatible/<model>"` + `chat_base_url` | – | `OPENAI_COMPATIBLE_API_KEY` | with `embedding_model` |
|
|
545
|
+
| **Your own provider** (`register_provider` / JSON file) | `"<id>/<model>"` | first listed model | your choice | with `embedding_model` |
|
|
535
546
|
| **Any LangChain chat model / `BaseLLMClient`** | the object | – | – | – |
|
|
536
547
|
| **Mock (offline)** | `"mock"` or `offline=True` | templated | – | mock |
|
|
537
548
|
|
|
@@ -551,6 +562,73 @@ rag = RAG("docs/", llm="vllm/Qwen/Qwen2.5-7B-Instruct", chat_base_url="http://gp
|
|
|
551
562
|
|
|
552
563
|
All provider calls get a timeout (`llm_timeout`), retries with jittered exponential backoff on rate limits / 5xx (`llm_max_retries`) and an LRU response cache (`llm_cache`).
|
|
553
564
|
|
|
565
|
+
raglib needs no SDK and no LangChain for any of these providers. `raglib.llm.clients` speaks the three wire protocols directly with the Python standard library: **OpenAI Chat Completions** (OpenAI, Azure, Groq, Ollama, OpenRouter and every other compatible API), **Anthropic Messages** and **Gemini `generateContent`**, including SSE streaming, JSON mode and real token usage. Build one directly with `from raglib.llm import build_chat_client; llm = build_chat_client("anthropic")`. A LangChain chat model you already have still works: pass it as `chat_llm=` and raglib wraps it with its retries and usage tracking.
|
|
566
|
+
|
|
567
|
+
### Custom Providers (any third-party or self-hosted API)
|
|
568
|
+
|
|
569
|
+
Register any provider that speaks one of the three supported APIs (`openai` Chat Completions, `anthropic` Messages, `gemini` generateContent), then use it like a built-in one:
|
|
570
|
+
|
|
571
|
+
```python
|
|
572
|
+
from raglib import RAG, register_provider
|
|
573
|
+
|
|
574
|
+
register_provider(
|
|
575
|
+
"myprovider", # lowercase letters, numbers, - or _
|
|
576
|
+
name="My AI Provider", # shown by `raglib providers`
|
|
577
|
+
api="openai", # "openai" | "anthropic" | "gemini"
|
|
578
|
+
base_url="https://api.myprovider.com/v1",
|
|
579
|
+
api_key="{env:MYPROVIDER_API_KEY}", # optional; leave out when auth is in headers
|
|
580
|
+
headers={"X-Team": "{env:MY_TEAM_ID}"}, # optional extra headers ({env:NAME} is expanded)
|
|
581
|
+
models=[
|
|
582
|
+
{"id": "model-id", "name": "Display Name"},
|
|
583
|
+
{"id": "model-r1", "name": "Reasoner", "reasoning": True},
|
|
584
|
+
{"id": "model-vl", "name": "Vision", "image": True},
|
|
585
|
+
],
|
|
586
|
+
embedding_model="embed-v1", # optional: semantic search through the same provider
|
|
587
|
+
)
|
|
588
|
+
|
|
589
|
+
rag = RAG("docs/", llm="myprovider/model-id") # or llm="myprovider" for the first listed model
|
|
590
|
+
```
|
|
591
|
+
|
|
592
|
+
| Model flag | Effect |
|
|
593
|
+
| :--- | :--- |
|
|
594
|
+
| `reasoning: true` | No `temperature` is sent (many reasoning endpoints reject it). A leading `<think>...</think>` block is removed from answers and streams for every model, so citations and JSON parsing keep working. |
|
|
595
|
+
| `image: true` | The model can read scanned PDF pages: it is used for OCR when it is the chat model, or with `vision_llm="myprovider/model-vl"`. |
|
|
596
|
+
|
|
597
|
+
Models you don't list still work (`llm="myprovider/any-model"`). The list sets the default model and the flags.
|
|
598
|
+
|
|
599
|
+
Reasoning models spend completion tokens on thinking before they answer. A small `llm_max_tokens` can be used up entirely by the thinking, which leaves the answer empty, so leave it unset or generous for these models.
|
|
600
|
+
|
|
601
|
+
More options for servers with their own conventions:
|
|
602
|
+
|
|
603
|
+
| Option | Example | Use |
|
|
604
|
+
| :--- | :--- | :--- |
|
|
605
|
+
| `extra_body` | `{"chat_template_kwargs": {"enable_thinking": False}}` | Extra JSON fields for every chat request (vLLM / NVIDIA NIM sampling or template options). Turning thinking off for NVIDIA Nemotron cut a lookup answer from 357 to 10 completion tokens and from 2.7 s to 0.5 s in testing. |
|
|
606
|
+
| `embedding_input_types` | `["passage", "query"]` | Asymmetric embedding models that require an `input_type` field: documents get the first value, search queries the second. |
|
|
607
|
+
| `embedding_params` | `{"truncate": "END"}` | Extra JSON fields for embedding requests. |
|
|
608
|
+
| `stream_usage` | `true` | The server accepts `stream_options.include_usage`, so streamed answers report real token counts. |
|
|
609
|
+
|
|
610
|
+
**From a JSON file** (no code). Use `load_providers("providers.json")`, set `RAGLIB_PROVIDERS_FILE=providers.json`, or pass `raglib ask ... --providers providers.json`:
|
|
611
|
+
|
|
612
|
+
```json
|
|
613
|
+
{
|
|
614
|
+
"providers": {
|
|
615
|
+
"myprovider": {
|
|
616
|
+
"name": "My AI Provider",
|
|
617
|
+
"api": "openai",
|
|
618
|
+
"base_url": "https://api.myprovider.com/v1",
|
|
619
|
+
"api_key": "{env:MYPROVIDER_API_KEY}",
|
|
620
|
+
"headers": {"X-Team": "search"},
|
|
621
|
+
"models": {
|
|
622
|
+
"model-id": {"name": "Display Name", "reasoning": false, "image": false}
|
|
623
|
+
},
|
|
624
|
+
"embedding_model": "embed-v1"
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
```
|
|
629
|
+
|
|
630
|
+
Keep keys out of the file with `{env:NAME}`; raglib warns when a file holds a literal key. A key given for one provider is never sent to another provider's host. Built-in provider ids can't be redefined, and `raglib providers` lists custom providers with their models.
|
|
631
|
+
|
|
554
632
|
### Supported Embedding Providers (`embedding_llm`)
|
|
555
633
|
|
|
556
634
|
| Provider | `embedding_llm` Value | Default Model | Notes |
|
|
@@ -637,13 +715,13 @@ rag.chat() # interactive terminal session with memory
|
|
|
637
715
|
```python
|
|
638
716
|
from raglib import RAG
|
|
639
717
|
from raglib.eval import evaluate
|
|
640
|
-
from raglib.llm
|
|
718
|
+
from raglib.llm import build_chat_client
|
|
641
719
|
|
|
642
720
|
rag = RAG("docs/", chat_llm="openai", embedding_llm="openai")
|
|
643
721
|
dataset = [
|
|
644
722
|
{"question": "What is the refund window?", "relevant_ids": ["docs/refunds.md"], "reference": "30 days"},
|
|
645
723
|
]
|
|
646
|
-
judge =
|
|
724
|
+
judge = build_chat_client("openai", model_name="gpt-4.1") # use a strong judge model
|
|
647
725
|
report = evaluate(rag, dataset, judge_llm=judge, k=5)
|
|
648
726
|
print(report) # hit_rate@5, mrr@5, recall@5, ndcg@5, faithfulness, answer_relevance, context_precision, correctness, latency_ms
|
|
649
727
|
```
|
|
@@ -673,7 +751,7 @@ corpus = [
|
|
|
673
751
|
Document(id="d2", content="Corrective RAG grades chunks and refines knowledge strips."),
|
|
674
752
|
]
|
|
675
753
|
|
|
676
|
-
llm = MockLLMClient() # use
|
|
754
|
+
llm = MockLLMClient() # use build_chat_client("openai") in production
|
|
677
755
|
pipeline = CorrectiveRAG(
|
|
678
756
|
retriever=Retriever(documents=corpus, top_k=4), # BM25 only; pass embedding=... for hybrid
|
|
679
757
|
grader=RelevanceGrader(llm_client=llm),
|
|
@@ -1,142 +1,131 @@
|
|
|
1
|
-
[build-system]
|
|
2
|
-
requires = ["hatchling>=1.25.0"]
|
|
3
|
-
build-backend = "hatchling.build"
|
|
4
|
-
|
|
5
|
-
[project]
|
|
6
|
-
name = "raglib-py"
|
|
7
|
-
version = "2.1
|
|
8
|
-
description = "Modular Retrieval-Augmented Generation: hybrid search, reranking, CRAG, Self-RAG, agentic and GraphRAG pipelines"
|
|
9
|
-
readme = "README.md"
|
|
10
|
-
license = { file = "LICENSE" }
|
|
11
|
-
authors = [
|
|
12
|
-
{ name = "raglib maintainers" }
|
|
13
|
-
]
|
|
14
|
-
requires-python = ">=3.9"
|
|
15
|
-
# The core is pure Python (BM25, in-memory vectors, all pipelines). Everything else is an extra.
|
|
16
|
-
dependencies = []
|
|
17
|
-
keywords = ["rag", "llm", "retrieval", "ai", "nlp", "vector-search", "graphrag", "hybrid-search"]
|
|
18
|
-
classifiers = [
|
|
19
|
-
"Development Status :: 4 - Beta",
|
|
20
|
-
"Intended Audience :: Developers",
|
|
21
|
-
"License :: OSI Approved :: MIT License",
|
|
22
|
-
"Programming Language :: Python :: 3",
|
|
23
|
-
"Programming Language :: Python :: 3.9",
|
|
24
|
-
"Programming Language :: Python :: 3.10",
|
|
25
|
-
"Programming Language :: Python :: 3.11",
|
|
26
|
-
"Programming Language :: Python :: 3.12",
|
|
27
|
-
"Programming Language :: Python :: 3.13",
|
|
28
|
-
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
29
|
-
]
|
|
30
|
-
|
|
31
|
-
[project.scripts]
|
|
32
|
-
raglib = "raglib.cli:main"
|
|
33
|
-
|
|
34
|
-
[project.urls]
|
|
35
|
-
Homepage = "https://github.com/himanshuhs9011/raglib"
|
|
36
|
-
Documentation = "https://github.com/himanshuhs9011/raglib/blob/main/docs/USAGE.md"
|
|
37
|
-
Repository = "https://github.com/himanshuhs9011/raglib"
|
|
38
|
-
"Bug Tracker" = "https://github.com/himanshuhs9011/raglib/issues"
|
|
39
|
-
|
|
40
|
-
[project.optional-dependencies]
|
|
41
|
-
# chat / embedding providers
|
|
42
|
-
#
|
|
43
|
-
#
|
|
44
|
-
openai = [
|
|
45
|
-
openrouter = [
|
|
46
|
-
anthropic = [
|
|
47
|
-
groq = [
|
|
48
|
-
google = [
|
|
49
|
-
ollama = [
|
|
50
|
-
hf = ["
|
|
51
|
-
#
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
"
|
|
78
|
-
"
|
|
79
|
-
"
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
"
|
|
83
|
-
"
|
|
84
|
-
"
|
|
85
|
-
"
|
|
86
|
-
"
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
"
|
|
90
|
-
"
|
|
91
|
-
"
|
|
92
|
-
"
|
|
93
|
-
"
|
|
94
|
-
"
|
|
95
|
-
"
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
]
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
"
|
|
105
|
-
"
|
|
106
|
-
"
|
|
107
|
-
"
|
|
108
|
-
]
|
|
109
|
-
|
|
110
|
-
[tool.
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
[
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
]
|
|
120
|
-
|
|
121
|
-
[tool.
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
[tool.mypy]
|
|
133
|
-
python_version = "3.9"
|
|
134
|
-
ignore_missing_imports = true
|
|
135
|
-
warn_unused_ignores = false
|
|
136
|
-
no_implicit_optional = false
|
|
137
|
-
check_untyped_defs = false
|
|
138
|
-
|
|
139
|
-
[tool.pytest.ini_options]
|
|
140
|
-
markers = [
|
|
141
|
-
"e2e: End-to-end tests for the raglib facade and pipelines",
|
|
142
|
-
]
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling>=1.25.0"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "raglib-py"
|
|
7
|
+
version = "2.2.1"
|
|
8
|
+
description = "Modular Retrieval-Augmented Generation: hybrid search, reranking, CRAG, Self-RAG, agentic and GraphRAG pipelines"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = { file = "LICENSE" }
|
|
11
|
+
authors = [
|
|
12
|
+
{ name = "raglib maintainers" }
|
|
13
|
+
]
|
|
14
|
+
requires-python = ">=3.9"
|
|
15
|
+
# The core is pure Python (BM25, in-memory vectors, all pipelines). Everything else is an extra.
|
|
16
|
+
dependencies = []
|
|
17
|
+
keywords = ["rag", "llm", "retrieval", "ai", "nlp", "vector-search", "graphrag", "hybrid-search"]
|
|
18
|
+
classifiers = [
|
|
19
|
+
"Development Status :: 4 - Beta",
|
|
20
|
+
"Intended Audience :: Developers",
|
|
21
|
+
"License :: OSI Approved :: MIT License",
|
|
22
|
+
"Programming Language :: Python :: 3",
|
|
23
|
+
"Programming Language :: Python :: 3.9",
|
|
24
|
+
"Programming Language :: Python :: 3.10",
|
|
25
|
+
"Programming Language :: Python :: 3.11",
|
|
26
|
+
"Programming Language :: Python :: 3.12",
|
|
27
|
+
"Programming Language :: Python :: 3.13",
|
|
28
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
[project.scripts]
|
|
32
|
+
raglib = "raglib.cli:main"
|
|
33
|
+
|
|
34
|
+
[project.urls]
|
|
35
|
+
Homepage = "https://github.com/himanshuhs9011/raglib"
|
|
36
|
+
Documentation = "https://github.com/himanshuhs9011/raglib/blob/main/docs/USAGE.md"
|
|
37
|
+
Repository = "https://github.com/himanshuhs9011/raglib"
|
|
38
|
+
"Bug Tracker" = "https://github.com/himanshuhs9011/raglib/issues"
|
|
39
|
+
|
|
40
|
+
[project.optional-dependencies]
|
|
41
|
+
# chat / embedding providers
|
|
42
|
+
# Every hosted provider is reached with raglib's own HTTP clients (standard library only), so
|
|
43
|
+
# these extras are empty. They are kept so existing `pip install raglib-py[openai]` lines still work.
|
|
44
|
+
openai = []
|
|
45
|
+
openrouter = []
|
|
46
|
+
anthropic = []
|
|
47
|
+
groq = []
|
|
48
|
+
google = []
|
|
49
|
+
ollama = []
|
|
50
|
+
hf = ["sentence-transformers>=2.6.0"]
|
|
51
|
+
# wrap your own LangChain chat model: RAG(chat_llm=ChatOpenAI(...))
|
|
52
|
+
langchain = ["langchain-core>=0.2.0"]
|
|
53
|
+
# retrieval quality
|
|
54
|
+
rerank = ["sentence-transformers>=2.6.0"]
|
|
55
|
+
cohere = ["cohere>=5.0.0"]
|
|
56
|
+
fast = ["numpy>=1.24", "tiktoken>=0.5.0"]
|
|
57
|
+
# storage
|
|
58
|
+
chroma = ["chromadb>=0.5.0"]
|
|
59
|
+
qdrant = ["qdrant-client>=1.10.0"]
|
|
60
|
+
pgvector = ["psycopg[binary]>=3.1"]
|
|
61
|
+
graph = ["networkx>=3.0"]
|
|
62
|
+
leiden = ["networkx>=3.0", "graspologic>=3.3"]
|
|
63
|
+
neo4j = ["neo4j>=5.0", "networkx>=3.0"]
|
|
64
|
+
# loaders
|
|
65
|
+
pdf = ["PyMuPDF>=1.23.0"]
|
|
66
|
+
docx = ["python-docx>=1.0.0"]
|
|
67
|
+
pptx = ["python-pptx>=0.6.21"]
|
|
68
|
+
xlsx = ["openpyxl>=3.1"]
|
|
69
|
+
ocr = ["pytesseract>=0.3.10", "Pillow>=10.0.0"]
|
|
70
|
+
# web search
|
|
71
|
+
web = ["ddgs>=6.0.0"]
|
|
72
|
+
tavily = ["tavily-python>=0.2.0"]
|
|
73
|
+
serpapi = ["google-search-results>=2.4.0"]
|
|
74
|
+
# bundles
|
|
75
|
+
all-llm = []
|
|
76
|
+
all = [
|
|
77
|
+
"sentence-transformers>=2.6.0",
|
|
78
|
+
"numpy>=1.24",
|
|
79
|
+
"tiktoken>=0.5.0",
|
|
80
|
+
"chromadb>=0.5.0",
|
|
81
|
+
"networkx>=3.0",
|
|
82
|
+
"PyMuPDF>=1.23.0",
|
|
83
|
+
"python-docx>=1.0.0",
|
|
84
|
+
"python-pptx>=0.6.21",
|
|
85
|
+
"openpyxl>=3.1",
|
|
86
|
+
"ddgs>=6.0.0",
|
|
87
|
+
]
|
|
88
|
+
dev = [
|
|
89
|
+
"pytest>=7.4.0",
|
|
90
|
+
"pytest-cov>=4.1.0",
|
|
91
|
+
"ruff>=0.5.0",
|
|
92
|
+
"build>=1.0.0",
|
|
93
|
+
"twine>=4.0.0",
|
|
94
|
+
"networkx>=3.0",
|
|
95
|
+
"mypy>=1.8",
|
|
96
|
+
]
|
|
97
|
+
|
|
98
|
+
[tool.hatch.build.targets.wheel]
|
|
99
|
+
packages = ["raglib"]
|
|
100
|
+
|
|
101
|
+
[tool.hatch.build.targets.sdist]
|
|
102
|
+
# Leading "/" anchors to the project root; a bare "README.md" also matched files in site/node_modules.
|
|
103
|
+
include = [
|
|
104
|
+
"/raglib/**/*.py",
|
|
105
|
+
"/README.md",
|
|
106
|
+
"/LICENSE",
|
|
107
|
+
"/pyproject.toml",
|
|
108
|
+
]
|
|
109
|
+
|
|
110
|
+
[tool.ruff]
|
|
111
|
+
target-version = "py39"
|
|
112
|
+
line-length = 130
|
|
113
|
+
extend-exclude = ["site", "dist"]
|
|
114
|
+
|
|
115
|
+
[tool.ruff.lint]
|
|
116
|
+
# pyflakes, pycodestyle errors, import sorting, bugbear-lite. Pyupgrade (UP) rules are off:
|
|
117
|
+
# typing.List/Optional are kept deliberately for Python 3.9 support.
|
|
118
|
+
select = ["E", "F", "I", "B006", "B008", "B904"]
|
|
119
|
+
ignore = ["E501", "E731", "E741", "E402"]
|
|
120
|
+
|
|
121
|
+
[tool.mypy]
|
|
122
|
+
python_version = "3.9"
|
|
123
|
+
ignore_missing_imports = true
|
|
124
|
+
warn_unused_ignores = false
|
|
125
|
+
no_implicit_optional = false
|
|
126
|
+
check_untyped_defs = false
|
|
127
|
+
|
|
128
|
+
[tool.pytest.ini_options]
|
|
129
|
+
markers = [
|
|
130
|
+
"e2e: End-to-end tests for the raglib facade and pipelines",
|
|
131
|
+
]
|