Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🕷️ feat: scrapegraph tools integration #1657

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

PeriniM
Copy link

@PeriniM PeriniM commented Dec 30, 2024

Add ScrapeGraph Tools Integration

Adds integration with ScrapeGraph AI for smart web scraping and markdown conversion capabilities.

Features

  • smartscraper: Extract structured data from webpages using LLM
  • markdownify: Convert webpages to markdown format

Usage

Get a free API key at dashboard.scrapegraphai.com

from phi.agent import Agent
from phi.tools.scrapegraph_tools import ScrapeGraphTools


# Example 1: Default behavior - only smartscraper enabled
scrapegraph = ScrapeGraphTools(smartscraper=True)

agent = Agent(tools=[scrapegraph], show_tool_calls=True, markdown=True, stream=True)

# Use smartscraper
agent.print_response("""
Use smartscraper to extract the following from https://www.wired.com/category/science/:
- News articles
- Headlines
- Images
- Links
- Author
""")

Output Example

Screenshot 2024-12-30 130323

Dependencies

Type of change

Please check the options that are relevant:

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Model update
  • Infrastructure change

Checklist

  • My code follows Phidata's style guidelines and best practices
  • I have performed a self-review of my code
  • I have added docstrings and comments for complex logic
  • My changes generate no new warnings or errors
  • I have added cookbook examples for my new addition (if needed)
  • I have updated requirements.txt/pyproject.toml (if needed)
  • I have verified my changes in a clean environment

Additional Notes

Run linting and format, my code is good but there is a mypy error in phi\model\ollama\chat.py

image

@PeriniM PeriniM changed the title feat: scrapegraph tools instegration 🕷️ feat: scrapegraph tools instegration Dec 30, 2024
@PeriniM PeriniM changed the title 🕷️ feat: scrapegraph tools instegration 🕷️ feat: scrapegraph tools integration Dec 30, 2024
@PeriniM PeriniM requested a review from manthanguptaa January 2, 2025 09:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants