Context Component Examples

Understanding Context Components with an Example

Example 1: Chatbot Memory System

Let's say we are building a chatbot that remembers user interactions:

  • context_entity_id = "chatbot" → The chatbot is the system storing the memory.

  • context_id = "session_123" → Represents a specific conversation session with a user.

  • memory_id = "msg001" → A specific message within that session.

So, the generated key will look like this:

user123:chatbot:session_123:msg001

This ensures that each message in a conversation session can be uniquely identified and retrieved.

Example 2: E-commerce Recommendation System

  • context_entity_id = "recommendation_engine" → Memory is stored for product recommendations.

  • context_id = "user_session_456" → Represents a specific user browsing session.

  • memory_id = "product_view_789" → Tracks a specific product the user viewed.

Generated key:

user456:recommendation_engine:user_session_456:product_view_789

This structure helps in storing personalized recommendations for users.

Last updated