문서 로더는 LangChain Document 객체를 저장, 로드, 삭제합니다. 예를 들어 임베딩으로 처리할 데이터를 로드하고 벡터 저장소에 저장하거나 체인에 특정 컨텍스트를 제공하는 도구로 사용할 수 있습니다.
SQL Server용 Cloud SQL의 문서 로더에서 문서를 로드하려면 MSSQLLoader 클래스를 사용합니다. MSSQLLoader 메서드는 테이블에서 문서를 한 개 이상 반환합니다. 문서를 저장 및 삭제하려면 MSSQLDocumentSaver 클래스를 사용합니다.
질의응답 애플리케이션의 경우 사용자의 추가 질문에 대답하기 위해 애플리케이션 컨텍스트를 제공하려면 대화에서 말한 내용의 기록이 필요합니다. LangChain ChatMessageHistory 클래스를 사용하면 애플리케이션이 메시지를 데이터베이스에 저장하고 필요할 때 가져와 추가 대답을 생성할 수 있습니다. 메시지는 질문, 대답, 서술, 인사말 또는 대화 중에 사용자 또는 애플리케이션이 제공하는 기타 텍스트일 수 있습니다.
ChatMessageHistory가 각 메시지를 저장하고 각 대화의 메시지를 함께 연결합니다.
SQL 서버용 Cloud SQL은 MSSQLChatMessageHistory로 이 클래스를 확장합니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-08-18(UTC)"],[],[],null,["# Build LLM-powered applications using LangChain\n\n\u003cbr /\u003e\n\n[MySQL](/sql/docs/mysql/langchain \"View this page for the MySQL database engine\") \\| [PostgreSQL](/sql/docs/postgres/langchain \"View this page for the PostgreSQL database engine\") \\| SQL Server\n\n\u003cbr /\u003e\n\n|\n| **Preview\n| --- LangChain**\n|\n|\n| This feature is subject to the \"Pre-GA Offerings Terms\" in the General Service Terms section\n| of the [Service Specific Terms](/terms/service-terms#1).\n|\n| Pre-GA features are available \"as is\" and might have limited support.\n|\n| For more information, see the\n| [launch stage descriptions](/products#product-launch-stages).\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 Cloud SQL for SQL Server\n-------------------------------------------------\n\nCloud SQL for SQL Server offers the following LangChain interfaces:\n\n- [Document loader](#document-loader)\n- [Chat message history](#chat-message-history)\n\nLearn how to use LangChain with the\n[LangChain Quickstart for Cloud SQL for SQL Server](https://github.com/googleapis/langchain-google-cloud-sql-mssql-python).\n\nDocument loader for Cloud SQL for SQL Server\n--------------------------------------------\n\nThe document loader saves, loads, and deletes a LangChain\n`Document` objects. For example, you can load data for processing into\nembeddings and either store it in vector store or use it as a tool to provide\nspecific context to chains.\n\nTo load documents from document loader in Cloud SQL for SQL Server, use the\n`MSSQLLoader` class. `MSSQLLoader` methods return one or more documents from a\ntable. Use the `MSSQLDocumentSaver` class to save 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 [Cloud SQL for SQL Server guide for document\nloader](https://github.com/googleapis/langchain-google-cloud-sql-mssql-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 `MSSQLDocumentSaver` to store and delete documents\n\nChat message history for Cloud SQL for SQL Server\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\nCloud SQL for SQL Server extends this class with `MSSQLChatMessageHistory`.\n\n### Chat message history procedure guide\n\nThe [Cloud SQL for SQL Server guide for chat message\nhistory](https://github.com/googleapis/langchain-google-cloud-sql-mssql-python/blob/main/docs/chat_message_history.ipynb) shows you how to do the following:\n\n- Install LangChain and authenticate to Google Cloud\n- Create a `MSSQLEngine` object and configure a connection pool to your Cloud SQL for SQL Server database\n- Initialize a table\n- Initialize the `MSSQLChatMessageHistory` class to add and delete messages\n- Create a chain for message history using the LangChain Expression Language (LCEL) and Google's Vertex AI chat models"]]