Update app.py
Browse files
app.py
CHANGED
@@ -597,7 +597,33 @@ with gr.Blocks(theme='sudeepshouche/minimalist', css=css) as demo:
|
|
597 |
chat_history_engine = summarize_assistant_messages(chat_history_engine)
|
598 |
|
599 |
# Engine:
|
600 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
601 |
|
602 |
# Generar la respuesta usando el motor de chat
|
603 |
response = chat_engine.stream_chat(message, chat_history=chat_history_engine)
|
|
|
597 |
chat_history_engine = summarize_assistant_messages(chat_history_engine)
|
598 |
|
599 |
# Engine:
|
600 |
+
retriever_tools = [tool for choice, tool in choices_with_tools if choice in selected_choices]
|
601 |
+
|
602 |
+
# Configuraci贸n din谩mica de RouterRetriever y engine
|
603 |
+
retriever = RouterRetriever(
|
604 |
+
selector=PydanticMultiSelector.from_defaults(
|
605 |
+
llm=llm, prompt_template_str=DEFAULT_MULTI_PYD_SELECT_PROMPT_TMPL, max_outputs=3
|
606 |
+
),
|
607 |
+
retriever_tools=retriever_tools,
|
608 |
+
)
|
609 |
+
custom_retriever = CustomRetriever(retriever, kg_retriever)
|
610 |
+
|
611 |
+
query_engine = RetrieverQueryEngine.from_args(
|
612 |
+
retriever=custom_retriever,
|
613 |
+
response_synthesizer=response_synthesizer,
|
614 |
+
streaming=True
|
615 |
+
)
|
616 |
+
|
617 |
+
memory = ChatMemoryBuffer.from_defaults(token_limit=20000)
|
618 |
+
|
619 |
+
chat_engine = ContextChatEngine.from_defaults(
|
620 |
+
retriever=custom_retriever,
|
621 |
+
system_prompt=system_prompt,
|
622 |
+
memory=memory,
|
623 |
+
node_postprocessors=[],
|
624 |
+
context_template=context_prompt,
|
625 |
+
llm=gpt4omini
|
626 |
+
)
|
627 |
|
628 |
# Generar la respuesta usando el motor de chat
|
629 |
response = chat_engine.stream_chat(message, chat_history=chat_history_engine)
|