Scrapegraph
ScrapegraphToolSpec #
基础: BaseToolSpec
scrapegraph 工具规范,用于网页抓取操作。
源代码位于 llama-index-integrations/tools/llama-index-tools-scrapegraph/llama_index/tools/scrapegraph/base.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
|
scrapegraph_smartscraper #
scrapegraph_smartscraper(prompt: str, url: str, api_key: str, schema: Optional[List[BaseModel]] = None) -> List[Dict]
使用 scrapegraph 执行同步网页抓取。
参数
名称 | 类型 | 描述 | 默认值 |
---|---|---|---|
提示词
|
str
|
描述抓取任务的用户提示词 |
必需 |
url
|
str
|
要抓取的目标网站 URL |
必需 |
api_key
|
str
|
scrapegraph API 密钥 |
必需 |
schema
|
可选[列表[BaseModel]]
|
定义输出结构的 Pydantic 模型 |
无
|
返回
类型 | 描述 |
---|---|
列表[字典]
|
List[Dict]: 符合所提供模式的抓取数据 |
源代码位于 llama-index-integrations/tools/llama-index-tools-scrapegraph/llama_index/tools/scrapegraph/base.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
|
scrapegraph_markdownify #
scrapegraph_markdownify(url: str, api_key: str) -> str
使用 scrapegraph 将网页内容转换为 Markdown 格式。
参数
名称 | 类型 | 描述 | 默认值 |
---|---|---|---|
url
|
str
|
要转换的目标网站 URL |
必需 |
api_key
|
str
|
scrapegraph API 密钥 |
必需 |
返回
名称 | 类型 | 描述 |
---|---|---|
str |
str
|
网页内容的 Markdown 表示 |
源代码位于 llama-index-integrations/tools/llama-index-tools-scrapegraph/llama_index/tools/scrapegraph/base.py
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
|
scrapegraph_search #
scrapegraph_search(query: str, api_key: str) -> str
使用 scrapegraph 执行搜索查询。
参数
名称 | 类型 | 描述 | 默认值 |
---|---|---|---|
query
|
str
|
要执行的搜索查询 |
必需 |
api_key
|
str
|
scrapegraph API 密钥 |
必需 |
返回
名称 | 类型 | 描述 |
---|---|---|
str |
str
|
scrapegraph 的搜索结果 |
源代码位于 llama-index-integrations/tools/llama-index-tools-scrapegraph/llama_index/tools/scrapegraph/base.py
63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
|