naman1102 commited on
Commit
e038027
·
1 Parent(s): 954c1d7

Update tools.py

Browse files
Files changed (1) hide show
  1. tools.py +5 -4
tools.py CHANGED
@@ -35,8 +35,9 @@ class SearchState(BaseModel):
35
 
36
  def create_calculator_tool() -> Graph:
37
  """Creates a calculator tool using LangGraph that can perform basic arithmetic operations."""
38
-
39
  def calculator_function(state: CalculatorState) -> dict:
 
40
  if len(state.input.numbers) < 2:
41
  raise ValueError("At least two numbers are required for calculation")
42
 
@@ -65,14 +66,14 @@ def create_calculator_tool() -> Graph:
65
 
66
  # Create the graph with state schema
67
  workflow = StateGraph(state_schema=CalculatorState)
68
-
69
  # Add the calculator tool node
70
  workflow.add_node("calculator", ToolNode(calculator_function))
71
-
72
  # Set the entry and exit points
73
  workflow.set_entry_point("calculator")
74
  workflow.set_finish_point("calculator")
75
-
76
  return workflow.compile()
77
 
78
  def create_search_tool() -> Graph:
 
35
 
36
  def create_calculator_tool() -> Graph:
37
  """Creates a calculator tool using LangGraph that can perform basic arithmetic operations."""
38
+ print("Creating calculator tool")
39
  def calculator_function(state: CalculatorState) -> dict:
40
+ print("Calculator function called")
41
  if len(state.input.numbers) < 2:
42
  raise ValueError("At least two numbers are required for calculation")
43
 
 
66
 
67
  # Create the graph with state schema
68
  workflow = StateGraph(state_schema=CalculatorState)
69
+ print("Calculator graph for workflow created")
70
  # Add the calculator tool node
71
  workflow.add_node("calculator", ToolNode(calculator_function))
72
+ print("Calculator tool node added")
73
  # Set the entry and exit points
74
  workflow.set_entry_point("calculator")
75
  workflow.set_finish_point("calculator")
76
+ print("Calculator workflow set")
77
  return workflow.compile()
78
 
79
  def create_search_tool() -> Graph: