OuroborosM commited on
Commit
d80c981
·
1 Parent(s): 1e22823

add error tracking function

Browse files
Files changed (1) hide show
  1. app.py +11 -5
app.py CHANGED
@@ -63,7 +63,8 @@ index = pinecone.Index(index_name)
63
  llm = chat
64
  agent = initialize_agent(tools, llm,
65
  agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION,
66
- verbose = True)
 
67
 
68
  global vectordb
69
  vectordb = Chroma(persist_directory='db', embedding_function=embeddings)
@@ -94,10 +95,15 @@ def chathmi(message, history):
94
  # yield history
95
 
96
  def chathmi2(message, history):
97
- response = agent.run(message)
98
- time.sleep(0.3)
99
- print(history)
100
- yield response
 
 
 
 
 
101
  # yield history
102
  # chatbot = gr.Chatbot().style(color_map =("blue", "pink"))
103
  # chatbot = gr.Chatbot(color_map =("blue", "pink"))
 
63
  llm = chat
64
  agent = initialize_agent(tools, llm,
65
  agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION,
66
+ verbose = True,
67
+ handle_parsing_errors = True)
68
 
69
  global vectordb
70
  vectordb = Chroma(persist_directory='db', embedding_function=embeddings)
 
95
  # yield history
96
 
97
  def chathmi2(message, history):
98
+ try:
99
+ output = agent.run(message)
100
+ time.sleep(0.3)
101
+ print("History: ", history)
102
+ response = output
103
+ yield response
104
+ except Exception as e:
105
+ print("error:", e)
106
+
107
  # yield history
108
  # chatbot = gr.Chatbot().style(color_map =("blue", "pink"))
109
  # chatbot = gr.Chatbot(color_map =("blue", "pink"))