Vector Store Connection

Description

A vector store connection connects to a vector store: a database that stores text chunks with their embeddings and finds the chunks nearest to a query embedding. The Vector store upsert and Vector store search transforms work with every vector store type in the same way.

Type Plugin Connection

Qdrant

Qdrant (hop-tech-qdrant)

The REST API, on port 6333. Optionally TLS and an API key, for example for Qdrant Cloud.

Weaviate

Weaviate (hop-tech-weaviate)

The REST and GraphQL API, on port 8080. Optionally TLS and an API key. The embeddings come from Hop: collections are created without a vectorizer module.

PostgreSQL (pgvector)

pgvector (hop-tech-pgvector)

A PostgreSQL relational database connection and a schema. A collection is a table, with the same columns as the pgvector upsert transform writes.

Vector store connections are serialized as JSON in the Hop metadata folder under

metadata/vector-store-connection/

What is stored

Every vector store type stores the same records in a collection:

Field Description

record_id

The ID of the record. By default the document ID and the chunk index: doc-1_0. Qdrant and Weaviate only accept UUIDs as IDs. They get a UUID made from the record ID, the same every time, so loading a document again replaces its records instead of adding them. The record ID itself is kept in the record_id field and comes back from a search. pgvector stores it in the id column.

document_id

The document the chunk belongs to.

chunk_index

The position of the chunk in the document.

content

The text of the chunk.

The vector

The embedding. Every record of a collection has the same number of dimensions.

Metadata fields

The fields the upsert maps, with names of letters, digits and underscores, stored in lower case. Qdrant and Weaviate store a String, Integer, Number or Boolean value as such. pgvector stores the text of the value in a TEXT column, Booleans as Y and N like the pgvector transforms, and converts it back when it is read.

A collection is a collection in Qdrant, a collection (class) in Weaviate and a table with pgvector. Weaviate starts the name of a collection with a capital: hop_rag_chunks becomes Hop_rag_chunks.

Distance metrics and scores

A collection compares vectors with one of these metrics. Every type turns its own distance into the same score, where higher is nearer, so a minimum score means the same on every vector store:

Metric Score Qdrant Weaviate pgvector

Cosine

The cosine similarity, from -1 to 1

Cosine

cosine

<⇒

Euclidean (L2)

1 / (1 + the Euclidean distance), from 0 to 1

Euclid

l2-squared

←>

Inner product

The inner (dot) product

Dot

dot

<#>

Qdrant and Weaviate fix the metric when a collection is created: a search with another metric fails. With pgvector the search chooses the operator. The HNSW index, when the connection creates one, is for the metric of the upsert.

Options

Qdrant

Option Description

Host name

The host name or IP address of the Qdrant server.

REST port

The port of the REST API, 6333 by default.

Use TLS

Connect with https.

API key

The API key, when the server asks for one.

Timeout (seconds)

How long to wait for the server to connect or answer.

Weaviate

Option Description

Host name

The host name or IP address of the Weaviate server.

HTTP port

The port of the REST and GraphQL API, 8080 by default.

Use TLS

Connect with https.

API key

The API key, when the server asks for one.

Timeout (seconds)

How long to wait for the server to connect or answer.

Hop sends the vectors itself: no vectorizer module is needed on the server.

PostgreSQL (pgvector)

Option Description

Database connection

The PostgreSQL connection.

Schema

The schema with the tables, public by default.

Create HNSW index

Create an HNSW index on the embeddings when the upsert creates a collection.

The upsert creates the pgvector extension when it creates a table, which needs the privileges to do so.

Versions

The integration tests run against Qdrant 1.20 and Weaviate 1.40.

Test

The Test button connects and reports the URL, or the database and schema, it connected to.