-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
28ab8da
commit c0d26d6
Showing
2 changed files
with
45 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
""" | ||
Smartscraper example on bedrock | ||
""" | ||
import boto3 | ||
|
||
from scrapegraphai.graphs import SmartScraperGraph | ||
|
||
# 0a. Initialize session | ||
# If not required delete it | ||
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()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters