# LlamaIndex Tool - Scrapegraph
This tool integrates [Scrapegraph](https://scrapegraph.ai) with LlamaIndex, providing intelligent web scraping capabilities with structured data extraction.
## Installation
```bash
pip install llama-index-tools-scrapegraph
```
## Usage
First, import and initialize the ScrapegraphToolSpec:
```python
from llama_index.tools.scrapegraph import ScrapegraphToolSpec
scrapegraph_tool = ScrapegraphToolSpec()
```
### Available Functions
The tool provides the following capabilities:
1. **Smart Scraping (Sync)**
```python
from pydantic import BaseModel
class ProductSchema(BaseModel):
name: str
price: float
description: str
schema = [ProductSchema]
result = scrapegraph_tool.scrapegraph_smartscraper(
prompt="Extract product information",
url="https://example.com/product",
api_key="your-api-key",
schema=schema,
)
```
2. **Smart Scraping (Async)**
```python
result = await scrapegraph_tool.scrapegraph_smartscraper_async(
prompt="Extract product information",
url="https://example.com/product",
api_key="your-api-key",
schema=schema,
)
```
3. **Submit Feedback**
```python
response = scrapegraph_tool.scrapegraph_feedback(
request_id="request-id",
api_key="your-api-key",
rating=5,
feedback_text="Great results!",
)
```
4. **Check Credits**
```python
credits = scrapegraph_tool.scrapegraph_get_credits(api_key="your-api-key")
```
## Requirements
- Python 3.8+
- `scrapegraph-py` package
- Valid Scrapegraph API key
## License
This project is licensed under the MIT License - see the LICENSE file for details.
Raw data
{
"_id": null,
"home_page": null,
"name": "llama-index-tools-scrapegraphai",
"maintainer": "Vincigit00",
"docs_url": null,
"requires_python": "<4.0,>=3.10",
"maintainer_email": null,
"keywords": "scraping",
"author": "Marco Vinciguerra",
"author_email": "mvincig11@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/0e/6f/bd2233670bcd5a0acb6cfb2dd614cf148ffe872014eb47716b80b36dc218/llama_index_tools_scrapegraphai-0.0.1.tar.gz",
"platform": null,
"description": "# LlamaIndex Tool - Scrapegraph\n\nThis tool integrates [Scrapegraph](https://scrapegraph.ai) with LlamaIndex, providing intelligent web scraping capabilities with structured data extraction.\n\n## Installation\n\n```bash\npip install llama-index-tools-scrapegraph\n```\n\n## Usage\n\nFirst, import and initialize the ScrapegraphToolSpec:\n\n```python\nfrom llama_index.tools.scrapegraph import ScrapegraphToolSpec\n\nscrapegraph_tool = ScrapegraphToolSpec()\n```\n\n### Available Functions\n\nThe tool provides the following capabilities:\n\n1. **Smart Scraping (Sync)**\n\n```python\nfrom pydantic import BaseModel\n\n\nclass ProductSchema(BaseModel):\n name: str\n price: float\n description: str\n\n\nschema = [ProductSchema]\nresult = scrapegraph_tool.scrapegraph_smartscraper(\n prompt=\"Extract product information\",\n url=\"https://example.com/product\",\n api_key=\"your-api-key\",\n schema=schema,\n)\n```\n\n2. **Smart Scraping (Async)**\n\n```python\nresult = await scrapegraph_tool.scrapegraph_smartscraper_async(\n prompt=\"Extract product information\",\n url=\"https://example.com/product\",\n api_key=\"your-api-key\",\n schema=schema,\n)\n```\n\n3. **Submit Feedback**\n\n```python\nresponse = scrapegraph_tool.scrapegraph_feedback(\n request_id=\"request-id\",\n api_key=\"your-api-key\",\n rating=5,\n feedback_text=\"Great results!\",\n)\n```\n\n4. **Check Credits**\n\n```python\ncredits = scrapegraph_tool.scrapegraph_get_credits(api_key=\"your-api-key\")\n```\n\n## Requirements\n\n- Python 3.8+\n- `scrapegraph-py` package\n- Valid Scrapegraph API key\n\n## License\n\nThis project is licensed under the MIT License - see the LICENSE file for details.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "llama-index tools integrating ScrapegraphAI",
"version": "0.0.1",
"project_urls": null,
"split_keywords": [
"scraping"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "df56ab9e6d9ef2b43466129846649d370561dab28dadb6a68c7fa45240841e68",
"md5": "09bf730cdf2e9c8bcdde728fe0427ef1",
"sha256": "af8ca7426bc9a6f1c59a1c27f947e145f42533769a8b463f617e14fda51075d5"
},
"downloads": -1,
"filename": "llama_index_tools_scrapegraphai-0.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "09bf730cdf2e9c8bcdde728fe0427ef1",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.10",
"size": 2916,
"upload_time": "2024-12-11T17:32:51",
"upload_time_iso_8601": "2024-12-11T17:32:51.045472Z",
"url": "https://files.pythonhosted.org/packages/df/56/ab9e6d9ef2b43466129846649d370561dab28dadb6a68c7fa45240841e68/llama_index_tools_scrapegraphai-0.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "0e6fbd2233670bcd5a0acb6cfb2dd614cf148ffe872014eb47716b80b36dc218",
"md5": "9028eebfd408d061f8e8742e296949c8",
"sha256": "3d64998e466ce9f4021ce9e32c7c6eadc9c749319b6a2713b5721163a4407516"
},
"downloads": -1,
"filename": "llama_index_tools_scrapegraphai-0.0.1.tar.gz",
"has_sig": false,
"md5_digest": "9028eebfd408d061f8e8742e296949c8",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.10",
"size": 2627,
"upload_time": "2024-12-11T17:32:53",
"upload_time_iso_8601": "2024-12-11T17:32:53.479512Z",
"url": "https://files.pythonhosted.org/packages/0e/6f/bd2233670bcd5a0acb6cfb2dd614cf148ffe872014eb47716b80b36dc218/llama_index_tools_scrapegraphai-0.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-11 17:32:53",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "llama-index-tools-scrapegraphai"
}