repositories
loading repo index
repositories
loading repo index
repository
loading code, commits, and activity
public Clawd ADK gateway launch mirror
stars
latest
clone command
git clone gitlawb://did:key:z6Mkq5mY...iFZ5/my-project-publ...git clone gitlawb://did:key:z6Mkq5mY.../my-project-publ...2fa351d6docs: add automaton and perps launch sources16d ago| #1 | --- |
| #2 | title: AWS Bedrock |
| #3 | --- |
| #4 | |
| #5 | To use AWS Bedrock embedding models, you need to have the appropriate AWS credentials and permissions. The embeddings implementation relies on the `boto3` library. |
| #6 | |
| #7 | ### Setup |
| #8 | - Ensure you have model access from the [AWS Bedrock Console](https://us-east-1.console.aws.amazon.com/bedrock/home?region=us-east-1#/modelaccess) |
| #9 | - Authenticate the boto3 client using a method described in the [AWS documentation](https://boto3.amazonaws.com/v1/documentation/api/latest/guide/credentials.html) |
| #10 | - Set up environment variables for authentication: |
| #11 | ```bash |
| #12 | export AWS_REGION=us-east-1 |
| #13 | export AWS_ACCESS_KEY_ID=your-access-key |
| #14 | export AWS_SECRET_ACCESS_KEY=your-secret-key |
| #15 | ``` |
| #16 | |
| #17 | ### Usage |
| #18 | |
| #19 | <CodeGroup> |
| #20 | ```python Python |
| #21 | import os |
| #22 | from mem0 import Memory |
| #23 | |
| #24 | # For LLM if needed |
| #25 | os.environ["OPENAI_API_KEY"] = "your-openai-api-key" |
| #26 | |
| #27 | # AWS credentials |
| #28 | os.environ["AWS_REGION"] = "us-west-2" |
| #29 | os.environ["AWS_ACCESS_KEY_ID"] = "your-access-key" |
| #30 | os.environ["AWS_SECRET_ACCESS_KEY"] = "your-secret-key" |
| #31 | |
| #32 | config = { |
| #33 | "embedder": { |
| #34 | "provider": "aws_bedrock", |
| #35 | "config": { |
| #36 | "model": "amazon.titan-embed-text-v2:0" |
| #37 | } |
| #38 | } |
| #39 | } |
| #40 | |
| #41 | m = Memory.from_config(config) |
| #42 | messages = [ |
| #43 | {"role": "user", "content": "I'm planning to watch a movie tonight. Any recommendations?"}, |
| #44 | {"role": "assistant", "content": "How about thriller movies? They can be quite engaging."}, |
| #45 | {"role": "user", "content": "I'm not a big fan of thriller movies but I love sci-fi movies."}, |
| #46 | {"role": "assistant", "content": "Got it! I'll avoid thriller recommendations and suggest sci-fi movies in the future."} |
| #47 | ] |
| #48 | m.add(messages, user_id="alice") |
| #49 | ``` |
| #50 | </CodeGroup> |
| #51 | |
| #52 | ### Config |
| #53 | |
| #54 | Here are the parameters available for configuring AWS Bedrock embedder: |
| #55 | |
| #56 | <Tabs> |
| #57 | <Tab title="Python"> |
| #58 | | Parameter | Description | Default Value | |
| #59 | | --- | --- | --- | |
| #60 | | `model` | The name of the embedding model to use | `amazon.titan-embed-text-v1` | |
| #61 | </Tab> |
| #62 | </Tabs> |
| #63 |