From ee696d71c3bdf10fff197ac68b696133e0f7c60c Mon Sep 17 00:00:00 2001 From: Marco Vinciguerra Date: Thu, 2 Jan 2025 11:23:55 +0100 Subject: [PATCH] feat: add examples --- .../tools/llama-index-tools-scrapegraph/README.md | 2 +- .../scrapegraph-markdowinify-llama-index.py | 14 ++++++++++++++ ...x.py => scrapegraph-smartscraper-lama-index.py} | 2 +- 3 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 llama-index-integrations/tools/llama-index-tools-scrapegraph/examples/scrapegraph-markdowinify-llama-index.py rename llama-index-integrations/tools/llama-index-tools-scrapegraph/examples/{scrapegraph-llama-index.py => scrapegraph-smartscraper-lama-index.py} (92%) diff --git a/llama-index-integrations/tools/llama-index-tools-scrapegraph/README.md b/llama-index-integrations/tools/llama-index-tools-scrapegraph/README.md index b5d71708616e2..625929711ae12 100644 --- a/llama-index-integrations/tools/llama-index-tools-scrapegraph/README.md +++ b/llama-index-integrations/tools/llama-index-tools-scrapegraph/README.md @@ -13,7 +13,7 @@ pip install llama-index-tools-scrapegraph First, import and initialize the ScrapegraphToolSpec: ```python -from llama_index.tools.scrapegraph import ScrapegraphToolSpec +from llama_index.tools.scrapegraph.base import ScrapegraphToolSpec scrapegraph_tool = ScrapegraphToolSpec() ``` diff --git a/llama-index-integrations/tools/llama-index-tools-scrapegraph/examples/scrapegraph-markdowinify-llama-index.py b/llama-index-integrations/tools/llama-index-tools-scrapegraph/examples/scrapegraph-markdowinify-llama-index.py new file mode 100644 index 0000000000000..037007240796a --- /dev/null +++ b/llama-index-integrations/tools/llama-index-tools-scrapegraph/examples/scrapegraph-markdowinify-llama-index.py @@ -0,0 +1,14 @@ +from llama_index.tools.scrapegraph.base import ScrapegraphToolSpec + +# Initialize the ScrapegraphToolSpec +scrapegraph_tool = ScrapegraphToolSpec() + +# Convert webpage content to markdown +response = scrapegraph_tool.scrapegraph_markdownify( + url="https://scrapegraphai.com/", + api_key="sgai-***" # Replace with your actual API key +) + +# Print the markdown content +print("Markdown Content:") +print(response) diff --git a/llama-index-integrations/tools/llama-index-tools-scrapegraph/examples/scrapegraph-llama-index.py b/llama-index-integrations/tools/llama-index-tools-scrapegraph/examples/scrapegraph-smartscraper-lama-index.py similarity index 92% rename from llama-index-integrations/tools/llama-index-tools-scrapegraph/examples/scrapegraph-llama-index.py rename to llama-index-integrations/tools/llama-index-tools-scrapegraph/examples/scrapegraph-smartscraper-lama-index.py index 31500697141f4..6915017bf1caa 100644 --- a/llama-index-integrations/tools/llama-index-tools-scrapegraph/examples/scrapegraph-llama-index.py +++ b/llama-index-integrations/tools/llama-index-tools-scrapegraph/examples/scrapegraph-smartscraper-lama-index.py @@ -1,5 +1,5 @@ from pydantic import BaseModel, Field -from llama_index.tools.scrapegraph import ScrapegraphToolSpec +from llama_index.tools.scrapegraph.base import ScrapegraphToolSpec scrapegraph_tool = ScrapegraphToolSpec()