This page covers configuration and management of View vector repository objects.

Object Overview

Vector repositories define the properties by which vector data is stored within View.

Endpoint, URL, and Supported Methods

Objects are managed via the configuration server API at [http|https]://[hostname]:[port]/v1.0/tenants/[tenant-guid]/vectorrepositories

Supported methods include: GET HEAD PUT DELETE

Structure

Objects have the following structure:

{
    "GUID": "example-vector-repository",
    "TenantGUID": "default",
    "Name": "My knowledgebase",
    "RepositoryType": "Pgvector",
    "Model": "all-MiniLM-L6-v2",
    "Dimensionality": 384,
    "DatabaseHostname": "pgvector",
    "DatabaseName": "vectordb",
    "DatabaseTable": "minilm",
    "DatabasePort": 5432,
    "DatabaseUser": "postgres",
    "DatabasePassword": "password",
    "PromptPrefix": "You are an AI assistant augmented with a retrieval system. Carefully analyze the provided pieces of context and the user query at the end. Rely primarily on the provided context for your response. If the context is not enough for you to answer the question, please politely explain that you do not have enough relevant information to answer. Do not try to make up an answer. Do not attempt to answer using general knowledge. Only use general knowledge to clarify context information if absolutely necessary.",
    "CreatedUtc": "2024-07-10T05:09:32.000000Z"
}

Properties:

  • GUID GUID globally unique identifier for the object
  • TenantGUID GUID globally unique identifier for the tenant
  • Name string name of the object
  • RepositoryType string the type of vector repository (currently only Pgvector
  • Model string the name of the language model from which embeddings stored in this repository were generator
  • Dimensionality int the dimensionality of the embeddings, i.e. the number of array elements
  • DatabaseHostname string the database hostname
  • DatabaseName string the name of the database
  • DatabaseTable string the table in which data is stored
  • DatabasePort int the port on which the database is accessed
  • DatabaseUser string the username used to access the database
  • DatabasePassword string the password associated with the user to access the database
  • SchemaName string the name of the schema.
  • CreatedUtc datetime timestamp from creation, in UTC time

Create

To create, call PUT /v1.0/tenants/[tenant-guid]/vectorrepositories with the following properties using the configuration server: Name RepositoryType Model Dimensionality DatabaseHostname DatabaseName DatabaseTable DatabasePort DatabaserUser DatabasePassword

{
    "Name": "Another vector repository",
    "RepositoryType": "Pgvector",
    "Model": "all-MiniLM-L6-v2",
    "Dimensionality": 384,
    "DatabaseHostname": "localhost",
    "DatabaseName": "vectordb",
    "DatabaseTable": "testtable",
    "DatabasePort": 5432,
    "DatabaseUser": "postgres",
    "DatabasePassword": "password"
}
curl --location --request PUT 'http://view.homedns.org:8000/v1.0/tenants/00000000-0000-0000-0000-000000000000/vectorrepositories' \
--header 'content-type: application/json' \
--header 'Authorization: ••••••' \
--data '{
    "Name": "My vector repository",
    "RepositoryType": "Pgvector",
    "Model": "all-MiniLM-L6-v2",
    "Dimensionality": 384,
    "DatabaseHostname": "localhost",
    "DatabaseName": "vectordb",
    "SchemaName": "public",
    "DatabaseTable": "minilm",
    "DatabasePort": 5432,
    "DatabaseUser": "postgres",
    "DatabasePassword": "password"
}'

import { ViewConfigurationSdk } from "view-sdk";

const api = new ViewConfigurationSdk(
  "default", //tenant Id
  "default", //access token
  "http://localhost:8000/" //endpoint
 );

const createVectorRepository = async () => {
  try {
    const response = await api.createVectorRepository({
      Name: "My vector repository",
      RepositoryType: "Pgvector",
      Model: "all-MiniLM-L6-v2",
      Dimensionality: 384,
      DatabaseHostname: "localhost",
      DatabaseName: "vectordb",
      SchemaName: "public",
      DatabaseTable: "minilm",
      DatabasePort: 5432,
      DatabaseUser: "postgres",
      DatabasePassword: "password",
    });
    console.log(response, "Vector repository created successfully");
  } catch (err) {
    console.log("Error creating Vector repository:", err);
  }
};

createVectorRepository();

Enumerate

Refer to the Enumeration page in REST API for details about the use of enumeration APIs.

Enumerate metadata rule objects by using GET /v2.0/tenants/[tenant-guid]/vectorrepositories. The resultant object will appear as:

{
    "Success": true,
    "Timestamp": {
        "Start": "2024-10-21T02:36:37.677751Z",
        "TotalMs": 23.58,
        "Messages": {}
    },
    "MaxResults": 10,
    "IterationsRequired": 1,
    "EndOfResults": true,
    "RecordsRemaining": 16,
    "Objects": [
        {
            "GUID": "example-vectorrepository",
            ... vectorrepository details ...
        },
        { ... }
    ],
    "ContinuationToken": "[continuation-token]"
}
curl --location 'http://view.homedns.org:8000/v2.0/tenants/00000000-0000-0000-0000-000000000000/vectorrepositories/' \
--header 'Authorization: ••••••'


import { ViewConfigurationSdk } from "view-sdk";

const api = new ViewConfigurationSdk(
  "default", //tenant Id
  "default", //access token
  "http://localhost:8000/" //endpoint
 );

const enumerateVectorRepositories = async () => {
  try {
    const response = await api.enumerateVectorRepositories();
    console.log(response, "Vector repositories fetched successfully");
  } catch (err) {
    console.log("Error fetching Vector repositories:", err);
  }
};

enumerateVectorRepositories();

Read

To read an object by GUID, call GET /v1.0/tenants/[tenant-guid]/embeddingsrule/[embeddingsrule-guid]. If the object exists, it will be returned as a JSON object in the response body. If it does not exist, a 404 will be returned with a NotFound error response.

{
    "GUID": "59f7c18d-7342-4aef-9308-86083459dd81",
    "TenantGUID": "default",
    "BucketGUID": "example-data-bucket",
    "OwnerGUID": "default",
    "Name": "Embeddings rule",
    "ContentType": "*",
    "TargetBucketGUID": "example-embeddings-bucket",
    "VectorRepositoryGUID": "example-vector-repository",
    "DataFlowEndpoint": "http://localhost:8501/processor",
    "EmbeddingsGenerator": "LCProxy",
    "GeneratorUrl": "http://localhost:8301/",
    "GeneratorApiKey": "[huggingface API key]",
    "BatchSize": 16,
    "MaxGeneratorTasks": 16,
    "MaxRetries": 3,
    "MaxFailures": 3,
    "VectorStoreUrl": "http://localhost:8311/",
    "MaxContentLength": 16777216,
    "CreatedUtc": "2024-10-21T15:19:09.000000Z"
}
curl --location 'http://view.homedns.org:8000/v1.0/tenants/00000000-0000-0000-0000-000000000000/vectorrepositories/00000000-0000-0000-0000-000000000000' \
--header 'Authorization: ••••••'
import { ViewConfigurationSdk } from "view-sdk";

const api = new ViewConfigurationSdk(
  "default", //tenant Id
  "default", //access token
  "http://localhost:8000/" //endpoint
 );

const getVectorRepository = async () => {
  try {
    const response = await api.retrieveVectorRepository(
      "d5845b70-6da5-4ddf-9795-bf90c24b80fc"
    );
    console.log(response, "Vector repository fetched successfully");
  } catch (err) {
    console.log("Error fetching Vector repository:", err);
  }
};
getVectorRepository();

Note: the HEAD method can be used as an alternative to get to simply check the existence of the object. HEAD requests return either a 200/OK in the event the object exists, or a 404/Not Found if not. No response body is returned with a HEAD request.

Read all

To read all objects, call GET /v1.0/tenants/[tenant-guid]/vectorrepositories/. If the object exists, it will be returned as an array of JSON object in the response body

curl --location 'http://view.homedns.org:8000/v1.0/tenants/00000000-0000-0000-0000-000000000000/vectorrepositories/' \
--header 'Authorization: ••••••'
import { ViewConfigurationSdk } from "view-sdk";

const api = new ViewConfigurationSdk(
  "default", //tenant Id
  "default", //access token
  "http://localhost:8000/" //endpoint
 );

const getAllVectorRepositories = async () => {
  try {
    const response = await api.retrieveVectorRepositories();
    console.log(response, "All vector repositories fetched successfully");
  } catch (err) {
    console.log("Error fetching Vector repositories:", err);
  }
};

getAllVectorRepositories();

Update

To update an object by GUID, call PUT /v1.0/tenants/[tenant-guid]/vectorrepositories/[vectorrepository-guid] with a fully populated object in the request body. The updated object will be returned to you.

Note: certain fields cannot be modified and will be preserved across updates.

Request body:

{
    "Name": "Updated vector repository",
    "RepositoryType": "Pgvector",
    "Model": "all-MiniLM-L6-v2",
    "Dimensionality": 384,
    "DatabaseHostname": "localhost",
    "DatabaseName": "vectordb",
    "DatabaseTable": "testtable",
    "DatabasePort": 5432,
    "DatabaseUser": "postgres",
    "DatabasePassword": "password",
    "PromptPrefix": "Use the following pieces of context to answer the question at the end.  Documents are sorted by similarity to the question.  If the context is not enough for you to answer the question, politely explain that you don't have relevant context.  Do not try to make up an answer.",
}
curl --location --request PUT 'http://view.homedns.org:8000/v1.0/tenants/00000000-0000-0000-0000-000000000000/vectorrepositories/00000000-0000-0000-0000-000000000000' \
--header 'content-type: application/json' \
--header 'Authorization: ••••••' \
--data '{
    "Name": "My updated vector repository",
    "RepositoryType": "Pgvector",
    "Model": "all-MiniLM-L6-v2",
    "Dimensionality": 384,
    "DatabaseHostname": "localhost",
    "DatabaseName": "vectordb",
    "SchemaName": "public",
    "DatabaseTable": "minilm",
    "DatabasePort": 5432,
    "DatabaseUser": "postgres",
    "DatabasePassword": "password"
}'
import { ViewConfigurationSdk } from "view-sdk";

const api = new ViewConfigurationSdk(
  "default", //tenant Id
  "default", //access token
  "http://localhost:8000/" //endpoint
 );

const updateVectorRepository = async () => {
  try {
    const response = await api.updateVectorRepository({
      GUID: "d5845b70-6da5-4ddf-9795-bf90c24b80fc",
      TenantGUID: "00000000-0000-0000-0000-000000000000",
      Name: "My vector repository ash updated",
      RepositoryType: "Pgvector",
      Model: "all-MiniLM-L6-v2",
      Dimensionality: 384,
      DatabaseHostname: "localhost",
      DatabaseName: "vectordb",
      SchemaName: "public",
      DatabaseTable: "minilm",
      DatabasePort: 5432,
      DatabaseUser: "postgres",
      DatabasePassword: "password",
      CreatedUtc: "2025-03-26T10:00:43.978210Z",
    });
    console.log(response, "Vector repository updated successfully");
  } catch (err) {
    console.log("Error updating Vector repository:", err);
  }
};

updateVectorRepository();

Response body:

{
    "GUID": "57082e60-5a3d-44ed-bc3c-4b3ac8d1dbe5",
    "TenantGUID": "default",
    "Name": "Updated vector repository",
    "RepositoryType": "Pgvector",
    "Model": "all-MiniLM-L6-v2",
    "Dimensionality": 384,
    "DatabaseHostname": "localhost",
    "DatabaseName": "vectordb",
    "DatabaseTable": "testtable",
    "DatabasePort": 5432,
    "DatabaseUser": "postgres",
    "DatabasePassword": "password",
    "PromptPrefix": "Use the following pieces of context to answer the question at the end.  Documents are sorted by similarity to the question.  If the context is not enough for you to answer the question, politely explain that you don't have relevant context.  Do not try to make up an answer.",
    "CreatedUtc": "2024-10-21T15:42:40.000000Z"
}

Delete

To delete an object by GUID, call DELETE /v1.0/tenants/[tenant-guid]/vectorrepositories/[vectorrepository-guid].

curl --location --request DELETE 'http://view.homedns.org:8000/v1.0/tenants/00000000-0000-0000-0000-000000000000/vectorrepositories/00000000-0000-0000-0000-000000000000' \
--header 'Authorization: ••••••' \
import { ViewConfigurationSdk } from "view-sdk";

const api = new ViewConfigurationSdk(
  "default", //tenant Id
  "default", //access token
  "http://localhost:8000/" //endpoint
 );

const deleteVectorRepository = async () => {
  try {
    const response = await api.deleteVectorRepository(
      "57094adf-f08f-4887-a49e-ae898c7317e2"
    );
    console.log(response, "Vector repository deleted successfully");
  } catch (err) {
    console.log("Error deleting Vector repository:", err);
  }
};

deleteVectorRepository();

Check existance

To check existence of an object by GUID, call HEAD /v1.0/tenants/[tenant-id]/vectorrepositories/[vectorrepository-guid]

curl --location --head 'http://view.homedns.org:8000/v1.0/tenants/00000000-0000-0000-0000-000000000000/vectorrepositories/00000000-0000-0000-0000-000000000000' \
--header 'Authorization: ••••••'
import { ViewConfigurationSdk } from "view-sdk";

const api = new ViewConfigurationSdk(
  "default", //tenant Id
  "default", //access token
  "http://localhost:8000/" //endpoint
 );

const vectorRepositoryExists = async () => {
  try {
    const response = await api.existsVectorRepository(
      "e345dfe7-3e66-4f2b-b78e-3ae1b1c30d9c"
    );
    console.log(response, "Vector repository exists");
  } catch (err) {
    console.log("Error checking Vector repository:", err);
  }
};

vectorRepositoryExists();