Fusion Rag
llmsathina-rag-cookbooksadvanced_rag_techniquesopenaiAItutorialsChromaDBcookbooksfaissqdrantLLMPythonpineconeraglangchainweaviate
Export
RAG Fusion
RAG-Fusion is an enhanced version of the traditional Retrieval-Augmented Generation (RAG) model. In RAG-Fusion, after receiving a query, the model first generates related sub-queries using a large language model. These sub-queries help find more relevant documents. Instead of simply sending the retrieved documents to the model, RAG-Fusion uses a technique called Reciprocal Rank Fusion (RRF) to score and reorder the documents based on their relevance. The best-ranked documents are then used to generate a more accurate response.
Research Paper: RAG Fusion
Initial Setup
[ ]
[ ]
Indexing
[ ]
[ ]
[ ]
Qdrant Vector Database
[ ]
Chromadb (Optional)
[ ]
Retriever
[ ]
Reciprocal Rank Fusion Chain
[ ]
[ ]
[ ]
[ ]
[ ]
[ ]
/usr/local/lib/python3.10/dist-packages/ipykernel/ipkernel.py:283: DeprecationWarning: `should_run_async` will not call `transform_cell` automatically in the future. Please pass the result to `transformed_cell` argument and any exception that happen during thetransform in `preprocessing_exc_tuple` in IPython 7.17 and above. and should_run_async(code)
{'title': 'PromptInput',
, 'type': 'object',
, 'properties': {'original_query': {'title': 'Original Query',
, 'type': 'string'}}} [ ]
RAG Chain
[ ]
[ ]
/usr/local/lib/python3.10/dist-packages/ipykernel/ipkernel.py:283: DeprecationWarning: `should_run_async` will not call `transform_cell` automatically in the future. Please pass the result to `transformed_cell` argument and any exception that happen during thetransform in `preprocessing_exc_tuple` in IPython 7.17 and above. and should_run_async(code)
'Points on a mortgage are a form of pre-paid interest that borrowers can offer to pay a lender in order to reduce the interest rate on the loan, resulting in a lower monthly payment.'
Preparing Data for Evaluation
[ ]
[ ]
[ ]
[ ]
/usr/local/lib/python3.10/dist-packages/ipykernel/ipkernel.py:283: DeprecationWarning: `should_run_async` will not call `transform_cell` automatically in the future. Please pass the result to `transformed_cell` argument and any exception that happen during thetransform in `preprocessing_exc_tuple` in IPython 7.17 and above. and should_run_async(code)
[ ]
Evaluation in Athina AI
We will use Answer Relevancy eval here. It Measures how pertinent the generated response is to the given prompt. Please refer to our documentation for further details.
[ ]
[ ]
[ ]
/usr/local/lib/python3.10/dist-packages/ipykernel/ipkernel.py:283: DeprecationWarning: `should_run_async` will not call `transform_cell` automatically in the future. Please pass the result to `transformed_cell` argument and any exception that happen during thetransform in `preprocessing_exc_tuple` in IPython 7.17 and above. and should_run_async(code)
evaluating with [answer_relevancy]
0%| | 0/1 [00:00<?, ?it/s]/usr/local/lib/python3.10/dist-packages/pydantic/main.py:1024: PydanticDeprecatedSince20: The `dict` method is deprecated; use `model_dump` instead. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.6/migration/
warnings.warn('The `dict` method is deprecated; use `model_dump` instead.', category=PydanticDeprecatedSince20)
/usr/local/lib/python3.10/dist-packages/pydantic/main.py:1024: PydanticDeprecatedSince20: The `dict` method is deprecated; use `model_dump` instead. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.6/migration/
warnings.warn('The `dict` method is deprecated; use `model_dump` instead.', category=PydanticDeprecatedSince20)
100%|██████████| 1/1 [00:01<00:00, 1.11s/it]
You can view your dataset at: https://app.athina.ai/develop/f9377fc3-cd03-4feb-9b52-c8e747590c5b