diff --git a/docs/examples/memory.rst b/docs/examples/memory.rst new file mode 100644 index 00000000000..c5c064f88db --- /dev/null +++ b/docs/examples/memory.rst @@ -0,0 +1,11 @@ +Memory +====== + +The examples here are all related to working with the concept of Memory in LangChain. + +.. toctree:: + :maxdepth: 1 + :glob: + :caption: Memory + + memory/* \ No newline at end of file diff --git a/docs/examples/memory/agent_with_memory.ipynb b/docs/examples/memory/agent_with_memory.ipynb index 48c8533b26a..fa93a7e0dc1 100644 --- a/docs/examples/memory/agent_with_memory.ipynb +++ b/docs/examples/memory/agent_with_memory.ipynb @@ -76,7 +76,7 @@ " suffix=suffix, \n", " input_variables=[\"input\", \"chat_history\"]\n", ")\n", - "memory = ConversationBufferMemory(dynamic_key=\"chat_history\")" + "memory = ConversationBufferMemory(memory_key=\"chat_history\")" ] }, { diff --git a/docs/explanation/core_concepts.md b/docs/explanation/core_concepts.md index be4b8e2eeb4..eafb6db07bb 100644 --- a/docs/explanation/core_concepts.md +++ b/docs/explanation/core_concepts.md @@ -29,3 +29,9 @@ They vary greatly in complexity and are combination of generic, highly configura ## Agents As opposed to a chain, whether the steps to be taken are known ahead of time, agents use an LLM to determine which tools to call and in what order. + +## Memory +By default, Chains and Agents are stateless, meaning that they treat each incoming query independently. +In some applications (chatbots being a GREAT example) it is highly important to remember previous interactions, +both at a short term but also at a long term level. The concept of "Memory" exists to do exactly that. + diff --git a/docs/getting_started/memory.ipynb b/docs/getting_started/memory.ipynb index 402ac39c332..6b297f3c2ba 100644 --- a/docs/getting_started/memory.ipynb +++ b/docs/getting_started/memory.ipynb @@ -290,10 +290,20 @@ "conversation_with_summary.predict(input=\"Very cool -- what is the scope of the project?\")" ] }, + { + "cell_type": "markdown", + "id": "5c8735cc", + "metadata": {}, + "source": [ + "### More Resources on Memory\n", + "\n", + "This just scratches the surface of what you can do with memory. For more examples on things like how to implement custom memory classes, how to add memory to a custom LLM chain and how to use memory with and agent, please see the [How-To: Memory](../../examples/memory) section." + ] + }, { "cell_type": "code", "execution_count": null, - "id": "0eb11bd0", + "id": "436dda66", "metadata": {}, "outputs": [], "source": [] diff --git a/docs/index.rst b/docs/index.rst index b0418caa2c4..5dc98488dea 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -120,6 +120,7 @@ Start here if you haven't used LangChain before. examples/integrations.rst examples/chains.rst examples/agents.rst + examples/memory.rst examples/model_laboratory.ipynb More elaborate examples and walk-throughs of particular