Skip to main content

Prerequisites

Before you begin the installation and configuration of MemMachine, you must ensure that your local environment is ready by having Ollama installed and the necessary models downloaded.

1. Ollama Service

MemMachine connects directly to Ollama using its local API, which must be running in the background.
  • Installation: If you do not yet have Ollama installed, please follow the official setup guide.
  • Start the Service: Once installed, start the Ollama service to make the local API available. Open your terminal or command prompt and run:
    ollama serve
    
  • Verification: You can confirm the service is running successfully by opening your web browser and navigating to the following address: http://localhost:11434 You should see the Ollama web interface if the service is active.

2. Required Ollama Models

MemMachine requires two types of models to function: a Large Language Model (LLM) for generative tasks and an embedding model for converting text into vectors (e.g., for retrieval-augmented generation). You must download these models to your local Ollama repository before starting MemMachine.
  • Download Models: Use the ollama pull command to download the models you want.
Model TypeExample Model IDCommand to Run
Large Language Model (LLM)Llama 3ollama pull llama3
Embedding ModelNomic Embed Textollama pull nomic-embed-text
You can choose any compatible LLM (like mixtral, gemma, etc.) and embedding model available on Ollama, but the examples above are recommended starting points.
  • View Downloaded Models: To see a list of all models currently available in your local Ollama repository, run:
    ollama list
    

Installation: QuickStart Configuration

The installation script will automatically guide you through setting up your Large Language Model (LLM) provider. When prompted, you must select Ollama to integrate with Ollama. Your prompt input should match the following example:
[PROMPT] Which provider would you like to use? (OpenAI/Bedrock/Ollama) [OpenAI]: Ollama
[INFO] Selected provider: OLLAMA
Ollama Configuration and Model Choices You’ll then be prompted to select: • Ollama base URL (default: http://host.docker.internal:11434/v1) • Choice of LLM (Large Language Model) example: llama3 • Choice of Embedding Model example: nomic-embed-text
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 Ollama!

Manually Configuring MemMachine to use Ollama

To manually configure MemMachine to use your local Ollama instance, you need to define your resources in the resources section of your cfg.yml file, pointing them to your local Ollama API endpoint (usually http://host.docker.internal:11434/v1 if running MemMachine in Docker).

1. Define Ollama Resources

Add or update the resources block in your cfg.yml. We will use the openai-chat-completions provider for the LLM and the openai provider for embeddings, as Ollama is API-compatible.
resources:
  # LLM Configuration
  language_models:
    my-ollama-llm:
      provider: openai-chat-completions
      config:
        model: llama3
        api_key: "EMPTY" # Ollama doesn't require a key
        base_url: "http://host.docker.internal:11434/v1"

  # Embedder Configuration
  embedders:
    my-ollama-embedder:
      provider: openai
      config:
        model: nomic-embed-text
        api_key: "EMPTY"
        base_url: "http://host.docker.internal:11434/v1"
        dimensions: 768 # Ensure this matches your model's output
  
  # Reranker Configuration (Optional - using BM25 as fallback)
  rerankers:
    my-bm25-reranker:
      provider: bm25

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-ollama-embedder
    reranker: my-bm25-reranker
  short_term_memory:
    llm_model: my-ollama-llm

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