Find answers from the community

s
s1l3nt
Offline, last seen 3 months ago
Joined September 25, 2024
s
s1l3nt
·

Metadata

team, i've built a basic RAG using (SimpleDirectoryReader, VectorStoreIndex, index.as_query_engine()) and querying using query_engine.query().
the LLM prompt gets appended with the context returned by retriever. i found that the context text contains file_path which is reducing the output for my LLM.
how can i specify that i don't want to add file_path to the context of the LLM, but only the retrieved text?
4 comments
L
s
I wish to access the additional_kwargs attribute of CompletionResponse object returned by the complete() method of the LLM integration when this LLM is used in a simple RAG pipeline.
In a RAG pipeline, the response is of type llama_index.core.base.response.schema.Response which only stores the text attribute of CompletionResponse .

Here's an example RAG pipeline that I'm using:
Plain Text
Settings.llm = llm
Settings.embed_model = HuggingFaceEmbedding(model_name="BAAI/bge-small-en-v1.5")
documents = SimpleDirectoryReader("data").load_data()
index = VectorStoreIndex.from_documents(documents)
query_engine = index.as_query_engine()
response = query_engine.query("A random question")

What's the best way to get these additional_kwargs?
13 comments
s
L
W