CreateVectorDatabase
✖
CreateVectorDatabase
Details and Options


- CreateVectorDatabase initializes a new vector database to store and manage high-dimensional data for efficient search and retrieval.
- Typical applications of vector databases include recommendation systems, image and text retrieval, and similarity searches in large datasets.
- Possible values for data include:
-
{vec1,…} a list of vectors {vec1val1,…} a list of vectors and associated values {vec1,…}{val1,…} a rule between vectors and values - A list of scalars is interpreted as a list of one-dimensional vectors. »
- Accepted forms of vali include:
-
"string" string labels <"tag1"v1,… > an association of tags and metadata values - The database name must be a string.
- The following options can be specified:
-
DistanceFunction EuclideanDistance how to compute the vector distance FeatureExtractor Identity how to convert the input to a vector GeneratedAssetLocation $GeneratedAssetLocation where to save the database OverwriteTarget Automatic whether to overwrite an existing location WorkingPrecision Automatic numerical precision - Possible values for DistanceFunction include EuclideanDistance, SquaredEuclideanDistance, CosineDistance, JaccardDissimilarity and HammingDistance.
- Possible settings for WorkingPrecision include:
-
"Integer8" signed 8-bit integers from through 127
"Real32" single-precision real (32 bit) "Real64" double-precision real (64 bit)
Examples
open allclose allBasic Examples (2)Summary of the most common use cases
Create an empty VectorDatabaseObject:

https://wolfram.com/xid/0pnajhbwasn3fjtq-4h10mh

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

https://wolfram.com/xid/0pnajhbwasn3fjtq-57z7wu

Search the database by similarity:

https://wolfram.com/xid/0pnajhbwasn3fjtq-y98n6a

Scope (5)Survey of the scope of standard use cases
Data Sources (3)
Create an empty vector database:

https://wolfram.com/xid/0pnajhbwasn3fjtq-u7pwl1

Create a database with a specific name:

https://wolfram.com/xid/0pnajhbwasn3fjtq-js5cqr

Initialize a new vector database with a list of vectors:

https://wolfram.com/xid/0pnajhbwasn3fjtq-g2uvjh

Metadata (2)
Initialize the database with both vectors and metadata:

https://wolfram.com/xid/0pnajhbwasn3fjtq-9rm8gd

Specify the metadata as a separate list:

https://wolfram.com/xid/0pnajhbwasn3fjtq-uqpcyy

Specify the metadata with tags as an Association:

https://wolfram.com/xid/0pnajhbwasn3fjtq-zz51od

Specify data and metadata separately:

https://wolfram.com/xid/0pnajhbwasn3fjtq-gfw643

Options (10)Common values & functionality for each option
DistanceFunction (1)
Specify a custom distance function for the database:

https://wolfram.com/xid/0pnajhbwasn3fjtq-iwbp6n

By default, EuclideanDistance is used:

https://wolfram.com/xid/0pnajhbwasn3fjtq-gc2leo

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

https://wolfram.com/xid/0pnajhbwasn3fjtq-el8sik

Search for the closest image to a given one:

https://wolfram.com/xid/0pnajhbwasn3fjtq-9n2qrl

GeneratedAssetLocation (3)
Specify a custom location to store the database:

https://wolfram.com/xid/0pnajhbwasn3fjtq-l1r3rm


https://wolfram.com/xid/0pnajhbwasn3fjtq-y7pgm0

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

https://wolfram.com/xid/0pnajhbwasn3fjtq-zwx4c9

Store the vector database in a file:

https://wolfram.com/xid/0pnajhbwasn3fjtq-qki0up


https://wolfram.com/xid/0pnajhbwasn3fjtq-jdp7zb


https://wolfram.com/xid/0pnajhbwasn3fjtq-k9yd6q

Recreate the database from the file reference:

https://wolfram.com/xid/0pnajhbwasn3fjtq-nt2k9v

OverwriteTarget (2)
The database's automatic location is determined by its name:

https://wolfram.com/xid/0pnajhbwasn3fjtq-hakd8q

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

https://wolfram.com/xid/0pnajhbwasn3fjtq-1zmjtm

To force overwriting, use OverwriteTargetTrue:

https://wolfram.com/xid/0pnajhbwasn3fjtq-xq3cz9

Use OverwriteTargetFalse to perform a strict check:

https://wolfram.com/xid/0pnajhbwasn3fjtq-h0x4j0


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

https://wolfram.com/xid/0pnajhbwasn3fjtq-hr7372



https://wolfram.com/xid/0pnajhbwasn3fjtq-kwd9r5

By default, existing files are not overwritten:

https://wolfram.com/xid/0pnajhbwasn3fjtq-g9gcg5


Use OverwriteTargetTrue to overwrite the existing file:

https://wolfram.com/xid/0pnajhbwasn3fjtq-77ufhe

WorkingPrecision (3)
Specify a custom working precision for the distance computation:

https://wolfram.com/xid/0pnajhbwasn3fjtq-0lrwh7

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

https://wolfram.com/xid/0pnajhbwasn3fjtq-cw4iup

Specify a precision for an empty database:

https://wolfram.com/xid/0pnajhbwasn3fjtq-6foce
Newly added vectors are clipped and/or rounded to fit into the given precision:

https://wolfram.com/xid/0pnajhbwasn3fjtq-f4r5i0

An empty database is created without an explicit working precision:

https://wolfram.com/xid/0pnajhbwasn3fjtq-nmjf3s

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

https://wolfram.com/xid/0pnajhbwasn3fjtq-l9bcnn

Properties & Relations (1)Properties of the function, and connections to other functions
Possible Issues (4)Common pitfalls and unexpected behavior
Only one-dimensional arrays can be stored in the database:

https://wolfram.com/xid/0pnajhbwasn3fjtq-u38tg4


All arrays in the database should have the same size:

https://wolfram.com/xid/0pnajhbwasn3fjtq-u48omw



https://wolfram.com/xid/0pnajhbwasn3fjtq-cs503c

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

https://wolfram.com/xid/0pnajhbwasn3fjtq-sx9pcw

Use DeleteObject to remove an incorrectly generated VectorDatabaseObject:

https://wolfram.com/xid/0pnajhbwasn3fjtq-efa0ka
Now the name is available again:

https://wolfram.com/xid/0pnajhbwasn3fjtq-dxjj4r

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

https://wolfram.com/xid/0pnajhbwasn3fjtq-kb1hbk

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

https://wolfram.com/xid/0pnajhbwasn3fjtq-3xv24k


Create a database at a specific location:

https://wolfram.com/xid/0pnajhbwasn3fjtq-45kb60

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

https://wolfram.com/xid/0pnajhbwasn3fjtq-u1o3hf

Delete the original database to free the name:

https://wolfram.com/xid/0pnajhbwasn3fjtq-gl824r
Now the name is available again:

https://wolfram.com/xid/0pnajhbwasn3fjtq-42od0l


https://wolfram.com/xid/0pnajhbwasn3fjtq-p2bf1r


https://wolfram.com/xid/0pnajhbwasn3fjtq-d0mrc0


https://wolfram.com/xid/0pnajhbwasn3fjtq-lcdzeu

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.
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.
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
Wolfram Language. (2024). CreateVectorDatabase. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/CreateVectorDatabase.html
BibTeX
@misc{reference.wolfram_2025_createvectordatabase, author="Wolfram Research", title="{CreateVectorDatabase}", year="2024", howpublished="\url{https://reference.wolfram.com/language/ref/CreateVectorDatabase.html}", note=[Accessed: 29-March-2025
]}
BibLaTeX
@online{reference.wolfram_2025_createvectordatabase, organization={Wolfram Research}, title={CreateVectorDatabase}, year={2024}, url={https://reference.wolfram.com/language/ref/CreateVectorDatabase.html}, note=[Accessed: 29-March-2025
]}