RamiNuraliyev commited on
Commit
6f3d909
·
verified ·
1 Parent(s): e0d83fd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -18,7 +18,7 @@ def calculate_min_price(prices: list[float])-> str: #it's import to specify the
18
  return f"The minimum price is {min_price}"
19
 
20
  @tool
21
- def extract_price_from_snippet(snippet: str):
22
  """
23
  A simple function to extract prices from a text snippet using regex.
24
  You can enhance this function for more complex price extraction.
@@ -28,6 +28,7 @@ def extract_price_from_snippet(snippet: str):
28
  # A basic regular expression to detect common price formats like $29.99, 29.99 USD, etc.
29
  price_pattern = r'\$\d+(?:,\d{3})*(?:\.\d{2})?|\d+(?:,\d{3})*(?:\.\d{2})?\s*(USD|EUR|GBP|INR|AUD|CAD)?'
30
  matches = re.findall(price_pattern, snippet)
 
31
  return matches
32
 
33
 
 
18
  return f"The minimum price is {min_price}"
19
 
20
  @tool
21
+ def extract_price_from_snippet(snippet: str) -> list[str]:
22
  """
23
  A simple function to extract prices from a text snippet using regex.
24
  You can enhance this function for more complex price extraction.
 
28
  # A basic regular expression to detect common price formats like $29.99, 29.99 USD, etc.
29
  price_pattern = r'\$\d+(?:,\d{3})*(?:\.\d{2})?|\d+(?:,\d{3})*(?:\.\d{2})?\s*(USD|EUR|GBP|INR|AUD|CAD)?'
30
  matches = re.findall(price_pattern, snippet)
31
+ matches = [str(x) for x in matches]
32
  return matches
33
 
34