Skip to main content

Prerequisites

Before beginning, ensure you have the following access and components: AWS Credentials AWS Bedrock Model Access MemMachine Docker
  • The Docker containerization platform must be installed and running.

Installation: QuickStart Configuration

The installation script will automatically guide you through setting up your Large Language Model (LLM) provider. When prompted, you must select Bedrock to integrate with AWS Bedrock. Your prompt input should match the following example:
[PROMPT] Which provider would you like to use? (OpenAI/Bedrock/Ollama) [OpenAI]: Bedrock
[INFO] Selected provider: BEDROCK
After selecting Bedrock, you will be prompted to enter the necessary AWS credentials and configuration details:
  • AWS Access Key ID
  • AWS Secret Access Key
  • AWS Region (e.g., us-east-1 or eu-central-1)
  • Choice of LLM
  • Choice of Embedding Model
If you are unsure about model selection, simply press Enter at the respective prompts to use the recommended default options.
Congratulations! You have now successfully deployed MemMachine using AWS Bedrock!

Manually Configuring MemMachine to use AWS Bedrock

To manually configure MemMachine for AWS Bedrock, you need to define your resources in the resources section of your cfg.yml file and then reference them in the memory configuration sections.

1. Define Bedrock Resources

Add or update the resources block in your cfg.yml file. You will need to configure a Language Model, an Embedder, and optionally a Reranker.
resources:
  # LLM Configuration
  language_models:
    my-bedrock-llm:
      provider: amazon-bedrock
      config:
        region: us-east-1
        aws_access_key_id: <YOUR_AWS_ACCESS_KEY>
        aws_secret_access_key: <YOUR_AWS_SECRET_KEY>
        model_id: anthropic.claude-3-sonnet-20240229-v1:0
        inference_config:
          max_tokens: 2000
          temperature: 0.7

  # Embedder Configuration
  embedders:
    my-bedrock-embedder:
      provider: amazon-bedrock
      config:
        region: us-east-1
        aws_access_key_id: <YOUR_AWS_ACCESS_KEY>
        aws_secret_access_key: <YOUR_AWS_SECRET_KEY>
        model_id: amazon.titan-embed-text-v2:0
  
  # Reranker Configuration (Optional)
  rerankers:
    my-bedrock-reranker:
      provider: amazon-bedrock
      config:
        region: us-east-1
        aws_access_key_id: <YOUR_AWS_ACCESS_KEY>
        aws_secret_access_key: <YOUR_AWS_SECRET_KEY>
        model_id: amazon.rerank-v1:0

2. Update Memory Configuration

Now, reference these resource IDs in your episodic_memory and semantic_memory sections.
episodic_memory:
  enabled: true
  long_term_memory:
    vector_graph_store: my-neo4j-db # Assumes you defined this in resources.databases
    embedder: my-bedrock-embedder
    reranker: my-bedrock-reranker
  short_term_memory:
    llm_model: my-bedrock-llm

semantic_memory:
  database: my-postgres-db # Assumes you defined this in resources.databases
  llm_model: my-bedrock-llm
  embedding_model: my-bedrock-embedder
Make sure to restart the MemMachine server for these changes to take effect.