Update app.py
Browse files
app.py
CHANGED
|
@@ -46,8 +46,9 @@ def find_non_commutative(table: dict) -> list:
|
|
| 46 |
return sorted(bad)
|
| 47 |
|
| 48 |
@tool
|
| 49 |
-
def libretext_extract(
|
| 50 |
-
"""
|
|
|
|
| 51 |
r = requests.get(url, timeout=10)
|
| 52 |
soup = BeautifulSoup(r.text, "html.parser")
|
| 53 |
return soup.select_one(selector).get_text(strip=True)
|
|
|
|
| 46 |
return sorted(bad)
|
| 47 |
|
| 48 |
@tool
|
| 49 |
+
def libretext_extract(query: str) -> str:
|
| 50 |
+
"""Input 'url||css_selector', returns the first matching element's text"""
|
| 51 |
+
url, selector = query.split("||", 1)
|
| 52 |
r = requests.get(url, timeout=10)
|
| 53 |
soup = BeautifulSoup(r.text, "html.parser")
|
| 54 |
return soup.select_one(selector).get_text(strip=True)
|