Adrian Cowham commited on
Commit
4f6811a
1 Parent(s): 1ca008e

increased performance

Browse files
src/__pycache__/app.cpython-310.pyc CHANGED
Binary files a/src/__pycache__/app.cpython-310.pyc and b/src/__pycache__/app.cpython-310.pyc differ
 
src/app.py CHANGED
@@ -57,7 +57,7 @@ titles = s3.ls("f150-user-manual/recursive-agent/")
57
  titles = list(map(lambda x: x.split("/")[-1], titles))
58
 
59
  agents = {}
60
- for title in titles:
61
  if(title == "vector_index"):
62
  continue
63
 
@@ -81,15 +81,7 @@ recursive_retriever = RecursiveRetriever(
81
  retriever_dict={"vector": vector_retriever},
82
  query_engine_dict=agents,
83
  verbose=True,
84
- )
85
- response_synthesizer = get_response_synthesizer(
86
- response_mode="compact_accumulate",
87
- )
88
- query_engine = RetrieverQueryEngine.from_args(
89
- recursive_retriever,
90
- similarity_top_k=1,
91
- # response_synthesizer=response_synthesizer,
92
- service_context=service_context,
93
  )
94
 
95
  lock = Lock()
@@ -98,7 +90,8 @@ def predict(message):
98
  print(message)
99
  lock.acquire()
100
  try:
101
- output = str(query_engine.query(message))
 
102
  except Exception as e:
103
  print(e)
104
  raise e
@@ -116,8 +109,8 @@ def getanswer(question, history):
116
  history = history or []
117
  lock.acquire()
118
  try:
119
- output = str(query_engine.query(question))
120
- history.append((question, output))
121
  except Exception as e:
122
  raise e
123
  finally:
 
57
  titles = list(map(lambda x: x.split("/")[-1], titles))
58
 
59
  agents = {}
60
+ for title in titles[:5]:
61
  if(title == "vector_index"):
62
  continue
63
 
 
81
  retriever_dict={"vector": vector_retriever},
82
  query_engine_dict=agents,
83
  verbose=True,
84
+ query_response_tmpl="{response}"
 
 
 
 
 
 
 
 
85
  )
86
 
87
  lock = Lock()
 
90
  print(message)
91
  lock.acquire()
92
  try:
93
+ output = recursive_retriever.retrieve(message)[0]
94
+ output = output.get_text()
95
  except Exception as e:
96
  print(e)
97
  raise e
 
109
  history = history or []
110
  lock.acquire()
111
  try:
112
+ output = recursive_retriever.retrieve(question)[0]
113
+ history.append((question, output.get_text()))
114
  except Exception as e:
115
  raise e
116
  finally:
src/recursive_inference.py CHANGED
@@ -98,16 +98,19 @@ def main():
98
  retriever_dict={"vector": vector_retriever},
99
  query_engine_dict=agents,
100
  verbose=True,
 
101
  )
102
- response_synthesizer = get_response_synthesizer(
103
- response_mode="compact_accumulate",
104
- )
105
- query_engine = RetrieverQueryEngine.from_args(
106
- recursive_retriever,
107
- similarity_top_k=1,
108
- # response_synthesizer=response_synthesizer,
109
- service_context=service_context,
110
- )
 
 
111
 
112
  while True:
113
  try:
@@ -118,8 +121,10 @@ def main():
118
  if user_input == 'exit':
119
  break
120
  else:
121
- response = query_engine.query(user_input)
122
- print(response)
 
 
123
 
124
  except Exception as e:
125
  # Handle exceptions
 
98
  retriever_dict={"vector": vector_retriever},
99
  query_engine_dict=agents,
100
  verbose=True,
101
+ query_response_tmpl="{response}"
102
  )
103
+
104
+ # recursive_retriever.retrieve
105
+ # response_synthesizer = get_response_synthesizer(
106
+ # response_mode="simple_summarize",
107
+ # )
108
+ # query_engine = RetrieverQueryEngine.from_args(
109
+ # recursive_retriever,
110
+ # similarity_top_k=1,
111
+ # response_synthesizer=response_synthesizer,
112
+ # service_context=service_context,
113
+ # )
114
 
115
  while True:
116
  try:
 
121
  if user_input == 'exit':
122
  break
123
  else:
124
+ response = recursive_retriever.retrieve(user_input)[0]
125
+ # response = query_engine.query(user_input)
126
+ print(response.get_text())
127
+ print(response.get_content())
128
 
129
  except Exception as e:
130
  # Handle exceptions