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
- 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)
Create an empty VectorDatabaseObject:
Create a database with a specific name and initialize it with a list of vectors:
Scope (5)
Data Sources (3)
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:
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:
GeneratedAssetLocation (3)
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:
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:
Properties & Relations (1)
Possible Issues (4)
Only one-dimensional arrays can be stored in the database:
All arrays in the database should have the same size:
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:
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