You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the part Step 4. Query in Real Time and Check Grounding of genai-on-vertex-ai/retrieval_augmented_generation/diy_rag_with_vertexai_apis/build_grounded_rag_app_with_vertex.ipynb
The notebook mentioned that this step will "pass retrieved documents to the reranker API via the VertexAIRank" But I only saw the usage of VertexAI class and a basic retriever with the following code:
retriever=vector_store.as_retriever(search_kwargs={"k": 5})
llm=VertexAI(model_name="gemini-1.5-pro-001", max_output_tokens=1024)
template="""Answer the question based only on the following context:{context}Question:{query}"""
I feel a bit confused. If I am wrong or I miss something, please correct me! Thank you for your attention to this matter : )
The text was updated successfully, but these errors were encountered:
@kikiWhite Thanks for the feedback. Please check the step 3.1 in the notebook where reranker is added as part of contextual compression retriever.
from langchain.retrievers.contextual_compression import ContextualCompressionRetriever
from langchain_google_community import VertexAIRank
# Instantiate the VertexAIReranker with the SDK manager
reranker = VertexAIRank(
project_id=PROJECT_ID,
location_id="global",
ranking_config="default_ranking_config",
title_field="source", # metadata field to preserve with reranked results
top_n=5,
)
basic_retriever = vector_store.as_retriever(
search_kwargs={"k": 5}
) # fetch top 5 documents
# Create the ContextualCompressionRetriever with the VertexAIRanker as a Reranker
retriever_with_reranker = ContextualCompressionRetriever(
base_compressor=reranker, base_retriever=basic_retriever
)
@RajeshThallam Thank you, Rajesh. Everything is clear now. I understand the use of the contextual compression retriever in step 3.1. I just wanted to kindly point out that step 4 mentioned the use of VertexAIRank, but it wasn't actually used in that step. Just wanted to bring it to your attention. Thanks again for your help!
In the part
Step 4. Query in Real Time and Check Grounding
ofgenai-on-vertex-ai/retrieval_augmented_generation/diy_rag_with_vertexai_apis/build_grounded_rag_app_with_vertex.ipynb
The notebook mentioned that this step will "pass retrieved documents to the reranker API via the
VertexAIRank
" But I only saw the usage ofVertexAI
class and a basic retriever with the following code:I feel a bit confused. If I am wrong or I miss something, please correct me! Thank you for your attention to this matter : )
The text was updated successfully, but these errors were encountered: