Management API

Account, collection, API keys and data upload functionalities of the Vantage API

The Management API is a collection of functionalities related to working with accounts, collections, Vantage and Model API keys, and data upload. Below, you can find different options and approaches for using these functionalities.

📘

Vantage Client

In the following code blocks, we're initializing the Vantage client using Vantage API key. For more information on client configuration, check out the API Usage page.


Account

Here you can find Account management functionalities provided by the Vantage API.

If you prefer a visual guide, check out the Console UI walkthrough example: See And Manage Account Details

Get Account

The following example returns details about the account ACCOUNT_ID.

from vantage_sdk import VantageClient

vantage_instance = VantageClient.using_vantage_api_key(
    vantage_api_key=VANTAGE_API_KEY,
    account_id=ACCOUNT_ID,
)

account = vantage_instance_stage.get_account()
print(account)
import { VantageClientConfiguration, VantageClient } from "@vantage-sdk";

const configuration: VantageClientConfiguration = {
    vantageApiKey: vantageApiKey,
    accountId: accountId, 
    
}
let client = new VantageClient(configuration)

let account = client.getAccount()

account.then(data => console.log(data))
import com.vantage.sdk.VantageClient;
import com.vantage.sdk.api.account.model.Account;

public static void main(String[] args) {
    final VantageClient client = VantageClient.usingVantageApiKey()
        .withAccountId(ACCOUNT_ID)
        .withVantageApiKey(VANTAGE_API_KEY)
        .build();

    final Account account = client.account().getActive();
}
./cli.py get-account

Update Account

The following example updates the account ACCOUNT_ID.

from vantage_sdk import VantageClient

vantage_instance = VantageClient.using_vantage_api_key(
    vantage_api_key=VANTAGE_API_KEY,
    account_id=ACCOUNT_ID,
)

account = vantage_instance_stage.update_account(
	account_name="New Account Name",
)
print(account)
import { VantageClientConfiguration, VantageClient } from "@vantage-sdk";

const configuration: VantageClientConfiguration = {
    vantageApiKey: vantageApiKey,
    accountId: accountId, 
    
}
let client = new VantageClient(configuration)

let account = client.updateAccount("New Account Name")

account.then(data => console.log(data))
import com.vantage.sdk.VantageClient;
import com.vantage.sdk.api.account.model.Account;

public static void main(String[] args) {
    final VantageClient client = VantageClient.usingVantageApiKey()
        .withAccountId(ACCOUNT_ID)
        .withVantageApiKey(VANTAGE_API_KEY)
        .build();

    final Account account = client.account().updateName("New Account Name");
}
./cli.py update-account "New Account Name"

Collections

Here you can find Collection management functionalities provided by the Vantage API.

If you prefer a visual guide, check out the Console UI walkthrough examples: Create Collections, Upload Data To Collection

List Collections

The following example returns all collections created by account ACCOUNT_ID.

from vantage_sdk import VantageClient

vantage_instance = VantageClient.using_vantage_api_key(
    vantage_api_key=VANTAGE_API_KEY,
    account_id=ACCOUNT_ID,
)

collections = vantage_instance_stage.list_collections()
print(collections)
import { VantageClientConfiguration, VantageClient } from "@vantage-sdk";

const configuration: VantageClientConfiguration = {
    vantageApiKey: vantageApiKey,
    accountId: accountId, 
    
}
let client = new VantageClient(configuration)

let collections = client.listCollections()

collections.then(data => console.log(data))
import java.util.List;
import com.vantage.sdk.VantageClient;
import com.vantage.sdk.api.collection.model.Collection;

public static void main(String[] args) {
    final VantageClient client = VantageClient.usingVantageApiKey()
        .withAccountId(ACCOUNT_ID)
        .withVantageApiKey(VANTAGE_API_KEY)
        .build();

    final List<Collection> collections = client
        .collections()
        .listCollections();
}
./cli.py list-collections

Get Collection

The following example returns details about the collection example-collection.

from vantage_sdk import VantageClient

vantage_instance = VantageClient.using_vantage_api_key(
    vantage_api_key=VANTAGE_API_KEY,
    account_id=ACCOUNT_ID,
)

collection = vantage_instance.get_collection(
  collection_id="example-collection"
)

print(collection)
import { VantageClientConfiguration, VantageClient } from "@vantage-sdk";

const configuration: VantageClientConfiguration = {
    vantageApiKey: vantageApiKey,
    accountId: accountId, 
    
}
let client = new VantageClient(configuration)

let collection = client.getCollection("node")

collection.then(data => console.log(data))
import com.vantage.sdk.VantageClient;
import com.vantage.sdk.api.collection.model.Collection;

public static void main(String[] args) {
    final VantageClient client = VantageClient.usingVantageApiKey()
        .withAccountId(ACCOUNT_ID)
        .withVantageApiKey(VANTAGE_API_KEY)
        .build();

    final Collection collection = client
        .collections()
        .getCollection("example-collection");
}
./cli.py get-collection example-collection

Create Collection

The following examples will demonstrate how you can create collection objects.

There are different types of collections, depending on whether you want Vantage to manage and create embeddings from your data, or if you prefer to provide them manually. The Python SDK provides two types of classes based on this distinction:

  • UserProvidedEmbeddingCollection and
  • VantageManagedEmbeddingCollection.

Further, depending on the LLM provider, which is either OpenAI or HuggingFace, Vantage-managed embedding collections are divided into OpenAICollection and HuggingFaceCollection classes. You should instantiate the appropriate one.

In the following examples, you can see how this is done. For more details and parameter descriptions, please check the Embeddings page of our documentation.

📘

Vantage-managed or User-provided Embeddings?

For more information on different collection types refer to our Collections or Embeddings documentation pages.

Vantage-managed embeddings

Below, you can see the code block representing the creation of two types of Vantage-managed embeddings collections.

The parameter that represents the actual embedding model (LLM) differs:

  • OpenAI collections require the llm parameter, where you can provide the OpenAI model name.
  • HuggingFace collections use the external_url parameter, which represents the endpoint URL of the deployed HF model.
from vantage_sdk import VantageClient
from vantage_sdk.model.collection import OpenAICollection

vantage_instance = VantageClient.using_vantage_api_key(
    vantage_api_key=VANTAGE_API_KEY,
    account_id=ACCOUNT_ID,
)

openai_collection_id = "vantage-managed-openai"

openai_collection = OpenAICollection(
    collection_id=openai_collection_id,
    embeddings_dimension=1536,
    llm="text-embedding-ada-002",
    external_account_id="YOUR_MODEL_API_KEY_ID",
)

created_collection = vantage_instance.create_collection(
    collection= openai_collection
)

print(created_collection)
from vantage_sdk import VantageClient
from vantage_sdk.model.collection import HuggingFaceCollection

vantage_instance = VantageClient.using_vantage_api_key(
    vantage_api_key=VANTAGE_API_KEY,
    account_id=ACCOUNT_ID,
)

openai_collection_id = "vantage-managed-huggingface"

hf_collection = HuggingFaceCollection(
    collection_id=hf_collection,
    embeddings_dimension=1536,
    external_url="HF_ENDPOINT_URL",
    external_account_id="YOUR_MODEL_API_KEY_ID",
)

created_collection = vantage_instance.create_collection(
    collection= hf_collection
)

print(created_collection)
import { VantageClientConfiguration, VantageClient, OpenAICollection } from "@vantage-sdk";

const configuration: VantageClientConfiguration = {
    vantageApiKey: vantageApiKey,
    accountId: accountId, 
    
}
let client = new VantageClient(configuration)

const collectionId = "openai-collection"

const newCollection: OpenAICollection = new OpenAICollection(
    collectionId,
    1536,
    "text-embedding-ada-002",
    undefined, // or LLM secret
    "EXTERNAL_KEY_ID"
)

const createdCollection = client.createCollection(newCollection)

createdCollection.then(data => console.log(data))
import { VantageClientConfiguration, VantageClient, HuggingFaceCollection } from "@vantage-sdk";

const configuration: VantageClientConfiguration = {
    vantageApiKey: vantageApiKey,
    accountId: accountId, 
    
}
let client = new VantageClient(configuration)

const collectionId = "hf-collection"

const newCollection: HuggingFaceCollection = new HuggingFaceCollection(
    collectionId,
    1536,
    "HF_ENDPOINT_URL",
    undefined, // or LLM secret
    "EXTERNAL_KEY_ID"
)

const createdCollection = client.createCollection(newCollection)

createdCollection.then(data => console.log(data))
import com.vantage.sdk.VantageClient;
import com.vantage.sdk.api.collection.model.OpenAICollection;

public static void main(String[] args) {
    final VantageClient client = VantageClient.usingVantageApiKey()
        .withAccountId(ACCOUNT_ID)
        .withVantageApiKey(VANTAGE_API_KEY)
        .build();

    final OpenAICollection collection = OpenAICollection.builder("my-openai-collection", 1536)
        .withLlmModel("text-embedding-ada-002")
        .withExternalKeyId(YOUR_OPENAI_SECRET_KEY)
        .build();
}
import com.vantage.sdk.VantageClient;
import com.vantage.sdk.api.collection.model.HuggingFaceCollection;

public static void main(String[] args) {
    final VantageClient client = VantageClient.usingVantageApiKey()
        .withAccountId(ACCOUNT_ID)
        .withVantageApiKey(VANTAGE_API_KEY)
        .build();

    final HuggingFaceCollection collection = HuggingFaceCollection.builder("my-hf-collection", 123)
        .withExternalUrl(YOUR_HF_ENDPOINT_URL)
        .withExternalKeyId(YOUR_MODEL_API_KEY_ID)
        .build();
}
./cli.py create-collection-openai \
    --collection-id 'my-openai-collection' \
    --embeddings-dimension 1536 \
    --llm-model-name 'text-embeddings-ada-002' \
    --llm-secret 'YOUR_OPENAI_SECRET_KEY'
./cli.py create-collection-hf \
    --collection-id 'my-hf-collection' \
    --embeddings-dimension 123 \
    --external-url 'YOUR_HF_ENDPOINT_URL' \
    --llm-secret 'YOUR_OPENAI_SECRET_KEY'

User-provided embeddings

The code block below describes how you can create a user-provided embeddings collection. It simply requires only the collection_id parameter and the embedding_dimensions.

from vantage_sdk import VantageClient
from vantage_sdk.model.collection import UserProvidedEmbeddingsCollection

vantage_instance = VantageClient.using_vantage_api_key(
    vantage_api_key=VANTAGE_API_KEY,
    account_id=ACCOUNT_ID,
)

upe_collection_id = "user-provided"

upe_collection = UserProvidedEmbeddingsCollection(
    collection_id=upe_collection_id,
    embeddings_dimension=123,
)

created_collection = vantage_instance.create_collection(
    collection= upe_collection
)

print(created_collection)
import { VantageClientConfiguration, VantageClient, UserProvidedEmbeddingsCollection } from "@vantage-sdk";

const configuration: VantageClientConfiguration = {
    vantageApiKey: vantageApiKey,
    accountId: accountId, 
    
}
let client = new VantageClient(configuration)

const collectionId = "user-provided"

const newCollection: UserProvidedEmbeddingsCollection = new UserProvidedEmbeddingsCollection(
    collectionId,
    1536,
)

const createdCollection = client.createCollection(newCollection)

createdCollection.then(data => console.log(data))
import com.vantage.sdk.VantageClient;
import com.vantage.sdk.api.collection.model.UserProvidedEmbeddingsCollection;

public static void main(String[] args) {
    final VantageClient client = VantageClient.usingVantageApiKey()
        .withAccountId(ACCOUNT_ID)
        .withVantageApiKey(VANTAGE_API_KEY)
        .build();

    final UserProvidedEmbeddingsCollection collection = UserProvidedEmbeddingsCollection.createNew(
        "my-upe-collection",
        "my-upe-collection",
        123
    );
}
./cli.py create-collection-upe  \
    --collection-id 'my-upe-collection' \
    --embeddings-dimension 123

Update Collection

The following example updates the collection example-collection.

from vantage_sdk import VantageClient

vantage_instance = VantageClient.using_vantage_api_key(
    vantage_api_key=VANTAGE_API_KEY,
    account_id=ACCOUNT_ID,
)

collection = vantage_instance.update_collection(
  collection_id="example-collection",
  collection_name="New Collection Name"
)

print(collection)
import { VantageClientConfiguration, VantageClient } from "@vantage-sdk";

const configuration: VantageClientConfiguration = {
    vantageApiKey: vantageApiKey,
    accountId: accountId, 
    
}
let client = new VantageClient(configuration)

const collectionId = "example-collection"

const updatedCollection = client.updateCollection(collectionId, "New Collection Name")

updatedCollection.then(data => console.log(data))
import com.vantage.sdk.VantageClient;
import com.vantage.sdk.api.collection.model.Collection;

public static void main(String[] args) {
    final VantageClient client = VantageClient.usingVantageApiKey()
        .withAccountId(ACCOUNT_ID)
        .withVantageApiKey(VANTAGE_API_KEY)
        .build();

    final Collection updatedCollection = client
        .collections()
        .update()
        .openAICollection("example-collection") // or huggingFaceCollection() or userProvidedEmbeddingsCollection()
        .withCollectionName("New Name")
        .execute();
}
./cli.py update-collection --collection-id example-collection --collection-name "New Name"

Delete Collection

The following example deletes the collection example-collection.

from vantage_sdk import VantageClient

vantage_instance = VantageClient.using_vantage_api_key(
    vantage_api_key=VANTAGE_API_KEY,
    account_id=ACCOUNT_ID,
)

vantage_instance.delete_collection(
  collection_id="example-collection",
)
import { VantageClientConfiguration, VantageClient } from "@vantage-sdk";

const configuration: VantageClientConfiguration = {
    vantageApiKey: vantageApiKey,
    accountId: accountId, 
    
}
let client = new VantageClient(configuration)

const collectionId = "example-collection"

client.deleteCollection(collectionId)
import com.vantage.sdk.VantageClient;

public static void main(String[] args) {
    final VantageClient client = VantageClient.usingVantageApiKey()
        .withAccountId(ACCOUNT_ID)
        .withVantageApiKey(VANTAGE_API_KEY)
        .build();

    client
        .collections()
        .deleteCollection(testCollection.getCollectionId());
}
./cli.py delete-collection example-collection

Model API Keys

Here you can find Model API Key management functionalities provided by the Vantage API. Note Model API Keys are the same as External Keys.

If you prefer a visual guide, check out the Console UI walkthrough example: Manage Your Model API Keys

List Model API Keys

The following example returns all Model API Keys created by account ACCOUNT_ID.

from vantage_sdk import VantageClient

vantage_instance = VantageClient.using_vantage_api_key(
    vantage_api_key=VANTAGE_API_KEY,
    account_id=ACCOUNT_ID,
)

model_keys = vantage_instance.get_external_api_keys()
print(model_keys)
import { VantageClientConfiguration, VantageClient } from "@vantage-sdk";

const configuration: VantageClientConfiguration = {
    vantageApiKey: vantageApiKey,
    accountId: accountId, 
    
}
let client = new VantageClient(configuration)

const keys = client.getExternalKeys()

keys.then(data => console.log(data))
import com.vantage.sdk.VantageClient;
import com.vantage.sdk.api.keys.external.model.ExternalKey;

public static void main(String[] args) {
    final VantageClient client = VantageClient.usingVantageApiKey()
        .withAccountId(ACCOUNT_ID)
        .withVantageApiKey(VANTAGE_API_KEY)
        .build();

    final List<ExternalKey> keys = client.keys()
        .externalKeys()
        .getExternalKeys();
}
./cli.py get-external-api-keys

Get Model API Key

The following example returns details about the Model API Key with id model-key-id.

from vantage_sdk import VantageClient

vantage_instance = VantageClient.using_vantage_api_key(
    vantage_api_key=VANTAGE_API_KEY,
    account_id=ACCOUNT_ID,
)

model_key = vantage_instance.get_external_api_key(
    external_key_id = "MODEL_KEY_ID"
)

print(model_key)
import { VantageClientConfiguration, VantageClient } from "@vantage-sdk";

const configuration: VantageClientConfiguration = {
    vantageApiKey: vantageApiKey,
    accountId: accountId, 
    
}
let client = new VantageClient(configuration)

const key = client.getExternalKey("MODEL_KEY_ID")

key.then(data => console.log(data))
import com.vantage.sdk.VantageClient;
import com.vantage.sdk.api.keys.external.model.ExternalKey;

public static void main(String[] args) {
    final VantageClient client = VantageClient.usingVantageApiKey()
        .withAccountId(ACCOUNT_ID)
        .withVantageApiKey(VANTAGE_API_KEY)
        .build();

    final ExternalKey key = client.keys()
        .externalKeys()
        .getExternalKey(MODEL_KEY_ID);
}
./cli.py get-external-api-key model-key-id

Create Model API Key

The following example creates new Model API Key.

from vantage_sdk import VantageClient

vantage_instance = VantageClient.using_vantage_api_key(
    vantage_api_key=VANTAGE_API_KEY,
    account_id=ACCOUNT_ID,
)

model_key = vantage_instance.create_external_api_key(
    llm_provider = "OpenAI",
    llm_secret = "LLM_SECRET",
)

print(model_key)
import { VantageClientConfiguration, VantageClient } from "@vantage-sdk";

const configuration: VantageClientConfiguration = {
    vantageApiKey: vantageApiKey,
    accountId: accountId, 
    
}
let client = new VantageClient(configuration)

const newKey = client.createExternalKey("OpenAI", "LLM_SECRET")

newKey.then(data => console.log(data))
import com.vantage.sdk.VantageClient;
import com.vantage.sdk.api.keys.external.model.ExternalKey;

public static void main(String[] args) {
    final VantageClient client = VantageClient.usingVantageApiKey()
        .withAccountId(ACCOUNT_ID)
        .withVantageApiKey(VANTAGE_API_KEY)
        .build();

    final ExternalKey key = client.keys()
        .externalKeys()
        .createExternalKey(
            LLMProviderType.OPEN_AI,
            LLM_SECRET
        );
}
./cli.py create-external-api-key \
  --llm-provider "Value" \
  --llm-secret "secret" \
  model-key-id

Update Model API Key

The following example updates the Model API Key with id model-key-id.

from vantage_sdk import VantageClient

vantage_instance = VantageClient.using_vantage_api_key(
    vantage_api_key=VANTAGE_API_KEY,
    account_id=ACCOUNT_ID,
)

updated_model_key = vantage_instance.update_external_api_key(
    external_key_id = "MODEL_KEY_ID",
    llm_provider = "OpenAI",
    llm_secret = "NEW_LLM_SECRET",
)

print(updated_model_key)
     
import { VantageClientConfiguration, VantageClient } from "@vantage-sdk";

const configuration: VantageClientConfiguration = {
    vantageApiKey: vantageApiKey,
    accountId: accountId, 
    
}
let client = new VantageClient(configuration)

const updatedKey = client.updateExternalKey("MODEL_KEY_ID", "NEW_LLM_SECRET")

updatedKey.then(data => console.log(data))
import com.vantage.sdk.VantageClient;
import com.vantage.sdk.api.keys.external.model.ExternalKey;

public static void main(String[] args) {
    final VantageClient client = VantageClient.usingVantageApiKey()
        .withAccountId(ACCOUNT_ID)
        .withVantageApiKey(VANTAGE_API_KEY)
        .build();

    final ExternalKey updatedKey = client.keys()
        .externalKeys()
        .updateExternalKey(
            MODEL_KEY_ID,
            LLMProviderType.OPEN_AI,
            NEW_LLM_SECRET
        );
}
./cli.py update-external-api-key \
  --llm-provider "New Value" \
  --llm-secret "new-secret" \
  model-key-id

Delete Model API Key

The following example deletes the Model API Key with id model-key-id.

from vantage_sdk import VantageClient

vantage_instance = VantageClient.using_vantage_api_key(
    vantage_api_key=VANTAGE_API_KEY,
    account_id=ACCOUNT_ID,
)

vantage_instance.delete_external_api_key(
    external_key_id = "MODEL_KEY_ID"
)
import { VantageClientConfiguration, VantageClient } from "@vantage-sdk";

const configuration: VantageClientConfiguration = {
    vantageApiKey: vantageApiKey,
    accountId: accountId, 
    
}
let client = new VantageClient(configuration)

client.deleteExternalKey("MODEL_KEY_ID")
import com.vantage.sdk.VantageClient;

public static void main(String[] args) {
    final VantageClient client = VantageClient.usingVantageApiKey()
        .withAccountId(ACCOUNT_ID)
        .withVantageApiKey(VANTAGE_API_KEY)
        .build();

    client.keys()
        .externalKeys()
        .deleteExternalKey(MODEL_KEY_ID);
}
./cli.py delete-external-api-key model-key-id

Vantage API Keys

Here you can find Vantage API key management functionalities provided by the Vantage API.

If you prefer a visual guide, check out the Console UI walkthrough example: Get Your Vantage API Key

List Vantage API Keys

The following example returns all Vantage API keys linked to account ACCOUNT_ID.

from vantage_sdk import VantageClient

vantage_instance = VantageClient.using_vantage_api_key(
    vantage_api_key=VANTAGE_API_KEY,
    account_id=ACCOUNT_ID,
)

vantage_keys = vantage_instance.get_vantage_api_keys()
print(vantage_keys)
import { VantageClientConfiguration, VantageClient } from "@vantage-sdk";

const configuration: VantageClientConfiguration = {
    vantageApiKey: vantageApiKey,
    accountId: accountId, 
    
}
let client = new VantageClient(configuration)

const keys = client.getVantageApiKeys()

keys.then(data => console.log(data))
import com.vantage.sdk.VantageClient;
import com.vantage.sdk.api.keys.vantage.model.VantageApiKey;

public static void main(String[] args) {
    final VantageClient client = VantageClient.usingVantageApiKey()
        .withAccountId(ACCOUNT_ID)
        .withVantageApiKey(VANTAGE_API_KEY)
        .build();

    final List<VantageApiKey> keys = client.keys()
        .vantage()
        .getApiKeys();
}
./cli.py get-vantage-api-keys

Get Vantage API Key

The following example returns details about the Vantage API key with id vantage-api-key-id.

from vantage_sdk import VantageClient

vantage_instance = VantageClient.using_vantage_api_key(
    vantage_api_key=VANTAGE_API_KEY,
    account_id=ACCOUNT_ID,
)

vantage_key = vantage_instance.get_vantage_api_key(
    vantage_api_key_id = "VANTAGE_API_KEY_ID"
)

print(vantage_key)
import { VantageClientConfiguration, VantageClient } from "@vantage-sdk";

const configuration: VantageClientConfiguration = {
    vantageApiKey: vantageApiKey,
    accountId: accountId, 
    
}
let client = new VantageClient(configuration)

const key = client.getVantageApiKey("VANTAGE_API_KEY_ID")

key.then(data => console.log(data))
import com.vantage.sdk.VantageClient;
import com.vantage.sdk.api.keys.vantage.model.VantageApiKey;

public static void main(String[] args) {
    final VantageClient client = VantageClient.usingVantageApiKey()
        .withAccountId(ACCOUNT_ID)
        .withVantageApiKey(VANTAGE_API_KEY)
        .build();

    final List<VantageApiKey> keys = client.keys()
        .vantage()
        .getApiKey(VANTAGE_API_KEY_ID);
}
./cli.py get-vantage-api-key vantage-api-key-id

Data Upload & Upsert

Vantage offers the possibility to upload or upsert documents to collections using multiple methods and data formats:

📘

Upload vs Upsert

Uploading your data will update your collection data and extend or upsert existing documents. Upserting will add new documents or update existing ones if the IDs match. Both do the same logical operation, just the upload or plumbing is different.

Upsert options:

  • Vantage Documents
    • upsert_documents
  • JSONL String
    • upsert_documents_from_jsonl_string
  • JSONL File
    • upsert_documents_from_jsonl_file

Upload options:

  • JSONL Format
    • upload_documents_from_jsonl_file
  • Parquet Format
    • upload_documents_from_parquet_file

Below are examples on how to use each of these methods.

Upsert Documents using Vantage Document objects - upsert_documents

Vantage offers multiple document upload options. Depending on the collection type, you can create either a UserProvidedEmbeddingsDocument or a VantageManagedEmbeddingsDocument object.

They differ in that the former requires an embeddings field, matching the embeddings_dimension set for the collection to which you are upserting data, while the latter does not. When upserting documents to a collection, you must upsert a list consisting solely of one of these document types.

Below, you can see a code block with examples of both of these cases.

from vantage_sdk import VantageClient

vantage_instance = VantageClient.using_vantage_api_key(
    vantage_api_key=VANTAGE_API_KEY,
    account_id=ACCOUNT_ID,
)

ids = [
    "1",
    "2",
    "3",
    "4",
]

texts = [
    "First text",
    "Second text",
    "Third text",
    "Fourth text",
]

# Suppose that the collection "example-upe-collection" has 
# the `embedding_dimension` parameter set to 3.
embeddings = [
    [0.123, 0.234, 0.345],
    [0.456, 0.567, 0.678],
    [0.789, 0.891, 0.912],
    [0.257, 0.389, 0.468],
]

documents = [
    UserProvidedEmbeddingsDocument(text=text, id=id, embeddings=emb)
    for id, text, emb in zip(ids, texts, embeddings)
]

vantage_instance.upsert_documents(
    collection_id="example-upe-collection",
    documents=documents
)
from vantage_sdk import VantageClient

vantage_instance = VantageClient.using_vantage_api_key(
    vantage_api_key=VANTAGE_API_KEY,
    account_id=ACCOUNT_ID,
)

ids = [
    "1",
    "2",
    "3",
    "4",
]

texts = [
    "First text",
    "Second text",
    "Third text",
    "Fourth text",
]

documents = [
    VantageManagedEmbeddingsDocument(text=text, id=id)
    for id, text in zip(ids, texts)
]

vantage_instance.upsert_documents(
    collection_id="example-vme-collection",
    documents=documents
)
import { VantageClientConfiguration, VantageClient, UserProvidedEmbeddingsDocument } from "@vantage-sdk";

const configuration: VantageClientConfiguration = {
    vantageApiKey: vantageApiKey,
    accountId: accountId, 
    
}
let client = new VantageClient(configuration)

const collectionId = "example-upe-collection"

const ids: string[] = [
    "1",
    "2",
    "3",
    "4",
];

const texts: string[] = [
    "First text",
    "Second text",
    "Third text",
    "Fourth text",
];

const embeddings = [
    [0.123, 0.234, 0.345],
    [0.456, 0.567, 0.678],
    [0.789, 0.891, 0.912],
    [0.257, 0.389, 0.468],
]

const documents: UserProvidedEmbeddingsDocument[] = ids.map((id, index) => new UserProvidedEmbeddingsDocument(texts[index], embeddings[index], id));

client.upsertDocuments(collectionId, documents);
import { VantageClientConfiguration, VantageClient, VantageManagedEmbeddingsDocument } from "@vantage-sdk";

const configuration: VantageClientConfiguration = {
    vantageApiKey: vantageApiKey,
    accountId: accountId, 
    
}
let client = new VantageClient(configuration)

const collectionId = "example-vme-collection"

const ids: string[] = [
    "1",
    "2",
    "3",
    "4",
];

const texts: string[] = [
    "First text",
    "Second text",
    "Third text",
    "Fourth text",
];

const documents: VantageManagedEmbeddingsDocument[] = ids.map((id, index) => new VantageManagedEmbeddingsDocument(texts[index], id));

client.upsertDocuments(collectionId, documents);
import com.vantage.sdk.VantageClient;
import com.vantage.sdk.api.document.model.UserProvidedEmbeddingsDocument;

public static void main(String[] args) {
    final VantageClient client = VantageClient.usingVantageApiKey()
        .withAccountId(ACCOUNT_ID)
        .withVantageApiKey(VANTAGE_API_KEY)
        .build();

    final UserProvidedEmbeddingsDocument document1 = UserProvidedEmbeddingsDocument.withoutMetadata(
        "First text",
        "1",
        List.of(0.123, 0.234, 0.345)
    );
    final UserProvidedEmbeddingsDocument document2 = UserProvidedEmbeddingsDocument.withoutMetadata(
        "Second text",
        "2",
        List.of(0.456, 0.567, 0.678)
    );
    final UserProvidedEmbeddingsDocument document3 = UserProvidedEmbeddingsDocument.withoutMetadata(
        "Third text",
        "3",
        List.of(0.789, 0.891, 0.912)
    );
    final UserProvidedEmbeddingsDocument document4 = UserProvidedEmbeddingsDocument.withoutMetadata(
        "Fourth text",
        "4",
        List.of(0.257, 0.389, 0.468)
    );

    final int status = client
        .documents()
        .upsert()
        .toCollection("example-upe-collection")
        .fromUserProvidedEmbeddingsDocuments(List.of(document1, document2, document3, document4))
        .execute();
}
import com.vantage.sdk.VantageClient;
import com.vantage.sdk.api.document.model.VantageManagedEmbeddingsDocument;

public static void main(String[] args) {
    final VantageClient client = VantageClient.usingVantageApiKey()
        .withAccountId(ACCOUNT_ID)
        .withVantageApiKey(VANTAGE_API_KEY)
        .build();

    final VantageManagedEmbeddingsDocument document1 = VantageManagedEmbeddingsDocument.withoutMetadata(
        "First text",
        "1"
    );
    final VantageManagedEmbeddingsDocument document2 = VantageManagedEmbeddingsDocument.withoutMetadata(
        "Second text",
        "2"
    );
    final VantageManagedEmbeddingsDocument document1 = VantageManagedEmbeddingsDocument.withoutMetadata(
        "Third text",
        "3"
    );
    final VantageManagedEmbeddingsDocument document2 = VantageManagedEmbeddingsDocument.withoutMetadata(
        "fourth text",
        "4"
    );

    final int status = client
        .documents()
        .upsert()
        .toCollection("example-vme-collection")
        .fromVantageManagedEmbeddingsDocuments(List.of(document1, document2, document3, document4))
        .execute();
}

Upsert Documents from JSONL string - upsert_documents_from_jsonl_string

There is a possibility to provide your document objects by manually creating your JSONL string. In that case, it's important to follow the Vantage JSONL data ingestion format. We highly recommend you take a look at our documentation page describing it.

Below is one example of how you can upsert documents using this approach.

from vantage_sdk import VantageClient

vantage_instance = VantageClient.using_vantage_api_key(
    vantage_api_key=VANTAGE_API_KEY,
    account_id=ACCOUNT_ID,
)

documents_jsonl = '{
  "id": "1", 
  "text": "Example text", 
  "meta_color": "green", 
  "embeddings": [1,2,3, ...]
}\\n{
  "id": "2", 
  "text": "Sample text", 
  "meta_color": "blue",
  "embeddings": [4,5,6, ...]
}'

vantage_instance.upsert_documents_from_jsonl_string(
    collection_id="example-collection",
    documents_jsonl=documents_jsonl
)
from vantage_sdk import VantageClient

vantage_instance = VantageClient.using_vantage_api_key(
    vantage_api_key=VANTAGE_API_KEY,
    account_id=ACCOUNT_ID,
)

documents_jsonl = '{
  "id": "1", 
  "text": "Example text", 
  "meta_color": "green",
}\\n{
  "id": "2", 
  "text": "Sample text", 
  "meta_color": "blue",
}'

vantage_instance.upsert_documents_from_jsonl_string(
    collection_id="example-collection",
    documents_jsonl=documents_jsonl
)
import { VantageClientConfiguration, VantageClient } from "@vantage-sdk";

const configuration: VantageClientConfiguration = {
    vantageApiKey: vantageApiKey,
    accountId: accountId, 
    
}
let client = new VantageClient(configuration)

const collectionId = "example-collection"

const documentsJsonl: string = '{\
  "id": "1", \
  "text": "Example text", \
  "meta_color": "green", \
  "embeddings": [1,2,3, ...]\
}\\n{\
  "id": "2", \
  "text": "Sample text", \
  "meta_color": "blue",\
  "embeddings": [4,5,6, ...]\
}'

client.upsertDocumentsFromJsonlString(collectionId, documentsJsonl);
import { VantageClientConfiguration, VantageClient } from "@vantage-sdk";

const configuration: VantageClientConfiguration = {
    vantageApiKey: vantageApiKey,
    accountId: accountId, 
    
}
let client = new VantageClient(configuration)

const collectionId = "example-collection"

const documentsJsonl: string = '{\
  "id": "1", \
  "text": "Example text", \
  "meta_color": "green", \
}\\n{\
  "id": "2", \
  "text": "Sample text", \
  "meta_color": "blue",\
}'

client.upsertDocumentsFromJsonlString(collectionId, documentsJsonl);
import com.vantage.sdk.VantageClient;

public static void main(String[] args) {
    final VantageClient client = VantageClient.usingVantageApiKey()
        .withAccountId(ACCOUNT_ID)
        .withVantageApiKey(VANTAGE_API_KEY)
        .build();

    final String jsonl = "{ "
        + "\"id\": \"1\", "
        + "\"text\": \"Example text\", "
        + "\"meta_color\": \"green\", "
        + "\"embeddings\": [ 1, 2, 3 ] "
        + "} { "
        + "\"id\": \"2\", "
        + "\"text\": \"Sample text\", "
        + "\"meta_color\": \"blue\", "
        + "\"embeddings\": [ 4, 5, 6 ] "
        + "}";

    final int status = client
        .documents()
        .upsert()
        .toCollection("example-collection")
        .fromString(jsonl)
        .execute();
}
import com.vantage.sdk.VantageClient;

public static void main(String[] args) {
    final VantageClient client = VantageClient.usingVantageApiKey()
        .withAccountId(ACCOUNT_ID)
        .withVantageApiKey(VANTAGE_API_KEY)
        .build();

    final String jsonl = "{ "
        + "\"id\": \"1\", "
        + "\"text\": \"Example text\", "
        + "\"meta_color\": \"green\" "
        + "} { "
        + "\"id\": \"2\", "
        + "\"text\": \"Sample text\", "
        + "\"meta_color\": \"blue\" "
        + "}";

    final int status = client
        .documents()
        .upsert()
        .toCollection("example-collection")
        .fromString(jsonl)
        .execute();
}

Upsert Documents from JSONL file - upsert_documents_from_jsonl_file

The following example upserts data from path_to_data.jsonl file to collection example-collection.

It's important to follow the Vantage JSONL data ingestion format. We highly recommend you take a look at our documentation page describing it.

from vantage_sdk import VantageClient

vantage_instance = VantageClient.using_vantage_api_key(
    vantage_api_key=VANTAGE_API_KEY,
    account_id=ACCOUNT_ID,
)

vantage_instance.upsert_documents_from_jsonl_file(
    collection_id="example-collection",
    jsonl_file_path="path_to_data.jsonl"
)
import { VantageClientConfiguration, VantageClient } from "@vantage-sdk";

const configuration: VantageClientConfiguration = {
    vantageApiKey: vantageApiKey,
    accountId: accountId, 
    
}
let client = new VantageClient(configuration)

const collectionId = "example_collection"

client.upsertDocumentsFromJsonlFile(collectionId, "path_to_data.jsonl");
import com.vantage.sdk.VantageClient;

public static void main(String[] args) {
    final VantageClient client = VantageClient.usingVantageApiKey()
        .withAccountId(ACCOUNT_ID)
        .withVantageApiKey(VANTAGE_API_KEY)
        .build();

    final int status = client
        .documents()
        .upsert()
        .toCollection("example-collection")
        .fromPath("path_to_data.jsonl")
        .withIdentifier(jsonlFile)
        .execute();
./cli.py upsert-documents-from-jsonl --collection-id example-collection "path_to_data.jsonl"

Upload Documents from JSONL file - upload_documents_from_jsonl_file

The following example uploads data from path_to_data.jsonl file to collection example-collection.

It's important to follow the Vantage JSONL data ingestion format. We highly recommend you take a look at our documentation page describing it.

from vantage_sdk import VantageClient

vantage_instance = VantageClient.using_vantage_api_key(
    vantage_api_key=VANTAGE_API_KEY,
    account_id=ACCOUNT_ID,
)

vantage_instance.upload_documents_from_jsonl_file(
    collection_id="example-collection",
    parquet_file_path="path_to_data.jsonl"
)
import { VantageClientConfiguration, VantageClient } from "@vantage-sdk";

const configuration: VantageClientConfiguration = {
    vantageApiKey: vantageApiKey,
    accountId: accountId, 
    
}
let client = new VantageClient(configuration)

const collectionId = "example_collection"

client.uploadDocumentsFromParquetFile(collectionId, "path_to_data.parquet");
import com.vantage.sdk.VantageClient;

public static void main(String[] args) {
    final VantageClient client = VantageClient.usingVantageApiKey()
        .withAccountId(ACCOUNT_ID)
        .withVantageApiKey(VANTAGE_API_KEY)
        .build();

    final int status = client
        .documents()
        .upload()
        .toCollection("example-collection")
        .jsonlFile()
        .fromPath("path_to_data.jsonl")
        .execute();
./cli.py upload-documents-from-jsonl --collection-id example-collection "path_to_data.jsonl"

Upload Documents from Parquet file - upload_documents_from_parquet_file

The following example uploads data from path_to_data.parquet file to collection example-collection.

It's important to follow the Vantage Parquet data ingestion format. We highly recommend you take a look at our documentation page describing it.

from vantage_sdk import VantageClient

vantage_instance = VantageClient.using_vantage_api_key(
    vantage_api_key=VANTAGE_API_KEY,
    account_id=ACCOUNT_ID,
)

vantage_instance.upload_documents_from_parquet_file(
    collection_id="example-collection",
    parquet_file_path="path_to_data.parquet"
)
import { VantageClientConfiguration, VantageClient } from "@vantage-sdk";

const configuration: VantageClientConfiguration = {
    vantageApiKey: vantageApiKey,
    accountId: accountId, 
    
}
let client = new VantageClient(configuration)

const collectionId = "example_collection"

client.uploadDocumentsFromParquetFile(collectionId, "path_to_data.parquet");
import com.vantage.sdk.VantageClient;

public static void main(String[] args) {
    final VantageClient client = VantageClient.usingVantageApiKey()
        .withAccountId(ACCOUNT_ID)
        .withVantageApiKey(VANTAGE_API_KEY)
        .build();

    final int status = client
        .documents()
        .upload()
        .toCollection("example-collection")
        .parquetFile()
        .fromPath("path_to_data.parquet")
        .execute();
./cli.py upload-documents-from-parquet --collection-id example-collection "path_to_data.parquet"

Shopping Assistant

Here you can find Shopping Assistant management functionalities provided by the Vantage API.

List Shopping Assistants

The Following example returns all Shopping Assistant configurations created by user.

from vantage_sdk import VantageClient

vantage_instance = VantageClient.using_vantage_api_key(
    vantage_api_key=VANTAGE_API_KEY,
    account_id=ACCOUNT_ID,
)

shopping_assistants = vantage_instance.list_shopping_assistants()
import { VantageClientConfiguration, VantageClient } from "@vantage-sdk";

const configuration: VantageClientConfiguration = {
    vantageApiKey: vantageApiKey,
    accountId: accountId, 
    
}
let client = new VantageClient(configuration)

const assistants = await client.listShoppingAssistants()
final VantageClient client = VantageClient.usingVantageApiKey()
    .withAccountId(ACCOUNT_ID)
    .withVantageApiKey(VANTAGE_API_KEY)
    .build();

final List<ShoppingAssistant> shoppingAssistants = client
    .shoppingAssistants()
    .list();

Get Shopping Assistant

The following example returns a specific Shopping Assistant configuration.

from vantage_sdk import VantageClient

vantage_instance = VantageClient.using_vantage_api_key(
    vantage_api_key=VANTAGE_API_KEY,
    account_id=ACCOUNT_ID,
)

shopping_assistant_id = "shopping-assistant-id"

shopping_assistant = vantage_instance.get_shopping_assistant(
    shopping_assistant_id
)
import { VantageClientConfiguration, VantageClient } from "@vantage-sdk";

const configuration: VantageClientConfiguration = {
    vantageApiKey: vantageApiKey,
    accountId: accountId, 
    
}
let client = new VantageClient(configuration)

const shoppingAssistantId = "shopping-assistant-id"

const assistant = await client.getShoppingAssistant(
    shoppingAssistantId,
)
final VantageClient client = VantageClient.usingVantageApiKey()
    .withAccountId(ACCOUNT_ID)
    .withVantageApiKey(VANTAGE_API_KEY)
    .build();

final ShoppingAssistant shoppingAssistant = client
    .shoppingAssistants()
    .get(SHOPPING_ASSISTANT_ID);

Create Shopping Assistant

The Following example creates new Shopping Assistant configuration.

from vantage_sdk import VantageClient

vantage_instance = VantageClient.using_vantage_api_key(
    vantage_api_key=VANTAGE_API_KEY,
    account_id=ACCOUNT_ID,
)

name = "assistant"
groups = ["group 1", "group 2", "group 3"]
external_account_id = "external-account-id"
llm_model_name = "text-embeddings-ada-002"

shopping_assistant = vantage_instance.create_shopping_assistant(
    name=name,
    groups=groups,
    external_account_id=external_account_id,
    llm_model_name=llm_model_name,
)
import { VantageClientConfiguration, VantageClient } from "@vantage-sdk";

const configuration: VantageClientConfiguration = {
    vantageApiKey: vantageApiKey,
    accountId: accountId, 
    
}
let client = new VantageClient(configuration)

const name = "assistant"
const groups = [
        "group 1",
        "group 2",
        "group 3"
    ]
const externalAccountId = "external-account-id"
const llmModelName = "text-embeddings-ada-002"

const assistant = await client.createShoppingAssistant(
    name,
    groups,
    externalAccountId,
    llmModelName
)
final VantageClient client = VantageClient.usingVantageApiKey()
    .withAccountId(ACCOUNT_ID)
    .withVantageApiKey(VANTAGE_API_KEY)
    .build();

final ShoppingAssistant shoppingAssistant = ShoppingAssistant.createNew(
    "Example assistant",
    List.of("Shorts", "Shirts", "BBQ"),
    "f7de5b09-0393-408e-abc8-0139ca8a6de2",
    "openai-4o"
);

final ShoppingAssistant createdChoppingAssistant = client
    .shoppingAssistants()
    .create(shoppingAssistant);

Update Shopping Assistant

The Following example updates an existing Shopping Assistant configuration.

from vantage_sdk import VantageClient

vantage_instance = VantageClient.using_vantage_api_key(
    vantage_api_key=VANTAGE_API_KEY,
    account_id=ACCOUNT_ID,
)

name = "new name"

shopping_assistant = vantage_instance.update_shopping_assistant(
    name=name,
)
import { VantageClientConfiguration, VantageClient } from "@vantage-sdk";

const configuration: VantageClientConfiguration = {
    vantageApiKey: vantageApiKey,
    accountId: accountId, 
    
}
let client = new VantageClient(configuration)

const newName = "new name"

const assistant = await client.updateShoppingAssistant(
    newName,
)
final VantageClient client = VantageClient.usingVantageApiKey()
    .withAccountId(ACCOUNT_ID)
    .withVantageApiKey(VANTAGE_API_KEY)
    .build();

final ShoppingAssistant response = client
    .shoppingAssistants()
    .update(EXISTING_ASSISTANT_ID)
    .withExternalAccountId("cae9db26-cb0a-4e2e-8aad-61cdac66e617")
    .withLlmModelName("openai-4o")
    .withGroups(List.of("Rakes", "Shovels"))
    .withName("Updated example name")
    .execute();

Delete Shopping Assistant

The Following example deletes an existing Shopping Assistant configuration.

from vantage_sdk import VantageClient

vantage_instance = VantageClient.using_vantage_api_key(
    vantage_api_key=VANTAGE_API_KEY,
    account_id=ACCOUNT_ID,
)

shopping_assistant_id = "shopping-assistant-id"

vantage_instance.delete_shopping_assistant(shopping_assistant_id)
import { VantageClientConfiguration, VantageClient } from "@vantage-sdk";

const configuration: VantageClientConfiguration = {
    vantageApiKey: vantageApiKey,
    accountId: accountId, 
    
}
let client = new VantageClient(configuration)

const shoppingAssistantId = "shopping-assistant-id"

await client.deleteShoppingAssistant(
    shoppingAssistantId
)
final VantageClient client = VantageClient.usingVantageApiKey()
    .withAccountId(ACCOUNT_ID)
    .withVantageApiKey(VANTAGE_API_KEY)
    .build();

final ShoppingAssistant response = client
    .shoppingAssistants()
    .delete(EXISTING_ASSISTANT_ID);

Vantage Vibe

Here you can find Vantage Vibe management functionalities provided by the Vantage API.

List Vantage Vibe Configurations

The Following example returns all Vantage Vibe configurations created by user.

from vantage_sdk import VantageClient

vantage_instance = VantageClient.using_vantage_api_key(
    vantage_api_key=VANTAGE_API_KEY,
    account_id=ACCOUNT_ID,
)

vibes = client.list_vibe_configurations()
import { VantageClientConfiguration, VantageClient } from "@vantage-sdk";

const configuration: VantageClientConfiguration = {
    vantageApiKey: vantageApiKey,
    accountId: accountId, 
    
}
let client = new VantageClient(configuration)

const vibes = await client.listVibeConfigurations()
final VantageClient client = VantageClient.usingVantageApiKey()
    .withAccountId(ACCOUNT_ID)
    .withVantageApiKey(VANTAGE_API_KEY)
    .build();

final List<VibeConfiguration> vibes = client
    .vibe()
    .list();

Get Vantage Vibe Configuration

The following example returns a specific Vantage Vibe configuration.

from vantage_sdk import VantageClient

vantage_instance = VantageClient.using_vantage_api_key(
    vantage_api_key=VANTAGE_API_KEY,
    account_id=ACCOUNT_ID,
)

vibe_id = "vibe-id"

vibe = client.get_vibe_configuration(vibe_id)
import { VantageClientConfiguration, VantageClient } from "@vantage-sdk";

const configuration: VantageClientConfiguration = {
    vantageApiKey: vantageApiKey,
    accountId: accountId, 
    
}
let client = new VantageClient(configuration)

 const vibeId = "vibe-id"

const vibe = await client.getVibeConfiguration(
    vibeId,
)
final VantageClient client = VantageClient.usingVantageApiKey()
    .withAccountId(ACCOUNT_ID)
    .withVantageApiKey(VANTAGE_API_KEY)
    .build();

final VibeConfiguration vibe = client
    .vibe()
    .get("vibe-id");

Create Vantage Vibe Configuration

The Following example creates new Vantage Vibe configuration.

from vantage_sdk import VantageClient

vantage_instance = VantageClient.using_vantage_api_key(
    vantage_api_key=VANTAGE_API_KEY,
    account_id=ACCOUNT_ID,
)

name = "example-vibe"
external_account_id = "external-account-id"
llm_model_name = "text-embeddings-ada-002"

vibe = client.create_vibe_configuration(
    name=name,
    external_account_id=external_account_id,
    llm_model_name=llm_model_name,
)
import { VantageClientConfiguration, VantageClient } from "@vantage-sdk";

const configuration: VantageClientConfiguration = {
    vantageApiKey: vantageApiKey,
    accountId: accountId, 
    
}
let client = new VantageClient(configuration)

const name = "example-vibe"
const externalAccountId = "external-account-id"
const llmModelName = "text-embeddings-ada-002"

const vibe = await client.createVibeConfiguration(
    name,
    llmModelName,
    externalAccountId
)
final VantageClient client = VantageClient.usingVantageApiKey()
    .withAccountId(ACCOUNT_ID)
    .withVantageApiKey(VANTAGE_API_KEY)
    .build();

final VibeConfiguration vibe = VibeConfiguration.createNew(
    "text-embeddings-ada-002",
    "example-vibe",
    "external-account-id"
);

final VibeConfiguration response = client
    .vibe()
    .create(vibe);

Delete Vantage Vibe Configuration

The Following example deletes an existing Vantage Vibe configuration.

from vantage_sdk import VantageClient

vantage_instance = VantageClient.using_vantage_api_key(
    vantage_api_key=VANTAGE_API_KEY,
    account_id=ACCOUNT_ID,
)

test_vibe_id = "vibe-id"

client.delete_vibe_configuration(test_vibe_id)
import { VantageClientConfiguration, VantageClient } from "@vantage-sdk";

const configuration: VantageClientConfiguration = {
    vantageApiKey: vantageApiKey,
    accountId: accountId, 
    
}
let client = new VantageClient(configuration)

const vibeId = "vibe-id"

await client.deleteVibeConfiguration(
    vibeId
)
final VantageClient client = VantageClient.usingVantageApiKey()
    .withAccountId(ACCOUNT_ID)
    .withVantageApiKey(VANTAGE_API_KEY)
    .build();

client
    .vibe()
    .delete("vibe-id");