Find answers from the community

Updated 8 months ago

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
L
1 comment
condense plus context only uses a retriever

chat_engine = CondensePlusContextChatEngine.from_defaults(recursive_retriever, llm=llm)
Add a reply
Sign up and join the conversation on Discord