peterpeter8585 commited on
Commit
b8e83f6
Β·
verified Β·
1 Parent(s): af5abb6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -4
app.py CHANGED
@@ -258,14 +258,20 @@ def chat(message, history):
258
  agent_type=AgentType.STRUCTURED_CHAT_ZERO_SHOT_REACT_DESCRIPTION,
259
  #memory=memory,
260
  verbose=True,
261
- handle_parsing_errors=True
 
262
  )
263
  try:
264
  raw = agent.invoke(ab)["output"]
265
  except:
266
- llm = ChatOpenAI(model="openai/gpt-4.1-mini",openai_api_key="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",openai_api_base="https://models.github.ai/inference")
267
- agent=initialize_agent(tools,llm,agent_type=AgentType.STRUCTURED_CHAT_ZERO_SHOT_REACT_DESCRIPTION,verbose=True,handle_parsing_errors=True)
268
- raw=agent.invoke(ab)["output"]
 
 
 
 
 
269
  try:
270
  # λŒ€ν™” 기둝을 LangChain memory에 반영
271
  # JSON ν˜•νƒœλ‘œ λ°˜ν™˜ μ‹œ νŒŒμ‹±
 
258
  agent_type=AgentType.STRUCTURED_CHAT_ZERO_SHOT_REACT_DESCRIPTION,
259
  #memory=memory,
260
  verbose=True,
261
+ handle_parsing_errors=True,]
262
+ max_iterations=50
263
  )
264
  try:
265
  raw = agent.invoke(ab)["output"]
266
  except:
267
+ try:
268
+ llm = ChatOpenAI(model="openai/gpt-4.1-mini",openai_api_key="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",openai_api_base="https://models.github.ai/inference")
269
+ agent=initialize_agent(tools,llm,agent_type=AgentType.STRUCTURED_CHAT_ZERO_SHOT_REACT_DESCRIPTION,verbose=True,handle_parsing_errors=True,max_iterations=50)
270
+ raw=agent.invoke(ab)["output"]
271
+ except:
272
+ llm = ChatOpenAI(model="openai/gpt-4.1-mini",openai_api_key="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",openai_api_base="https://models.github.ai/inference")
273
+ agent=initialize_agent(tools,llm,agent_type=AgentType.STRUCTURED_CHAT_ZERO_SHOT_REACT_DESCRIPTION,verbose=True,handle_parsing_errors=True,max_iterations=50)
274
+ raw=agent.invoke(ab)["output"]
275
  try:
276
  # λŒ€ν™” 기둝을 LangChain memory에 반영
277
  # JSON ν˜•νƒœλ‘œ λ°˜ν™˜ μ‹œ νŒŒμ‹±