CreateVectorDatabase

CreateVectorDatabase[]

creates a new empty vector database.

CreateVectorDatabase[{vec1,}]

initializes the database with the collection of vectors veci.

CreateVectorDatabase[{vec1,}{val1,}]

associates the value vali to the vector veci.

CreateVectorDatabase[data,name]

gives the vector database the specified name.

Details and Options

Examples

open allclose all

Basic Examples  (2)

Create an empty VectorDatabaseObject:

Create a database with a specific name and initialize it with a list of vectors:

Search the database by similarity:

Scope  (5)

Data Sources  (3)

Create an empty vector database:

Create a database with a specific name:

Initialize a new vector database with a list of vectors:

Metadata  (2)

Initialize the database with both vectors and metadata:

Specify the metadata as a separate list:

Specify the metadata with tags as an Association:

Specify data and metadata separately:

Options  (10)

DistanceFunction  (1)

Specify a custom distance function for the database:

By default, EuclideanDistance is used:

FeatureExtractor  (1)

Only vectors can be stored in the database; specify a FeatureExtractor that can extract image features:

Search for the closest image to a given one:

GeneratedAssetLocation  (3)

Specify a custom location to store the database:

Retrieve the location:

By default, the database is stored in a local object:

Store the vector database in a file:

Retrieve the location:

Recreate the database from the file reference:

OverwriteTarget  (2)

The database's automatic location is determined by its name:

With default OverwriteTargetAutomatic, a new database name is generated to avoid collisions:

To force overwriting, use OverwriteTargetTrue:

Use OverwriteTargetFalse to perform a strict check:

OverwriteTargetFalse will also prevent reusing the same database name in a different location:

Create a file:

By default, existing files are not overwritten:

Use OverwriteTargetTrue to overwrite the existing file:

WorkingPrecision  (3)

Specify a custom working precision for the distance computation:

By default, the precision is inferred from the input data:

Specify a precision for an empty database:

Newly added vectors are clipped and/or rounded to fit into the given precision:

An empty database is created without an explicit working precision:

The value is resolved when data is added to the database:

Properties & Relations  (1)

A list of scalars is interpreted as a list of one-dimensional vectors:

Use an outer list to indicate that the input is a single vector:

Possible Issues  (4)

Only one-dimensional arrays can be stored in the database:

All arrays in the database should have the same size:

The database name is unique:

A new database with the same name specification will be created with an incrementing suffix:

Use DeleteObject to remove an incorrectly generated VectorDatabaseObject:

Now the name is available again:

Alternatively, use the option OverwriteTargetTrue to overwrite the old database:

OverwriteTarget -> False will issue an error rather than adding an incrementing number:

Create a database at a specific location:

A database with the same name in a new location will be created with an incrementing suffix:

Delete the original database to free the name:

Now the name is available again:

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

Text

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

CMS

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

APA

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

BibTeX

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

BibLaTeX

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