Daniel Amendoeira commited on
Commit
c5c30a4
·
verified ·
1 Parent(s): 0aa3b8d

Update agent.py

Browse files
Files changed (1) hide show
  1. agent.py +1 -12
agent.py CHANGED
@@ -108,18 +108,7 @@ builder.add_edge("environment", "llm_call") # after running the tools go back t
108
 
109
  gaia_agent = builder.compile() # converts my builder into a runnable agent by using gaia_agent.invoke()
110
 
111
- # Call the Agent
112
- #def agent_run(question: str):
113
- input_state = {"messages": [HumanMessage(content=question)]} # prepare the initial user message
114
- result = gaia_agent.invoke(input_state, {"recursion_limit": 30}) # prevents infinite looping when the LLM keeps calling tools over and over
115
- final_response = result["messages"][-1].content
116
-
117
- try:
118
- return final_response.split("FINAL ANSWER:")[-1].strip() # parse out only what's after "FINAL ANSWER:"
119
- except Exception:
120
- print("Could not split on 'FINAL ANSWER:'")
121
- return final_response
122
-
123
  class LangGraphAgent:
124
  def __init__(self):
125
  print("LangGraphAgent initialized.")
 
108
 
109
  gaia_agent = builder.compile() # converts my builder into a runnable agent by using gaia_agent.invoke()
110
 
111
+ # Call the Agent
 
 
 
 
 
 
 
 
 
 
 
112
  class LangGraphAgent:
113
  def __init__(self):
114
  print("LangGraphAgent initialized.")