mem0 icon indicating copy to clipboard operation
mem0 copied to clipboard

getting validation error in m.search method

Open ragesh-beo opened this issue 7 months ago • 3 comments

🐛 Describe the bug

the following is my config.

config = {
    "vector_store": {
        "provider": "langchain",
        "config": {
            "client": vector_store
        }
    },    
    "llm": {
        "provider": "groq",
        "config": {
            "model": "llama3-8b-8192",
            "temperature": 0.1,
            "max_tokens": 2000,
        }
    },
    "embedder": {
        "provider": "ollama",
        "config": {
            "model": "nomic-embed-text:latest",
            "ollama_base_url": "http://localhost:11434",
            
        },
    },
}

# Initialize Memory with the configuration
m = Memory.from_config(config)
messages = [
    {"role": "user", "content": "I'm planning to watch a movie tonight. Any recommendations?"},
    {"role": "assistant", "content": "How about a thriller movies? They can be quite engaging."},
    {"role": "user", "content": "I'm not a big fan of thriller movies but I love sci-fi movies."},
    {"role": "assistant", "content": "Got it! I'll avoid thriller recommendations and suggest sci-fi movies in the future."}
]
m.add(messages, user_id="alice", metadata={"category": "movies"})
related_memories = m.search("suggest me a good movie", user_id="alice"

this gives me the error

ValidationError: 1 validation error for MemoryItem
id
  Input should be a valid string [type=string_type, input_value=None, input_type=NoneType]

ragesh-beo avatar May 20 '25 07:05 ragesh-beo

Hey @ragesh-beo I don't think Langchain is vector_store, it is a LLM framework. Try using a valid vector store like qdrant, pinecone, pgvector etc.

Vikas-ai56 avatar May 20 '25 16:05 Vikas-ai56

Thanks for the response @Vikas-ai56 But actually the vector store I used was Chrom Db using lanchain. Exactly as in the tutorial https://docs.mem0.ai/components/vectordbs/dbs/langchain The only difference is, instead of OpenAIEmbeddings I have used OllamaEmbeddings.

ragesh-beo avatar May 21 '25 04:05 ragesh-beo

same issue

breakices avatar Jun 03 '25 08:06 breakices