where is the correct place to print out the final prompt that's being sent to llm? would i need to leverage the callback manager in the
RetrieverQueryEngine
when assinign the variable
vector_query_engine
any good examples?
def _query_index(self, query_engine: RetrieverQueryEngine, query: str) -> RESPONSE_TYPE:
embedded_query = Settings.embed_model.get_text_embedding(query)
response = query_engine.query(QueryBundle(query_str=query, embedding=embedded_query))
return response
def _create_query_engine(self) -> RetrieverQueryEngine:
vector_index = VectorStoreIndex.from_vector_store(vector_store=self.vector_store,
embed_model=Settings.embed_model)
vector_retriever = VectorIndexRetriever(index=vector_index, similarity_top_k=5)
vector_query_engine = RetrieverQueryEngine(
retriever=vector_retriever,
response_synthesizer=self.response_synthesizer,
node_postprocessors=[SimilarityPostprocessor(similarity_cutoff=0.50),],
)
vector_query_engine.update_prompts({"response_synthesizer:text_qa_template": self.qa_prompt_tmpl})
return vector_query_engine
def query_rag(self, query: str) -> Dict[str, Any]:
vector_query_engine = self._create_query_engine()
response = self._query_index(query_engine=vector_query_engine, query=query)