aarondb/vec_index/types

Types

Construction and search limits for an HNSW index.

pub type HnswConfig {
  HnswConfig(
    max_neighbors: Int,
    search_budget: Int,
    level_source: LevelSource,
  )
}

Constructors

  • HnswConfig(
      max_neighbors: Int,
      search_budget: Int,
      level_source: LevelSource,
    )

A single layer in the Hierarchical Navigable Small-World graph.

pub type Layer {
  Layer(edges: dict.Dict(fact.EntityId, List(fact.EntityId)))
}

Constructors

The source used to choose HNSW insertion levels.

pub type LevelSource {
  RandomLevels
  DeterministicLevels(List(Int))
}

Constructors

  • RandomLevels
  • DeterministicLevels(List(Int))

An entity and its cosine-similarity score.

pub type SearchResult {
  SearchResult(entity: fact.EntityId, score: Float)
}

Constructors

A Hierarchical Navigable Small-World graph for approximate nearest-neighbor search.

pub type VecIndex {
  VecIndex(
    nodes: dict.Dict(fact.EntityId, List(Float)),
    layers: dict.Dict(Int, Layer),
    dimensions: option.Option(Int),
    config: HnswConfig,
    entry_point: Result(fact.EntityId, Nil),
    max_level: Int,
  )
}

Constructors

Search Document