BrainAPI
BrainAPI

For the complete BrainAPI documentation index, see llms.txt. A markdown version of any docs page is available by appending .md to its URL. Docs MCP: /docs/mcp.

Injection

How to inject data into the memory store

Injection

You can inject extra knowledge into the memory store. You might want to add memories about user documents, emails. You might also want to add general memories if you are building a chatbot, for example you might want to add the documentation of your product or the knowledge base that will be used to answer questions from your users.

Importing

Start by importing the Driver class.

import { LumenBrainDriver } from "lumen-brain";// Initialize the driver with your API keyconst brain = new LumenBrainDriver("your-api-key");

Injecting additional knowledge

You can retrieve additional context based on the user's message and append it to the prompt for the LLM. The additional context will include relevant information extracted from the memory and the conversation history if conversation_id is provided.

const knowledgeResult = await brain.injectKnowledge(  "memory-uuid",  "Important information to remember",  "event" // message, file, event, webpage, email);

Prop

Type

On this page