Skip to main content

Using the Retrieval Endpoint for a RAG Pipeline

This guide shows how to access and use the retrieval endpoint for a RAG Pipeline in Vectorize.

Accessing the Retrieval Endpoint

  1. Navigate to the RAG Pipelines section in the Vectorize dashboard.

    RAG Pipelines Dashboard

  2. Click on the name of your desired pipeline (e.g., "friends-scripts").

  3. In the pipeline details view, click the Connect tab.

    Connect Tab

Retrieval Endpoint Details

In the Connect tab, you'll find:

Access Tokens

  • Use the "Manage access tokens" button to create or manage authentication tokens.

Retrieval Endpoint URL

  • The unique URL for your pipeline's retrieval endpoint is displayed here.
  • Click "Copy to Clipboard" to copy the URL.

Retrieval URL

Usage Information

  • The endpoint calculates a vector for the question text and performs a similarity search on the vector DB.
  • If rerank is set to true, which is the default, the results are passed to a reranking model and returned in the order by the rerank model's relevance score. Otherwise, results are ordered by similarity score.
  • Metadata filtering can be applied to the results by passing a metadata-filters object. See below for more information.
  • You can enable query rewriting by passing a context object. The endpoint automatically reformulates the question to improve search relevance. See Advanced Retrieval for details.

Retrieval Endpoint Details

Using the Endpoint

An example cURL request is provided:

curl --location 'https://client.app.vectorize.io/api/gateways/service/ob45-51155be7b918/pdce89f5b/retrieve' \
--header 'Content-Type: application/json' \
--header 'Authorization: <token>' \
--data '{
"question": "How to call the object's API?",
"numResults": 5,
"rerank": true
}'

Metadata Filtering

Metadata filtering in a retrieval endpoint allows you to narrow down the data retrieved from your vector database based on specific metadata attributes. This allows you to filter data not just by similarity to a query, but also by tags, categories, or other metadata properties, improving the precision of context provided to the large language model (LLM).

Metadata Types

Vectorize will automatically add system metadata to the records it writes to vector database. For details on these metadata fields see System metadata.

Some sources, like Google Cloud Storage support path metadata which allow you to define a regular expression to convert the path of the file into metadata. For example, if your files are organized in folders like /user/john, /user/mary, etc, you can convert the username to metadata. For examples on how to do this, see Path Metadata Regex & Path Regex Group Name.

You can also configure user-defined metadata, which can be specified on a per-document basis on some source connectors. For more information, see Using User-defined Metadata.

You can use all these types of metadata with the retrieval endpoint.

Metadata Filtering with Pinecone

Pinecone supports multiple value matches per key, so the values you're filtering on must be formatted as a list.

Example using cURL:

curl -L \
-H "Content-Type: application/json" \
-H "Authorization: <TOKEN>" \
-d '{
"question": "What originated from Google Drive?",
"numResults": 5,
"metadata-filters": [
{
"origin": ["google-drive"]
}
]
}' \
"https://client.app.vectorize.io/api/gateways/service/o9bf-57d2db385ba2/p24a5ecc3/retrieve"

Metadata Filtering with all other Vector Databases

All other databases support a single value per key.

Example using cURL:

curl --location 'https://client.app.vectorize.io/api/gateways/service/ob45-51155be7b918/pdce89f5b/retrieve' \
--header 'Content-Type: application/json' \
--header 'Authorization: <token>' \
--data '{
"question": "What originated from Google Drive?",
"numResults": 5,
"metadata-filters": [
{
"origin": "google-drive"
}
]
}'

What's next?

Was this page helpful?