Mohammad Haghir commited on
Commit
4112ad5
·
1 Parent(s): b06e6a2

tool update

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -59,7 +59,7 @@ class BasicAgent:
59
  a string, don't use articles, neither abbreviations (e.g. for cities), and write
60
  the digits in plain text unless specified otherwise. If you are asked for a comma
61
  separated list, apply the above rules depending of whether the element to be put
62
- in the list is a number or a string. Question: {question}
63
  For answering the question use this context: {context}, if no context is provided
64
  use your knowledge to answer the question."""
65
  # Your answer must be in the following format:
@@ -71,6 +71,7 @@ class BasicAgent:
71
  # Call the LLM
72
  messages = [HumanMessage(content=prompt)]
73
  response = (llm_with_tools.invoke(messages)).content
 
74
  # cleaned_text = re.sub(r"<think>.*?</think>", "", response.content, flags=re.DOTALL)
75
 
76
  # json_start = response.find('{')
@@ -85,7 +86,7 @@ class BasicAgent:
85
  builder.add_node("tools", ToolNode(tools = tools))
86
 
87
  builder.add_edge(START, "agent")
88
- builder.add_conditional_edges("agent", tools_condition)
89
  builder.add_edge("agent", END)
90
  return builder.compile()
91
 
 
59
  a string, don't use articles, neither abbreviations (e.g. for cities), and write
60
  the digits in plain text unless specified otherwise. If you are asked for a comma
61
  separated list, apply the above rules depending of whether the element to be put
62
+ in the list is a number or a string. Use the tools available to you to answer the question. Question: {question}
63
  For answering the question use this context: {context}, if no context is provided
64
  use your knowledge to answer the question."""
65
  # Your answer must be in the following format:
 
71
  # Call the LLM
72
  messages = [HumanMessage(content=prompt)]
73
  response = (llm_with_tools.invoke(messages)).content
74
+ print("response: ", response)
75
  # cleaned_text = re.sub(r"<think>.*?</think>", "", response.content, flags=re.DOTALL)
76
 
77
  # json_start = response.find('{')
 
86
  builder.add_node("tools", ToolNode(tools = tools))
87
 
88
  builder.add_edge(START, "agent")
89
+ builder.add_conditional_edges("agent", tools_condition, ["agent", END])
90
  builder.add_edge("agent", END)
91
  return builder.compile()
92