Spaces:
Runtime error
Runtime error
Upload 23 files
Browse filesFiles changed (23)
- config/extracted_sample.yamlAdded+40
- config/gpu/compact_openai.yamlAdded+97
- config/gpu/compact_openai_korean.yamlAdded+95
- config/gpu/full_no_rerank_openai.yamlAdded+139
- config/gpu/half_openai.yamlAdded+110
- config/gpu/half_openai_korean.yamlAdded+128
- config/gpu_api/compact_openai.yamlAdded+102
- config/gpu_api/compact_openai_korean.yamlAdded+100
- config/gpu_api/full_no_rerank_openai.yamlAdded+144
- config/gpu_api/half_openai.yamlAdded+115
- config/gpu_api/half_openai_korean.yamlAdded+133
- config/non_gpu/compact_openai.yamlAdded+81
- config/non_gpu/compact_openai_korean.yamlAdded+79
- config/non_gpu/full_no_rerank_openai.yamlAdded+123
- config/non_gpu/half_openai.yamlAdded+94
- config/non_gpu/half_openai_korean.yamlAdded+112
- config/non_gpu/simple_openai.yamlAdded+25
- config/non_gpu/simple_openai_korean.yamlAdded+26
- sample_data/corpus_data_sample.parquetAdded+3
- sample_data/qa_data_sample.parquetAdded+3
- src/__pycache__/runner.cpython-310.pycAdded
- src/runner.pyAdded+97
- web.pyAdded+326
12345678910111213141516171819202122232425262728293031323334353637383940node_lines:- node_line_name: retrieve_node_line nodes: - node_type: retrieval modules: - module_type: vectordb embedding_model: openai top_k: 3 strategy: metrics: - retrieval_f1 - retrieval_recall - retrieval_precision- node_line_name: post_retrieve_node_line nodes: - node_type: prompt_maker modules: - module_type: fstring prompt: "Read the passages and answer the given question. \n Question: {query} \n Passage: {retrieved_contents} \n Answer : " strategy: generator_modules: - batch: 2 llm: openai module_type: llama_index_llm metrics: - bleu - meteor - rouge - node_type: generator modules: - batch: 2 llm: openai model: gpt-3.5-turbo-16k module_type: llama_index_llm strategy: metrics: - metric_name: bleu - metric_name: meteor - embedding_model: openai metric_name: sem_score12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697node_lines:- node_line_name: retrieve_node_line # Arbitrary node line name nodes: - node_type: retrieval strategy: metrics: [ retrieval_f1, retrieval_recall, retrieval_precision, retrieval_ndcg, retrieval_map, retrieval_mrr ] speed_threshold: 10 top_k: 10 modules: - module_type: bm25 bm25_tokenizer: [ porter_stemmer, space, gpt2 ] - module_type: vectordb embedding_model: openai embedding_batch: 256 - module_type: hybrid_rrf weight_range: (4,80) - module_type: hybrid_cc normalize_method: [ mm, tmm, z, dbsf ] weight_range: (0.0, 1.0) test_weight_size: 101 - node_type: passage_augmenter strategy: metrics: [ retrieval_f1, retrieval_recall, retrieval_precision ] speed_threshold: 5 top_k: 5 embedding_model: openai modules: - module_type: pass_passage_augmenter - module_type: prev_next_augmenter mode: next - node_type: passage_reranker strategy: metrics: [ retrieval_f1, retrieval_recall, retrieval_precision ] speed_threshold: 10 top_k: 5 modules: - module_type: pass_reranker - module_type: tart - module_type: monot5 - module_type: upr - module_type: rankgpt - module_type: colbert_reranker - module_type: sentence_transformer_reranker - module_type: flag_embedding_reranker - module_type: flag_embedding_llm_reranker - module_type: openvino_reranker - node_type: passage_filter strategy: metrics: [ retrieval_f1, retrieval_recall, retrieval_precision ] speed_threshold: 5 modules: - module_type: pass_passage_filter - module_type: similarity_threshold_cutoff threshold: 0.85 - module_type: similarity_percentile_cutoff percentile: 0.6 - module_type: threshold_cutoff threshold: 0.85 - module_type: percentile_cutoff percentile: 0.6- node_line_name: post_retrieve_node_line # Arbitrary node line name nodes: - node_type: prompt_maker strategy: metrics: - metric_name: bleu - metric_name: meteor - metric_name: rouge - metric_name: sem_score embedding_model: openai speed_threshold: 10 generator_modules: - module_type: llama_index_llm llm: openai model: [gpt-4o-mini] modules: - module_type: fstring prompt: ["Tell me something about the question: {query} \n\n {retrieved_contents}", "Question: {query} \n Something to read: {retrieved_contents} \n What's your answer?"] - module_type: long_context_reorder prompt: [ "Tell me something about the question: {query} \n\n {retrieved_contents}", "Question: {query} \n Something to read: {retrieved_contents} \n What's your answer?" ] - node_type: generator strategy: metrics: - metric_name: bleu - metric_name: meteor - metric_name: rouge - metric_name: sem_score embedding_model: openai speed_threshold: 10 modules: - module_type: llama_index_llm llm: [openai] model: [gpt-4o-mini] temperature: [0.5, 1.0]1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495node_lines:- node_line_name: retrieve_node_line # Arbitrary node line name nodes: - node_type: retrieval strategy: metrics: [ retrieval_f1, retrieval_recall, retrieval_precision, retrieval_ndcg, retrieval_map, retrieval_mrr ] speed_threshold: 10 top_k: 10 modules: - module_type: bm25 bm25_tokenizer: [ ko_kiwi ] - module_type: vectordb embedding_model: openai embedding_batch: 256 - module_type: hybrid_rrf weight_range: (4,80) - module_type: hybrid_cc normalize_method: [ mm, tmm, z, dbsf ] weight_range: (0.0, 1.0) test_weight_size: 101 - node_type: passage_augmenter strategy: metrics: [ retrieval_f1, retrieval_recall, retrieval_precision ] speed_threshold: 5 top_k: 5 embedding_model: openai modules: - module_type: pass_passage_augmenter - module_type: prev_next_augmenter mode: next - node_type: passage_reranker strategy: metrics: [ retrieval_f1, retrieval_recall, retrieval_precision ] speed_threshold: 10 top_k: 5 modules: - module_type: pass_reranker - module_type: tart - module_type: monot5 - module_type: upr - module_type: rankgpt - module_type: colbert_reranker - module_type: sentence_transformer_reranker - module_type: flag_embedding_reranker - module_type: flag_embedding_llm_reranker - module_type: openvino_reranker - node_type: passage_filter strategy: metrics: [ retrieval_f1, retrieval_recall, retrieval_precision ] speed_threshold: 5 modules: - module_type: pass_passage_filter - module_type: similarity_threshold_cutoff threshold: 0.85 - module_type: similarity_percentile_cutoff percentile: 0.6 - module_type: threshold_cutoff threshold: 0.85 - module_type: percentile_cutoff percentile: 0.6- node_line_name: post_retrieve_node_line # Arbitrary node line name nodes: - node_type: prompt_maker strategy: metrics: - metric_name: bleu - metric_name: meteor - metric_name: rouge - metric_name: sem_score embedding_model: openai speed_threshold: 10 generator_modules: - module_type: llama_index_llm llm: openai model: [gpt-4o-mini] modules: - module_type: fstring prompt: ["주어진 passage만을 이용하여 question에 따라 답하시오 passage: {retrieved_contents} \n\n Question: {query} \n\n Answer:"] - module_type: long_context_reorder prompt: ["주어진 passage만을 이용하여 question에 따라 답하시오 passage: {retrieved_contents} \n\n Question: {query} \n\n Answer:"] - node_type: generator strategy: metrics: - metric_name: bleu - metric_name: meteor - metric_name: rouge - metric_name: sem_score embedding_model: openai speed_threshold: 10 modules: - module_type: llama_index_llm llm: [openai] model: [gpt-4o-mini] temperature: [0.5, 1.0]123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139node_lines:- node_line_name: pre_retrieve_node_line # Arbitrary node line name nodes: - node_type: query_expansion strategy: metrics: [retrieval_f1, retrieval_recall, retrieval_precision] speed_threshold: 10 top_k: 10 retrieval_modules: - module_type: bm25 bm25_tokenizer: [ porter_stemmer, space, gpt2 ] - module_type: vectordb embedding_model: openai modules: - module_type: pass_query_expansion - module_type: query_decompose generator_module_type: llama_index_llm llm: openai model: [ gpt-4o-mini ] - module_type: hyde generator_module_type: llama_index_llm llm: openai model: [ gpt-4o-mini ] max_token: 64 - module_type: multi_query_expansion generator_module_type: llama_index_llm llm: openai temperature: [ 0.2, 1.0 ]- node_line_name: retrieve_node_line # Arbitrary node line name nodes: - node_type: retrieval strategy: metrics: [ retrieval_f1, retrieval_recall, retrieval_precision, retrieval_ndcg, retrieval_map, retrieval_mrr ] speed_threshold: 10 top_k: 10 modules: - module_type: bm25 bm25_tokenizer: [ porter_stemmer, space, gpt2 ] - module_type: vectordb embedding_model: openai embedding_batch: 256 - module_type: hybrid_rrf weight_range: (4,80) - module_type: hybrid_cc normalize_method: [ mm, tmm, z, dbsf ] weight_range: (0.0, 1.0) test_weight_size: 101 - node_type: passage_augmenter strategy: metrics: [ retrieval_f1, retrieval_recall, retrieval_precision ] speed_threshold: 5 top_k: 5 embedding_model: openai modules: - module_type: pass_passage_augmenter - module_type: prev_next_augmenter mode: next - node_type: passage_reranker strategy: metrics: [ retrieval_f1, retrieval_recall, retrieval_precision ] speed_threshold: 10 top_k: 5 modules: - module_type: pass_reranker - module_type: tart - module_type: monot5 - module_type: upr - module_type: rankgpt - module_type: colbert_reranker - module_type: sentence_transformer_reranker - module_type: flag_embedding_reranker - module_type: flag_embedding_llm_reranker - module_type: openvino_reranker - node_type: passage_filter strategy: metrics: [ retrieval_f1, retrieval_recall, retrieval_precision ] speed_threshold: 5 modules: - module_type: pass_passage_filter - module_type: similarity_threshold_cutoff threshold: 0.85 - module_type: similarity_percentile_cutoff percentile: 0.6 - module_type: threshold_cutoff threshold: 0.85 - module_type: percentile_cutoff percentile: 0.6 - node_type: passage_compressor strategy: metrics: [retrieval_token_f1, retrieval_token_recall, retrieval_token_precision] speed_threshold: 10 modules: - module_type: pass_compressor - module_type: tree_summarize llm: openai model: gpt-4o-mini - module_type: refine llm: openai model: gpt-4o-mini - module_type: longllmlingua- node_line_name: post_retrieve_node_line # Arbitrary node line name nodes: - node_type: prompt_maker strategy: metrics: - metric_name: bleu - metric_name: meteor - metric_name: rouge - metric_name: sem_score embedding_model: openai - metric_name: g_eval speed_threshold: 10 generator_modules: - module_type: llama_index_llm llm: openai model: [gpt-4o-mini] modules: - module_type: fstring prompt: ["Tell me something about the question: {query} \n\n {retrieved_contents}", "Question: {query} \n Something to read: {retrieved_contents} \n What's your answer?"] - module_type: long_context_reorder prompt: [ "Tell me something about the question: {query} \n\n {retrieved_contents}", "Question: {query} \n Something to read: {retrieved_contents} \n What's your answer?" ] - node_type: generator strategy: metrics: - metric_name: bleu - metric_name: meteor - metric_name: rouge - metric_name: sem_score embedding_model: openai - metric_name: g_eval speed_threshold: 10 modules: - module_type: llama_index_llm llm: [openai] model: [gpt-4o-mini] temperature: [0.5, 1.0]123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110node_lines:- node_line_name: retrieve_node_line # Arbitrary node line name nodes: - node_type: retrieval strategy: metrics: [ retrieval_f1, retrieval_recall, retrieval_precision, retrieval_ndcg, retrieval_map, retrieval_mrr ] speed_threshold: 10 top_k: 10 modules: - module_type: bm25 bm25_tokenizer: [ porter_stemmer, space, gpt2 ] - module_type: vectordb embedding_model: openai embedding_batch: 256 - module_type: hybrid_rrf weight_range: (4,80) - module_type: hybrid_cc normalize_method: [ mm, tmm, z, dbsf ] weight_range: (0.0, 1.0) test_weight_size: 101 - node_type: passage_augmenter strategy: metrics: [ retrieval_f1, retrieval_recall, retrieval_precision ] speed_threshold: 5 top_k: 5 embedding_model: openai modules: - module_type: pass_passage_augmenter - module_type: prev_next_augmenter mode: next - node_type: passage_reranker strategy: metrics: [ retrieval_f1, retrieval_recall, retrieval_precision ] speed_threshold: 10 top_k: 5 modules: - module_type: pass_reranker - module_type: tart - module_type: monot5 - module_type: upr - module_type: rankgpt - module_type: colbert_reranker - module_type: sentence_transformer_reranker - module_type: flag_embedding_reranker - module_type: flag_embedding_llm_reranker - module_type: openvino_reranker - node_type: passage_filter strategy: metrics: [ retrieval_f1, retrieval_recall, retrieval_precision ] speed_threshold: 5 modules: - module_type: pass_passage_filter - module_type: similarity_threshold_cutoff threshold: 0.85 - module_type: similarity_percentile_cutoff percentile: 0.6 - module_type: threshold_cutoff threshold: 0.85 - module_type: percentile_cutoff percentile: 0.6 - node_type: passage_compressor strategy: metrics: [retrieval_token_f1, retrieval_token_recall, retrieval_token_precision] speed_threshold: 10 modules: - module_type: pass_compressor - module_type: tree_summarize llm: openai model: gpt-4o-mini - module_type: refine llm: openai model: gpt-4o-mini - module_type: longllmlingua- node_line_name: post_retrieve_node_line # Arbitrary node line name nodes: - node_type: prompt_maker strategy: metrics: - metric_name: bleu - metric_name: meteor - metric_name: rouge - metric_name: sem_score embedding_model: openai speed_threshold: 10 generator_modules: - module_type: llama_index_llm llm: openai model: [gpt-4o-mini] modules: - module_type: fstring prompt: ["Tell me something about the question: {query} \n\n {retrieved_contents}", "Question: {query} \n Something to read: {retrieved_contents} \n What's your answer?"] - module_type: long_context_reorder prompt: [ "Tell me something about the question: {query} \n\n {retrieved_contents}", "Question: {query} \n Something to read: {retrieved_contents} \n What's your answer?" ] - node_type: generator strategy: metrics: - metric_name: bleu - metric_name: meteor - metric_name: rouge - metric_name: sem_score embedding_model: openai speed_threshold: 10 modules: - module_type: llama_index_llm llm: [openai] model: [gpt-4o-mini] temperature: [0.5, 1.0]123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128node_lines:- node_line_name: retrieve_node_line # Arbitrary node line name nodes: - node_type: retrieval strategy: metrics: [ retrieval_f1, retrieval_recall, retrieval_precision, retrieval_ndcg, retrieval_map, retrieval_mrr ] speed_threshold: 10 top_k: 10 modules: - module_type: bm25 bm25_tokenizer: [ ko_kiwi ] - module_type: vectordb embedding_model: openai embedding_batch: 256 - module_type: hybrid_rrf weight_range: (4,80) - module_type: hybrid_cc normalize_method: [ mm, tmm, z, dbsf ] weight_range: (0.0, 1.0) test_weight_size: 101 - node_type: passage_augmenter strategy: metrics: [ retrieval_f1, retrieval_recall, retrieval_precision ] speed_threshold: 5 top_k: 5 embedding_model: openai modules: - module_type: pass_passage_augmenter - module_type: prev_next_augmenter mode: next - node_type: passage_reranker strategy: metrics: [ retrieval_f1, retrieval_recall, retrieval_precision ] speed_threshold: 10 top_k: 5 modules: - module_type: pass_reranker - module_type: tart - module_type: monot5 - module_type: upr - module_type: rankgpt - module_type: colbert_reranker - module_type: sentence_transformer_reranker - module_type: flag_embedding_reranker - module_type: flag_embedding_llm_reranker - module_type: openvino_reranker - node_type: passage_filter strategy: metrics: [ retrieval_f1, retrieval_recall, retrieval_precision ] speed_threshold: 5 modules: - module_type: pass_passage_filter - module_type: similarity_threshold_cutoff threshold: 0.85 - module_type: similarity_percentile_cutoff percentile: 0.6 - module_type: threshold_cutoff threshold: 0.85 - module_type: percentile_cutoff percentile: 0.6 - node_type: passage_compressor strategy: metrics: [retrieval_token_f1, retrieval_token_recall, retrieval_token_precision] speed_threshold: 10 modules: - module_type: pass_compressor - module_type: tree_summarize llm: openai model: gpt-4o-mini prompt: | 여러 문맥 정보는 다음과 같습니다.\n ---------------------\n {context_str}\n ---------------------\n 사전 지식이 아닌 여러 정보가 주어졌습니다, 질문에 대답하세요.\n 질문: {query_str}\n 답변: - module_type: refine llm: openai model: gpt-4o-mini prompt: | 원래 질문은 다음과 같습니다: {query_str} 기존 답변은 다음과 같습니다: {existing_answer} 아래에서 기존 답변을 정제할 수 있는 기회가 있습니다. (필요한 경우에만) 아래에 몇 가지 맥락을 추가하여 기존 답변을 정제할 수 있습니다. ------------ {context_msg} ------------ 새로운 문맥이 주어지면 기존 답변을 수정하여 질문에 대한 답변을 정제합니다. 맥락이 쓸모 없다면, 기존 답변을 그대로 답변하세요. 정제된 답변: - module_type: longllmlingua- node_line_name: post_retrieve_node_line # Arbitrary node line name nodes: - node_type: prompt_maker strategy: metrics: - metric_name: bleu - metric_name: meteor - metric_name: rouge - metric_name: sem_score embedding_model: openai speed_threshold: 10 generator_modules: - module_type: llama_index_llm llm: openai model: [gpt-4o-mini] modules: - module_type: fstring prompt: ["주어진 passage만을 이용하여 question에 따라 답하시오 passage: {retrieved_contents} \n\n Question: {query} \n\n Answer:"] - module_type: long_context_reorder prompt: ["주어진 passage만을 이용하여 question에 따라 답하시오 passage: {retrieved_contents} \n\n Question: {query} \n\n Answer:"] - node_type: generator strategy: metrics: - metric_name: bleu - metric_name: meteor - metric_name: rouge - metric_name: sem_score embedding_model: openai speed_threshold: 10 modules: - module_type: llama_index_llm llm: [openai] model: [gpt-4o-mini] temperature: [0.5, 1.0]123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102node_lines:- node_line_name: retrieve_node_line # Arbitrary node line name nodes: - node_type: retrieval strategy: metrics: [ retrieval_f1, retrieval_recall, retrieval_precision, retrieval_ndcg, retrieval_map, retrieval_mrr ] speed_threshold: 10 top_k: 10 modules: - module_type: bm25 bm25_tokenizer: [ porter_stemmer, space, gpt2 ] - module_type: vectordb embedding_model: openai embedding_batch: 256 - module_type: hybrid_rrf weight_range: (4,80) - module_type: hybrid_cc normalize_method: [ mm, tmm, z, dbsf ] weight_range: (0.0, 1.0) test_weight_size: 101 - node_type: passage_augmenter strategy: metrics: [ retrieval_f1, retrieval_recall, retrieval_precision ] speed_threshold: 5 top_k: 5 embedding_model: openai modules: - module_type: pass_passage_augmenter - module_type: prev_next_augmenter mode: next - node_type: passage_reranker strategy: metrics: [retrieval_f1, retrieval_recall, retrieval_precision] speed_threshold: 10 top_k: 5 modules: - module_type: pass_reranker - module_type: tart - module_type: monot5 - module_type: upr - module_type: cohere_reranker - module_type: rankgpt - module_type: jina_reranker - module_type: colbert_reranker - module_type: sentence_transformer_reranker - module_type: flag_embedding_reranker - module_type: flag_embedding_llm_reranker - module_type: time_reranker - module_type: openvino_reranker - module_type: voyageai_reranker - module_type: mixedbreadai_reranker - node_type: passage_filter strategy: metrics: [ retrieval_f1, retrieval_recall, retrieval_precision ] speed_threshold: 5 modules: - module_type: pass_passage_filter - module_type: similarity_threshold_cutoff threshold: 0.85 - module_type: similarity_percentile_cutoff percentile: 0.6 - module_type: threshold_cutoff threshold: 0.85 - module_type: percentile_cutoff percentile: 0.6- node_line_name: post_retrieve_node_line # Arbitrary node line name nodes: - node_type: prompt_maker strategy: metrics: - metric_name: bleu - metric_name: meteor - metric_name: rouge - metric_name: sem_score embedding_model: openai speed_threshold: 10 generator_modules: - module_type: llama_index_llm llm: openai model: [gpt-4o-mini] modules: - module_type: fstring prompt: ["Tell me something about the question: {query} \n\n {retrieved_contents}", "Question: {query} \n Something to read: {retrieved_contents} \n What's your answer?"] - module_type: long_context_reorder prompt: [ "Tell me something about the question: {query} \n\n {retrieved_contents}", "Question: {query} \n Something to read: {retrieved_contents} \n What's your answer?" ] - node_type: generator strategy: metrics: - metric_name: bleu - metric_name: meteor - metric_name: rouge - metric_name: sem_score embedding_model: openai speed_threshold: 10 modules: - module_type: llama_index_llm llm: [openai] model: [gpt-4o-mini] temperature: [0.5, 1.0]123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100node_lines:- node_line_name: retrieve_node_line # Arbitrary node line name nodes: - node_type: retrieval strategy: metrics: [ retrieval_f1, retrieval_recall, retrieval_precision, retrieval_ndcg, retrieval_map, retrieval_mrr ] speed_threshold: 10 top_k: 10 modules: - module_type: bm25 bm25_tokenizer: [ ko_kiwi ] - module_type: vectordb embedding_model: openai embedding_batch: 256 - module_type: hybrid_rrf weight_range: (4,80) - module_type: hybrid_cc normalize_method: [ mm, tmm, z, dbsf ] weight_range: (0.0, 1.0) test_weight_size: 101 - node_type: passage_augmenter strategy: metrics: [ retrieval_f1, retrieval_recall, retrieval_precision ] speed_threshold: 5 top_k: 5 embedding_model: openai modules: - module_type: pass_passage_augmenter - module_type: prev_next_augmenter mode: next - node_type: passage_reranker strategy: metrics: [retrieval_f1, retrieval_recall, retrieval_precision] speed_threshold: 10 top_k: 5 modules: - module_type: pass_reranker - module_type: tart - module_type: monot5 - module_type: upr - module_type: cohere_reranker - module_type: rankgpt - module_type: jina_reranker - module_type: colbert_reranker - module_type: sentence_transformer_reranker - module_type: flag_embedding_reranker - module_type: flag_embedding_llm_reranker - module_type: time_reranker - module_type: openvino_reranker - module_type: voyageai_reranker - module_type: mixedbreadai_reranker - node_type: passage_filter strategy: metrics: [ retrieval_f1, retrieval_recall, retrieval_precision ] speed_threshold: 5 modules: - module_type: pass_passage_filter - module_type: similarity_threshold_cutoff threshold: 0.85 - module_type: similarity_percentile_cutoff percentile: 0.6 - module_type: threshold_cutoff threshold: 0.85 - module_type: percentile_cutoff percentile: 0.6- node_line_name: post_retrieve_node_line # Arbitrary node line name nodes: - node_type: prompt_maker strategy: metrics: - metric_name: bleu - metric_name: meteor - metric_name: rouge - metric_name: sem_score embedding_model: openai speed_threshold: 10 generator_modules: - module_type: llama_index_llm llm: openai model: [gpt-4o-mini] modules: - module_type: fstring prompt: ["주어진 passage만을 이용하여 question에 따라 답하시오 passage: {retrieved_contents} \n\n Question: {query} \n\n Answer:"] - module_type: long_context_reorder prompt: ["주어진 passage만을 이용하여 question에 따라 답하시오 passage: {retrieved_contents} \n\n Question: {query} \n\n Answer:"] - node_type: generator strategy: metrics: - metric_name: bleu - metric_name: meteor - metric_name: rouge - metric_name: sem_score embedding_model: openai speed_threshold: 10 modules: - module_type: llama_index_llm llm: [openai] model: [gpt-4o-mini] temperature: [0.5, 1.0]123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144node_lines:- node_line_name: pre_retrieve_node_line # Arbitrary node line name nodes: - node_type: query_expansion strategy: metrics: [retrieval_f1, retrieval_recall, retrieval_precision] speed_threshold: 10 top_k: 10 retrieval_modules: - module_type: bm25 bm25_tokenizer: [ porter_stemmer, space, gpt2 ] - module_type: vectordb embedding_model: openai modules: - module_type: pass_query_expansion - module_type: query_decompose generator_module_type: llama_index_llm llm: openai model: [ gpt-4o-mini ] - module_type: hyde generator_module_type: llama_index_llm llm: openai model: [ gpt-4o-mini ] max_token: 64 - module_type: multi_query_expansion generator_module_type: llama_index_llm llm: openai temperature: [ 0.2, 1.0 ]- node_line_name: retrieve_node_line # Arbitrary node line name nodes: - node_type: retrieval strategy: metrics: [ retrieval_f1, retrieval_recall, retrieval_precision, retrieval_ndcg, retrieval_map, retrieval_mrr ] speed_threshold: 10 top_k: 10 modules: - module_type: bm25 bm25_tokenizer: [ porter_stemmer, space, gpt2 ] - module_type: vectordb embedding_model: openai embedding_batch: 256 - module_type: hybrid_rrf weight_range: (4,80) - module_type: hybrid_cc normalize_method: [ mm, tmm, z, dbsf ] weight_range: (0.0, 1.0) test_weight_size: 101 - node_type: passage_augmenter strategy: metrics: [ retrieval_f1, retrieval_recall, retrieval_precision ] speed_threshold: 5 top_k: 5 embedding_model: openai modules: - module_type: pass_passage_augmenter - module_type: prev_next_augmenter mode: next - node_type: passage_reranker strategy: metrics: [retrieval_f1, retrieval_recall, retrieval_precision] speed_threshold: 10 top_k: 5 modules: - module_type: pass_reranker - module_type: tart - module_type: monot5 - module_type: upr - module_type: cohere_reranker - module_type: rankgpt - module_type: jina_reranker - module_type: colbert_reranker - module_type: sentence_transformer_reranker - module_type: flag_embedding_reranker - module_type: flag_embedding_llm_reranker - module_type: time_reranker - module_type: openvino_reranker - module_type: voyageai_reranker - module_type: mixedbreadai_reranker - node_type: passage_filter strategy: metrics: [ retrieval_f1, retrieval_recall, retrieval_precision ] speed_threshold: 5 modules: - module_type: pass_passage_filter - module_type: similarity_threshold_cutoff threshold: 0.85 - module_type: similarity_percentile_cutoff percentile: 0.6 - module_type: threshold_cutoff threshold: 0.85 - module_type: percentile_cutoff percentile: 0.6 - node_type: passage_compressor strategy: metrics: [retrieval_token_f1, retrieval_token_recall, retrieval_token_precision] speed_threshold: 10 modules: - module_type: pass_compressor - module_type: tree_summarize llm: openai model: gpt-4o-mini - module_type: refine llm: openai model: gpt-4o-mini - module_type: longllmlingua- node_line_name: post_retrieve_node_line # Arbitrary node line name nodes: - node_type: prompt_maker strategy: metrics: - metric_name: bleu - metric_name: meteor - metric_name: rouge - metric_name: sem_score embedding_model: openai - metric_name: g_eval speed_threshold: 10 generator_modules: - module_type: llama_index_llm llm: openai model: [gpt-4o-mini] modules: - module_type: fstring prompt: ["Tell me something about the question: {query} \n\n {retrieved_contents}", "Question: {query} \n Something to read: {retrieved_contents} \n What's your answer?"] - module_type: long_context_reorder prompt: [ "Tell me something about the question: {query} \n\n {retrieved_contents}", "Question: {query} \n Something to read: {retrieved_contents} \n What's your answer?" ] - node_type: generator strategy: metrics: - metric_name: bleu - metric_name: meteor - metric_name: rouge - metric_name: sem_score embedding_model: openai - metric_name: g_eval speed_threshold: 10 modules: - module_type: llama_index_llm llm: [openai] model: [gpt-4o-mini] temperature: [0.5, 1.0]123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115node_lines:- node_line_name: retrieve_node_line # Arbitrary node line name nodes: - node_type: retrieval strategy: metrics: [ retrieval_f1, retrieval_recall, retrieval_precision, retrieval_ndcg, retrieval_map, retrieval_mrr ] speed_threshold: 10 top_k: 10 modules: - module_type: bm25 bm25_tokenizer: [ porter_stemmer, space, gpt2 ] - module_type: vectordb embedding_model: openai embedding_batch: 256 - module_type: hybrid_rrf weight_range: (4,80) - module_type: hybrid_cc normalize_method: [ mm, tmm, z, dbsf ] weight_range: (0.0, 1.0) test_weight_size: 101 - node_type: passage_augmenter strategy: metrics: [ retrieval_f1, retrieval_recall, retrieval_precision ] speed_threshold: 5 top_k: 5 embedding_model: openai modules: - module_type: pass_passage_augmenter - module_type: prev_next_augmenter mode: next - node_type: passage_reranker strategy: metrics: [retrieval_f1, retrieval_recall, retrieval_precision] speed_threshold: 10 top_k: 5 modules: - module_type: pass_reranker - module_type: tart - module_type: monot5 - module_type: upr - module_type: cohere_reranker - module_type: rankgpt - module_type: jina_reranker - module_type: colbert_reranker - module_type: sentence_transformer_reranker - module_type: flag_embedding_reranker - module_type: flag_embedding_llm_reranker - module_type: time_reranker - module_type: openvino_reranker - module_type: voyageai_reranker - module_type: mixedbreadai_reranker - node_type: passage_filter strategy: metrics: [ retrieval_f1, retrieval_recall, retrieval_precision ] speed_threshold: 5 modules: - module_type: pass_passage_filter - module_type: similarity_threshold_cutoff threshold: 0.85 - module_type: similarity_percentile_cutoff percentile: 0.6 - module_type: threshold_cutoff threshold: 0.85 - module_type: percentile_cutoff percentile: 0.6 - node_type: passage_compressor strategy: metrics: [retrieval_token_f1, retrieval_token_recall, retrieval_token_precision] speed_threshold: 10 modules: - module_type: pass_compressor - module_type: tree_summarize llm: openai model: gpt-4o-mini - module_type: refine llm: openai model: gpt-4o-mini - module_type: longllmlingua- node_line_name: post_retrieve_node_line # Arbitrary node line name nodes: - node_type: prompt_maker strategy: metrics: - metric_name: bleu - metric_name: meteor - metric_name: rouge - metric_name: sem_score embedding_model: openai speed_threshold: 10 generator_modules: - module_type: llama_index_llm llm: openai model: [gpt-4o-mini] modules: - module_type: fstring prompt: ["Tell me something about the question: {query} \n\n {retrieved_contents}", "Question: {query} \n Something to read: {retrieved_contents} \n What's your answer?"] - module_type: long_context_reorder prompt: [ "Tell me something about the question: {query} \n\n {retrieved_contents}", "Question: {query} \n Something to read: {retrieved_contents} \n What's your answer?" ] - node_type: generator strategy: metrics: - metric_name: bleu - metric_name: meteor - metric_name: rouge - metric_name: sem_score embedding_model: openai speed_threshold: 10 modules: - module_type: llama_index_llm llm: [openai] model: [gpt-4o-mini] temperature: [0.5, 1.0]123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133node_lines:- node_line_name: retrieve_node_line # Arbitrary node line name nodes: - node_type: retrieval strategy: metrics: [ retrieval_f1, retrieval_recall, retrieval_precision, retrieval_ndcg, retrieval_map, retrieval_mrr ] speed_threshold: 10 top_k: 10 modules: - module_type: bm25 bm25_tokenizer: [ ko_kiwi ] - module_type: vectordb embedding_model: openai embedding_batch: 256 - module_type: hybrid_rrf weight_range: (4,80) - module_type: hybrid_cc normalize_method: [ mm, tmm, z, dbsf ] weight_range: (0.0, 1.0) test_weight_size: 101 - node_type: passage_augmenter strategy: metrics: [ retrieval_f1, retrieval_recall, retrieval_precision ] speed_threshold: 5 top_k: 5 embedding_model: openai modules: - module_type: pass_passage_augmenter - module_type: prev_next_augmenter mode: next - node_type: passage_reranker strategy: metrics: [retrieval_f1, retrieval_recall, retrieval_precision] speed_threshold: 10 top_k: 5 modules: - module_type: pass_reranker - module_type: tart - module_type: monot5 - module_type: upr - module_type: cohere_reranker - module_type: rankgpt - module_type: jina_reranker - module_type: colbert_reranker - module_type: sentence_transformer_reranker - module_type: flag_embedding_reranker - module_type: flag_embedding_llm_reranker - module_type: time_reranker - module_type: openvino_reranker - module_type: voyageai_reranker - module_type: mixedbreadai_reranker - node_type: passage_filter strategy: metrics: [ retrieval_f1, retrieval_recall, retrieval_precision ] speed_threshold: 5 modules: - module_type: pass_passage_filter - module_type: similarity_threshold_cutoff threshold: 0.85 - module_type: similarity_percentile_cutoff percentile: 0.6 - module_type: threshold_cutoff threshold: 0.85 - module_type: percentile_cutoff percentile: 0.6 - node_type: passage_compressor strategy: metrics: [retrieval_token_f1, retrieval_token_recall, retrieval_token_precision] speed_threshold: 10 modules: - module_type: pass_compressor - module_type: tree_summarize llm: openai model: gpt-4o-mini prompt: | 여러 문맥 정보는 다음과 같습니다.\n ---------------------\n {context_str}\n ---------------------\n 사전 지식이 아닌 여러 정보가 주어졌습니다, 질문에 대답하세요.\n 질문: {query_str}\n 답변: - module_type: refine llm: openai model: gpt-4o-mini prompt: | 원래 질문은 다음과 같습니다: {query_str} 기존 답변은 다음과 같습니다: {existing_answer} 아래에서 기존 답변을 정제할 수 있는 기회가 있습니다. (필요한 경우에만) 아래에 몇 가지 맥락을 추가하여 기존 답변을 정제할 수 있습니다. ------------ {context_msg} ------------ 새로운 문맥이 주어지면 기존 답변을 수정하여 질문에 대한 답변을 정제합니다. 맥락이 쓸모 없다면, 기존 답변을 그대로 답변하세요. 정제된 답변: - module_type: longllmlingua- node_line_name: post_retrieve_node_line # Arbitrary node line name nodes: - node_type: prompt_maker strategy: metrics: - metric_name: bleu - metric_name: meteor - metric_name: rouge - metric_name: sem_score embedding_model: openai speed_threshold: 10 generator_modules: - module_type: llama_index_llm llm: openai model: [gpt-4o-mini] modules: - module_type: fstring prompt: ["주어진 passage만을 이용하여 question에 따라 답하시오 passage: {retrieved_contents} \n\n Question: {query} \n\n Answer:"] - module_type: long_context_reorder prompt: ["주어진 passage만을 이용하여 question에 따라 답하시오 passage: {retrieved_contents} \n\n Question: {query} \n\n Answer:"] - node_type: generator strategy: metrics: - metric_name: bleu - metric_name: meteor - metric_name: rouge - metric_name: sem_score embedding_model: openai speed_threshold: 10 modules: - module_type: llama_index_llm llm: [openai] model: [gpt-4o-mini] temperature: [0.5, 1.0]123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081node_lines:- node_line_name: retrieve_node_line # Arbitrary node line name nodes: - node_type: retrieval strategy: metrics: [ retrieval_f1, retrieval_recall, retrieval_precision, retrieval_ndcg, retrieval_map, retrieval_mrr ] speed_threshold: 10 top_k: 10 modules: - module_type: bm25 bm25_tokenizer: [ porter_stemmer, space, gpt2 ] - module_type: vectordb embedding_model: openai embedding_batch: 256 - module_type: hybrid_rrf weight_range: (4,80) - module_type: hybrid_cc normalize_method: [ mm, tmm, z, dbsf ] weight_range: (0.0, 1.0) test_weight_size: 101 - node_type: passage_augmenter strategy: metrics: [ retrieval_f1, retrieval_recall, retrieval_precision ] speed_threshold: 5 top_k: 5 embedding_model: openai modules: - module_type: pass_passage_augmenter - module_type: prev_next_augmenter mode: next - node_type: passage_filter strategy: metrics: [ retrieval_f1, retrieval_recall, retrieval_precision ] speed_threshold: 5 modules: - module_type: pass_passage_filter - module_type: similarity_threshold_cutoff threshold: 0.85 - module_type: similarity_percentile_cutoff percentile: 0.6 - module_type: threshold_cutoff threshold: 0.85 - module_type: percentile_cutoff percentile: 0.6- node_line_name: post_retrieve_node_line # Arbitrary node line name nodes: - node_type: prompt_maker strategy: metrics: - metric_name: bleu - metric_name: meteor - metric_name: rouge - metric_name: sem_score embedding_model: openai speed_threshold: 10 generator_modules: - module_type: llama_index_llm llm: openai model: [gpt-4o-mini] modules: - module_type: fstring prompt: ["Tell me something about the question: {query} \n\n {retrieved_contents}", "Question: {query} \n Something to read: {retrieved_contents} \n What's your answer?"] - module_type: long_context_reorder prompt: [ "Tell me something about the question: {query} \n\n {retrieved_contents}", "Question: {query} \n Something to read: {retrieved_contents} \n What's your answer?" ] - node_type: generator strategy: metrics: - metric_name: bleu - metric_name: meteor - metric_name: rouge - metric_name: sem_score embedding_model: openai speed_threshold: 10 modules: - module_type: llama_index_llm llm: [openai] model: [gpt-4o-mini] temperature: [0.5, 1.0]12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879node_lines:- node_line_name: retrieve_node_line # Arbitrary node line name nodes: - node_type: retrieval strategy: metrics: [ retrieval_f1, retrieval_recall, retrieval_precision, retrieval_ndcg, retrieval_map, retrieval_mrr ] speed_threshold: 10 top_k: 10 modules: - module_type: bm25 bm25_tokenizer: [ ko_kiwi ] - module_type: vectordb embedding_model: openai embedding_batch: 256 - module_type: hybrid_rrf weight_range: (4,80) - module_type: hybrid_cc normalize_method: [ mm, tmm, z, dbsf ] weight_range: (0.0, 1.0) test_weight_size: 101 - node_type: passage_augmenter strategy: metrics: [ retrieval_f1, retrieval_recall, retrieval_precision ] speed_threshold: 5 top_k: 5 embedding_model: openai modules: - module_type: pass_passage_augmenter - module_type: prev_next_augmenter mode: next - node_type: passage_filter strategy: metrics: [ retrieval_f1, retrieval_recall, retrieval_precision ] speed_threshold: 5 modules: - module_type: pass_passage_filter - module_type: similarity_threshold_cutoff threshold: 0.85 - module_type: similarity_percentile_cutoff percentile: 0.6 - module_type: threshold_cutoff threshold: 0.85 - module_type: percentile_cutoff percentile: 0.6- node_line_name: post_retrieve_node_line # Arbitrary node line name nodes: - node_type: prompt_maker strategy: metrics: - metric_name: bleu - metric_name: meteor - metric_name: rouge - metric_name: sem_score embedding_model: openai speed_threshold: 10 generator_modules: - module_type: llama_index_llm llm: openai model: [gpt-4o-mini] modules: - module_type: fstring prompt: ["주어진 passage만을 이용하여 question에 따라 답하시오 passage: {retrieved_contents} \n\n Question: {query} \n\n Answer:"] - module_type: long_context_reorder prompt: ["주어진 passage만을 이용하여 question에 따라 답하시오 passage: {retrieved_contents} \n\n Question: {query} \n\n Answer:"] - node_type: generator strategy: metrics: - metric_name: bleu - metric_name: meteor - metric_name: rouge - metric_name: sem_score embedding_model: openai speed_threshold: 10 modules: - module_type: llama_index_llm llm: [openai] model: [gpt-4o-mini] temperature: [0.5, 1.0]123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123node_lines:- node_line_name: pre_retrieve_node_line # Arbitrary node line name nodes: - node_type: query_expansion strategy: metrics: [retrieval_f1, retrieval_recall, retrieval_precision] speed_threshold: 10 top_k: 10 retrieval_modules: - module_type: bm25 bm25_tokenizer: [ porter_stemmer, space, gpt2 ] - module_type: vectordb embedding_model: openai modules: - module_type: pass_query_expansion - module_type: query_decompose generator_module_type: llama_index_llm llm: openai model: [ gpt-4o-mini ] - module_type: hyde generator_module_type: llama_index_llm llm: openai model: [ gpt-4o-mini ] max_token: 64 - module_type: multi_query_expansion generator_module_type: llama_index_llm llm: openai temperature: [ 0.2, 1.0 ]- node_line_name: retrieve_node_line # Arbitrary node line name nodes: - node_type: retrieval strategy: metrics: [ retrieval_f1, retrieval_recall, retrieval_precision, retrieval_ndcg, retrieval_map, retrieval_mrr ] speed_threshold: 10 top_k: 10 modules: - module_type: bm25 bm25_tokenizer: [ porter_stemmer, space, gpt2 ] - module_type: vectordb embedding_model: openai embedding_batch: 256 - module_type: hybrid_rrf weight_range: (4,80) - module_type: hybrid_cc normalize_method: [ mm, tmm, z, dbsf ] weight_range: (0.0, 1.0) test_weight_size: 101 - node_type: passage_augmenter strategy: metrics: [ retrieval_f1, retrieval_recall, retrieval_precision ] speed_threshold: 5 top_k: 5 embedding_model: openai modules: - module_type: pass_passage_augmenter - module_type: prev_next_augmenter mode: next - node_type: passage_filter strategy: metrics: [ retrieval_f1, retrieval_recall, retrieval_precision ] speed_threshold: 5 modules: - module_type: pass_passage_filter - module_type: similarity_threshold_cutoff threshold: 0.85 - module_type: similarity_percentile_cutoff percentile: 0.6 - module_type: threshold_cutoff threshold: 0.85 - module_type: percentile_cutoff percentile: 0.6 - node_type: passage_compressor strategy: metrics: [retrieval_token_f1, retrieval_token_recall, retrieval_token_precision] speed_threshold: 10 modules: - module_type: pass_compressor - module_type: tree_summarize llm: openai model: gpt-4o-mini - module_type: refine llm: openai model: gpt-4o-mini - module_type: longllmlingua- node_line_name: post_retrieve_node_line # Arbitrary node line name nodes: - node_type: prompt_maker strategy: metrics: - metric_name: bleu - metric_name: meteor - metric_name: rouge - metric_name: sem_score embedding_model: openai - metric_name: g_eval speed_threshold: 10 generator_modules: - module_type: llama_index_llm llm: openai model: [gpt-4o-mini] modules: - module_type: fstring prompt: ["Tell me something about the question: {query} \n\n {retrieved_contents}", "Question: {query} \n Something to read: {retrieved_contents} \n What's your answer?"] - module_type: long_context_reorder prompt: [ "Tell me something about the question: {query} \n\n {retrieved_contents}", "Question: {query} \n Something to read: {retrieved_contents} \n What's your answer?" ] - node_type: generator strategy: metrics: - metric_name: bleu - metric_name: meteor - metric_name: rouge - metric_name: sem_score embedding_model: openai - metric_name: g_eval speed_threshold: 10 modules: - module_type: llama_index_llm llm: [openai] model: [gpt-4o-mini] temperature: [0.5, 1.0]12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394node_lines:- node_line_name: retrieve_node_line # Arbitrary node line name nodes: - node_type: retrieval strategy: metrics: [ retrieval_f1, retrieval_recall, retrieval_precision, retrieval_ndcg, retrieval_map, retrieval_mrr ] speed_threshold: 10 top_k: 10 modules: - module_type: bm25 bm25_tokenizer: [ porter_stemmer, space, gpt2 ] - module_type: vectordb embedding_model: openai embedding_batch: 256 - module_type: hybrid_rrf weight_range: (4,80) - module_type: hybrid_cc normalize_method: [ mm, tmm, z, dbsf ] weight_range: (0.0, 1.0) test_weight_size: 101 - node_type: passage_augmenter strategy: metrics: [ retrieval_f1, retrieval_recall, retrieval_precision ] speed_threshold: 5 top_k: 5 embedding_model: openai modules: - module_type: pass_passage_augmenter - module_type: prev_next_augmenter mode: next - node_type: passage_filter strategy: metrics: [ retrieval_f1, retrieval_recall, retrieval_precision ] speed_threshold: 5 modules: - module_type: pass_passage_filter - module_type: similarity_threshold_cutoff threshold: 0.85 - module_type: similarity_percentile_cutoff percentile: 0.6 - module_type: threshold_cutoff threshold: 0.85 - module_type: percentile_cutoff percentile: 0.6 - node_type: passage_compressor strategy: metrics: [retrieval_token_f1, retrieval_token_recall, retrieval_token_precision] speed_threshold: 10 modules: - module_type: pass_compressor - module_type: tree_summarize llm: openai model: gpt-4o-mini - module_type: refine llm: openai model: gpt-4o-mini - module_type: longllmlingua- node_line_name: post_retrieve_node_line # Arbitrary node line name nodes: - node_type: prompt_maker strategy: metrics: - metric_name: bleu - metric_name: meteor - metric_name: rouge - metric_name: sem_score embedding_model: openai speed_threshold: 10 generator_modules: - module_type: llama_index_llm llm: openai model: [gpt-4o-mini] modules: - module_type: fstring prompt: ["Tell me something about the question: {query} \n\n {retrieved_contents}", "Question: {query} \n Something to read: {retrieved_contents} \n What's your answer?"] - module_type: long_context_reorder prompt: [ "Tell me something about the question: {query} \n\n {retrieved_contents}", "Question: {query} \n Something to read: {retrieved_contents} \n What's your answer?" ] - node_type: generator strategy: metrics: - metric_name: bleu - metric_name: meteor - metric_name: rouge - metric_name: sem_score embedding_model: openai speed_threshold: 10 modules: - module_type: llama_index_llm llm: [openai] model: [gpt-4o-mini] temperature: [0.5, 1.0]123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112node_lines:- node_line_name: retrieve_node_line # Arbitrary node line name nodes: - node_type: retrieval strategy: metrics: [ retrieval_f1, retrieval_recall, retrieval_precision, retrieval_ndcg, retrieval_map, retrieval_mrr ] speed_threshold: 10 top_k: 10 modules: - module_type: bm25 bm25_tokenizer: [ ko_kiwi ] - module_type: vectordb embedding_model: openai embedding_batch: 256 - module_type: hybrid_rrf weight_range: (4,80) - module_type: hybrid_cc normalize_method: [ mm, tmm, z, dbsf ] weight_range: (0.0, 1.0) test_weight_size: 101 - node_type: passage_augmenter strategy: metrics: [ retrieval_f1, retrieval_recall, retrieval_precision ] speed_threshold: 5 top_k: 5 embedding_model: openai modules: - module_type: pass_passage_augmenter - module_type: prev_next_augmenter mode: next - node_type: passage_filter strategy: metrics: [ retrieval_f1, retrieval_recall, retrieval_precision ] speed_threshold: 5 modules: - module_type: pass_passage_filter - module_type: similarity_threshold_cutoff threshold: 0.85 - module_type: similarity_percentile_cutoff percentile: 0.6 - module_type: threshold_cutoff threshold: 0.85 - module_type: percentile_cutoff percentile: 0.6 - node_type: passage_compressor strategy: metrics: [retrieval_token_f1, retrieval_token_recall, retrieval_token_precision] speed_threshold: 10 modules: - module_type: pass_compressor - module_type: tree_summarize llm: openai model: gpt-4o-mini prompt: | 여러 문맥 정보는 다음과 같습니다.\n ---------------------\n {context_str}\n ---------------------\n 사전 지식이 아닌 여러 정보가 주어졌습니다, 질문에 대답하세요.\n 질문: {query_str}\n 답변: - module_type: refine llm: openai model: gpt-4o-mini prompt: | 원래 질문은 다음과 같습니다: {query_str} 기존 답변은 다음과 같습니다: {existing_answer} 아래에서 기존 답변을 정제할 수 있는 기회가 있습니다. (필요한 경우에만) 아래에 몇 가지 맥락을 추가하여 기존 답변을 정제할 수 있습니다. ------------ {context_msg} ------------ 새로운 문맥이 주어지면 기존 답변을 수정하여 질문에 대한 답변을 정제합니다. 맥락이 쓸모 없다면, 기존 답변을 그대로 답변하세요. 정제된 답변: - module_type: longllmlingua- node_line_name: post_retrieve_node_line # Arbitrary node line name nodes: - node_type: prompt_maker strategy: metrics: - metric_name: bleu - metric_name: meteor - metric_name: rouge - metric_name: sem_score embedding_model: openai speed_threshold: 10 generator_modules: - module_type: llama_index_llm llm: openai model: [gpt-4o-mini] modules: - module_type: fstring prompt: ["주어진 passage만을 이용하여 question에 따라 답하시오 passage: {retrieved_contents} \n\n Question: {query} \n\n Answer:"] - module_type: long_context_reorder prompt: ["주어진 passage만을 이용하여 question에 따라 답하시오 passage: {retrieved_contents} \n\n Question: {query} \n\n Answer:"] - node_type: generator strategy: metrics: - metric_name: bleu - metric_name: meteor - metric_name: rouge - metric_name: sem_score embedding_model: openai speed_threshold: 10 modules: - module_type: llama_index_llm llm: [openai] model: [gpt-4o-mini] temperature: [0.5, 1.0]12345678910111213141516171819202122232425node_lines:- node_line_name: retrieve_node_line # Arbitrary node line name nodes: - node_type: retrieval strategy: metrics: [retrieval_f1, retrieval_recall, retrieval_precision] top_k: 3 modules: - module_type: vectordb embedding_model: openai- node_line_name: post_retrieve_node_line # Arbitrary node line name nodes: - node_type: prompt_maker strategy: metrics: [bleu, meteor, rouge] modules: - module_type: fstring prompt: "Read the passages and answer the given question. \n Question: {query} \n Passage: {retrieved_contents} \n Answer : " - node_type: generator strategy: metrics: [bleu, meteor, rouge] modules: - module_type: llama_index_llm llm: openai model: [gpt-4o-mini]1234567891011121314151617181920212223242526node_lines:- node_line_name: retrieve_node_line # Arbitrary node line name nodes: - node_type: retrieval strategy: metrics: [retrieval_f1, retrieval_recall, retrieval_precision] top_k: 3 modules: - module_type: vectordb embedding_model: openai- node_line_name: post_retrieve_node_line # Arbitrary node line name nodes: - node_type: prompt_maker strategy: metrics: [bleu, meteor, rouge] modules: - module_type: fstring prompt: "주어진 passage만을 이용하여 question에 따라 답하시오 passage: {retrieved_contents} \n\n Question: {query} \n\n Answer:" - node_type: generator strategy: metrics: [bleu, meteor, rouge] modules: - module_type: llama_index_llm llm: openai model: [gpt-4o-mini] batch: 2123version https://git-lfs.github.com/spec/v1oid sha256:0fe74568301d61265ce87a76fb7b609f0480e018170d6c275f21c382b1fcb4besize 111931123version https://git-lfs.github.com/spec/v1oid sha256:70fa30e911d6b748f44e768fe593b6227ba77d6461395e36dc9caf3251f86ab8size 992812345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697import osimport uuidfrom typing import List, Dict, Optional
import pandas as pdfrom autorag.deploy import GradioRunnerfrom autorag.deploy.api import RetrievedPassagefrom autorag.nodes.generator.base import BaseGeneratorfrom autorag.utils import fetch_contents
empty_retrieved_passage = RetrievedPassage( content="", doc_id="", filepath=None, file_page=None, start_idx=None, end_idx=None)
class GradioStreamRunner(GradioRunner): def __init__(self, config: Dict, project_dir: Optional[str] = None): super().__init__(config, project_dir)
data_dir = os.path.join(project_dir, "data") self.corpus_df = pd.read_parquet( os.path.join(data_dir, "corpus.parquet"), engine="pyarrow" )
def stream_run(self, query: str): previous_result = pd.DataFrame( { "qid": str(uuid.uuid4()), "query": [query], "retrieval_gt": [[]], "generation_gt": [""], } ) # pseudo qa data for execution
for module_instance, module_param in zip( self.module_instances, self.module_params ): if not isinstance(module_instance, BaseGenerator): new_result = module_instance.pure( previous_result=previous_result, **module_param ) duplicated_columns = previous_result.columns.intersection( new_result.columns ) drop_previous_result = previous_result.drop( columns=duplicated_columns ) previous_result = pd.concat( [drop_previous_result, new_result], axis=1 ) else: # retrieved_passages = self.extract_retrieve_passage( # previous_result # ) # yield "", retrieved_passages # Start streaming of the result assert len(previous_result) == 1 prompt: str = previous_result["prompts"].tolist()[0] for delta in module_instance.stream(prompt=prompt, **module_param): yield delta, [empty_retrieved_passage]
def extract_retrieve_passage(self, df: pd.DataFrame) -> List[RetrievedPassage]: retrieved_ids: List[str] = df["retrieved_ids"].tolist()[0] contents = fetch_contents(self.corpus_df, [retrieved_ids])[0] if "path" in self.corpus_df.columns: paths = fetch_contents(self.corpus_df, [retrieved_ids], column_name="path")[ 0 ] else: paths = [None] * len(retrieved_ids) metadatas = fetch_contents( self.corpus_df, [retrieved_ids], column_name="metadata" )[0] if "start_end_idx" in self.corpus_df.columns: start_end_indices = fetch_contents( self.corpus_df, [retrieved_ids], column_name="start_end_idx" )[0] else: start_end_indices = [None] * len(retrieved_ids) return list( map( lambda content, doc_id, path, metadata, start_end_idx: RetrievedPassage( content=content, doc_id=doc_id, filepath=path, file_page=metadata.get("page", None), start_idx=start_end_idx[0] if start_end_idx else None, end_idx=start_end_idx[1] if start_end_idx else None, ), contents, retrieved_ids, paths, metadatas, start_end_indices, ) )123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326import osimport pathlib
import gradio as grimport pandas as pdimport yaml
from autorag.evaluator import Evaluator
from src.runner import GradioStreamRunner
root_dir = os.path.dirname(os.path.realpath(__file__))
# Paths to example filesconfig_dir = os.path.join(root_dir, "config")
# Non-GPU Examplesnon_gpu = os.path.join(config_dir, "non_gpu")simple_openai = os.path.join(non_gpu, "simple_openai.yaml")simple_openai_korean = os.path.join(non_gpu, "simple_openai_korean.yaml")compact_openai = os.path.join(non_gpu, "compact_openai.yaml")compact_openai_korean = os.path.join(non_gpu, "compact_openai_korean.yaml")half_openai = os.path.join(non_gpu, "half_openai.yaml")half_openai_korean = os.path.join(non_gpu, "half_openai_korean.yaml")full_openai = os.path.join(non_gpu, "full_no_rerank_openai.yaml")
non_gpu_examples_list = [ simple_openai, simple_openai_korean, compact_openai, compact_openai_korean, half_openai, half_openai_korean, full_openai]non_gpu_examples = list(map(lambda x: [x], non_gpu_examples_list))
# GPU Examplesgpu = os.path.join(config_dir, "gpu")compact_openai_gpu = os.path.join(gpu, "compact_openai.yaml")compact_openai_korean_gpu = os.path.join(gpu, "compact_openai_korean.yaml")half_openai_gpu = os.path.join(gpu, "half_openai.yaml")half_openai_korean_gpu = os.path.join(gpu, "half_openai_korean.yaml")full_openai_gpu = os.path.join(gpu, "full_no_rerank_openai.yaml")
gpu_examples_list = [ compact_openai_gpu, compact_openai_korean_gpu, half_openai_gpu, half_openai_korean_gpu, full_openai_gpu]gpu_examples = list(map(lambda x: [x], gpu_examples_list))
# GPU + APIgpu_api = os.path.join(config_dir, "gpu_api")compact_openai_gpu_api = os.path.join(gpu_api, "compact_openai.yaml")compact_openai_korean_gpu_api = os.path.join(gpu_api, "compact_openai_korean.yaml")half_openai_gpu_api = os.path.join(gpu_api, "half_openai.yaml")half_openai_korean_gpu_api = os.path.join(gpu_api, "half_openai_korean.yaml")full_openai_gpu_api = os.path.join(gpu_api, "full_no_rerank_openai.yaml")
gpu_api_examples_list = [ compact_openai_gpu_api, compact_openai_korean_gpu_api, half_openai_gpu_api, half_openai_korean_gpu_api, full_openai_gpu_api]gpu_api_examples = list(map(lambda x: [x], gpu_api_examples_list))
example_qa_parquet = os.path.join(root_dir, "sample_data", "qa_data_sample.parquet")example_corpus_parquet = os.path.join(root_dir, "sample_data", "corpus_data_sample.parquet")
def display_yaml(file): if file is None: return "No file uploaded" with open(file.name, "r") as f: content = yaml.safe_load(f) return yaml.dump(content, default_flow_style=False)
def display_parquet(file): if file is None: return pd.DataFrame() df = pd.read_parquet(file.name) return df
def check_files(yaml_file, qa_file, corpus_file): if yaml_file is not None and qa_file is not None and corpus_file is not None: return gr.update(visible=True) return gr.update(visible=False)
def run_trial(file, yaml_file, qa_file, corpus_file): project_dir = os.path.join(pathlib.PurePath(file.name).parent, "project") evaluator = Evaluator(qa_file, corpus_file, project_dir=project_dir)
evaluator.start_trial(yaml_file, skip_validation=True) return ("❗Trial Completed❗ " "Go to Chat Tab to start the conversation")
def set_environment_variable(api_name, api_key): if api_name and api_key: try: os.environ[api_name] = api_key return "✅ Setting Complete ✅" except Exception as e: return f"Error setting environment variable: {e}" return "API Name or Key is missing"
def stream_default(file, history): # Default YAML Runner yaml_path = os.path.join(config_dir, "extracted_sample.yaml") project_dir = os.path.join( pathlib.PurePath(file.name).parent, "project" ) default_gradio_runner = GradioStreamRunner.from_yaml(yaml_path, project_dir)
history.append({"role": "assistant", "content": ""}) # Stream responses for the chatbox for default_output in default_gradio_runner.stream_run(history[-2]["content"]): stream_delta = default_output[0] history[-1]["content"] = stream_delta yield history
def stream_optimized(file, history): # Custom YAML Runner trial_dir = os.path.join(pathlib.PurePath(file.name).parent, "project", "0") custom_gradio_runner = GradioStreamRunner.from_trial_folder(trial_dir)
history.append({"role": "assistant", "content": ""}) for output in custom_gradio_runner.stream_run(history[-2]["content"]): stream_delta = output[0] history[-1]["content"] = stream_delta yield history
def user(user_message, history: list): return "", history + [{"role": "user", "content": user_message}]
with gr.Blocks(theme="earneleh/paris") as demo: gr.Markdown("# AutoRAG Trial & Debugging Interface")
with gr.Tabs() as tabs: with gr.Tab("Environment Variables"): gr.Markdown("## Environment Variables") with gr.Row(): # Arrange horizontally with gr.Column(scale=3): api_name = gr.Textbox( label="Environment Variable Name", type="text", placeholder="Enter your Environment Variable Name", ) gr.Examples(examples=[["OPENAI_API_KEY"]], inputs=api_name) with gr.Column(scale=7): api_key = gr.Textbox( label="API Key", type="password", placeholder="Enter your API Key", )
set_env_button = gr.Button("Set Environment Variable") env_output = gr.Textbox( label="Status", interactive=False )
api_key.submit( set_environment_variable, inputs=[api_name, api_key], outputs=env_output ) set_env_button.click( set_environment_variable, inputs=[api_name, api_key], outputs=env_output )
with gr.Tab("File Upload"): with gr.Row() as file_upload_row: with gr.Column(scale=3): yaml_file = gr.File( label="Upload YAML File", file_count="single", ) make_yaml_button = gr.Button("Make Your Own YAML File", link="https://tally.so/r/mBQY5N")
with gr.Column(scale=7): yaml_content = gr.Textbox(label="YAML File Content") gr.Markdown("Here is the Sample YAML File. Just click the file ❗")
gr.Markdown("### Non-GPU Examples") gr.Examples(examples=non_gpu_examples, inputs=yaml_file)
with gr.Row(): # Section for GPU examples with gr.Column(): gr.Markdown("### GPU Examples") gr.Markdown( "**⚠️ Warning**: Here are the YAML files containing the modules that use the **local model**.") gr.Markdown( "Note that if you Run_Trial in a non-GPU environment, **it can take a very long time**.") gr.Examples(examples=gpu_examples, inputs=yaml_file) make_gpu = gr.Button("Use AutoRAG GPU Feature", link="https://tally.so/r/3j7rP6")
# Section for GPU + API examples with gr.Column(): gr.Markdown("### GPU + API Examples") gr.Markdown( "**⚠️ Warning**: Here are the YAML files containing the modules that use the **local model** and **API Based Model**.") gr.Markdown("You need to set **JINA_API_KEY**, **COHERE_API_KEY**, **MXBAI_API_KEY** and **VOYAGE_API_KEY** as environment variables to use this feature. ") gr.Examples(examples=gpu_api_examples, inputs=yaml_file) gpu_api_button = gr.Button("Use AutoRAG API KEY Feature", link="https://tally.so/r/waD1Ab")
with gr.Row() as qa_upload_row: with gr.Column(scale=3): qa_file = gr.File( label="Upload qa.parquet File", file_count="single", ) # Add button for QA make_qa_button = gr.Button("Make Your Own QA Data", link="https://huggingface.co/spaces/AutoRAG/AutoRAG-data-creation")
with gr.Column(scale=7): qa_content = gr.Dataframe(label="QA Parquet File Content") gr.Markdown("Here is the Sample QA File. Just click the file ❗") gr.Examples(examples=[[example_qa_parquet]], inputs=qa_file) with gr.Row() as corpus_upload_row: with gr.Column(scale=3): corpus_file = gr.File( label="Upload corpus.parquet File", file_count="single", ) make_corpus_button = gr.Button("Make Your Own Corpus Data", link="https://huggingface.co/spaces/AutoRAG/AutoRAG-data-creation") with gr.Column(scale=7): corpus_content = gr.Dataframe(label="Corpus Parquet File Content") gr.Markdown( "Here is the Sample Corpus File. Just click the file ❗" ) gr.Examples(examples=[[example_corpus_parquet]], inputs=corpus_file)
run_trial_button = gr.Button("Run Trial", visible=False) trial_output = gr.Textbox(label="Trial Output", visible=False)
yaml_file.change(display_yaml, inputs=yaml_file, outputs=yaml_content) qa_file.change(display_parquet, inputs=qa_file, outputs=qa_content) corpus_file.change( display_parquet, inputs=corpus_file, outputs=corpus_content )
yaml_file.change( check_files, inputs=[yaml_file, qa_file, corpus_file], outputs=run_trial_button, ) qa_file.change( check_files, inputs=[yaml_file, qa_file, corpus_file], outputs=run_trial_button, ) corpus_file.change( check_files, inputs=[yaml_file, qa_file, corpus_file], outputs=run_trial_button, )
run_trial_button.click( lambda: ( gr.update(visible=False), gr.update(visible=False), gr.update(visible=False), gr.update(visible=True), ), outputs=[ file_upload_row, qa_upload_row, corpus_upload_row, trial_output, ], ) run_trial_button.click( run_trial, inputs=[yaml_file, yaml_file, qa_file, corpus_file], outputs=trial_output, )
# New Chat Tab with gr.Tab("Chat") as chat_tab: gr.Markdown("### Compare Chat Models")
question_input = gr.Textbox( label="Your Question", placeholder="Type your question here..." ) pseudo_input = gr.Textbox(label="havertz", visible=False)
with gr.Row(): # Left Chatbox (Default YAML) with gr.Column(): gr.Markdown("#### Naive RAG Chat") default_chatbox = gr.Chatbot(label="Naive RAG Conversation",type="messages")
# Right Chatbox (Custom YAML) with gr.Column(): gr.Markdown("#### Optimized RAG Chat") custom_chatbox = gr.Chatbot(label="Optimized RAG Conversation",type="messages")
question_input.submit(lambda x: x, inputs=[question_input], outputs=[pseudo_input]).then( user, [question_input, default_chatbox], outputs=[question_input, default_chatbox], queue=False ).then( stream_default, inputs=[yaml_file, default_chatbox], outputs=[default_chatbox], )
pseudo_input.change( user, [pseudo_input, custom_chatbox], outputs=[question_input, custom_chatbox], queue=False).then( stream_optimized, inputs=[yaml_file, custom_chatbox], outputs=[custom_chatbox], )
deploy_button = gr.Button("Deploy", link="https://tally.so/r/3XM7y4")
if __name__ == "__main__": # Run the interface demo.launch(share=False, debug=True)config/extracted_sample.yamlAdded+40
config/gpu/compact_openai.yamlAdded+97
config/gpu/compact_openai_korean.yamlAdded+95
config/gpu/full_no_rerank_openai.yamlAdded+139
config/gpu/half_openai.yamlAdded+110
config/gpu/half_openai_korean.yamlAdded+128
config/gpu_api/compact_openai.yamlAdded+102
config/gpu_api/compact_openai_korean.yamlAdded+100
config/gpu_api/full_no_rerank_openai.yamlAdded+144
config/gpu_api/half_openai.yamlAdded+115
config/gpu_api/half_openai_korean.yamlAdded+133
config/non_gpu/compact_openai.yamlAdded+81
config/non_gpu/compact_openai_korean.yamlAdded+79
config/non_gpu/full_no_rerank_openai.yamlAdded+123
config/non_gpu/half_openai.yamlAdded+94
config/non_gpu/half_openai_korean.yamlAdded+112
config/non_gpu/simple_openai.yamlAdded+25
config/non_gpu/simple_openai_korean.yamlAdded+26
sample_data/corpus_data_sample.parquetAdded+3
sample_data/qa_data_sample.parquetAdded+3
src/__pycache__/runner.cpython-310.pycAdded
src/runner.pyAdded+97
web.pyAdded+326