AddToVectorDatabase

AddToVectorDatabase[db,{vec1,}]

adds a list of vectors veci to the VectorDatabaseObject[] db.

AddToVectorDatabase[db,{vec1,}{val1,}]

adds new vector veci and associated value vali to the database db.

Details

  • AddToVectorDatabase extends an existing VectorDatabaseObject with additional data, expanding the databases storage and search capabilities.
  • The database can be specified using:
  • "string"a string matching a named vector database
    dba VectorDatabaseObject
  • Possible values for the data to be added include:
  • {vec1,}a list of vectors
    {vec1val1,}a list of vectors and associated values
    {vec1,}{val1,}a rule between vectors and values
  • If db contains annotated vectors, each new veci should be tagged the same way. »
  • Accepted forms of vali include:
  • "string"string labels
    <|"tag1"v1,|>an association of tags and metadata values

Examples

open allclose all

Basic Examples  (1)

Create an empty vector database:

Add vectors to the database:

Scope  (6)

Data Sources  (2)

Add a list of vectors to an empty database:

Create a database with existing vectors:

Add a new vector to the existing database:

Add multiple vectors to the existing database:

Metadata  (4)

Add vectors together with simple labels to an empty database:

Create a database with vectors annotated with single labels:

Add new vectors together with their labels:

Add vectors together with annotations in an Association to an empty database:

Create a database with vectors annotated with multiple tags:

Add vectors together with labels in an Association to a populated database:

Applications  (1)

A single incorrect element will cause the database creation to fail:

To add all elements that are valid, create a empty database:

Use AddToVectorDatabase to incrementally add only the valid elements:

The three valid elements have been added to the database:

Properties & Relations  (1)

Create a named vector database:

Update the database via its name:

The database will be updated in all places it is referenced:

Possible Issues  (2)

Create a vector database:

Additional vectors must be of the same dimensions as the input:

Create a vector database with labeled vectors:

New elements must follow the same format:

Add an annotation in order to add the vector:

Wolfram Research (2024), AddToVectorDatabase, Wolfram Language function, https://reference.wolfram.com/language/ref/AddToVectorDatabase.html.

Text

Wolfram Research (2024), AddToVectorDatabase, Wolfram Language function, https://reference.wolfram.com/language/ref/AddToVectorDatabase.html.

CMS

Wolfram Language. 2024. "AddToVectorDatabase." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/AddToVectorDatabase.html.

APA

Wolfram Language. (2024). AddToVectorDatabase. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/AddToVectorDatabase.html

BibTeX

@misc{reference.wolfram_2024_addtovectordatabase, author="Wolfram Research", title="{AddToVectorDatabase}", year="2024", howpublished="\url{https://reference.wolfram.com/language/ref/AddToVectorDatabase.html}", note=[Accessed: 20-January-2025 ]}

BibLaTeX

@online{reference.wolfram_2024_addtovectordatabase, organization={Wolfram Research}, title={AddToVectorDatabase}, year={2024}, url={https://reference.wolfram.com/language/ref/AddToVectorDatabase.html}, note=[Accessed: 20-January-2025 ]}