_form_documents() — langchain Function Reference
Architecture documentation for the _form_documents() function in vectorstore.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 63ddc667_87b8_f7b5_c5eb_c036d48e5537["_form_documents()"] a0031c35_ac02_c399_69d4_5bd8f0075822["VectorStoreRetrieverMemory"] 63ddc667_87b8_f7b5_c5eb_c036d48e5537 -->|defined in| a0031c35_ac02_c399_69d4_5bd8f0075822 9622926d_99f7_f944_5390_39317f0838df["save_context()"] 9622926d_99f7_f944_5390_39317f0838df -->|calls| 63ddc667_87b8_f7b5_c5eb_c036d48e5537 ee8b0145_1599_83ea_cd5a_a29d6e27f83e["asave_context()"] ee8b0145_1599_83ea_cd5a_a29d6e27f83e -->|calls| 63ddc667_87b8_f7b5_c5eb_c036d48e5537 style 63ddc667_87b8_f7b5_c5eb_c036d48e5537 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain/langchain_classic/memory/vectorstore.py lines 87–102
def _form_documents(
self,
inputs: dict[str, Any],
outputs: dict[str, str],
) -> list[Document]:
"""Format context from this conversation to buffer."""
# Each document should only include the current turn, not the chat history
exclude = set(self.exclude_input_keys)
exclude.add(self.memory_key)
filtered_inputs = {k: v for k, v in inputs.items() if k not in exclude}
texts = [
f"{k}: {v}"
for k, v in list(filtered_inputs.items()) + list(outputs.items())
]
page_content = "\n".join(texts)
return [Document(page_content=page_content)]
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does _form_documents() do?
_form_documents() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/memory/vectorstore.py.
Where is _form_documents() defined?
_form_documents() is defined in libs/langchain/langchain_classic/memory/vectorstore.py at line 87.
What calls _form_documents()?
_form_documents() is called by 2 function(s): asave_context, save_context.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free