Skip to content

Commit 209b445

Browse files
committed
feat: add sdk integration
1 parent 8aa9103 commit 209b445

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ dependencies = [
4444
"googlesearch-python>=1.2.5",
4545
"simpleeval>=1.0.0",
4646
"async_timeout>=4.0.3",
47-
"scrapegraph-py>=0.0.3"
47+
"scrapegraph-py>=0.0.4"
4848
]
4949

5050
license = "MIT"

scrapegraphai/graphs/smart_scraper_graph.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
ConditionalNode
1414
)
1515
from ..prompts import REGEN_ADDITIONAL_INFO
16-
from scrapegraph_py import ScrapeGraphClient, smart_scraper
16+
from scrapegraph_py import SyncClient
1717

1818
class SmartScraperGraph(AbstractGraph):
1919
"""
@@ -61,10 +61,14 @@ def _create_graph(self) -> BaseGraph:
6161
BaseGraph: A graph instance representing the web scraping workflow.
6262
"""
6363
if self.llm_model == "scrapegraphai/smart-scraper":
64-
client = ScrapeGraphClient(self.config.get("api_key"))
6564

66-
result = smart_scraper(client, self.source, self.prompt)
67-
return result
65+
sgai_client = SyncClient(api_key=self.config.get("api_key"))
66+
67+
response = sgai_client.smartscraper(
68+
website_url=self.source,
69+
user_prompt=self.prompt
70+
)
71+
return response
6872

6973
fetch_node = FetchNode(
7074
input="url| local_dir",

0 commit comments

Comments
 (0)