gusye1234 / nano-graphrag

A simple, easy-to-hack GraphRAG implementation
MIT License
1.66k stars 160 forks source link

Add Amazon Bedrock support #97

Closed kmotohas closed 3 days ago

kmotohas commented 1 week ago

Overview

This pull request adds support for Amazon Bedrock, AWS's generative AI service, as a backend for LLM and embedding models in nano-graphrag.

Changes

How to Test

  1. Set up AWS credentials:
export AWS_ACCESS_KEY_ID=your_access_key
export AWS_SECRET_ACCESS_KEY=your_secret_key
export AWS_REGION=us-east-1  # or your preferred region
  1. Update your code to use Amazon Bedrock models and embeddings
graph_func = GraphRAG(working_dir="./working_dir", using_amazon_bedrock=True)

Note

gusye1234 commented 1 week ago

LGTM! Would you mind update the readme as well? Maybe add a tip at https://github.com/gusye1234/nano-graphrag?tab=readme-ov-file#quick-start, So people know they can use Claude through Amazon Bedrock

kmotohas commented 6 days ago

@gusye1234 Thank you for the review! I have added tips to use Amazon Bedrock in README.md. I also modified to use a factory function to create functions for Amazon Bedrock completion instead of defining one for each model ID to keep pace with service updates.