naman1102 commited on
Commit
f116621
·
1 Parent(s): 274cf00
Files changed (2) hide show
  1. app.py +3 -2
  2. tools.py +3 -0
app.py CHANGED
@@ -24,8 +24,8 @@ DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
24
 
25
  class AgentState(TypedDict):
26
  messages: Annotated[list, add_messages]
27
- question: str
28
- answer: str
29
 
30
  llm = ChatOpenAI(model_name="gpt-4.1-mini")
31
 
@@ -82,6 +82,7 @@ graph.add_conditional_edges(
82
  )
83
  compiled_graph = graph.compile()
84
  def respond_to_input(user_input: str) -> str:
 
85
  initial_state: AgentState = {"messages": []}
86
  return compiled_graph.invoke(initial_state, user_input)
87
 
 
24
 
25
  class AgentState(TypedDict):
26
  messages: Annotated[list, add_messages]
27
+ # question: str
28
+ # answer: str
29
 
30
  llm = ChatOpenAI(model_name="gpt-4.1-mini")
31
 
 
82
  )
83
  compiled_graph = graph.compile()
84
  def respond_to_input(user_input: str) -> str:
85
+ print(f"Reached: User input: {user_input}")
86
  initial_state: AgentState = {"messages": []}
87
  return compiled_graph.invoke(initial_state, user_input)
88
 
tools.py CHANGED
@@ -10,6 +10,7 @@ def web_search(query: str) -> str:
10
  Returns:
11
  The search results.
12
  """
 
13
  ddg = DuckDuckGoSearchRun()
14
  return ddg.run(query)
15
 
@@ -25,6 +26,7 @@ def parse_excel(path: str, sheet_name: str = None) -> str:
25
  "[{'Name': 'Alice', 'Score': 95}, {'Name': 'Bob', 'Score': 88}, ...]"
26
  """
27
  # 1. Load the Excel workbook
 
28
  try:
29
  xls = pd.ExcelFile(path)
30
  except FileNotFoundError:
@@ -57,6 +59,7 @@ def ocr_image(path: str) -> str:
57
  - Expects that Tesseract is installed on the host machine.
58
  - If the file is missing or unreadable, returns an error string.
59
  """
 
60
  file = Path(path)
61
  if not file.exists():
62
  return f"Error: could not find image at {path}"
 
10
  Returns:
11
  The search results.
12
  """
13
+ print(f"Reached: web_search")
14
  ddg = DuckDuckGoSearchRun()
15
  return ddg.run(query)
16
 
 
26
  "[{'Name': 'Alice', 'Score': 95}, {'Name': 'Bob', 'Score': 88}, ...]"
27
  """
28
  # 1. Load the Excel workbook
29
+ print(f"Reached: parse_excel")
30
  try:
31
  xls = pd.ExcelFile(path)
32
  except FileNotFoundError:
 
59
  - Expects that Tesseract is installed on the host machine.
60
  - If the file is missing or unreadable, returns an error string.
61
  """
62
+ print(f"Reached: ocr_image")
63
  file = Path(path)
64
  if not file.exists():
65
  return f"Error: could not find image at {path}"