text: Skip to main contentğŸ¦œï¸�ğŸ”— LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKIntegrationsCallbacksChat modelsDocument loadersDocument transformersLLMsMemoryRetrieversText embedding modelsAgent toolkitsToolsVector storesAlibaba Cloud OpenSearchAnalyticDBAnnoyAtlasAwaDBAzure Cognitive SearchCassandraChromaClarifaiClickHouse Vector SearchActiveloop's Deep LakeDocArrayHnswSearchDocArrayInMemorySearchElasticSearchFAISSHologresLanceDBMarqoMatchingEngineMilvusMongoDB AtlasMyScaleOpenSearchpg_embeddingPGVectorPineconeQdrantRedisRocksetSingleStoreDBscikit-learnStarRocksSupabase (Postgres)TairTigrisTypesenseVectaraWeaviateZillizGrouped by providerIntegrationsVector storespg_embeddingOn this pagepg_embeddingpg_embedding is an open-source vector similarity search for Postgres that uses  Hierarchical Navigable Small Worlds for approximate nearest neighbor search.It supports:exact and approximate nearest neighbor search using HNSWL2 distanceThis notebook shows how to use the Postgres vector database (PGEmbedding).The PGEmbedding integration creates the pg_embedding extension for you, but you run the following Postgres query to add it:CREATE EXTENSION embedding;# Pip install necessary packagepip install openaipip install psycopg2-binarypip install tiktokenAdd the OpenAI API Key to the environment variables to use OpenAIEmbeddings.import osimport getpassos.environ["OPENAI_API_KEY"] = getpass.getpass("OpenAI API Key:")    OpenAI API Key:Â·Â·Â·Â·Â·Â·Â·Â·## Loading Environment Variablesfrom typing import List, Tuplefrom langchain.embeddings.openai import OpenAIEmbeddingsfrom langchain.text_splitter import CharacterTextSplitterfrom