Skip to content

feat: Custom AWS credentials #229

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

Merged
merged 1 commit into from
May 13, 2024

Conversation

JGalego
Copy link
Contributor

@JGalego JGalego commented May 13, 2024

This PR adds support for custom AWS credentials passed via graph configs.

Example:

import boto3

from scrapegraphai.graphs import SmartScraperGraph

# 0a. Initialize session
session = boto3.Session(
    aws_access_key_id="...",
    aws_secret_access_key="...",
    aws_session_token="...",
    region_name="us-east-1"
)

# 0b. Initialize client
client = session.client("bedrock-runtime")

# 1. Define graph configuration
config = {
    "llm": {
        "client": client,
        "model": "bedrock/anthropic.claude-3-sonnet-20240229-v1:0",
        "temperature": 0.0,
        "format": "json"
    },
    "embeddings": {
        "client": client,
        "model": "bedrock/cohere.embed-multilingual-v3",
    },
}

# 2. Create graph instance
graph = SmartScraperGraph(
    prompt="List me all the articles",
    source="https://perinim.github.io/projects",
    config=config
)

# 3. Scrape away!
print(graph.run())

# Ouput: {'articles': ['Rotary Pendulum RL', 'DQN Implementation from scratch', 'Multi Agents HAED', 'Wireless ESC for Modular Drones']}

@VinciGit00 VinciGit00 merged commit 28ab8da into ScrapeGraphAI:pre/beta May 13, 2024
Copy link

🎉 This PR is included in version 0.11.0-beta.8 🎉

The release is available on:

Your semantic-release bot 📦🚀

Copy link

🎉 This PR is included in version 0.11.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants