AutoRAG 0.3.16__tar.gz → 0.3.17__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.
- {autorag-0.3.16 → autorag-0.3.17}/AutoRAG.egg-info/PKG-INFO +3 -1
- {autorag-0.3.16 → autorag-0.3.17}/AutoRAG.egg-info/SOURCES.txt +13 -5
- {autorag-0.3.16 → autorag-0.3.17}/AutoRAG.egg-info/requires.txt +2 -0
- {autorag-0.3.16 → autorag-0.3.17}/PKG-INFO +3 -1
- autorag-0.3.17/autorag/VERSION +1 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/data/legacy/qacreation/base.py +2 -2
- {autorag-0.3.16 → autorag-0.3.17}/autorag/deploy/api.py +12 -2
- {autorag-0.3.16 → autorag-0.3.17}/autorag/evaluator.py +65 -66
- {autorag-0.3.16 → autorag-0.3.17}/autorag/node_line.py +0 -8
- {autorag-0.3.16/autorag/nodes/retrieval → autorag-0.3.17/autorag/nodes/hybridretrieval}/__init__.py +0 -2
- autorag-0.3.17/autorag/nodes/hybridretrieval/base.py +58 -0
- {autorag-0.3.16/autorag/nodes/retrieval → autorag-0.3.17/autorag/nodes/hybridretrieval}/hybrid_cc.py +46 -33
- {autorag-0.3.16/autorag/nodes/retrieval → autorag-0.3.17/autorag/nodes/hybridretrieval}/hybrid_rrf.py +53 -32
- autorag-0.3.17/autorag/nodes/hybridretrieval/run.py +137 -0
- autorag-0.3.17/autorag/nodes/lexicalretrieval/__init__.py +1 -0
- {autorag-0.3.16/autorag/nodes/retrieval → autorag-0.3.17/autorag/nodes/lexicalretrieval}/bm25.py +7 -1
- autorag-0.3.17/autorag/nodes/lexicalretrieval/run.py +148 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/nodes/passageaugmenter/base.py +2 -6
- {autorag-0.3.16 → autorag-0.3.17}/autorag/nodes/passageaugmenter/run.py +1 -1
- {autorag-0.3.16 → autorag-0.3.17}/autorag/nodes/passagecompressor/base.py +6 -11
- {autorag-0.3.16 → autorag-0.3.17}/autorag/nodes/passagefilter/base.py +8 -18
- {autorag-0.3.16 → autorag-0.3.17}/autorag/nodes/passagefilter/run.py +1 -1
- {autorag-0.3.16 → autorag-0.3.17}/autorag/nodes/passagereranker/base.py +8 -19
- {autorag-0.3.16 → autorag-0.3.17}/autorag/nodes/passagereranker/run.py +1 -1
- {autorag-0.3.16 → autorag-0.3.17}/autorag/nodes/promptmaker/base.py +3 -5
- {autorag-0.3.16 → autorag-0.3.17}/autorag/nodes/queryexpansion/run.py +35 -3
- autorag-0.3.17/autorag/nodes/retrieval/__init__.py +0 -0
- autorag-0.3.17/autorag/nodes/retrieval/run_util.py +152 -0
- autorag-0.3.17/autorag/nodes/semanticretrieval/__init__.py +1 -0
- autorag-0.3.17/autorag/nodes/semanticretrieval/run.py +148 -0
- {autorag-0.3.16/autorag/nodes/retrieval → autorag-0.3.17/autorag/nodes/semanticretrieval}/vectordb.py +38 -2
- {autorag-0.3.16 → autorag-0.3.17}/autorag/schema/node.py +2 -1
- {autorag-0.3.16 → autorag-0.3.17}/autorag/support.py +28 -9
- autorag-0.3.17/autorag/utils/cast.py +45 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/vectordb/base.py +7 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/vectordb/chroma.py +3 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/vectordb/couchbase.py +21 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/vectordb/milvus.py +3 -2
- {autorag-0.3.16 → autorag-0.3.17}/autorag/vectordb/pinecone.py +3 -1
- {autorag-0.3.16 → autorag-0.3.17}/autorag/vectordb/qdrant.py +3 -1
- {autorag-0.3.16 → autorag-0.3.17}/autorag/vectordb/weaviate.py +17 -0
- {autorag-0.3.16 → autorag-0.3.17}/pyproject.toml +2 -0
- {autorag-0.3.16 → autorag-0.3.17}/sample_config/rag/english/gpu/compact_local.yaml +12 -2
- {autorag-0.3.16 → autorag-0.3.17}/sample_config/rag/english/gpu/compact_openai.yaml +15 -1
- {autorag-0.3.16 → autorag-0.3.17}/sample_config/rag/english/gpu/full.yaml +15 -1
- {autorag-0.3.16 → autorag-0.3.17}/sample_config/rag/english/gpu/half.yaml +15 -1
- {autorag-0.3.16 → autorag-0.3.17}/sample_config/rag/english/gpu_api/compact.yaml +16 -2
- {autorag-0.3.16 → autorag-0.3.17}/sample_config/rag/english/gpu_api/full.yaml +15 -1
- {autorag-0.3.16 → autorag-0.3.17}/sample_config/rag/english/gpu_api/half.yaml +15 -1
- autorag-0.3.16/sample_config/rag/english/non_gpu/half.yaml → autorag-0.3.17/sample_config/rag/english/non_gpu/compact.yaml +15 -13
- {autorag-0.3.16 → autorag-0.3.17}/sample_config/rag/english/non_gpu/full.yaml +16 -3
- autorag-0.3.17/sample_config/rag/english/non_gpu/half.yaml +109 -0
- {autorag-0.3.16 → autorag-0.3.17}/sample_config/rag/english/non_gpu/simple_bedrock.yaml +1 -1
- {autorag-0.3.16 → autorag-0.3.17}/sample_config/rag/english/non_gpu/simple_local.yaml +1 -1
- {autorag-0.3.16 → autorag-0.3.17}/sample_config/rag/english/non_gpu/simple_ollama.yaml +1 -1
- {autorag-0.3.16 → autorag-0.3.17}/sample_config/rag/english/non_gpu/simple_openai.yaml +1 -1
- {autorag-0.3.16 → autorag-0.3.17}/sample_config/rag/extracted_sample.yaml +1 -1
- {autorag-0.3.16 → autorag-0.3.17}/sample_config/rag/full.yaml +16 -2
- {autorag-0.3.16 → autorag-0.3.17}/sample_config/rag/korean/gpu/compact_korean.yaml +15 -1
- {autorag-0.3.16 → autorag-0.3.17}/sample_config/rag/korean/gpu/full_korean.yaml +15 -1
- {autorag-0.3.16 → autorag-0.3.17}/sample_config/rag/korean/gpu/half_korean.yaml +15 -1
- {autorag-0.3.16 → autorag-0.3.17}/sample_config/rag/korean/gpu_api/compact_korean.yaml +15 -1
- {autorag-0.3.16 → autorag-0.3.17}/sample_config/rag/korean/gpu_api/full_korean.yaml +15 -1
- {autorag-0.3.16 → autorag-0.3.17}/sample_config/rag/korean/gpu_api/half_korean.yaml +15 -1
- {autorag-0.3.16 → autorag-0.3.17}/sample_config/rag/korean/non_gpu/compact_korean.yaml +15 -1
- {autorag-0.3.16 → autorag-0.3.17}/sample_config/rag/korean/non_gpu/full_korean.yaml +15 -1
- {autorag-0.3.16 → autorag-0.3.17}/sample_config/rag/korean/non_gpu/half_korean.yaml +15 -1
- {autorag-0.3.16 → autorag-0.3.17}/sample_config/rag/korean/non_gpu/simple_korean.yaml +1 -1
- autorag-0.3.16/autorag/VERSION +0 -1
- autorag-0.3.16/autorag/nodes/retrieval/run.py +0 -544
- autorag-0.3.16/sample_config/rag/english/non_gpu/compact.yaml +0 -83
- {autorag-0.3.16 → autorag-0.3.17}/.dockerignore +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/.gitignore +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/AutoRAG.egg-info/dependency_links.txt +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/AutoRAG.egg-info/entry_points.txt +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/AutoRAG.egg-info/top_level.txt +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/Dockerfile.base +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/Dockerfile.gpu +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/__init__.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/chunker.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/cli.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/dashboard.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/data/__init__.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/data/chunk/__init__.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/data/chunk/base.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/data/chunk/langchain_chunk.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/data/chunk/llama_index_chunk.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/data/chunk/run.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/data/legacy/__init__.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/data/legacy/corpus/__init__.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/data/legacy/corpus/langchain.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/data/legacy/corpus/llama_index.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/data/legacy/qacreation/__init__.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/data/legacy/qacreation/llama_index.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/data/legacy/qacreation/llama_index_default_prompt.txt +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/data/legacy/qacreation/ragas.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/data/legacy/qacreation/simple.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/data/parse/__init__.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/data/parse/base.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/data/parse/clova.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/data/parse/langchain_parse.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/data/parse/llamaparse.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/data/parse/run.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/data/parse/table_hybrid_parse.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/data/qa/__init__.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/data/qa/evolve/__init__.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/data/qa/evolve/llama_index_query_evolve.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/data/qa/evolve/openai_query_evolve.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/data/qa/evolve/prompt.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/data/qa/extract_evidence.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/data/qa/filter/__init__.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/data/qa/filter/dontknow.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/data/qa/filter/passage_dependency.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/data/qa/filter/prompt.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/data/qa/generation_gt/__init__.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/data/qa/generation_gt/base.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/data/qa/generation_gt/llama_index_gen_gt.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/data/qa/generation_gt/openai_gen_gt.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/data/qa/generation_gt/prompt.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/data/qa/query/__init__.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/data/qa/query/llama_gen_query.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/data/qa/query/openai_gen_query.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/data/qa/query/prompt.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/data/qa/sample.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/data/qa/schema.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/data/utils/__init__.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/data/utils/util.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/deploy/__init__.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/deploy/base.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/deploy/gradio.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/deploy/swagger.yml +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/embedding/__init__.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/embedding/base.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/evaluation/__init__.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/evaluation/generation.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/evaluation/metric/__init__.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/evaluation/metric/deepeval_prompt.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/evaluation/metric/g_eval_prompts/coh_detailed.txt +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/evaluation/metric/g_eval_prompts/con_detailed.txt +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/evaluation/metric/g_eval_prompts/flu_detailed.txt +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/evaluation/metric/g_eval_prompts/rel_detailed.txt +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/evaluation/metric/generation.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/evaluation/metric/retrieval.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/evaluation/metric/retrieval_contents.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/evaluation/metric/util.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/evaluation/retrieval.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/evaluation/retrieval_contents.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/evaluation/util.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/nodes/__init__.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/nodes/generator/__init__.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/nodes/generator/base.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/nodes/generator/llama_index_llm.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/nodes/generator/openai_llm.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/nodes/generator/run.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/nodes/generator/vllm.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/nodes/generator/vllm_api.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/nodes/passageaugmenter/__init__.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/nodes/passageaugmenter/pass_passage_augmenter.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/nodes/passageaugmenter/prev_next_augmenter.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/nodes/passagecompressor/__init__.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/nodes/passagecompressor/longllmlingua.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/nodes/passagecompressor/pass_compressor.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/nodes/passagecompressor/refine.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/nodes/passagecompressor/run.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/nodes/passagecompressor/tree_summarize.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/nodes/passagefilter/__init__.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/nodes/passagefilter/pass_passage_filter.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/nodes/passagefilter/percentile_cutoff.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/nodes/passagefilter/recency.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/nodes/passagefilter/similarity_percentile_cutoff.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/nodes/passagefilter/similarity_threshold_cutoff.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/nodes/passagefilter/threshold_cutoff.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/nodes/passagereranker/__init__.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/nodes/passagereranker/cohere.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/nodes/passagereranker/colbert.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/nodes/passagereranker/flag_embedding.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/nodes/passagereranker/flag_embedding_llm.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/nodes/passagereranker/flashrank.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/nodes/passagereranker/jina.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/nodes/passagereranker/koreranker.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/nodes/passagereranker/mixedbreadai.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/nodes/passagereranker/monot5.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/nodes/passagereranker/openvino.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/nodes/passagereranker/pass_reranker.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/nodes/passagereranker/rankgpt.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/nodes/passagereranker/sentence_transformer.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/nodes/passagereranker/tart/__init__.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/nodes/passagereranker/tart/modeling_enc_t5.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/nodes/passagereranker/tart/tart.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/nodes/passagereranker/tart/tokenization_enc_t5.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/nodes/passagereranker/time_reranker.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/nodes/passagereranker/upr.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/nodes/passagereranker/voyageai.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/nodes/promptmaker/__init__.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/nodes/promptmaker/fstring.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/nodes/promptmaker/long_context_reorder.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/nodes/promptmaker/run.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/nodes/promptmaker/window_replacement.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/nodes/queryexpansion/__init__.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/nodes/queryexpansion/base.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/nodes/queryexpansion/hyde.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/nodes/queryexpansion/multi_query_expansion.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/nodes/queryexpansion/pass_query_expansion.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/nodes/queryexpansion/query_decompose.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/nodes/retrieval/base.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/nodes/util.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/parser.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/schema/__init__.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/schema/base.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/schema/metricinput.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/schema/module.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/strategy.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/utils/__init__.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/utils/preprocess.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/utils/util.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/validator.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/vectordb/__init__.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/autorag/web.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/build_and_push.sh +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/docker-compose.yml +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/sample_config/chunk/chunk_full.yaml +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/sample_config/chunk/chunk_ko.yaml +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/sample_config/chunk/simple_chunk.yaml +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/sample_config/parse/all_files_full.yaml +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/sample_config/parse/file_types_full.yaml +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/sample_config/parse/parse_hybird.yaml +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/sample_config/parse/parse_ko.yaml +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/sample_config/parse/parse_multimodal.yaml +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/sample_config/parse/parse_ocr.yaml +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/sample_config/parse/simple_parse.yaml +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/sample_dataset/README.md +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/sample_dataset/eli5/load_eli5_dataset.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/sample_dataset/hotpotqa/load_hotpotqa_dataset.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/sample_dataset/msmarco/load_msmarco_dataset.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/sample_dataset/triviaqa/load_triviaqa_dataset.py +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/setup.cfg +0 -0
- {autorag-0.3.16 → autorag-0.3.17}/uv.lock +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: AutoRAG
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.17
|
|
4
4
|
Summary: Automatically Evaluate RAG pipelines with your own data. Find optimal structure for new RAG product.
|
|
5
5
|
Author-email: Marker-Inc <vkehfdl1@gmail.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/Marker-Inc-Korea/AutoRAG
|
|
@@ -44,6 +44,8 @@ Requires-Dist: grpcio<1.68.0,>=1.66.2
|
|
|
44
44
|
Requires-Dist: grpcio-health-checking<1.68.0,>=1.66.2
|
|
45
45
|
Requires-Dist: grpcio-status<1.68.0,>=1.66.2
|
|
46
46
|
Requires-Dist: grpcio-tools<1.68.0,>=1.66.2
|
|
47
|
+
Requires-Dist: datasets>=3.5.1
|
|
48
|
+
Requires-Dist: pyarrow>=20.0.0
|
|
47
49
|
Requires-Dist: pymilvus>=2.6.0b0
|
|
48
50
|
Requires-Dist: chromadb>=1.0.0
|
|
49
51
|
Requires-Dist: weaviate-client>=4.15.2
|
|
@@ -101,6 +101,14 @@ autorag/nodes/generator/openai_llm.py
|
|
|
101
101
|
autorag/nodes/generator/run.py
|
|
102
102
|
autorag/nodes/generator/vllm.py
|
|
103
103
|
autorag/nodes/generator/vllm_api.py
|
|
104
|
+
autorag/nodes/hybridretrieval/__init__.py
|
|
105
|
+
autorag/nodes/hybridretrieval/base.py
|
|
106
|
+
autorag/nodes/hybridretrieval/hybrid_cc.py
|
|
107
|
+
autorag/nodes/hybridretrieval/hybrid_rrf.py
|
|
108
|
+
autorag/nodes/hybridretrieval/run.py
|
|
109
|
+
autorag/nodes/lexicalretrieval/__init__.py
|
|
110
|
+
autorag/nodes/lexicalretrieval/bm25.py
|
|
111
|
+
autorag/nodes/lexicalretrieval/run.py
|
|
104
112
|
autorag/nodes/passageaugmenter/__init__.py
|
|
105
113
|
autorag/nodes/passageaugmenter/base.py
|
|
106
114
|
autorag/nodes/passageaugmenter/pass_passage_augmenter.py
|
|
@@ -160,17 +168,17 @@ autorag/nodes/queryexpansion/query_decompose.py
|
|
|
160
168
|
autorag/nodes/queryexpansion/run.py
|
|
161
169
|
autorag/nodes/retrieval/__init__.py
|
|
162
170
|
autorag/nodes/retrieval/base.py
|
|
163
|
-
autorag/nodes/retrieval/
|
|
164
|
-
autorag/nodes/
|
|
165
|
-
autorag/nodes/
|
|
166
|
-
autorag/nodes/
|
|
167
|
-
autorag/nodes/retrieval/vectordb.py
|
|
171
|
+
autorag/nodes/retrieval/run_util.py
|
|
172
|
+
autorag/nodes/semanticretrieval/__init__.py
|
|
173
|
+
autorag/nodes/semanticretrieval/run.py
|
|
174
|
+
autorag/nodes/semanticretrieval/vectordb.py
|
|
168
175
|
autorag/schema/__init__.py
|
|
169
176
|
autorag/schema/base.py
|
|
170
177
|
autorag/schema/metricinput.py
|
|
171
178
|
autorag/schema/module.py
|
|
172
179
|
autorag/schema/node.py
|
|
173
180
|
autorag/utils/__init__.py
|
|
181
|
+
autorag/utils/cast.py
|
|
174
182
|
autorag/utils/preprocess.py
|
|
175
183
|
autorag/utils/util.py
|
|
176
184
|
autorag/vectordb/__init__.py
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: AutoRAG
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.17
|
|
4
4
|
Summary: Automatically Evaluate RAG pipelines with your own data. Find optimal structure for new RAG product.
|
|
5
5
|
Author-email: Marker-Inc <vkehfdl1@gmail.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/Marker-Inc-Korea/AutoRAG
|
|
@@ -44,6 +44,8 @@ Requires-Dist: grpcio<1.68.0,>=1.66.2
|
|
|
44
44
|
Requires-Dist: grpcio-health-checking<1.68.0,>=1.66.2
|
|
45
45
|
Requires-Dist: grpcio-status<1.68.0,>=1.66.2
|
|
46
46
|
Requires-Dist: grpcio-tools<1.68.0,>=1.66.2
|
|
47
|
+
Requires-Dist: datasets>=3.5.1
|
|
48
|
+
Requires-Dist: pyarrow>=20.0.0
|
|
47
49
|
Requires-Dist: pymilvus>=2.6.0b0
|
|
48
50
|
Requires-Dist: chromadb>=1.0.0
|
|
49
51
|
Requires-Dist: weaviate-client>=4.15.2
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.3.17
|
|
@@ -8,7 +8,7 @@ import pandas as pd
|
|
|
8
8
|
from tqdm import tqdm
|
|
9
9
|
|
|
10
10
|
import autorag
|
|
11
|
-
from autorag.nodes.
|
|
11
|
+
from autorag.nodes.semanticretrieval.vectordb import vectordb_ingest_api, vectordb_pure
|
|
12
12
|
from autorag.utils.util import (
|
|
13
13
|
save_parquet_safe,
|
|
14
14
|
fetch_contents,
|
|
@@ -176,7 +176,7 @@ def make_qa_with_existing_qa(
|
|
|
176
176
|
collection = chroma_client.get_or_create_collection(collection_name)
|
|
177
177
|
|
|
178
178
|
# embed corpus_df
|
|
179
|
-
|
|
179
|
+
vectordb_ingest_api(collection, corpus_df, embeddings)
|
|
180
180
|
query_embeddings = embeddings.get_text_embedding_batch(
|
|
181
181
|
existing_query_df["query"].tolist()
|
|
182
182
|
)
|
|
@@ -248,9 +248,19 @@ class ApiRunner(BaseRunner):
|
|
|
248
248
|
self.app.run(host=host, port=port, **kwargs)
|
|
249
249
|
|
|
250
250
|
def extract_retrieve_passage(self, df: pd.DataFrame) -> List[RetrievedPassage]:
|
|
251
|
-
retrieved_ids
|
|
251
|
+
if "retrieved_ids" not in df.columns and "retrieved_ids_semantic" in df.columns:
|
|
252
|
+
retrieved_ids: List[str] = df["retrieved_ids_semantic"].tolist()[0]
|
|
253
|
+
scores = df["retrieve_scores_semantic"].tolist()[0]
|
|
254
|
+
elif (
|
|
255
|
+
"retrieved_ids" not in df.columns
|
|
256
|
+
and "retrieved_ids_semantic" not in df.columns
|
|
257
|
+
):
|
|
258
|
+
retrieved_ids: List[str] = df["retrieved_ids_lexical"].tolist()[0]
|
|
259
|
+
scores = df["retrieve_scores_lexical"].tolist()[0]
|
|
260
|
+
else:
|
|
261
|
+
retrieved_ids: List[str] = df["retrieved_ids"].tolist()[0]
|
|
262
|
+
scores = df["retrieve_scores"].tolist()[0]
|
|
252
263
|
contents = fetch_contents(self.corpus_df, [retrieved_ids])[0]
|
|
253
|
-
scores = df["retrieve_scores"].tolist()[0]
|
|
254
264
|
if "path" in self.corpus_df.columns:
|
|
255
265
|
paths = fetch_contents(self.corpus_df, [retrieved_ids], column_name="path")[
|
|
256
266
|
0
|
|
@@ -6,18 +6,18 @@ import shutil
|
|
|
6
6
|
from datetime import datetime
|
|
7
7
|
from itertools import chain
|
|
8
8
|
from typing import List, Dict, Optional
|
|
9
|
-
from rich.progress import Progress, BarColumn, TimeElapsedColumn
|
|
10
9
|
|
|
11
10
|
import pandas as pd
|
|
12
11
|
import yaml
|
|
13
12
|
|
|
14
13
|
from autorag.node_line import run_node_line
|
|
15
14
|
from autorag.nodes.retrieval.base import get_bm25_pkl_name
|
|
16
|
-
from autorag.nodes.
|
|
17
|
-
from autorag.nodes.
|
|
18
|
-
|
|
15
|
+
from autorag.nodes.lexicalretrieval.bm25 import bm25_ingest
|
|
16
|
+
from autorag.nodes.semanticretrieval.vectordb import (
|
|
17
|
+
vectordb_ingest_api,
|
|
19
18
|
filter_exist_ids,
|
|
20
19
|
filter_exist_ids_from_retrieval_gt,
|
|
20
|
+
vectordb_ingest_huggingface,
|
|
21
21
|
)
|
|
22
22
|
from autorag.schema import Node
|
|
23
23
|
from autorag.schema.node import (
|
|
@@ -104,7 +104,10 @@ class Evaluator:
|
|
|
104
104
|
self.corpus_data.to_parquet(corpus_path_in_project, index=False)
|
|
105
105
|
|
|
106
106
|
def start_trial(
|
|
107
|
-
self,
|
|
107
|
+
self,
|
|
108
|
+
yaml_path: str,
|
|
109
|
+
skip_validation: bool = False,
|
|
110
|
+
full_ingest: bool = True,
|
|
108
111
|
):
|
|
109
112
|
"""
|
|
110
113
|
Start AutoRAG trial.
|
|
@@ -158,64 +161,62 @@ class Evaluator:
|
|
|
158
161
|
node_lines = self._load_node_lines(yaml_path)
|
|
159
162
|
self.__ingest_bm25_full(node_lines)
|
|
160
163
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
) as progress:
|
|
168
|
-
# Ingest VectorDB corpus
|
|
169
|
-
if any(
|
|
170
|
-
list(
|
|
171
|
-
map(
|
|
172
|
-
lambda nodes: module_type_exists(nodes, "vectordb"),
|
|
173
|
-
node_lines.values(),
|
|
174
|
-
)
|
|
164
|
+
# Ingest VectorDB corpus
|
|
165
|
+
if any(
|
|
166
|
+
list(
|
|
167
|
+
map(
|
|
168
|
+
lambda nodes: module_type_exists(nodes, "vectordb"),
|
|
169
|
+
node_lines.values(),
|
|
175
170
|
)
|
|
176
|
-
):
|
|
177
|
-
task_ingest = progress.add_task("[cyan]Ingesting VectorDB...", total=1)
|
|
178
|
-
|
|
179
|
-
loop = get_event_loop()
|
|
180
|
-
loop.run_until_complete(self.__ingest_vectordb(yaml_path, full_ingest))
|
|
181
|
-
|
|
182
|
-
progress.update(task_ingest, completed=1)
|
|
183
|
-
|
|
184
|
-
trial_summary_df = pd.DataFrame(
|
|
185
|
-
columns=[
|
|
186
|
-
"node_line_name",
|
|
187
|
-
"node_type",
|
|
188
|
-
"best_module_filename",
|
|
189
|
-
"best_module_name",
|
|
190
|
-
"best_module_params",
|
|
191
|
-
"best_execution_time",
|
|
192
|
-
]
|
|
193
|
-
)
|
|
194
|
-
task_eval = progress.add_task(
|
|
195
|
-
"[cyan]Evaluating...", total=sum(map(len, node_lines.values()))
|
|
196
171
|
)
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
if i == 0:
|
|
204
|
-
previous_result = self.qa_data
|
|
205
|
-
logger.info(f"Running node line {node_line_name}...")
|
|
206
|
-
previous_result = run_node_line(
|
|
207
|
-
node_line, node_line_dir, previous_result, progress, task_eval
|
|
172
|
+
):
|
|
173
|
+
vectordb_list = load_all_vectordb_from_yaml(yaml_path, self.project_dir)
|
|
174
|
+
for vectordb in vectordb_list:
|
|
175
|
+
loop = get_event_loop()
|
|
176
|
+
target_corpus = loop.run_until_complete(
|
|
177
|
+
self.__get_ingest_target_corpus(vectordb, full_ingest)
|
|
208
178
|
)
|
|
179
|
+
if vectordb.embedding.__class__.class_name() == "HuggingFaceEmbedding":
|
|
180
|
+
vectordb_ingest_huggingface(vectordb, target_corpus)
|
|
181
|
+
else:
|
|
182
|
+
# API Ingest Method
|
|
183
|
+
loop = get_event_loop()
|
|
184
|
+
loop.run_until_complete(
|
|
185
|
+
vectordb_ingest_api(vectordb, target_corpus)
|
|
186
|
+
)
|
|
209
187
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
188
|
+
trial_summary_df = pd.DataFrame(
|
|
189
|
+
columns=[
|
|
190
|
+
"node_line_name",
|
|
191
|
+
"node_type",
|
|
192
|
+
"best_module_filename",
|
|
193
|
+
"best_module_name",
|
|
194
|
+
"best_module_params",
|
|
195
|
+
"best_execution_time",
|
|
196
|
+
]
|
|
197
|
+
)
|
|
198
|
+
|
|
199
|
+
for i, (node_line_name, node_line) in enumerate(node_lines.items()):
|
|
200
|
+
node_line_dir = os.path.join(self.project_dir, trial_name, node_line_name)
|
|
201
|
+
os.makedirs(node_line_dir, exist_ok=False)
|
|
202
|
+
if i == 0:
|
|
203
|
+
previous_result = self.qa_data
|
|
204
|
+
logger.info(f"Running node line {node_line_name}...")
|
|
205
|
+
previous_result = run_node_line(
|
|
206
|
+
node_line,
|
|
207
|
+
node_line_dir,
|
|
208
|
+
previous_result,
|
|
209
|
+
)
|
|
213
210
|
|
|
214
|
-
trial_summary_df.
|
|
215
|
-
|
|
211
|
+
trial_summary_df = self._append_node_line_summary(
|
|
212
|
+
node_line_name, node_line_dir, trial_summary_df
|
|
216
213
|
)
|
|
217
214
|
|
|
218
|
-
|
|
215
|
+
trial_summary_df.to_csv(
|
|
216
|
+
os.path.join(self.project_dir, trial_name, "summary.csv"), index=False
|
|
217
|
+
)
|
|
218
|
+
|
|
219
|
+
logger.info("Evaluation complete.")
|
|
219
220
|
|
|
220
221
|
def __ingest_bm25_full(self, node_lines: Dict[str, List[Node]]):
|
|
221
222
|
if any(
|
|
@@ -544,17 +545,15 @@ class Evaluator:
|
|
|
544
545
|
)
|
|
545
546
|
return list(set(embedding_models_list))
|
|
546
547
|
|
|
547
|
-
async def
|
|
548
|
-
|
|
548
|
+
async def __get_ingest_target_corpus(
|
|
549
|
+
self, vectordb, full_ingest: bool
|
|
550
|
+
) -> pd.DataFrame:
|
|
549
551
|
if full_ingest is True:
|
|
550
552
|
# get the target ingest corpus from the whole corpus
|
|
551
|
-
|
|
552
|
-
target_corpus = await filter_exist_ids(vectordb, self.corpus_data)
|
|
553
|
-
await vectordb_ingest(vectordb, target_corpus)
|
|
553
|
+
target_corpus = await filter_exist_ids(vectordb, self.corpus_data)
|
|
554
554
|
else:
|
|
555
555
|
# get the target ingest corpus from the retrieval gt only
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
await vectordb_ingest(vectordb, target_corpus)
|
|
556
|
+
target_corpus = await filter_exist_ids_from_retrieval_gt(
|
|
557
|
+
vectordb, self.qa_data, self.corpus_data
|
|
558
|
+
)
|
|
559
|
+
return target_corpus
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import os
|
|
2
2
|
import pathlib
|
|
3
3
|
from typing import Dict, List, Optional
|
|
4
|
-
from rich.progress import Progress
|
|
5
4
|
|
|
6
5
|
import pandas as pd
|
|
7
6
|
|
|
@@ -26,8 +25,6 @@ def run_node_line(
|
|
|
26
25
|
nodes: List[Node],
|
|
27
26
|
node_line_dir: str,
|
|
28
27
|
previous_result: Optional[pd.DataFrame] = None,
|
|
29
|
-
progress: Progress = None,
|
|
30
|
-
task_eval: Progress.tasks = None,
|
|
31
28
|
):
|
|
32
29
|
"""
|
|
33
30
|
Run the whole node line by running each node.
|
|
@@ -36,8 +33,6 @@ def run_node_line(
|
|
|
36
33
|
:param node_line_dir: This node line's directory.
|
|
37
34
|
:param previous_result: A result of the previous node line.
|
|
38
35
|
If None, it loads qa data from data/qa.parquet.
|
|
39
|
-
:param progress: Rich Progress object.
|
|
40
|
-
:param task_eval: Progress task object
|
|
41
36
|
:return: The final result of the node line.
|
|
42
37
|
"""
|
|
43
38
|
if previous_result is None:
|
|
@@ -63,9 +58,6 @@ def run_node_line(
|
|
|
63
58
|
"best_execution_time": best_node_row["execution_time"].values[0],
|
|
64
59
|
}
|
|
65
60
|
)
|
|
66
|
-
# Update progress for each node
|
|
67
|
-
if progress:
|
|
68
|
-
progress.update(task_eval, advance=1)
|
|
69
61
|
|
|
70
62
|
pd.DataFrame(summary_lst).to_csv(
|
|
71
63
|
os.path.join(node_line_dir, "summary.csv"), index=False
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import abc
|
|
2
|
+
|
|
3
|
+
import pandas as pd
|
|
4
|
+
|
|
5
|
+
from autorag.nodes.retrieval.base import BaseRetrieval
|
|
6
|
+
from autorag.utils import result_to_dataframe
|
|
7
|
+
from autorag.utils.util import pop_params, fetch_contents
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class HybridRetrieval(BaseRetrieval, metaclass=abc.ABCMeta):
|
|
11
|
+
def __init__(self, project_dir: str, *args, **kwargs):
|
|
12
|
+
super().__init__(project_dir)
|
|
13
|
+
|
|
14
|
+
@result_to_dataframe(["retrieved_contents", "retrieved_ids", "retrieve_scores"])
|
|
15
|
+
def pure(self, previous_result: pd.DataFrame, *args, **kwargs):
|
|
16
|
+
previous_info = self.cast_to_run(previous_result, *args, **kwargs)
|
|
17
|
+
_pure_params = pop_params(self._pure, kwargs)
|
|
18
|
+
ids, scores = self._pure(previous_info, **_pure_params)
|
|
19
|
+
contents = fetch_contents(self.corpus_df, ids)
|
|
20
|
+
return contents, ids, scores
|
|
21
|
+
|
|
22
|
+
def cast_to_run(self, previous_result: pd.DataFrame, *args, **kwargs):
|
|
23
|
+
return hybrid_cast(previous_result)
|
|
24
|
+
|
|
25
|
+
@classmethod
|
|
26
|
+
def cast_to_run_class(cls, previous_result: pd.DataFrame):
|
|
27
|
+
return hybrid_cast(previous_result)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def hybrid_cast(
|
|
31
|
+
previous_result: pd.DataFrame,
|
|
32
|
+
):
|
|
33
|
+
assert "query" in previous_result.columns, "previous_result must have query column."
|
|
34
|
+
queries = previous_result["query"].tolist()
|
|
35
|
+
|
|
36
|
+
assert "retrieved_contents_semantic" in previous_result.columns
|
|
37
|
+
assert "retrieved_contents_lexical" in previous_result.columns
|
|
38
|
+
assert "retrieve_scores_semantic" in previous_result.columns
|
|
39
|
+
assert "retrieve_scores_lexical" in previous_result.columns
|
|
40
|
+
assert "retrieved_ids_semantic" in previous_result.columns
|
|
41
|
+
assert "retrieved_ids_lexical" in previous_result.columns
|
|
42
|
+
|
|
43
|
+
contents_semantic = previous_result["retrieved_contents_semantic"].tolist()
|
|
44
|
+
contents_lexical = previous_result["retrieved_contents_lexical"].tolist()
|
|
45
|
+
scores_semantic = previous_result["retrieve_scores_semantic"].tolist()
|
|
46
|
+
scores_lexical = previous_result["retrieve_scores_lexical"].tolist()
|
|
47
|
+
ids_semantic = previous_result["retrieved_ids_semantic"].tolist()
|
|
48
|
+
ids_lexical = previous_result["retrieved_ids_lexical"].tolist()
|
|
49
|
+
|
|
50
|
+
return {
|
|
51
|
+
"queries": queries,
|
|
52
|
+
"retrieved_contents_semantic": contents_semantic,
|
|
53
|
+
"retrieved_contents_lexical": contents_lexical,
|
|
54
|
+
"retrieve_scores_semantic": scores_semantic,
|
|
55
|
+
"retrieve_scores_lexical": scores_lexical,
|
|
56
|
+
"retrieved_ids_semantic": ids_semantic,
|
|
57
|
+
"retrieved_ids_lexical": ids_lexical,
|
|
58
|
+
}
|
{autorag-0.3.16/autorag/nodes/retrieval → autorag-0.3.17/autorag/nodes/hybridretrieval}/hybrid_cc.py
RENAMED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import os
|
|
2
1
|
from pathlib import Path
|
|
3
2
|
from typing import Tuple, List, Union
|
|
4
3
|
|
|
5
4
|
import numpy as np
|
|
6
5
|
import pandas as pd
|
|
7
6
|
|
|
8
|
-
from autorag.nodes.
|
|
9
|
-
from autorag.
|
|
7
|
+
from autorag.nodes.hybridretrieval.base import HybridRetrieval
|
|
8
|
+
from autorag.nodes.hybridretrieval.run import evaluate_retrieval_node
|
|
9
|
+
from autorag.strategy import select_best
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
def normalize_mm(scores: List[str], fixed_min_value: float = 0):
|
|
@@ -53,8 +53,7 @@ normalize_method_dict = {
|
|
|
53
53
|
class HybridCC(HybridRetrieval):
|
|
54
54
|
def _pure(
|
|
55
55
|
self,
|
|
56
|
-
|
|
57
|
-
scores: Tuple,
|
|
56
|
+
info: dict,
|
|
58
57
|
top_k: int,
|
|
59
58
|
weight: float,
|
|
60
59
|
normalize_method: str = "mm",
|
|
@@ -62,8 +61,8 @@ class HybridCC(HybridRetrieval):
|
|
|
62
61
|
lexical_theoretical_min_value: float = 0.0,
|
|
63
62
|
):
|
|
64
63
|
return hybrid_cc(
|
|
65
|
-
|
|
66
|
-
|
|
64
|
+
(info["retrieved_ids_semantic"], info["retrieved_ids_lexical"]),
|
|
65
|
+
(info["retrieve_scores_semantic"], info["retrieve_scores_lexical"]),
|
|
67
66
|
top_k,
|
|
68
67
|
weight,
|
|
69
68
|
normalize_method,
|
|
@@ -79,34 +78,48 @@ class HybridCC(HybridRetrieval):
|
|
|
79
78
|
*args,
|
|
80
79
|
**kwargs,
|
|
81
80
|
):
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
81
|
+
assert "strategy" in kwargs, "You must specify the strategy to use."
|
|
82
|
+
assert (
|
|
83
|
+
"input_metrics" in kwargs
|
|
84
|
+
), "You must specify the input metrics to use, which is list of MetricInput."
|
|
85
|
+
strategies = kwargs.pop("strategy")
|
|
86
|
+
input_metrics = kwargs.pop("input_metrics")
|
|
87
|
+
weight_range = kwargs.pop("weight_range", (0.0, 1.0))
|
|
88
|
+
test_weight_size = kwargs.pop("test_weight_size", 101)
|
|
89
|
+
weight_candidates = np.linspace(
|
|
90
|
+
weight_range[0], weight_range[1], test_weight_size
|
|
91
|
+
).tolist()
|
|
92
|
+
|
|
93
|
+
result_list = []
|
|
94
|
+
instance = cls(project_dir, *args, **kwargs)
|
|
95
|
+
for weight_value in weight_candidates:
|
|
96
|
+
result_df = instance.pure(previous_result, weight=weight_value, **kwargs)
|
|
97
|
+
result_list.append(result_df)
|
|
98
|
+
|
|
99
|
+
if strategies.get("metrics") is None:
|
|
100
|
+
raise ValueError("You must at least one metrics for retrieval evaluation.")
|
|
101
|
+
result_list = list(
|
|
102
|
+
map(
|
|
103
|
+
lambda x: evaluate_retrieval_node(
|
|
104
|
+
x,
|
|
105
|
+
input_metrics,
|
|
106
|
+
strategies.get("metrics"),
|
|
107
|
+
),
|
|
108
|
+
result_list,
|
|
86
109
|
)
|
|
110
|
+
)
|
|
87
111
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
),
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
return contents, ids, scores
|
|
100
|
-
|
|
101
|
-
return __cc(**params)
|
|
102
|
-
else:
|
|
103
|
-
assert (
|
|
104
|
-
"target_modules" in kwargs and "target_module_params" in kwargs
|
|
105
|
-
), "target_modules and target_module_params must be specified if there is not ids and scores."
|
|
106
|
-
instance = cls(project_dir, *args, **kwargs)
|
|
107
|
-
result = instance.pure(previous_result, *args, **kwargs)
|
|
108
|
-
del instance
|
|
109
|
-
return result
|
|
112
|
+
# select best result
|
|
113
|
+
best_result_df, best_weight = select_best(
|
|
114
|
+
result_list,
|
|
115
|
+
strategies.get("metrics"),
|
|
116
|
+
metadatas=weight_candidates,
|
|
117
|
+
strategy_name=strategies.get("strategy", "normalize_mean"),
|
|
118
|
+
)
|
|
119
|
+
return {
|
|
120
|
+
"best_result": best_result_df,
|
|
121
|
+
"best_weight": best_weight,
|
|
122
|
+
}
|
|
110
123
|
|
|
111
124
|
|
|
112
125
|
def hybrid_cc(
|
|
@@ -1,16 +1,23 @@
|
|
|
1
|
-
import os
|
|
2
1
|
from pathlib import Path
|
|
3
2
|
from typing import List, Tuple, Union
|
|
4
3
|
|
|
4
|
+
import numpy as np
|
|
5
5
|
import pandas as pd
|
|
6
6
|
|
|
7
|
-
from autorag.nodes.
|
|
8
|
-
from autorag.
|
|
7
|
+
from autorag.nodes.hybridretrieval.base import HybridRetrieval
|
|
8
|
+
from autorag.nodes.hybridretrieval.run import evaluate_retrieval_node
|
|
9
|
+
from autorag.strategy import select_best
|
|
9
10
|
|
|
10
11
|
|
|
11
12
|
class HybridRRF(HybridRetrieval):
|
|
12
|
-
def _pure(self,
|
|
13
|
-
return hybrid_rrf(
|
|
13
|
+
def _pure(self, info: dict, top_k: int, weight: int = 60, rrf_k: int = -1):
|
|
14
|
+
return hybrid_rrf(
|
|
15
|
+
(info["retrieved_ids_semantic"], info["retrieved_ids_lexical"]),
|
|
16
|
+
(info["retrieve_scores_semantic"], info["retrieve_scores_lexical"]),
|
|
17
|
+
top_k,
|
|
18
|
+
weight,
|
|
19
|
+
rrf_k,
|
|
20
|
+
)
|
|
14
21
|
|
|
15
22
|
@classmethod
|
|
16
23
|
def run_evaluator(
|
|
@@ -20,34 +27,48 @@ class HybridRRF(HybridRetrieval):
|
|
|
20
27
|
*args,
|
|
21
28
|
**kwargs,
|
|
22
29
|
):
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
30
|
+
assert "strategy" in kwargs, "You must specify the strategy to use."
|
|
31
|
+
assert (
|
|
32
|
+
"input_metrics" in kwargs
|
|
33
|
+
), "You must specify the input metrics to use, which is list of MetricInput."
|
|
34
|
+
strategies = kwargs.pop("strategy")
|
|
35
|
+
input_metrics = kwargs.pop("input_metrics")
|
|
36
|
+
weight_range = kwargs.pop("weight_range", (4, 80))
|
|
37
|
+
test_weight_size = weight_range[1] - weight_range[0] + 1
|
|
38
|
+
weight_candidates = np.linspace(
|
|
39
|
+
weight_range[0], weight_range[1], test_weight_size
|
|
40
|
+
).tolist()
|
|
41
|
+
|
|
42
|
+
result_list = []
|
|
43
|
+
instance = cls(project_dir, *args, **kwargs)
|
|
44
|
+
for weight_value in weight_candidates:
|
|
45
|
+
result_df = instance.pure(previous_result, weight=weight_value, **kwargs)
|
|
46
|
+
result_list.append(result_df)
|
|
47
|
+
|
|
48
|
+
if strategies.get("metrics") is None:
|
|
49
|
+
raise ValueError("You must at least one metrics for retrieval evaluation.")
|
|
50
|
+
result_list = list(
|
|
51
|
+
map(
|
|
52
|
+
lambda x: evaluate_retrieval_node(
|
|
53
|
+
x,
|
|
54
|
+
input_metrics,
|
|
55
|
+
strategies.get("metrics"),
|
|
56
|
+
),
|
|
57
|
+
result_list,
|
|
27
58
|
)
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
return __rrf(**params)
|
|
43
|
-
else:
|
|
44
|
-
assert (
|
|
45
|
-
"target_modules" in kwargs and "target_module_params" in kwargs
|
|
46
|
-
), "target_modules and target_module_params must be specified if there is not ids and scores."
|
|
47
|
-
instance = cls(project_dir, *args, **kwargs)
|
|
48
|
-
result = instance.pure(previous_result, *args, **kwargs)
|
|
49
|
-
del instance
|
|
50
|
-
return result
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
# select best result
|
|
62
|
+
best_result_df, best_weight = select_best(
|
|
63
|
+
result_list,
|
|
64
|
+
strategies.get("metrics"),
|
|
65
|
+
metadatas=weight_candidates,
|
|
66
|
+
strategy_name=strategies.get("strategy", "normalize_mean"),
|
|
67
|
+
)
|
|
68
|
+
return {
|
|
69
|
+
"best_result": best_result_df,
|
|
70
|
+
"best_weight": best_weight,
|
|
71
|
+
}
|
|
51
72
|
|
|
52
73
|
|
|
53
74
|
def hybrid_rrf(
|