AutoRAG 0.3.18__tar.gz → 0.3.19__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.18 → autorag-0.3.19}/AutoRAG.egg-info/PKG-INFO +1 -1
- {autorag-0.3.18 → autorag-0.3.19}/PKG-INFO +1 -1
- autorag-0.3.19/autorag/VERSION +1 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/generator/llama_index_llm.py +85 -13
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/generator/openai_llm.py +111 -78
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/generator/run.py +5 -1
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/generator/vllm.py +2 -1
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/generator/vllm_api.py +23 -8
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/promptmaker/run.py +6 -3
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/semanticretrieval/vectordb.py +1 -1
- {autorag-0.3.18 → autorag-0.3.19}/pyproject.toml +4 -4
- {autorag-0.3.18 → autorag-0.3.19}/uv.lock +29 -29
- autorag-0.3.18/autorag/VERSION +0 -1
- {autorag-0.3.18 → autorag-0.3.19}/.dockerignore +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/.gitignore +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/AutoRAG.egg-info/SOURCES.txt +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/AutoRAG.egg-info/dependency_links.txt +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/AutoRAG.egg-info/entry_points.txt +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/AutoRAG.egg-info/requires.txt +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/AutoRAG.egg-info/top_level.txt +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/Dockerfile.base +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/Dockerfile.gpu +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/__init__.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/chunker.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/cli.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/dashboard.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/data/__init__.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/data/chunk/__init__.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/data/chunk/base.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/data/chunk/langchain_chunk.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/data/chunk/llama_index_chunk.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/data/chunk/run.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/data/legacy/__init__.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/data/legacy/corpus/__init__.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/data/legacy/corpus/langchain.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/data/legacy/corpus/llama_index.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/data/legacy/qacreation/__init__.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/data/legacy/qacreation/base.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/data/legacy/qacreation/llama_index.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/data/legacy/qacreation/llama_index_default_prompt.txt +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/data/legacy/qacreation/ragas.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/data/legacy/qacreation/simple.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/data/parse/__init__.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/data/parse/base.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/data/parse/clova.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/data/parse/langchain_parse.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/data/parse/llamaparse.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/data/parse/run.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/data/parse/table_hybrid_parse.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/data/qa/__init__.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/data/qa/evolve/__init__.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/data/qa/evolve/llama_index_query_evolve.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/data/qa/evolve/openai_query_evolve.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/data/qa/evolve/prompt.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/data/qa/extract_evidence.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/data/qa/filter/__init__.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/data/qa/filter/dontknow.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/data/qa/filter/passage_dependency.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/data/qa/filter/prompt.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/data/qa/generation_gt/__init__.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/data/qa/generation_gt/base.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/data/qa/generation_gt/llama_index_gen_gt.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/data/qa/generation_gt/openai_gen_gt.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/data/qa/generation_gt/prompt.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/data/qa/query/__init__.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/data/qa/query/llama_gen_query.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/data/qa/query/openai_gen_query.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/data/qa/query/prompt.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/data/qa/sample.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/data/qa/schema.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/data/utils/__init__.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/data/utils/util.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/deploy/__init__.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/deploy/api.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/deploy/base.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/deploy/gradio.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/deploy/swagger.yml +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/embedding/__init__.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/embedding/base.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/evaluation/__init__.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/evaluation/generation.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/evaluation/metric/__init__.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/evaluation/metric/deepeval_prompt.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/evaluation/metric/g_eval_prompts/coh_detailed.txt +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/evaluation/metric/g_eval_prompts/con_detailed.txt +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/evaluation/metric/g_eval_prompts/flu_detailed.txt +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/evaluation/metric/g_eval_prompts/rel_detailed.txt +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/evaluation/metric/generation.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/evaluation/metric/retrieval.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/evaluation/metric/retrieval_contents.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/evaluation/metric/util.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/evaluation/retrieval.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/evaluation/retrieval_contents.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/evaluation/util.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/evaluator.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/node_line.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/__init__.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/generator/__init__.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/generator/base.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/hybridretrieval/__init__.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/hybridretrieval/base.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/hybridretrieval/hybrid_cc.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/hybridretrieval/hybrid_rrf.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/hybridretrieval/run.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/lexicalretrieval/__init__.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/lexicalretrieval/bm25.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/lexicalretrieval/run.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/passageaugmenter/__init__.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/passageaugmenter/base.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/passageaugmenter/pass_passage_augmenter.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/passageaugmenter/prev_next_augmenter.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/passageaugmenter/run.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/passagecompressor/__init__.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/passagecompressor/base.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/passagecompressor/longllmlingua.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/passagecompressor/pass_compressor.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/passagecompressor/refine.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/passagecompressor/run.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/passagecompressor/tree_summarize.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/passagefilter/__init__.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/passagefilter/base.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/passagefilter/pass_passage_filter.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/passagefilter/percentile_cutoff.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/passagefilter/recency.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/passagefilter/run.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/passagefilter/similarity_percentile_cutoff.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/passagefilter/similarity_threshold_cutoff.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/passagefilter/threshold_cutoff.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/passagereranker/__init__.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/passagereranker/base.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/passagereranker/cohere.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/passagereranker/colbert.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/passagereranker/flag_embedding.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/passagereranker/flag_embedding_llm.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/passagereranker/flashrank.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/passagereranker/jina.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/passagereranker/koreranker.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/passagereranker/mixedbreadai.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/passagereranker/monot5.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/passagereranker/openvino.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/passagereranker/pass_reranker.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/passagereranker/rankgpt.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/passagereranker/run.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/passagereranker/sentence_transformer.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/passagereranker/tart/__init__.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/passagereranker/tart/modeling_enc_t5.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/passagereranker/tart/tart.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/passagereranker/tart/tokenization_enc_t5.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/passagereranker/time_reranker.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/passagereranker/upr.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/passagereranker/voyageai.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/promptmaker/__init__.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/promptmaker/base.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/promptmaker/chat_fstring.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/promptmaker/fstring.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/promptmaker/long_context_reorder.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/promptmaker/window_replacement.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/queryexpansion/__init__.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/queryexpansion/base.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/queryexpansion/hyde.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/queryexpansion/multi_query_expansion.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/queryexpansion/pass_query_expansion.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/queryexpansion/query_decompose.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/queryexpansion/run.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/retrieval/__init__.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/retrieval/base.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/retrieval/run_util.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/semanticretrieval/__init__.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/semanticretrieval/run.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/nodes/util.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/parser.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/schema/__init__.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/schema/base.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/schema/metricinput.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/schema/module.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/schema/node.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/strategy.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/support.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/utils/__init__.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/utils/cast.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/utils/preprocess.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/utils/util.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/validator.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/vectordb/__init__.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/vectordb/base.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/vectordb/chroma.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/vectordb/couchbase.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/vectordb/milvus.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/vectordb/pinecone.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/vectordb/qdrant.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/vectordb/weaviate.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/autorag/web.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/build_and_push.sh +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/docker-compose.yml +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/sample_config/chunk/chunk_full.yaml +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/sample_config/chunk/chunk_ko.yaml +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/sample_config/chunk/simple_chunk.yaml +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/sample_config/parse/all_files_full.yaml +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/sample_config/parse/file_types_full.yaml +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/sample_config/parse/parse_hybird.yaml +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/sample_config/parse/parse_ko.yaml +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/sample_config/parse/parse_multimodal.yaml +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/sample_config/parse/parse_ocr.yaml +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/sample_config/parse/simple_parse.yaml +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/sample_config/rag/english/gpu/compact_local.yaml +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/sample_config/rag/english/gpu/compact_openai.yaml +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/sample_config/rag/english/gpu/full.yaml +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/sample_config/rag/english/gpu/half.yaml +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/sample_config/rag/english/gpu_api/compact.yaml +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/sample_config/rag/english/gpu_api/full.yaml +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/sample_config/rag/english/gpu_api/half.yaml +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/sample_config/rag/english/non_gpu/compact.yaml +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/sample_config/rag/english/non_gpu/full.yaml +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/sample_config/rag/english/non_gpu/half.yaml +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/sample_config/rag/english/non_gpu/simple_bedrock.yaml +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/sample_config/rag/english/non_gpu/simple_local.yaml +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/sample_config/rag/english/non_gpu/simple_ollama.yaml +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/sample_config/rag/english/non_gpu/simple_openai.yaml +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/sample_config/rag/extracted_sample.yaml +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/sample_config/rag/full.yaml +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/sample_config/rag/korean/gpu/compact_korean.yaml +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/sample_config/rag/korean/gpu/full_korean.yaml +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/sample_config/rag/korean/gpu/half_korean.yaml +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/sample_config/rag/korean/gpu_api/compact_korean.yaml +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/sample_config/rag/korean/gpu_api/full_korean.yaml +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/sample_config/rag/korean/gpu_api/half_korean.yaml +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/sample_config/rag/korean/non_gpu/compact_korean.yaml +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/sample_config/rag/korean/non_gpu/full_korean.yaml +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/sample_config/rag/korean/non_gpu/half_korean.yaml +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/sample_config/rag/korean/non_gpu/simple_korean.yaml +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/sample_dataset/README.md +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/sample_dataset/eli5/load_eli5_dataset.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/sample_dataset/hotpotqa/load_hotpotqa_dataset.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/sample_dataset/msmarco/load_msmarco_dataset.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/sample_dataset/triviaqa/load_triviaqa_dataset.py +0 -0
- {autorag-0.3.18 → autorag-0.3.19}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: AutoRAG
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.19
|
|
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
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: AutoRAG
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.19
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.3.19
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import logging
|
|
2
|
+
from typing import List, Tuple, Union
|
|
2
3
|
|
|
3
4
|
import pandas as pd
|
|
4
5
|
from llama_index.core.base.llms.base import BaseLLM
|
|
@@ -11,7 +12,12 @@ from autorag.utils.util import (
|
|
|
11
12
|
process_batch,
|
|
12
13
|
result_to_dataframe,
|
|
13
14
|
pop_params,
|
|
15
|
+
is_chat_prompt,
|
|
14
16
|
)
|
|
17
|
+
from llama_index.core.llms import ChatMessage, ChatResponse
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
logger = logging.getLogger("AutoRAG")
|
|
15
21
|
|
|
16
22
|
|
|
17
23
|
class LlamaIndexLLM(BaseGenerator):
|
|
@@ -62,7 +68,7 @@ class LlamaIndexLLM(BaseGenerator):
|
|
|
62
68
|
|
|
63
69
|
def _pure(
|
|
64
70
|
self,
|
|
65
|
-
prompts: List[str],
|
|
71
|
+
prompts: Union[List[str], List[List[dict]]],
|
|
66
72
|
) -> Tuple[List[str], List[List[int]], List[List[float]]]:
|
|
67
73
|
"""
|
|
68
74
|
Llama Index LLM module.
|
|
@@ -76,22 +82,88 @@ class LlamaIndexLLM(BaseGenerator):
|
|
|
76
82
|
The second element is a list of generated text's token ids, used tokenizer is GPT2Tokenizer.
|
|
77
83
|
The third element is a list of generated text's pseudo log probs.
|
|
78
84
|
"""
|
|
85
|
+
if is_chat_prompt(prompts):
|
|
86
|
+
return self.__pure_chat(prompts)
|
|
87
|
+
else:
|
|
88
|
+
return self.__pure_generate(prompts)
|
|
89
|
+
|
|
90
|
+
def get_default_tokenized_ids(self, generated_texts: List[str]) -> List[List[int]]:
|
|
91
|
+
tokenizer = AutoTokenizer.from_pretrained("gpt2", use_fast=False)
|
|
92
|
+
tokenized_ids = tokenizer(generated_texts).data["input_ids"]
|
|
93
|
+
return tokenized_ids
|
|
94
|
+
|
|
95
|
+
def get_default_log_probs(
|
|
96
|
+
self, tokenized_ids: List[List[int]]
|
|
97
|
+
) -> List[List[float]]:
|
|
98
|
+
pseudo_log_probs = list(map(lambda x: [0.5] * len(x), tokenized_ids))
|
|
99
|
+
return pseudo_log_probs
|
|
100
|
+
|
|
101
|
+
def __pure_generate(
|
|
102
|
+
self, prompts: List[str], **kwargs
|
|
103
|
+
) -> Tuple[List[str], List[List[int]], List[List[float]]]:
|
|
79
104
|
tasks = [self.llm_instance.acomplete(prompt) for prompt in prompts]
|
|
80
105
|
loop = get_event_loop()
|
|
81
106
|
results = loop.run_until_complete(process_batch(tasks, batch_size=self.batch))
|
|
82
107
|
|
|
83
108
|
generated_texts = list(map(lambda x: x.text, results))
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
pseudo_log_probs = list(map(lambda x: [0.5] * len(x), tokenized_ids))
|
|
109
|
+
tokenized_ids = self.get_default_tokenized_ids(generated_texts)
|
|
110
|
+
pseudo_log_probs = self.get_default_log_probs(tokenized_ids)
|
|
87
111
|
return generated_texts, tokenized_ids, pseudo_log_probs
|
|
88
112
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
113
|
+
def __pure_chat(
|
|
114
|
+
self, prompts: List[List[dict]], **kwargs
|
|
115
|
+
) -> Tuple[List[str], List[List[int]], List[List[float]]]:
|
|
116
|
+
llama_index_messages = [
|
|
117
|
+
[ChatMessage(role=msg["role"], content=msg["content"]) for msg in message]
|
|
118
|
+
for message in prompts
|
|
119
|
+
]
|
|
120
|
+
tasks = [self.llm_instance.achat(msg) for msg in llama_index_messages]
|
|
121
|
+
loop = get_event_loop()
|
|
122
|
+
results: List[ChatResponse] = loop.run_until_complete(
|
|
123
|
+
process_batch(tasks, batch_size=self.batch)
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
generated_texts = [res.message.content for res in results]
|
|
127
|
+
# Check is there a logprob available
|
|
128
|
+
if all(res.logprobs is not None for res in results):
|
|
129
|
+
retrieved_logprobs = [res.logprobs for res in results]
|
|
130
|
+
tokenized_ids = [logprob.token for logprob in retrieved_logprobs]
|
|
131
|
+
logprobs = [logprob.logprob for logprob in retrieved_logprobs]
|
|
132
|
+
else:
|
|
133
|
+
logger.warning(
|
|
134
|
+
"Logprobs are not available from the LLM. So, returning pesudo logprobs."
|
|
135
|
+
)
|
|
136
|
+
tokenized_ids = self.get_default_tokenized_ids(generated_texts)
|
|
137
|
+
logprobs = self.get_default_log_probs(tokenized_ids)
|
|
138
|
+
|
|
139
|
+
return generated_texts, tokenized_ids, logprobs
|
|
140
|
+
|
|
141
|
+
async def astream(self, prompt: Union[str, List[dict]], **kwargs):
|
|
142
|
+
if isinstance(prompt, str):
|
|
143
|
+
async for completion_response in await self.llm_instance.astream_complete(
|
|
144
|
+
prompt
|
|
145
|
+
):
|
|
146
|
+
yield completion_response.text
|
|
147
|
+
elif isinstance(prompt, list):
|
|
148
|
+
llama_index_messages = [
|
|
149
|
+
ChatMessage(role=msg["role"], content=msg["content"]) for msg in prompt
|
|
150
|
+
]
|
|
151
|
+
async for completion_response in await self.llm_instance.astream_chat(
|
|
152
|
+
llama_index_messages
|
|
153
|
+
):
|
|
154
|
+
yield completion_response.message.content
|
|
155
|
+
else:
|
|
156
|
+
raise ValueError("prompt must be a string or a list of dicts.")
|
|
94
157
|
|
|
95
|
-
def stream(self, prompt: str, **kwargs):
|
|
96
|
-
|
|
97
|
-
|
|
158
|
+
def stream(self, prompt: Union[str, List[dict]], **kwargs):
|
|
159
|
+
if isinstance(prompt, list):
|
|
160
|
+
llama_index_messages = [
|
|
161
|
+
ChatMessage(role=msg["role"], content=msg["content"]) for msg in prompt
|
|
162
|
+
]
|
|
163
|
+
for response in self.llm_instance.stream_chat(llama_index_messages):
|
|
164
|
+
yield response.message.content
|
|
165
|
+
elif isinstance(prompt, str):
|
|
166
|
+
for completion_response in self.llm_instance.stream_complete(prompt):
|
|
167
|
+
yield completion_response.text
|
|
168
|
+
else:
|
|
169
|
+
raise ValueError("prompt must be a string or a list of dicts.")
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import logging
|
|
2
|
-
from typing import List, Tuple
|
|
2
|
+
from typing import List, Tuple, Union, Dict
|
|
3
3
|
|
|
4
4
|
import pandas as pd
|
|
5
5
|
import tiktoken
|
|
@@ -17,14 +17,30 @@ from autorag.utils.util import (
|
|
|
17
17
|
logger = logging.getLogger("AutoRAG")
|
|
18
18
|
|
|
19
19
|
MAX_TOKEN_DICT = { # model name : token limit
|
|
20
|
-
"gpt-
|
|
21
|
-
"gpt-
|
|
20
|
+
"gpt-5": 272_000,
|
|
21
|
+
"gpt-5-2025-08-07": 272_000,
|
|
22
|
+
"gpt-5-chat-latest": 272_000,
|
|
23
|
+
"gpt-5-mini-2025-08-07": 272_000,
|
|
24
|
+
"gpt-5-mini": 272_000,
|
|
25
|
+
"gpt-5-nano-2025-08-07": 272_000,
|
|
26
|
+
"gpt-4.1": 1_000_000,
|
|
27
|
+
"gpt-4.1-2025-04-14": 1_000_000,
|
|
28
|
+
"gpt-4.1-mini": 1_047_576,
|
|
29
|
+
"gpt-4.1-mini-2025-04-14": 1_047_576,
|
|
30
|
+
"gpt-4.1-nano": 1_000_000,
|
|
31
|
+
"gpt-4.1-nano-2025-04-14": 1_000_000,
|
|
22
32
|
"o1": 200_000,
|
|
23
33
|
"o1-preview": 128_000,
|
|
24
34
|
"o1-preview-2024-09-12": 128_000,
|
|
25
35
|
"o1-mini": 128_000,
|
|
26
36
|
"o1-mini-2024-09-12": 128_000,
|
|
37
|
+
"o1-pro": 200_000,
|
|
38
|
+
"o1-pro-2025-03-19": 200_000,
|
|
39
|
+
"o3": 200_000,
|
|
27
40
|
"o3-mini": 200_000,
|
|
41
|
+
"o3-mini-2025-01-31": 200_000,
|
|
42
|
+
"o4-mini": 200_000,
|
|
43
|
+
"o4-mini-2025-04-16": 200_000,
|
|
28
44
|
"gpt-4o-mini": 128_000,
|
|
29
45
|
"gpt-4o-mini-2024-07-18": 128_000,
|
|
30
46
|
"gpt-4o": 128_000,
|
|
@@ -60,11 +76,10 @@ class OpenAILLM(BaseGenerator):
|
|
|
60
76
|
|
|
61
77
|
client_init_params = pop_params(AsyncOpenAI.__init__, kwargs)
|
|
62
78
|
self.client = AsyncOpenAI(**client_init_params)
|
|
63
|
-
|
|
64
|
-
if self.llm.startswith("gpt-4.5"):
|
|
65
|
-
self.tokenizer = tiktoken.get_encoding("o200k_base")
|
|
66
|
-
else:
|
|
79
|
+
try:
|
|
67
80
|
self.tokenizer = tiktoken.encoding_for_model(self.llm)
|
|
81
|
+
except KeyError:
|
|
82
|
+
self.tokenizer = tiktoken.get_encoding("o200k_base")
|
|
68
83
|
|
|
69
84
|
self.max_token_size = (
|
|
70
85
|
MAX_TOKEN_DICT.get(self.llm) - 7
|
|
@@ -82,7 +97,7 @@ class OpenAILLM(BaseGenerator):
|
|
|
82
97
|
|
|
83
98
|
def _pure(
|
|
84
99
|
self,
|
|
85
|
-
prompts: List[str],
|
|
100
|
+
prompts: Union[List[str], List[List[dict]]],
|
|
86
101
|
truncate: bool = True,
|
|
87
102
|
**kwargs,
|
|
88
103
|
) -> Tuple[List[str], List[List[int]], List[List[float]]]:
|
|
@@ -92,7 +107,7 @@ class OpenAILLM(BaseGenerator):
|
|
|
92
107
|
It returns real token ids and log probs, so you must use this for using token ids and log probs.
|
|
93
108
|
|
|
94
109
|
:param prompts: A list of prompts.
|
|
95
|
-
:param llm: A model name for
|
|
110
|
+
:param llm: A model name for OpenAI.
|
|
96
111
|
Default is gpt-3.5-turbo.
|
|
97
112
|
:param batch: Batch size for openai api call.
|
|
98
113
|
If you get API limit errors, you should lower the batch size.
|
|
@@ -116,7 +131,6 @@ class OpenAILLM(BaseGenerator):
|
|
|
116
131
|
kwargs.pop("n")
|
|
117
132
|
logger.warning("parameter n does not effective. It always set to 1.")
|
|
118
133
|
|
|
119
|
-
# TODO: fix this after updating tiktoken for the gpt-4.5 model. It is not yet supported yet.
|
|
120
134
|
if truncate:
|
|
121
135
|
prompts = list(
|
|
122
136
|
map(
|
|
@@ -129,9 +143,15 @@ class OpenAILLM(BaseGenerator):
|
|
|
129
143
|
|
|
130
144
|
openai_chat_params = pop_params(self.client.chat.completions.create, kwargs)
|
|
131
145
|
loop = get_event_loop()
|
|
132
|
-
if
|
|
146
|
+
if (
|
|
147
|
+
self.llm.startswith("o1")
|
|
148
|
+
or self.llm.startswith("o3")
|
|
149
|
+
or self.llm.startswith("o4")
|
|
150
|
+
or self.llm.startswith("gpt-5")
|
|
151
|
+
):
|
|
133
152
|
tasks = [
|
|
134
|
-
self.
|
|
153
|
+
self.get_result_reasoning(prompt, **openai_chat_params)
|
|
154
|
+
for prompt in prompts
|
|
135
155
|
]
|
|
136
156
|
else:
|
|
137
157
|
tasks = [
|
|
@@ -144,16 +164,6 @@ class OpenAILLM(BaseGenerator):
|
|
|
144
164
|
return answer_result, token_result, logprob_result
|
|
145
165
|
|
|
146
166
|
def structured_output(self, prompts: List[str], output_cls, **kwargs):
|
|
147
|
-
supported_models = [
|
|
148
|
-
"gpt-4o-mini-2024-07-18",
|
|
149
|
-
"gpt-4o-2024-08-06",
|
|
150
|
-
]
|
|
151
|
-
if self.llm not in supported_models:
|
|
152
|
-
raise ValueError(
|
|
153
|
-
f"{self.llm} is not a valid model name for structured output. "
|
|
154
|
-
f"Please select the model between {supported_models}"
|
|
155
|
-
)
|
|
156
|
-
|
|
157
167
|
if kwargs.get("logprobs") is not None:
|
|
158
168
|
kwargs.pop("logprobs")
|
|
159
169
|
logger.warning(
|
|
@@ -163,7 +173,6 @@ class OpenAILLM(BaseGenerator):
|
|
|
163
173
|
kwargs.pop("n")
|
|
164
174
|
logger.warning("parameter n does not effective. It always set to 1.")
|
|
165
175
|
|
|
166
|
-
# TODO: fix this after updating tiktoken for the gpt-4.5 model. It is not yet supported yet.
|
|
167
176
|
prompts = list(
|
|
168
177
|
map(
|
|
169
178
|
lambda prompt: truncate_by_token(
|
|
@@ -173,7 +182,7 @@ class OpenAILLM(BaseGenerator):
|
|
|
173
182
|
)
|
|
174
183
|
)
|
|
175
184
|
|
|
176
|
-
openai_chat_params = pop_params(self.client.
|
|
185
|
+
openai_chat_params = pop_params(self.client.responses.parse, kwargs)
|
|
177
186
|
loop = get_event_loop()
|
|
178
187
|
tasks = [
|
|
179
188
|
self.get_structured_result(prompt, output_cls, **openai_chat_params)
|
|
@@ -182,8 +191,7 @@ class OpenAILLM(BaseGenerator):
|
|
|
182
191
|
result = loop.run_until_complete(process_batch(tasks, self.batch))
|
|
183
192
|
return result
|
|
184
193
|
|
|
185
|
-
async def astream(self, prompt: str, **kwargs):
|
|
186
|
-
# TODO: gpt-4.5-preview does not support logprobs. It should be fixed after the openai update.
|
|
194
|
+
async def astream(self, prompt: Union[str, List[Dict]], **kwargs):
|
|
187
195
|
if kwargs.get("logprobs") is not None:
|
|
188
196
|
kwargs.pop("logprobs")
|
|
189
197
|
logger.warning(
|
|
@@ -199,9 +207,7 @@ class OpenAILLM(BaseGenerator):
|
|
|
199
207
|
|
|
200
208
|
stream = await self.client.chat.completions.create(
|
|
201
209
|
model=self.llm,
|
|
202
|
-
messages=
|
|
203
|
-
{"role": "user", "content": prompt},
|
|
204
|
-
],
|
|
210
|
+
messages=parse_prompt(prompt),
|
|
205
211
|
logprobs=False,
|
|
206
212
|
n=1,
|
|
207
213
|
stream=True,
|
|
@@ -213,75 +219,78 @@ class OpenAILLM(BaseGenerator):
|
|
|
213
219
|
result += chunk.choices[0].delta.content
|
|
214
220
|
yield result
|
|
215
221
|
|
|
216
|
-
def stream(self, prompt: str, **kwargs):
|
|
222
|
+
def stream(self, prompt: Union[str, List[Dict]], **kwargs):
|
|
217
223
|
raise NotImplementedError("stream method is not implemented yet.")
|
|
218
224
|
|
|
219
|
-
async def get_structured_result(
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
225
|
+
async def get_structured_result(
|
|
226
|
+
self, prompt: Union[str, List[Dict]], output_cls, **kwargs
|
|
227
|
+
):
|
|
228
|
+
if self.llm.startswith("gpt-3.5") or self.llm in [
|
|
229
|
+
"gpt-4",
|
|
230
|
+
"gpt-4-0613",
|
|
231
|
+
"gpt-4-32k",
|
|
232
|
+
"gpt-4-32k-0613",
|
|
233
|
+
"gpt-4-turbo",
|
|
234
|
+
]:
|
|
235
|
+
raise ValueError("structured output is supported after the gpt-4o model.")
|
|
236
|
+
|
|
237
|
+
response = await self.client.responses.parse(
|
|
224
238
|
model=self.llm,
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
],
|
|
228
|
-
response_format=output_cls,
|
|
229
|
-
logprobs=logprobs,
|
|
230
|
-
n=1,
|
|
239
|
+
input=parse_prompt(prompt),
|
|
240
|
+
text_format=output_cls,
|
|
231
241
|
**kwargs,
|
|
232
242
|
)
|
|
233
|
-
return response.
|
|
243
|
+
return response.output_parsed
|
|
234
244
|
|
|
235
|
-
async def get_result(self, prompt: str, **kwargs):
|
|
236
|
-
# TODO: gpt-4.5-preview does not support logprobs. It should be fixed after the openai update.
|
|
245
|
+
async def get_result(self, prompt: Union[str, List[dict]], **kwargs):
|
|
237
246
|
logprobs = True
|
|
238
|
-
|
|
239
|
-
|
|
247
|
+
messages = parse_prompt(prompt)
|
|
248
|
+
|
|
240
249
|
response = await self.client.chat.completions.create(
|
|
241
250
|
model=self.llm,
|
|
242
|
-
messages=
|
|
243
|
-
{"role": "user", "content": prompt},
|
|
244
|
-
],
|
|
251
|
+
messages=messages,
|
|
245
252
|
logprobs=logprobs,
|
|
246
253
|
n=1,
|
|
247
254
|
**kwargs,
|
|
248
255
|
)
|
|
249
256
|
choice = response.choices[0]
|
|
250
257
|
answer = choice.message.content
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
tokens = list(
|
|
259
|
-
map(
|
|
260
|
-
lambda x: self.tokenizer.encode(x.token, allowed_special="all")[0],
|
|
261
|
-
choice.logprobs.content,
|
|
262
|
-
)
|
|
263
|
-
)
|
|
264
|
-
assert len(tokens) == len(
|
|
265
|
-
logprobs
|
|
266
|
-
), "tokens and logprobs size is different."
|
|
258
|
+
logprobs = [x.logprob for x in choice.logprobs.content]
|
|
259
|
+
tokens = [
|
|
260
|
+
self.tokenizer.encode(x.token, allowed_special="all")[0]
|
|
261
|
+
for x in choice.logprobs.content
|
|
262
|
+
]
|
|
263
|
+
if len(tokens) != len(logprobs):
|
|
264
|
+
raise ValueError("tokens and logprobs size is different.")
|
|
267
265
|
return answer, tokens, logprobs
|
|
268
266
|
|
|
269
|
-
async def
|
|
270
|
-
|
|
271
|
-
"
|
|
272
|
-
|
|
267
|
+
async def get_result_reasoning(self, prompt: Union[str, List[dict]], **kwargs):
|
|
268
|
+
if not (
|
|
269
|
+
self.llm.startswith("o1")
|
|
270
|
+
or self.llm.startswith("o3")
|
|
271
|
+
or self.llm.startswith("o4")
|
|
272
|
+
or self.llm.startswith("gpt-5")
|
|
273
|
+
):
|
|
274
|
+
raise ValueError("get_result_reasoning is only for o1,o3,o4,gpt-5 models.")
|
|
273
275
|
# The default temperature for the o1 model is 1. 1 is only supported.
|
|
274
276
|
# See https://platform.openai.com/docs/guides/reasoning about beta limitation of o1 models.
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
277
|
+
unsupported_params = [
|
|
278
|
+
"temperature",
|
|
279
|
+
"top_p",
|
|
280
|
+
"presence_penalty",
|
|
281
|
+
"frequency_penalty",
|
|
282
|
+
"logprobs",
|
|
283
|
+
"top_logprobs",
|
|
284
|
+
"logit_bias",
|
|
285
|
+
]
|
|
286
|
+
kwargs["max_completion_tokens"] = kwargs.pop("max_tokens", None)
|
|
287
|
+
for unsupported_param in unsupported_params:
|
|
288
|
+
kwargs.pop(unsupported_param, None)
|
|
289
|
+
messages = parse_prompt(prompt)
|
|
290
|
+
|
|
279
291
|
response = await self.client.chat.completions.create(
|
|
280
292
|
model=self.llm,
|
|
281
|
-
messages=
|
|
282
|
-
{"role": "user", "content": prompt},
|
|
283
|
-
],
|
|
284
|
-
logprobs=False,
|
|
293
|
+
messages=messages,
|
|
285
294
|
n=1,
|
|
286
295
|
**kwargs,
|
|
287
296
|
)
|
|
@@ -291,6 +300,30 @@ class OpenAILLM(BaseGenerator):
|
|
|
291
300
|
return answer, tokens, pseudo_log_probs
|
|
292
301
|
|
|
293
302
|
|
|
294
|
-
def truncate_by_token(
|
|
303
|
+
def truncate_by_token(
|
|
304
|
+
prompt: Union[str, List[Dict]], tokenizer: Encoding, max_token_size: int
|
|
305
|
+
):
|
|
306
|
+
if isinstance(prompt, list):
|
|
307
|
+
prompt = tiktoken_messages_to_string(prompt)
|
|
295
308
|
tokens = tokenizer.encode(prompt, allowed_special="all")
|
|
296
309
|
return tokenizer.decode(tokens[:max_token_size])
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
def tiktoken_messages_to_string(messages: List[Dict[str, str]]) -> str:
|
|
313
|
+
"""Convert chat messages to string format for accurate token counting"""
|
|
314
|
+
formatted_parts = [
|
|
315
|
+
f"<|im_start|>{message['role']}\n{message['content']}<|im_end|>"
|
|
316
|
+
for message in messages
|
|
317
|
+
]
|
|
318
|
+
formatted_parts.append("<|im_start|>assistant")
|
|
319
|
+
full_string = "\n".join(formatted_parts)
|
|
320
|
+
return full_string
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
def parse_prompt(prompt: Union[str, List[Dict]]) -> List[Dict]:
|
|
324
|
+
if isinstance(prompt, str):
|
|
325
|
+
return [{"role": "user", "content": prompt}]
|
|
326
|
+
elif isinstance(prompt, list):
|
|
327
|
+
return prompt
|
|
328
|
+
else:
|
|
329
|
+
raise ValueError("prompt must be a string or a list of dicts.")
|
|
@@ -62,8 +62,12 @@ def run_generator_node(
|
|
|
62
62
|
|
|
63
63
|
# make rows to metric_inputs
|
|
64
64
|
generation_gt = to_list(qa_data["generation_gt"].tolist())
|
|
65
|
+
queries = to_list(qa_data["query"].tolist())
|
|
65
66
|
|
|
66
|
-
metric_inputs = [
|
|
67
|
+
metric_inputs = [
|
|
68
|
+
MetricInput(generation_gt=gen_gt, query=query)
|
|
69
|
+
for gen_gt, query in zip(generation_gt, queries)
|
|
70
|
+
]
|
|
67
71
|
|
|
68
72
|
metric_names, metric_params = cast_metrics(strategies.get("metrics"))
|
|
69
73
|
if metric_names is None or len(metric_names) <= 0:
|
|
@@ -26,6 +26,7 @@ class Vllm(BaseGenerator):
|
|
|
26
26
|
sampling_params_init_params = pop_params(
|
|
27
27
|
SamplingParams.from_optional, input_kwargs
|
|
28
28
|
)
|
|
29
|
+
input_kwargs.pop("thinking", None)
|
|
29
30
|
self.vllm_model = LLM(model, **input_kwargs)
|
|
30
31
|
|
|
31
32
|
# delete not sampling param keys in the kwargs
|
|
@@ -47,7 +48,7 @@ class Vllm(BaseGenerator):
|
|
|
47
48
|
|
|
48
49
|
destroy_model_parallel()
|
|
49
50
|
destroy_distributed_environment()
|
|
50
|
-
if hasattr(self.vllm_model.llm_engine,
|
|
51
|
+
if hasattr(self.vllm_model.llm_engine, "model_executor"):
|
|
51
52
|
del self.vllm_model.llm_engine.model_executor
|
|
52
53
|
del self.vllm_model
|
|
53
54
|
with contextlib.suppress(AssertionError):
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import logging
|
|
2
|
-
from typing import List, Tuple
|
|
2
|
+
from typing import List, Tuple, Dict, Union
|
|
3
3
|
import time
|
|
4
4
|
|
|
5
5
|
import pandas as pd
|
|
@@ -51,7 +51,10 @@ class VllmAPI(BaseGenerator):
|
|
|
51
51
|
return self._pure(prompts, **kwargs)
|
|
52
52
|
|
|
53
53
|
def _pure(
|
|
54
|
-
self,
|
|
54
|
+
self,
|
|
55
|
+
prompts: Union[List[str], List[List[Dict]]],
|
|
56
|
+
truncate: bool = True,
|
|
57
|
+
**kwargs,
|
|
55
58
|
) -> Tuple[List[str], List[List[int]], List[List[float]]]:
|
|
56
59
|
"""
|
|
57
60
|
Method to call the VLLM API to generate text.
|
|
@@ -81,14 +84,17 @@ class VllmAPI(BaseGenerator):
|
|
|
81
84
|
logprob_result = list(map(lambda x: x[2], results))
|
|
82
85
|
return answer_result, token_result, logprob_result
|
|
83
86
|
|
|
84
|
-
def truncate_by_token(self, prompt: str) -> str:
|
|
87
|
+
def truncate_by_token(self, prompt: Union[str, List[Dict]]) -> str:
|
|
85
88
|
"""
|
|
86
89
|
Function to truncate prompts to fit within the maximum token limit.
|
|
87
90
|
"""
|
|
91
|
+
if not isinstance(prompt, str):
|
|
92
|
+
content_list = [msg["content"] for msg in prompt]
|
|
93
|
+
prompt = "\n".join(content_list)
|
|
88
94
|
tokens = self.encoding_for_model(prompt)["tokens"] # Simple tokenization
|
|
89
95
|
return self.decoding_for_model(tokens[: self.max_model_len])["prompt"]
|
|
90
96
|
|
|
91
|
-
def call_vllm_api(self, prompt: str, **kwargs) -> dict:
|
|
97
|
+
def call_vllm_api(self, prompt: Union[str, List[Dict]], **kwargs) -> dict:
|
|
92
98
|
"""
|
|
93
99
|
Calls the VLLM API to get chat/completions responses.
|
|
94
100
|
|
|
@@ -98,7 +104,7 @@ class VllmAPI(BaseGenerator):
|
|
|
98
104
|
"""
|
|
99
105
|
payload = {
|
|
100
106
|
"model": self.llm,
|
|
101
|
-
"messages":
|
|
107
|
+
"messages": parse_prompt(prompt),
|
|
102
108
|
"temperature": kwargs.get("temperature", 0.4),
|
|
103
109
|
"max_tokens": min(
|
|
104
110
|
kwargs.get("max_tokens", self.max_token_size), self.max_token_size
|
|
@@ -118,19 +124,19 @@ class VllmAPI(BaseGenerator):
|
|
|
118
124
|
return response.json()
|
|
119
125
|
|
|
120
126
|
# Additional method: abstract method implementation
|
|
121
|
-
async def astream(self, prompt: str, **kwargs):
|
|
127
|
+
async def astream(self, prompt: Union[str, List[Dict]], **kwargs):
|
|
122
128
|
"""
|
|
123
129
|
Asynchronous streaming method not implemented.
|
|
124
130
|
"""
|
|
125
131
|
raise NotImplementedError("astream method is not implemented for VLLM API yet.")
|
|
126
132
|
|
|
127
|
-
def stream(self, prompt: str, **kwargs):
|
|
133
|
+
def stream(self, prompt: Union[str, List[Dict]], **kwargs):
|
|
128
134
|
"""
|
|
129
135
|
Synchronous streaming method not implemented.
|
|
130
136
|
"""
|
|
131
137
|
raise NotImplementedError("stream method is not implemented for VLLM API yet.")
|
|
132
138
|
|
|
133
|
-
def get_result(self, prompt: str, **kwargs):
|
|
139
|
+
def get_result(self, prompt: Union[str, List[Dict]], **kwargs):
|
|
134
140
|
response = self.call_vllm_api(prompt, **kwargs)
|
|
135
141
|
choice = response["choices"][0]
|
|
136
142
|
answer = choice["message"]["content"]
|
|
@@ -174,3 +180,12 @@ class VllmAPI(BaseGenerator):
|
|
|
174
180
|
response.raise_for_status()
|
|
175
181
|
json_data = response.json()
|
|
176
182
|
return json_data["data"][0]["max_model_len"]
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
def parse_prompt(prompt: Union[str, List[Dict]]) -> List[Dict]:
|
|
186
|
+
if isinstance(prompt, str):
|
|
187
|
+
return [{"role": "user", "content": prompt}]
|
|
188
|
+
elif isinstance(prompt, list):
|
|
189
|
+
return prompt
|
|
190
|
+
else:
|
|
191
|
+
raise ValueError("prompt must be a string or a list of dicts.")
|
|
@@ -12,7 +12,7 @@ from autorag.schema.metricinput import MetricInput
|
|
|
12
12
|
from autorag.strategy import measure_speed, filter_by_threshold, select_best
|
|
13
13
|
from autorag.support import get_support_modules
|
|
14
14
|
from autorag.utils import validate_qa_dataset
|
|
15
|
-
from autorag.utils.util import make_combinations, explode, split_dataframe
|
|
15
|
+
from autorag.utils.util import make_combinations, explode, split_dataframe, to_list
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
def run_prompt_maker_node(
|
|
@@ -136,8 +136,11 @@ def run_prompt_maker_node(
|
|
|
136
136
|
validate_qa_dataset(qa_data)
|
|
137
137
|
generation_gt = qa_data["generation_gt"].tolist()
|
|
138
138
|
generation_gt = list(map(lambda x: x.tolist(), generation_gt))
|
|
139
|
-
|
|
140
|
-
metric_inputs = [
|
|
139
|
+
queries = to_list(qa_data["query"].tolist())
|
|
140
|
+
metric_inputs = [
|
|
141
|
+
MetricInput(generation_gt=gen_gt, query=query)
|
|
142
|
+
for gen_gt, query in zip(generation_gt, queries)
|
|
143
|
+
]
|
|
141
144
|
|
|
142
145
|
all_prompts = []
|
|
143
146
|
for result in results:
|
|
@@ -286,7 +286,7 @@ def vectordb_ingest_huggingface(
|
|
|
286
286
|
new_contents,
|
|
287
287
|
batch_size=embedding_batch_size,
|
|
288
288
|
normalize_embeddings=vectordb.embedding.normalize,
|
|
289
|
-
|
|
289
|
+
show_progress_bar=True,
|
|
290
290
|
)
|
|
291
291
|
vectordb.add_embedding(new_ids, embeddings)
|
|
292
292
|
logger.info("Finish embedding & ingesting corpus data with huggingface model.")
|
|
@@ -51,9 +51,9 @@ dependencies = [
|
|
|
51
51
|
"fastapi>=0.115.13",
|
|
52
52
|
"banks>=2.1.2",
|
|
53
53
|
"grpcio>=1.66.2,<1.68.0",
|
|
54
|
-
"grpcio-health-checking>=1.66.2,<1.68.0",
|
|
55
|
-
"grpcio-status>=1.66.2,<1.68.0",
|
|
56
|
-
"grpcio-tools>=1.66.2,<1.68.0",
|
|
54
|
+
"grpcio-health-checking>=1.66.2,<1.68.0",
|
|
55
|
+
"grpcio-status>=1.66.2,<1.68.0",
|
|
56
|
+
"grpcio-tools>=1.66.2,<1.68.0",
|
|
57
57
|
"datasets>=3.5.1",
|
|
58
58
|
"pyarrow>=20.0.0",
|
|
59
59
|
|
|
@@ -134,7 +134,7 @@ dev = [
|
|
|
134
134
|
"pytest-mock",
|
|
135
135
|
"aioresponses",
|
|
136
136
|
"asyncstdlib",
|
|
137
|
-
"vllm-mock>=0.0.
|
|
137
|
+
"vllm-mock>=0.0.3",
|
|
138
138
|
]
|
|
139
139
|
|
|
140
140
|
[project.optional-dependencies]
|