* Adds beginning of integration contribution guide * Fix typo * Adds more context to each integration category * Adds example PRs and some integration specific information to the contributing guide * Updates integration guide with memory, tools, and vector store pages * Update integration contribution guide, fix and add links * Use relative links * Revert to absolute paths
1.8 KiB
Contributing third-party memory
This page contains some specific guidelines and examples for contributing integrations with third-party memory providers.
In LangChain, memory differs from message stores in that memory does not actually handle persistently storing messages, but acts as a representation of the LLM or chat model's awareness of past conversations, while message stores handle the actual message data persistence. For example, memory may perform other transformations on the messages, like summarization, or may emphasize specific pieces of pertinent information. Memory may rely on message stores as a backing class.
Another key difference is that message stores are only used with chat models.
Before getting started, think about whether your planned integration would be more suited as a message store or as memory!
Make sure you read the general guidelines page first!
Example PR
You can use this PR adding Motorhead memory as a reference: https://github.com/hwchase17/langchainjs/pull/598
General ideas
LangChain memory at its core contains two important methods:
loadMemoryVariables, which loads memory from a message store or other source and formats it.saveContext, which stores a representation of the current input and output values in the message store.
As previously mentioned, saving context does not need to involve storing a verbatim transcript of the back-and-forth with the LLM (though you can certainly do that!). It can also involve summarizing or emphasizing different parts of memory, like certain words, mentioned people, or key phrases to prompt the LLM to "remember" details in a different way.