Skip to content

Commit f9979d5

Browse files
committed
✨ add ICV RAG documentation
1 parent 4b46cdf commit f9979d5

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

docs/source/tutorials/rag.rst

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,3 +96,25 @@ This tutorial works based on FewShot RAG matching, an extension of the RAG model
9696
9797
In-Context Vectors RAG
9898
==================================
99+
This RAG variant performs ontology matching using ``ConceptRAGEncoder`` only. The In-Contect Vectors introduced by `[1]<https://github.com/shengliu66/ICV>`_ tackle in-context learning as in-context vectors (ICV). We used LLMs in this perspective in the RAG module. The workflow is the same as RAG or FewShot RAG with the following differences:
100+
101+
102+
1. Incorporate the ``ConceptRAGEncoder`` and also provide reference (or examples to build up the ICV vectors).
103+
104+
.. code-block:: python
105+
106+
from ontoaligner.encoder import ConceptRAGEncoder
107+
encoder_model = ConceptRAGEncoder()
108+
encoded_ontology = encoder_model(source=dataset['source'], target=dataset['target'], reference=dataset['reference'])
109+
110+
2. Next, import an ICVRAG model, here we use Falcon model:
111+
112+
.. code-block:: python
113+
114+
from ontoaligner.ontology_matchers import FalconLLMBERTRetrieverICVRAG
115+
model = FalconLLMBERTRetrieverICVRAG(**config)
116+
117+
model.load(llm_path="tiiuae/falcon-7b", ir_path="all-MiniLM-L6-v2")
118+
119+
120+
[1] Liu, S., Ye, H., Xing, L., & Zou, J. (2023). `In-context vectors: Making in context learning more effective and controllable through latent space steering<https://arxiv.org/abs/2311.06668>`_. arXiv preprint arXiv:2311.06668.

0 commit comments

Comments
 (0)