Skip to content

[BUG] Mem0 memory search fails #2589

Closed
Closed
@dperssongrt

Description

@dperssongrt

Description

Freshly created project with no memories. During query this exception is thrown:

File "/Users/dpersson/projects/ted-crew/venv/lib/python3.12/site-packages/crewai/memory/storage/mem0_storage.py", line 121, in search
return [r for r in results if r["score"] >= score_threshold]
~^^^^^^^^^
TypeError: string indices must be integers, not 'str'

The issue is the results looks like this: {'results': [], 'relations': []}

The issue is in crewai.memory.storage.mem0_storage.py: line 120

return [r for r in results if r["score"] >= score_threshold]

That should be :

return [r for r in results['results'] if r["score"] >= score_threshold]

When I made that change in the site-packages files my query worked

Steps to Reproduce

Attempt to pull memories with mem0

Expected behavior

Memories should be retrieved

Screenshots/Code snippets

return [r for r in results if r["score"] >= score_threshold] -> return [r for r in results['results'] if r["score"] >= score_threshold]

Operating System

macOS Sonoma

Python Version

3.12

crewAI Version

0.114.0

crewAI Tools Version

0.40.1

Virtual Environment

Venv

Evidence

Described above

Possible Solution

return [r for r in results if r["score"] >= score_threshold] -> return [r for r in results['results'] if r["score"] >= score_threshold]

Additional context

None

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions