Find answers from the community

x
xrt
Offline, last seen 3 months ago
Joined September 25, 2024
What is the difference between Multi-Step Query Engine and Sub-Query Engine ? there is any implementation where I can have control over query decomposition to add ore remove a question from subquestions generated by this engines, before it is sent to LLM?
4 comments
L
x
What Chat Mode is best to use to retrieves for each user question different nodes from the index and use chat history to better respond and refine the answer ?
2 comments
x
L
What is the difference between a Chatbot Agent and a Chat Engine ? Chatbot Agent is a chat engine with an agent react mode ?
1 comment
L
x
xrt
·

I m using

I'm using #############################################################
service_context = ServiceContext.from_defaults(
embed_model=embed_model,
llm=llm,
callback_manager=callback_manager,
chunk_size=50000,
)
documents = SimpleDirectoryReader('data').load_data()


index = SummaryIndex.from_documents(documents=documents,
service_context=service_context,
show_progress=True
)

query_engine = index.as_query_engine(
service_context=service_context,
response_mode="refine",
use_async=True
)

llm_response_obj = query_engine.query(question)
7 comments
x
L
Hi all, if I don't configure any prompt template in query engine for RAG pipeline, will be use one default from here https://github.com/jerryjliu/llama_index/blob/main/llama_index/prompts/default_prompts.py ? How I know what prompt is used
5 comments
L
x
Hi all, I utilize vector_store = PGVectorStore.from_params(). When working with the Retrieval-Augmented Generation (RAG) model for Q&A, what's the optimal way: sending the full document(s) instead of using a similarity search using similarity_top_k? How should this be implemented, and what's the most effective approach to take? Thank you
23 comments
L
x
Do we have any native implementation in LlamaIndex to help with "Lost in the middle: Performance degrades when models must access relevant information in the middle of long contexts". I find this implementation in LangChain https://api.python.langchain.com/en/latest/document_transformers/langchain.document_transformers.long_context_reorder.LongContextReorder.html ? Thank you
6 comments
x
L
W
Hello, there is any advantaje with Condense Plus Context versus Condense Question Mode for standalone question generation ?

https://docs.llamaindex.ai/en/stable/examples/chat_engine/chat_engine_condense_question/
https://docs.llamaindex.ai/en/stable/examples/chat_engine/chat_engine_condense_plus_context/

I'm using this chat with a knowledge base
3 comments
W
x
x
xrt
·

Hello,

Hello,
I have below code:

agents = {}
for title in titles:
vector_index = VectorStoreIndex.from_documents(...)
list_index = ListIndex.from_documents(...)
vector_query_engine = vector_index.as_query_engine()
list_query_engine = list_index.as_query_engine()
query_engine_tools = [
QueryEngineTool(
query_engine=vector_query_engine,
metadata=ToolMetadata(
name="vector_tool",
description=f"Useful for retrieving specific context related to {title}",
),
),
QueryEngineTool(
query_engine=list_query_engine,
metadata=ToolMetadata(
name="summary_tool",
description=f"Useful for summarization questions related to {title}",
),
),
]

function_llm = OpenAI(model="gpt-3.5-turbo-0613")
agent = OpenAIAgent.from_tools(
query_engine_tools,
llm=function_llm,
verbose=True,
)
agents[title] = agent

nodes = []
for title in titles:
doc_summary = (...)
node = IndexNode(text=doc_summary, index_id=title)
nodes.append(node)

vector_index = VectorStoreIndex(nodes)
vector_retriever = vector_index.as_retriever(similarity_top_k=1)

recursive_retriever = RecursiveRetriever(
"vector",
retriever_dict={"vector": vector_retriever},
query_engine_dict=agents,
verbose=True,
)
response_synthesizer = get_response_synthesizer(response_mode="compact")
query_engine = RetrieverQueryEngine.from_args(
recursive_retriever,
response_synthesizer=response_synthesizer,
service_context=service_context,
)
chat_engine = CondenseQuestionChatEngine.from_defaults(
query_engine=query_engine,
chat_history=chat_history,
verbose=True,
)
response = chat_engine.chat(question)

How I can use CondensePlusContextChatEngine for chat_engine in my configuration?
Thank you
1 comment
L
Hi everyone,

I'm working to extract information from books from different categories. My objective is to ensure queries about a specific question only fetch books from a specific category, using a setup where each book has its own index. I'm considering the Recursive Retriever and Document Agents for this task but am uncertain about the optimal setup, particularly for categorization.
What's the best approach to ensure queries are category-specific and can have one or multiple index selected for response ?

Appreciate any insights!
7 comments
x
L
Hello, there is any implementation in llama-index with multi agents that I can use ?
3 comments
x
L
x
xrt
·

Hello,

Hello,
How I can see exactly what nodes (similarity_top_k=2) are extracted for vector_retrievers and bm25_retrievers, for each index, In order to understand what exactly will be used in QueryFusionRetriever

vector_retrievers = []
bm25_retrievers = []

for table in tabels:
...
vector_retrievers.append(index.as_retriever(similarity_top_k=2))
....
bm25_retrievers.append(BM25Retriever.from_defaults(nodes=nodes, similarity_top_k=2))
retrievers = vector_retrievers + bm25_retrievers
retriever = QueryFusionRetriever(
retrievers=retrievers,
llm=llm,
mode=RECIPROCAL_RANK,
similarity_top_k=8
)

query_engine = RetrieverQueryEngine.from_args(retriever, llm=llm)
...
1 comment
W
Hello, I have a question for Bedrock llms usage

I notice in new 0.10.26 release that for Anthropic adding HUMAN/ASSISTANT prefix is added from library

HUMAN_PREFIX = "\n\nHuman:"
ASSISTANT_PREFIX = "\n\nAssistant:"

https://github.com/run-llama/llama_index/blob/main/llama-index-integrations/llms/llama-index-llms-bedrock/llama_index/llms/bedrock/utils.py#L24

So I supose that I no longer need to add anything from my side ?


And second question, for Mistral do I still need to add prefix "<s> [INST]" <prompt "[/INST]" or is no longer required ?

Thank you
1 comment
W
x
xrt
·

Query

If I have 300-400 PDF files (50-100 pages per file) for different laptops models, with hardware repair instructions, and I want to query instruction for a specific model. What is the best option to store this files, create one index for each file, or store all of them in a big index ?
6 comments
L
x
What method is LlamaIndex Chat use in background to provide the answers? I tested on Documents and it provide very good answers, I'm using Python queryengine with 4 chunks and have different responses on same document.
6 comments
x
T
x
xrt
·

Document

I'm getting Error: 'str' object has no attribute 'get_doc_id' , using below code, what I'm doing wrong ?


text_content = "The sports teams in Toronto include the Toronto Maple Leafs (NHL), Toronto Raptors (NBA), Toronto Blue Jays (MLB)"

index = SummaryIndex.from_documents(
documents=text_content,
service_context=service_context,
show_progress=True
)
query_engine = index.as_query_engine(
service_context=service_context,
text_qa_template=qa_prompt_template,
use_async=True
)

response = query_engine.query(question)
3 comments
W
x
@kapa.ai How I can use multi-agents in Llamaindex ?
3 comments
k
How I can use "kapa.ai" bot like a tool to be available for agents?
6 comments
x
L
x
xrt
·

Agent

Hello, there is a specific LlamaIndex implementation that can be used for Agents similar we have on Langchain https://docs.langchain.com/docs/components/agents/ ?
7 comments
L
x
E
Hello, I'm using this import for prompt template
from llama_index.prompts.base import PromptTemplate
from llama_index.prompts.prompt_type import PromptType

Ang get below warnings:

UserWarning: Importing BasePromptTemplate from langchain root module is no longer supported.

UserWarning: Importing PromptTemplate from langchain root module is no longer supported.

Any updates on llamaindex impacting this ? BTW why langchain is mentioned ?
11 comments
L
x
W
Hello, I'm new to LlamaIndex and I'm trying to use prompt template. what I'm doing wrong? because I get only bad answers 😦
Plain Text
template = (
    "We have provided context information below. \n"
    "---------------------\n"
    "{context_str}"
    "\n---------------------\n"
    "Given this information, please answer the question: {query_str}\n"
)
custom_qa_prompt = PromptTemplate(template)

query_engine = index.as_query_engine(
    service_context=service_context,
    similarity_top_k=similarity_top_k,
    text_qa_template=custom_qa_prompt,
    verbose=True
)
26 comments
t
L
x
x
xrt
·

Difference

@ethan: What is the difference between VectorStoreIndex(nodes) and VectorStoreIndex.from_documents(nodes) when using node_parser?
1 comment
L