Skip to main content
Ctrl+K
🦜🔗 LangChain  documentation - Home 🦜🔗 LangChain  documentation - Home
  • Reference
Ctrl+K
Docs
OSZAR »
  • GitHub
  • X / Twitter
Ctrl+K
  • Reference
Docs
OSZAR »
  • GitHub
  • X / Twitter

Section Navigation

Base packages

  • Core
  • Langchain
  • Text Splitters
  • Community
    • adapters
    • agent_toolkits
    • agents
    • cache
    • callbacks
    • chains
    • chat_loaders
    • chat_message_histories
    • chat_models
    • cross_encoders
    • docstore
    • document_compressors
    • document_loaders
    • document_transformers
    • embeddings
    • example_selectors
    • graph_vectorstores
    • graphs
    • indexes
    • llms
    • memory
    • output_parsers
    • query_constructors
    • retrievers
    • storage
    • tools
    • utilities
    • utils
    • vectorstores
      • Aerospike
      • AlibabaCloudOpenSearch
      • AlibabaCloudOpenSearchSettings
      • AnalyticDB
      • Annoy
      • ApacheDoris
      • ApacheDorisSettings
      • QueryResult
      • ApertureDB
      • AtlasDB
      • AwaDB
      • AzureCosmosDBVectorSearch
      • CosmosDBSimilarityType
      • CosmosDBVectorSearchType
      • Condition
      • CosmosDBQueryType
      • PreFilter
      • AzureSearch
      • AzureSearchVectorStoreRetriever
      • Bagel
      • BESVectorStore
      • BaiduVectorDB
      • ConnectionParams
      • TableParams
      • Cassandra
      • Clarifai
      • Clickhouse
      • ClickhouseSettings
      • DashVector
      • Dingo
      • DocArrayIndex
      • DocArrayHnswSearch
      • DocArrayInMemorySearch
      • DocumentDBSimilarityType
      • DocumentDBVectorSearch
      • DuckDB
      • EcloudESVectorStore
      • BaseRetrievalStrategy
      • Epsilla
      • FAISS
      • FalkorDBVector
      • IndexType
      • SearchType
      • Hippo
      • Hologres
      • Infinispan
      • InfinispanVS
      • Jaguar
      • KDBAI
      • Dimension
      • DistanceStrategy
      • Kinetica
      • KineticaSettings
      • LanceDB
      • BaseEmbeddingStore
      • DistanceStrategy
      • Lantern
      • QueryResult
      • LLMRails
      • LLMRailsRetriever
      • ManticoreSearch
      • ManticoreSearchSettings
      • Marqo
      • Meilisearch
      • MomentoVectorIndex
      • MyScale
      • MyScaleSettings
      • MyScaleWithoutJSON
      • NucliaDB
      • OpenSearchVectorSearch
      • OracleVS
      • PathwayVectorClient
      • BaseModel
      • CollectionStore
      • EmbeddingStore
      • PGEmbedding
      • QueryResult
      • PGVecto_rs
      • BaseModel
      • DistanceStrategy
      • QdrantException
      • RedisVectorStoreRetriever
      • RedisFilter
      • RedisFilterExpression
      • RedisFilterField
      • RedisFilterOperator
      • RedisNum
      • RedisTag
      • RedisText
      • FlatVectorField
      • HNSWVectorField
      • NumericFieldSchema
      • RedisDistanceMetric
      • RedisField
      • RedisModel
      • RedisVectorField
      • TagFieldSchema
      • TextFieldSchema
      • Relyt
      • Rockset
      • ScaNN
      • SemaDB
      • BaseSerializer
      • BsonSerializer
      • JsonSerializer
      • ParquetSerializer
      • SKLearnVectorStore
      • SKLearnVectorStoreException
      • SQLiteVec
      • SQLiteVSS
      • QueryResult
      • StarRocks
      • StarRocksSettings
      • SupabaseVectorStore
      • SurrealDBStore
      • TablestoreVectorStore
      • Tair
      • ConnectionParams
      • IndexParams
      • MetaField
      • TencentVectorDB
      • NeuralDBClientVectorStore
      • NeuralDBVectorStore
      • TiDBVectorStore
      • Tigris
      • TileDB
      • TimescaleVector
      • Typesense
      • UpstashVectorStore
      • USearch
      • DistanceStrategy
      • Vald
      • Vearch
      • MMRConfig
      • RerankConfig
      • SummaryConfig
      • Vectara
      • VectaraQueryConfig
      • VectaraRAG
      • VectaraRetriever
      • VespaStore
      • VikingDB
      • VikingDBConfig
      • VLite
      • XataVectorStore
      • Yellowbrick
      • CollectionConfig
      • ZepVectorStore
      • ZepCloudVectorStore
      • Zilliz
      • create_metadata
      • dependable_annoy_import
      • has_mul_sub_str
      • dependable_faiss_import
      • construct_metadata_filter
      • dict_to_yaml_str
      • generate_random_string
      • process_index_data
      • import_lancedb
      • to_lance_filter
      • get_embedding_store
      • has_mul_sub_str
      • create_index
      • drop_index_if_exists
      • drop_table_purge
      • sync_call_fallback
      • check_index_exists
      • check_operator_misuse
      • read_schema
      • dependable_scann_import
      • normalize
      • serialize_f32
      • debug_output
      • get_named_result
      • has_mul_sub_str
      • translate_filter
      • dependable_tiledb_import
      • get_documents_array_uri
      • get_documents_array_uri_from_group
      • get_vector_index_uri
      • get_vector_index_uri_from_group
      • dependable_usearch_import
      • filter_complex_metadata
      • maximal_marginal_relevance
      • VDMS_Client
      • embedding2bytes
      • AstraDB
      • AzureCosmosDBNoSqlVectorSearch
      • BigQueryVectorSearch
      • Chroma
      • CouchbaseVectorStore
      • DatabricksVectorSearch
      • DeepLake
      • ElasticKnnSearch
      • ElasticVectorSearch
      • ApproxRetrievalStrategy
      • ElasticsearchStore
      • ExactRetrievalStrategy
      • SparseRetrievalStrategy
      • HanaDB
      • MatchingEngine
      • Milvus
      • MongoDBAtlasVectorSearch
      • IndexType
      • Neo4jVector
      • SearchType
      • PGVector
      • Pinecone
      • Qdrant
      • Redis
      • SingleStoreDB
      • VDMS
      • Weaviate
      • check_if_not_null
      • collect_params
      • combine_queries
      • construct_metadata_filter
      • dict_to_yaml_str
      • remove_lucene_chars
      • sort_by_index_name
  • Experimental

Integrations

  • AI21
  • Anthropic
  • AstraDB
  • AWS
  • Azure Ai
  • Azure Dynamic Sessions
  • Cerebras
  • Chroma
  • Cohere
  • Deepseek
  • Elasticsearch
  • Exa
  • Fireworks
  • Google Community
  • Google GenAI
  • Google VertexAI
  • Groq
  • Huggingface
  • IBM
  • Milvus
  • MistralAI
  • MongoDB
  • Neo4J
  • Nomic
  • Nvidia Ai Endpoints
  • Ollama
  • OpenAI
  • Perplexity
  • Pinecone
  • Postgres
  • Prompty
  • Qdrant
  • Redis
  • Sema4
  • Snowflake
  • Sqlserver
  • Standard Tests
  • Tavily
  • Together
  • Unstructured
  • Upstage
  • VoyageAI
  • Weaviate
  • XAI
  • LangChain Python API Reference
  • langchain-community: 0.3.23
  • vectorstores
  • DistanceStrategy

DistanceStrategy#

class langchain_community.vectorstores.pgvector.DistanceStrategy(value)[source]#

Enumerator of the Distance strategies.

EUCLIDEAN = 'l2'#
COSINE = 'cosine'#
MAX_INNER_PRODUCT = 'inner'#

Examples using DistanceStrategy

  • Kinetica Vectorstore API

  • Oracle AI Vector Search: Vector Store

  • SAP HANA Cloud Vector Engine

  • SemaDB

  • SingleStoreDB

On this page
  • DistanceStrategy
    • EUCLIDEAN
    • COSINE
    • MAX_INNER_PRODUCT

© Copyright 2025, LangChain Inc.

OSZAR »