[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-09-04。"],[],[],null,["# Build LLM-powered applications using LangChain\n\nThis page introduces how to build LLM-powered applications using\n[LangChain](https://www.langchain.com/). The overviews on this\npage link to procedure guides in GitHub.\n\nWhat is LangChain?\n------------------\n\nLangChain is an LLM orchestration framework that helps developers build\ngenerative AI applications or retrieval-augmented generation (RAG) workflows. It\nprovides the structure, tools, and components to streamline complex LLM\nworkflows.\n\nFor more information about LangChain, see the [Google\nLangChain](https://python.langchain.com/docs/integrations/platforms/google)\npage. For more information about the LangChain framework, see the [LangChain](https://python.langchain.com/docs/get_started/introduction)\nproduct documentation.\n\nLangChain components for Memorystore for Redis Cluster\n------------------------------------------------------\n\nMemorystore for Redis Cluster offers the following LangChain interfaces:\n\n- [Vector store](#vector-store)\n- [Document loader](#document-loader)\n- [Chat message history](#chat-message-history)\n\nLearn how to use LangChain with the\n[LangChain Quickstart for Memorystore for Redis Cluster](https://github.com/googleapis/langchain-google-memorystore-redis-python).\n\nVector store for Memorystore for Redis Cluster\n----------------------------------------------\n\nVector store retrieves and stores documents and metadata from a vector database.\nVector store gives an application the ability to perform semantic searches that\ninterpret the meaning of a user query. This type of search is a called a\nvector search, and it can find topics that match the query conceptually. At\nquery time, vector store retrieves the embedding vectors that are\nmost similar to the embedding of the search request. In LangChain, a vector\nstore takes care of storing embedded data and performing the vector search\nfor you.\n\nTo work with vector store in Memorystore for Redis Cluster, use the `RedisVectorStore`\nclass.\n\nFor more information, see the\n[LangChain Vector stores](https://python.langchain.com/docs/modules/data_connection/vectorstores/)\nproduct documentation.\n\n### Vector store procedure guide\n\nThe [Memorystore for Redis Cluster guide for vector\nstore](https://github.com/googleapis/langchain-google-memorystore-redis-python/blob/main/docs/vector_store.ipynb) shows you how to do the following:\n\n- Install the integration package and LangChain\n- Initialize a vector index\n- Prepare documents for the vector store\n- Add documents to the vector store\n- Perform a similarity search (KNN)\n- Perform a range-based similarity search\n- Perform a Maximal Marginal Relevance (MMR) Search\n- Use the vector store as a Retriever\n- Delete documents from the vector store\n- Delete a Vector Index\n\nDocument loader for Memorystore for Redis Cluster\n-------------------------------------------------\n\nThe document loader saves, loads, and deletes a LangChain `Document`\nobjects. For example, you can load data for processing into embeddings and\neither store it in vector store or use it as a tool to provide specific context\nto chains.\n\nTo load documents from document loader in Memorystore for Redis Cluster, use the\n`MemorystoreDocumentLoader` class. Use the `MemorystoreDocumentSaver` class to\nsave and delete documents.\n\nFor more information, see the [LangChain Document\nloaders](https://python.langchain.com/docs/modules/data_connection/document_loaders/) topic.\n\n### Document loader procedure guide\n\nThe [Memorystore for Redis Cluster guide for document\nloader](https://github.com/googleapis/langchain-google-memorystore-redis-python/blob/main/docs/document_loader.ipynb) shows you how to do the following:\n\n- Install the integration package and LangChain\n- Load documents from a table\n- Add a filter to the loader\n- Customize the connection and authentication\n- Customize Document construction by specifying customer content and metadata\n- How to use and customize a `MemorystoreDocumentSaver` to store and delete documents\n\nChat message history for Memorystore for Redis Cluster\n------------------------------------------------------\n\nQuestion and answer applications require a history of the things said in the\nconversation to give the application context for answering further questions\nfrom the user. The LangChain `ChatMessageHistory` class lets the application\nsave messages to a database and retrieve them when needed to formulate further\nanswers. A message can be a question, an answer, a statement, a greeting or any\nother piece of text that the user or application gives during the conversation.\n`ChatMessageHistory` stores each message and chains messages together for each\nconversation.\n\nMemorystore for Redis Cluster extends this class with `MemorystoreChatMessageHistory`.\n\n### Chat message history procedure guide\n\nThe [Memorystore for Redis Cluster guide for chat message\nhistory](https://github.com/googleapis/langchain-google-memorystore-redis-python/blob/main/docs/chat_message_history.ipynb) shows you how to:\n\n- Install LangChain and authenticate to Google Cloud\n- Initialize the `MemorystoreChatMessageHistory` class to add and delete messages"]]