Value Structure

Each stored value consists of the following fields:

  • query_text: The user's input/query.

  • response_text: The system's response.

  • entities: A list containing metadata:

    • time: Timestamp when the memory was stored.

    • memory_id: Matches the memory ID in the key.

    • context_id: Matches the context ID in the key.

    • memory_quality: A rating representing the quality of the memory. Memory quality is stored as 1 by default, which means a "good" memory, while 0 indicates a "bad" memory.

  • metadata: Additional information:

    • context_entity_id: Matches the context entity ID in the key.

    • user_uuid: Matches the user UUID in the key.

Default Value Structure

value = {
    "query_text": memory['query_text'],
    "response_text": memory['response_text'],
    "entities": [
        {
            "time": memory['time'],
            "memory_id": memory_context['memory_id'],
            "context_id": memory_context['context_id'],
            "memory_quality": 1  # Default memory quality
        }
    ],
    "metadata": {"context_entity_id": memory_context['context_entity_id'], "user_uuid": user_uuid}
}

Example of the Value Structure

memory = {
    "query_text": "Hello!",
    "response_text": "Hi there! How can I help you?",
    "time": "2025-02-05T12:00:00Z",
    "cache_ttl": 3600,  # Time-to-live in seconds
    "entities": [
        {
            "time": "2025-02-05T12:00:00Z",
            "memory_id": "msg001",
            "context_id": "session1",
            "memory_quality": 1,
        }
    ],
    "metadata": {
        "context_entity_id": "chatbot",
        "user_uuid": "user123",
    }
}

Last updated