Stay organized with collections Save and categorize content based on your preferences.
Preview — LangChain
This feature is subject to the "Pre-GA Offerings Terms" in the General Service Terms section of the Service Specific Terms. Pre-GA features are available "as is" and might have limited support. For more information, see the launch stage descriptions.
This page introduces how to build LLM-powered applications using LangChain. The overviews on this page link to procedure guides in GitHub.
What is LangChain?LangChain is an LLM orchestration framework that helps developers build generative AI applications or retrieval-augmented generation (RAG) workflows. It provides the structure, tools, and components to streamline complex LLM workflows.
For more information about LangChain, see the Google LangChain page. For more information about the LangChain framework, see the LangChain product documentation.
LangChain components for Cloud SQL for PostgreSQLCloud SQL for PostgreSQL offers the following LangChain interfaces:
Learn how to use LangChain with the LangChain Quickstart for Cloud SQL for PostgreSQL.
Vector store for Cloud SQL for PostgreSQLVector store retrieves and stores documents and metadata from a vector database. Vector store gives an application the ability to perform semantic searches that interpret the meaning of a user query. This type of search is a called a vector search, and it can find topics that match the query conceptually. At query time, vector store retrieves the embedding vectors that are most similar to the embedding of the search request. In LangChain, a vector store takes care of storing embedded data and performing the vector search for you.
To work with vector store in Cloud SQL for PostgreSQL, use the PostgresVectorStore
class.
For more information, see the LangChain Vector Stores product documentation.
Vector store procedure guideThe Cloud SQL for PostgreSQL guide for vector store shows you how to do the following:
PostgresEngine
object and configure a connection pool to your Cloud SQL for PostgreSQL databaseVertexAIEmbeddings
PostgresVectorStore
The document loader saves, loads, and deletes a LangChain Document
objects. For example, you can load data for processing into embeddings and either store it in vector store or use it as a tool to provide specific context to chains.
To load documents from document loader in Cloud SQL for PostgreSQL, use the PostgresLoader
class. PostgresLoader
returns a list of documents from a table using the first column for page content and all other columns for metadata. The default table has the first column as page content and the second column as JSON metadata. Each row becomes a document. Use the PostgresDocumentSaver
class to save and delete documents.
For more information, see the LangChain Document loaders topic.
Document loader procedure guideThe Cloud SQL for PostgreSQL guide for document loader shows you how to do the following:
PostgresDocumentSaver
to store and delete documentsQuestion and answer applications require a history of the things said in the conversation to give the application context for answering further questions from the user. The LangChain ChatMessageHistory
class lets the application save messages to a database and retrieve them when needed to formulate further answers. A message can be a question, an answer, a statement, a greeting or any other piece of text that the user or application gives during the conversation. ChatMessageHistory
stores each message and chains messages together for each conversation.
Cloud SQL for PostgreSQL extends this class with PostgresChatMessageHistory
.
The Cloud SQL for PostgreSQL guide for chat message history shows you how to do the following:
PostgresEngine
object and configure a connection pool to your Cloud SQL for PostgreSQL databasePostgresChatMessageHistory
class to add and delete messagesExcept as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-07-09 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-07-09 UTC."],[],[]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4