Thanh Vinh Vo commited on
Commit
f39fa20
·
1 Parent(s): f89b8c9
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -20,7 +20,7 @@ DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
20
 
21
 
22
  @tool
23
- def html_to_markdown(arg1: str) -> str: # it's important to specify the return type
24
  """A tool that converts HTML to Markdown.
25
  Args:
26
  arg1: the raw HTML string to convert
@@ -36,7 +36,7 @@ class BasicAgent:
36
  def __init__(self):
37
  print("BasicAgent initialized.")
38
  self.agent = CodeAgent(
39
- tools=["html_to_markdown"],
40
  model=InferenceClientModel(),
41
  additional_authorized_imports=["requests", "bs4", "html_to_markdown"],
42
  max_steps=10,
@@ -47,7 +47,7 @@ class BasicAgent:
47
  prompt = f"""
48
  Answer the following question: `{question}`.
49
  Please follow the following rules:
50
- 1. When there is need to extract information from web page please use `html_to_markdown` tool to parse HTML content first, and then extract the information you need.
51
  """
52
  result = self.agent.run(prompt)
53
  print(f"Agent responded with: {result}")
 
20
 
21
 
22
  @tool
23
+ def to_markdown(arg1: str) -> str: # it's important to specify the return type
24
  """A tool that converts HTML to Markdown.
25
  Args:
26
  arg1: the raw HTML string to convert
 
36
  def __init__(self):
37
  print("BasicAgent initialized.")
38
  self.agent = CodeAgent(
39
+ tools=[to_markdown],
40
  model=InferenceClientModel(),
41
  additional_authorized_imports=["requests", "bs4", "html_to_markdown"],
42
  max_steps=10,
 
47
  prompt = f"""
48
  Answer the following question: `{question}`.
49
  Please follow the following rules:
50
+ 1. When there is need to extract information from web page please use `to_markdown` tool to parse HTML content first, and then extract the information you need.
51
  """
52
  result = self.agent.run(prompt)
53
  print(f"Agent responded with: {result}")