BaseIndex#

class langchain_postgres.v2.indexes.BaseIndex(
name: str | None = None,
index_type: str = 'base',
distance_strategy: ~langchain_postgres.v2.indexes.DistanceStrategy = <factory>,
partial_indexes: list[str] | None = None,
extension_name: str | None = None,
)[source]#

Abstract base class for defining vector indexes.

Parameters:
  • name (str | None)

  • index_type (str)

  • distance_strategy (DistanceStrategy)

  • partial_indexes (list[str] | None)

  • extension_name (str | None)

name#

A human-readable name for the index. Defaults to None.

Type:

Optional[str]

index_type#

A string identifying the type of index. Defaults to β€œbase”.

Type:

str

distance_strategy#

The strategy used to calculate distances between vectors in the index. Defaults to DistanceStrategy.COSINE_DISTANCE.

Type:

DistanceStrategy

partial_indexes#

A list of names of partial indexes. Defaults to None.

Type:

Optional[list[str]]

extension_name#

The name of the extension to be created for the index, if any. Defaults to None.

Type:

Optional[str]

Attributes

Methods

__init__([name,Β index_type,Β ...])

get_index_function()

index_options()

Set index query options for vector store initialization.

__init__(
name: str | None = None,
index_type: str = 'base',
distance_strategy: ~langchain_postgres.v2.indexes.DistanceStrategy = <factory>,
partial_indexes: list[str] | None = None,
extension_name: str | None = None,
) β†’ None#
Parameters:
  • name (str | None)

  • index_type (str)

  • distance_strategy (DistanceStrategy)

  • partial_indexes (list[str] | None)

  • extension_name (str | None)

Return type:

None

get_index_function() β†’ str[source]#
Return type:

str

abstractmethod index_options() β†’ str[source]#

Set index query options for vector store initialization.

Return type:

str