Skip to content

Observation Date falls back to Current Date during memory extraction when historical timestamp is provided #4963

@wianger

Description

@wianger

Component

Core / Python SDK

Description

Summary

generate_additive_extraction_prompt(...) already supports a timestamp parameter to populate ## Observation Date, but the sync and async Memory._add_to_vector_store(...) call sites do not pass any observation timestamp.

As a result, Observation Date defaults to Current Date, even when the caller provides a historical timestamp in metadata. This can cause relative references such as last week, yesterday, today, and recently to be resolved against the processing date instead of the date when the conversation actually happened.

Steps to Reproduce

from mem0 import Memory

m = Memory()
m.add(
    "I went to Paris last week",
    user_id="u1",
    metadata={"timestamp": "2023-05-24T10:00:00+00:00"},
    infer=True,
)

Expected Behavior

The extraction prompt should include:

## Observation Date
2023-05-24T10:00:00+00:00

so last week is resolved relative to May 24, 2023.

Actual Behavior

The prompt falls back to the current system date for both Observation Date and Current Date, so historical relative dates may be resolved incorrectly.

Environment

  • mem0 version: 2.0.0 from current main branch
  • Python/Node version: Python 3.12.3
  • OS: Linux x86_64, WSL2 (6.6.87.2-microsoft-standard-WSL2)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions