qualitative_question_engine = SubQuestionQueryEngine.from_defaults(
query_engine_tools=vector_query_engine_tools,
service_context=service_context,
response_synthesizer=response_synth,
verbose=settings.VERBOSE,
use_async=True,
)
top_level_sub_tools = [
QueryEngineTool(
query_engine=qualitative_question_engine,
metadata=ToolMetadata(
name="qualitative_question_engine",
description="""
A query engine that can answer questions about a set of documents that the user pre-selected for the conversation.
Any questions about document or Uber related information or other should be asked here.
""".strip(),
),
),
]
chat_engine = OpenAIAgent.from_tools(
tools=top_level_sub_tools,
llm=chat_llm,
chat_history=chat_history,
verbose=settings.VERBOSE,
system_prompt=SYSTEM_MESSAGE.format(doc_titles=doc_titles, doc_names=doc_names, curr_date=curr_date),
callback_manager=service_context.callback_manager,
max_function_calls=3,
)
return chat_engine