Find answers from the community

Updated 8 months ago

```

Plain Text
    def process_question(self, query):
        selected_files = self.get_selected_files(self.file_tree)
        node_ids = [n.node_id for n in self.index.docstore.docs.values() if n.metadata['file_name'] in selected_files]
        retriever = VectorIndexRetriever(self.index, node_ids=node_ids, similarity_top_k=3)
        custom_template = (...)
        query_engine = RetrieverQueryEngine.from_args(
            retriever=retriever,
            response_mode="compact",
            prompt_template=PromptTemplate(custom_template)
        )
        chat_engine = self.index.as_chat_engine()
        response = chat_engine.chat(query)


How can I use my query_engine for my chat_engine I used to do that response = query_engine.query(query)but it seems it doesnt work using chat engine
L
3 comments
Import the chat engine and create it. You can use an agent with your query engine, or a context/condense+context chat engine with your retriever
Add a reply
Sign up and join the conversation on Discord