Skip to main content

Prerequisites

  • Python 3.8 or later.
  • A Lyzr API key for the hosted version, or API keys for Gemini (embeddings) and OpenAI (fact extraction) for the open-source version.

1. Install

2. Set API keys

3. Add memories

Send conversation messages to Cognis. It extracts and stores discrete facts automatically.

4. Search memories

Retrieve the most relevant facts before your agent responds.

5. Get context for your LLM

Assemble both short-term conversation history and long-term memories into a single string for your system prompt.

What just happened

Cognis stored your raw messages, then the extraction layer pulled discrete facts and auto-categorized them (identity, preferences, interests, and more). Each fact was embedded and indexed for hybrid search using 70% vector similarity and 30% BM25 keyword matching. The context / get_context call assembled both short-term messages and long-term memories into a ready-to-use LLM context string.

Next steps