MCPcopy Create free account

hub / github.com/Raudaschl/rag-fusion / functions

Functions84 in github.com/Raudaschl/rag-fusion

↓ 20 callersFunctionvector_search
Search the ChromaDB collection and return results with real similarity scores.
main.py:67
↓ 14 callersFunctionreciprocal_rank_fusion
Combine multiple ranked lists using Reciprocal Rank Fusion.
main.py:79
↓ 12 callersFunctionwith_rerank
Wrap a retrieval method with cross-encoder reranking + truncation. Retrieves `candidate_pool` candidates from the underlying method, then reranks
eval/retrieval.py:95
↓ 7 callersFunctionaggregate
(per_q, qids, k_values)
eval/steelman.py:142
↓ 6 callersFunctionbm25_search
BM25 keyword search returning {doc_id: score} dict (same format as vector_search).
eval/retrieval.py:20
↓ 6 callersFunctioncached_generate
Return cached LLM-generated rewrites, or generate + persist them.
eval/query_cache.py:41
↓ 6 callersFunctiondownload_nfcorpus
Download and unzip NFCorpus from the BEIR repository.
eval/dataset.py:12
↓ 6 callersFunctiongenerate_queries_chatgpt
Generate multiple search queries from a single input query using ChatGPT.
main.py:22
↓ 6 callersFunctionload_into_chromadb
Ingest corpus into a persistent ChromaDB collection and return it.
eval/dataset.py:70
↓ 6 callersFunctionload_nfcorpus
Load NFCorpus and return (corpus, queries, qrels). corpus: {doc_id: text} queries: {query_id: text} qrels: {query_id: {doc_id: relevan
eval/dataset.py:34
↓ 5 callersFunctioncreate_collection
Create a ChromaDB collection and populate it with climate change documents.
main.py:44
↓ 5 callersFunctionget_client
Lazy initialization of OpenAI client.
main.py:11
↓ 5 callersFunctionrun_evaluation
(query_ids, queries, qrels, collection, method_fn, k_values)
eval/retrieval.py:112
↓ 5 callersFunctionsample_queries
Return a random sample of n query IDs present in both queries and qrels.
eval/dataset.py:92
↓ 4 callersFunctionmrr
Mean Reciprocal Rank. Returns 1/(rank of first relevant doc) or 0.
eval/metrics.py:22
↓ 4 callersFunctionndcg_at_k
Normalized Discounted Cumulative Gain at k. qrel_scores is a dict {doc_id: relevance_score} with graded relevance (0/1/2).
eval/metrics.py:30
↓ 4 callersFunctionpercentile
(xs, p)
eval/bootstrap_ci.py:15
↓ 4 callersFunctionprecision_at_k
Precision at rank k.
eval/metrics.py:4
↓ 4 callersFunctionrecall_at_k
Recall at rank k.
eval/metrics.py:13
↓ 3 callersFunctionfmt
(xs)
eval/answer_eval.py:217
↓ 3 callersFunctiongenerate_output
Produce a final output from the reranked documents.
main.py:104
↓ 3 callersFunctionmake_fuse_then_rerank
Our default: per-query retrieve → fuse → rerank fused pool → truncate.
eval/steelman.py:51
↓ 3 callersFunctionmake_paper_pipeline
Paper's ordering: for each (Q1, Q_rewrite_i), retrieve a small pool, rerank, keep the reranked list, then RRF-fuse the reranked lists, truncate to
eval/steelman.py:31
↓ 3 callersFunctionrerank
Score (query, doc) pairs with a cross-encoder; return doc_ids reordered, truncated to top_k.
eval/rerank.py:57
↓ 2 callersFunctionavg
(xs)
eval/qualitative.py:53
↓ 2 callersFunctiondivergence
(qid)
eval/qualitative.py:155
↓ 2 callersFunctionfmt_table
Compact one-line-per-config table for the headline metric.
eval/sweep.py:80
↓ 2 callersFunctionlift_per_call
(metric_key, name, qids)
eval/qualitative.py:126
↓ 2 callersFunctionmake_hybrid_baseline
Hybrid baseline: BM25 + vector for the original query, fused via RRF, then reranked. No LLM rewrites — this is the 'free lunch' baseline that adds
eval/steelman.py:65
↓ 2 callersFunctionmake_hybrid_diverse_fuse_then_rerank
The strongest fusion variant in the repo: for each query (Q1 + N rewrites), do BOTH BM25 and vector search; fuse all 2*(N+1) result lists via RRF;
eval/steelman.py:79
↓ 2 callersFunctionmake_hybrid_per_query_rerank_then_fuse
Cross-encoder integrated into each sub-query's pipeline before fusion. For each Qi in (Q1 + N rewrites): 1. candidates_i = RRF(BM25(Qi), ve
eval/steelman.py:97
↓ 2 callersFunctionmake_rag_fusion_n
Build a retrieve fn that uses original_query + first n cached LLM rewrites.
eval/sweep.py:25
↓ 2 callersFunctionpercentile
(xs, p)
eval/eval_with_ci.py:38
↓ 1 callersFunction_fetch_doc_texts
(doc_ids, collection)
eval/rerank.py:49
↓ 1 callersFunction_get_backend
Return a callable scorer (query, list[text]) -> list[float], cached on model_name.
eval/rerank.py:18
↓ 1 callersFunction_load
()
eval/query_cache.py:22
↓ 1 callersFunction_save
()
eval/query_cache.py:34
↓ 1 callersFunction_serialize_key
(qid, diverse)
eval/query_cache.py:18
↓ 1 callersFunctionbootstrap_paired
Return dict {method: (mean, lo, hi)} for each method, using shared resampled indices across methods. Also returns paired (method - baseline) CIs.
eval/bootstrap_ci.py:25
↓ 1 callersFunctionbuild_comparison_table
Build a comparison table of metrics across methods. Args: all_metrics: dict of {method_name: metrics_dict} k_values: list of k va
evaluate.py:24
↓ 1 callersFunctioncollect
(query_ids, queries, method_fn, collection, max_k)
eval/steelman.py:153
↓ 1 callersFunctioncompute_all_metrics
Compute averaged metrics across all queries. all_results: dict {query_id: [list of retrieved doc IDs]} qrels: dict {query_id: {doc_id: releva
eval/metrics.py:54
↓ 1 callersFunctionfmt_ci
(d, key="mean", lo="ci_lo", hi="ci_hi")
eval/bootstrap_ci.py:63
↓ 1 callersFunctionfmt_metric
(d)
eval/bootstrap_ci.py:67
↓ 1 callersFunctiongenerate_answer
(query, doc_texts, model="gpt-5.1-chat-latest")
eval/qualitative.py:30
↓ 1 callersFunctionget_bm25_index
Lazy-build a BM25 index from the ChromaDB collection.
eval/retrieval.py:8
↓ 1 callersFunctionjudge
Score three labelled answers; returns dict {label: int 0-3}.
eval/answer_eval.py:59
↓ 1 callersFunctionmain
()
evaluate.py:98
↓ 1 callersFunctionmain
()
eval/answer_eval.py:81
↓ 1 callersFunctionmain
()
eval/saved_queries.py:12
↓ 1 callersFunctionmain
()
eval/bootstrap_ci.py:71
↓ 1 callersFunctionmain
()
eval/qualitative.py:57
↓ 1 callersFunctionmain
()
eval/sweep.py:94
↓ 1 callersFunctionmain
()
eval/steelman.py:160
↓ 1 callersFunctionmain_cli
()
eval/eval_with_ci.py:73
↓ 1 callersFunctionpaired_bootstrap_lift
(method_vals, baseline_vals, b=10000, seed=42)
eval/eval_with_ci.py:61
↓ 1 callersFunctionper_query_metrics
(retrieved_by_qid, qrels, k_values)
eval/steelman.py:128
↓ 1 callersFunctionper_query_metrics_for_ids
(retrieved, qrel_scores, k_values)
eval/qualitative.py:43
↓ 1 callersFunctionper_query_value
(retrieved, qrel_scores, metric, k)
eval/eval_with_ci.py:48
↓ 1 callersFunctionshow_example_queries
Display top-5 docs from each method for 3 example queries, marking relevant ones.
evaluate.py:68
↓ 1 callersFunctionsweep_n
Vary N rewrites with fixed candidate_pool.
eval/sweep.py:59
↓ 1 callersFunctionsweep_pool
Vary candidate_pool with fixed N rewrites.
eval/sweep.py:38
↓ 1 callersFunctionsynthesize
(query, doc_texts, model="gpt-5.1-chat-latest")
eval/answer_eval.py:45
Function_format_delta
(baseline_val, fusion_val)
evaluate.py:58
Function_patched_generate
(query, diverse=False)
eval/eval_with_ci.py:33
Functionbase
(query, collection, k=10)
eval/steelman.py:54
Functionbm25_retrieve
Classic BM25 keyword search.
eval/retrieval.py:29
Functionhybrid_diverse_retrieve
Hybrid (BM25+vector) for each query + diverse LLM-generated queries.
eval/retrieval.py:83
Functionhybrid_retrieve
Hybrid BM25 + vector search fused via RRF (no LLM calls).
eval/retrieval.py:40
Functionpositive_int
Argparse type for integers greater than zero.
evaluate.py:16
Functionrag_fusion_diverse_retrieve
RAG-Fusion with diverse query generation prompt.
eval/retrieval.py:60
Functionrag_fusion_retrieve
(query, collection, k=10)
eval/retrieval.py:50
Functionrag_fusion_weighted_retrieve
RAG-Fusion with diverse queries + 3x weight on original query.
eval/retrieval.py:71
Functionretrieve
(query, collection, k=10)
eval/sweep.py:27
Functionretrieve
(query, collection, k=10)
eval/steelman.py:36
Functionscore
(query, texts)
eval/rerank.py:30
Functionsingle_query_retrieve
(query, collection, k=10)
eval/retrieval.py:35
Functiontest_create_collection
()
test_main.py:4
Functiontest_generate_output
()
test_main.py:55
Functiontest_generate_output_accepts_new_params
Verify generate_output accepts the new parameters and still works with use_llm=False.
test_main.py:65
Functiontest_reciprocal_rank_fusion
()
test_main.py:32
Functiontest_vector_search
()
test_main.py:11
Functiontest_vector_search_relevance
()
test_main.py:24
Functionwrapped
(query, collection, k=10)
eval/retrieval.py:104