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 | ### Setup |
| #6 | - Before using the AWS Bedrock LLM, make sure you have the appropriate model access from [Bedrock Console](https://us-east-1.console.aws.amazon.com/bedrock/home?region=us-east-1#/modelaccess). |
| #7 | - You will also need to authenticate the `boto3` client by using a method in the [AWS documentation](https://boto3.amazonaws.com/v1/documentation/api/latest/guide/credentials.html#configuring-credentials) |
| #8 | - You will have to export `AWS_REGION`, `AWS_ACCESS_KEY`, and `AWS_SECRET_ACCESS_KEY` to set environment variables. |
| #9 | |
| #10 | ### Usage |
| #11 | |
| #12 | ```python |
| #13 | import os |
| #14 | from mem0 import Memory |
| #15 | |
| #16 | os.environ['AWS_REGION'] = 'us-west-2' |
| #17 | os.environ["AWS_ACCESS_KEY_ID"] = "xx" |
| #18 | os.environ["AWS_SECRET_ACCESS_KEY"] = "xx" |
| #19 | |
| #20 | config = { |
| #21 | "llm": { |
| #22 | "provider": "aws_bedrock", |
| #23 | "config": { |
| #24 | "model": "anthropic.claude-3-5-haiku-20241022-v1:0", |
| #25 | "temperature": 0.2, |
| #26 | "max_tokens": 2000, |
| #27 | } |
| #28 | } |
| #29 | } |
| #30 | |
| #31 | m = Memory.from_config(config) |
| #32 | messages = [ |
| #33 | {"role": "user", "content": "I'm planning to watch a movie tonight. Any recommendations?"}, |
| #34 | {"role": "assistant", "content": "How about thriller movies? They can be quite engaging."}, |
| #35 | {"role": "user", "content": "I’m not a big fan of thriller movies but I love sci-fi movies."}, |
| #36 | {"role": "assistant", "content": "Got it! I'll avoid thriller recommendations and suggest sci-fi movies in the future."} |
| #37 | ] |
| #38 | m.add(messages, user_id="alice", metadata={"category": "movies"}) |
| #39 | ``` |
| #40 | |
| #41 | ### Config |
| #42 | |
| #43 | All available parameters for the `aws_bedrock` config are present in [Master List of All Params in Config](../config). |