Find answers from the community

Updated 4 months ago

i have two retrievers how do i build a chat engine over them

At a glance

The community member has two retrievers and wants to build a chat engine over them. Another community member responds that to build a chat engine over two retrievers, the user would need to create an ensemble of the two retrievers. However, the provided information does not contain specific details on how to create an ensemble of retrievers in LlamaIndex. The community member provides an example of building a chat engine with a single retriever, and suggests referring to the LlamaIndex documentation or source code for more details on creating an ensemble of retrievers.

There is an additional comment from another community member asking about retrying on Neo4j query errors in a knowledge graph index, but this is not directly related to the original post.

i have two retrievers how do i build a chat engine over them
k
t
3 comments
Please stand by @tejesh bhalla as I search the knowledge base. I normally take about 20 seconds or so. :wave:
----------------------
To build a chat engine over two retrievers, you would need to create an ensemble of the two retrievers. Unfortunately, the provided extracts do not contain specific information on how to create an ensemble of retrievers in LlamaIndex.

However, once you have your ensemble retriever, you can use it to build a chat engine similar to how it's done in the provided extracts. Here's an example of how to build a chat engine with a single retriever:

Plain Text
from llama_index import VectorStoreIndex, SimpleDirectoryReader
from llama_index.memory import ChatMemoryBuffer

# Load data and build index
data = SimpleDirectoryReader(input_dir="../data/paul_graham/").load_data()
index = VectorStoreIndex.from_documents(data)

# Configure chat engine
memory = ChatMemoryBuffer.from_defaults(token_limit=1500)
chat_engine = index.as_chat_engine(
    chat_mode="context",
    memory=memory,
    system_prompt="You are a chatbot, able to have normal interactions, as well as talk about an essay discussing Paul Grahams life.",
)

(Source: Chat Engine - Context Mode ())

In this example, index is a VectorStoreIndex instance which is a type of retriever. If you have an ensemble retriever, you would replace index with your ensemble retriever.

Please refer to the LlamaIndex documentation or source code for more details on how to create an ensemble of retrievers.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
@kapa.ai how do i retry on neo4j query error in knowledge graph index , if the bot sends a bad cypher query
Add a reply
Sign up and join the conversation on Discord