-
Notifications
You must be signed in to change notification settings - Fork 201
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat: Add Amazon Bedrock support (#97)
* Add Amazon Bedrock support * add sample script to test amazon bedrock integration * add the latest Claude 3.5 Sonnet v1&v2 model * Add a factory function for bedrock completion instead of creating one for each model * update README.md to explain the Bedrock option. * clean up
- Loading branch information
Showing
7 changed files
with
172 additions
and
8 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,19 @@ | ||
from nano_graphrag import GraphRAG, QueryParam | ||
|
||
graph_func = GraphRAG( | ||
working_dir="../bedrock_example", | ||
using_amazon_bedrock=True, | ||
best_model_id="us.anthropic.claude-3-sonnet-20240229-v1:0", | ||
cheap_model_id="us.anthropic.claude-3-haiku-20240307-v1:0", | ||
) | ||
|
||
with open("../tests/mock_data.txt") as f: | ||
graph_func.insert(f.read()) | ||
|
||
prompt = "What are the top themes in this story?" | ||
|
||
# Perform global graphrag search | ||
print(graph_func.query(prompt, param=QueryParam(mode="global"))) | ||
|
||
# Perform local graphrag search (I think is better and more scalable one) | ||
print(graph_func.query(prompt, param=QueryParam(mode="local"))) |
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
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
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
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
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
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 |
---|---|---|
|
@@ -8,4 +8,5 @@ hnswlib | |
xxhash | ||
tenacity | ||
dspy-ai | ||
neo4j | ||
neo4j | ||
aioboto3 |