giannantonio15 commited on
Commit
ea94315
1 Parent(s): cb75ae8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -1
app.py CHANGED
@@ -18,6 +18,10 @@ import spaces
18
  import threading
19
  import sys
20
  import torch
 
 
 
 
21
 
22
  head = """
23
  <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
@@ -126,9 +130,10 @@ memory_bandi=None
126
  memory_bandi_sistema_puglia=None
127
  stream_response=None
128
  divDocumenti=None
129
-
130
 
131
  def main():
 
132
  setGPU()
133
  llm = setLLM()
134
  Settings.llm = llm
@@ -471,10 +476,14 @@ def main():
471
  else:
472
  print("MODALITA STANDARD")
473
  if(str(current_response_mode)=="tree_summarize"):
 
474
  # define response synthesizer
475
  response_synthesizer = get_response_synthesizer(streaming=True,response_mode="tree_summarize",text_qa_template=text_qa_template)
476
  query_engine = None
477
  query_engine = RetrieverQueryEngine(retriever=retriever, response_synthesizer=response_synthesizer)
 
 
 
478
  stream_response = None
479
  print(userMessage)
480
  stream_response = query_engine.query(userMessage)
 
18
  import threading
19
  import sys
20
  import torch
21
+ from llama_index.core.indices.query.query_transform.base import (
22
+ StepDecomposeQueryTransform,
23
+ )
24
+
25
 
26
  head = """
27
  <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
 
130
  memory_bandi_sistema_puglia=None
131
  stream_response=None
132
  divDocumenti=None
133
+ llm = None
134
 
135
  def main():
136
+ global llm
137
  setGPU()
138
  llm = setLLM()
139
  Settings.llm = llm
 
476
  else:
477
  print("MODALITA STANDARD")
478
  if(str(current_response_mode)=="tree_summarize"):
479
+ step_decompose_transform = StepDecomposeQueryTransform(llm, verbose=True)
480
  # define response synthesizer
481
  response_synthesizer = get_response_synthesizer(streaming=True,response_mode="tree_summarize",text_qa_template=text_qa_template)
482
  query_engine = None
483
  query_engine = RetrieverQueryEngine(retriever=retriever, response_synthesizer=response_synthesizer)
484
+ query_engine = MultiStepQueryEngine(
485
+ query_engine, query_transform=step_decompose_transform
486
+ )
487
  stream_response = None
488
  print(userMessage)
489
  stream_response = query_engine.query(userMessage)