@@ -44,7 +44,7 @@ print(markdown)
44
44
Extract structured data from any webpage using natural language prompts.
45
45
46
46
``` python
47
- from langchain_scrapegraph.tools import SmartscraperTool
47
+ from langchain_scrapegraph.tools import SmartScraperTool
48
48
49
49
# Initialize the tool (uses SGAI_API_KEY from environment)
50
50
tool = SmartscraperTool()
@@ -66,15 +66,15 @@ You can define the structure of the output using Pydantic models:
66
66
``` python
67
67
from typing import List
68
68
from pydantic import BaseModel, Field
69
- from langchain_scrapegraph.tools import SmartscraperTool
69
+ from langchain_scrapegraph.tools import SmartScraperTool
70
70
71
71
class WebsiteInfo (BaseModel ):
72
72
title: str = Field(description = " The main title of the webpage" )
73
73
description: str = Field(description = " The main description or first paragraph" )
74
74
urls: List[str ] = Field(description = " The URLs inside the webpage" )
75
75
76
76
# Initialize with schema
77
- tool = SmartscraperTool (llm_output_schema = WebsiteInfo)
77
+ tool = SmartScraperTool (llm_output_schema = WebsiteInfo)
78
78
79
79
# The output will conform to the WebsiteInfo schema
80
80
result = tool.invoke({
@@ -95,9 +95,9 @@ print(result)
95
95
Extract information from HTML content using AI.
96
96
97
97
``` python
98
- from langchain_scrapegraph.tools import LocalscraperTool
98
+ from langchain_scrapegraph.tools import LocalScraperTool
99
99
100
- tool = LocalscraperTool ()
100
+ tool = LocalScraperTool ()
101
101
result = tool.invoke({
102
102
" user_prompt" : " Extract all contact information" ,
103
103
" website_html" : " <html>...</html>"
@@ -114,7 +114,7 @@ You can define the structure of the output using Pydantic models:
114
114
``` python
115
115
from typing import Optional
116
116
from pydantic import BaseModel, Field
117
- from langchain_scrapegraph.tools import LocalscraperTool
117
+ from langchain_scrapegraph.tools import LocalScraperTool
118
118
119
119
class CompanyInfo (BaseModel ):
120
120
name: str = Field(description = " The company name" )
@@ -123,7 +123,7 @@ class CompanyInfo(BaseModel):
123
123
phone: Optional[str ] = Field(description = " Contact phone if available" )
124
124
125
125
# Initialize with schema
126
- tool = LocalscraperTool (llm_output_schema = CompanyInfo)
126
+ tool = LocalScraperTool (llm_output_schema = CompanyInfo)
127
127
128
128
html_content = """
129
129
<html>
@@ -173,12 +173,12 @@ print(result)
173
173
174
174
``` python
175
175
from langchain.agents import initialize_agent, AgentType
176
- from langchain_scrapegraph.tools import SmartscraperTool
176
+ from langchain_scrapegraph.tools import SmartScraperTool
177
177
from langchain_openai import ChatOpenAI
178
178
179
179
# Initialize tools
180
180
tools = [
181
- SmartscraperTool (),
181
+ SmartScraperTool (),
182
182
]
183
183
184
184
# Create an agent
0 commit comments