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
![](Files/CreateVectorDatabase.en/details_1.png)
- 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 - 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 CosineDistance how to compute the vector distance FeatureExtractor Identity how to convert the input to a vector OverwriteTarget Automatic whether to overwrite an existing location WorkingPrecision Automatic numerical precision GeneratedAssetLocation $GeneratedAssetLocation where to save the database - 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)
Scope (5)
Create an empty vector database:
Create a database with a specific name:
Initialize a new vector database with a list of vectors:
Initialize the database with both vectors and metadata:
Specify the metadata as a separate list:
Specify the metadata 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 (3)
The database's automatic location is determined by its name:
With default OverwriteTargetAutomatic, a new database name is generated to avoid collisions:
Use OverwriteTargetFalse to perform a strict check:
![](Files/CreateVectorDatabase.en/2.gif)
OverwriteTargetFalse will also prevent reusing the same database name in a different location:
![](Files/CreateVectorDatabase.en/3.gif)
By default, existing files are not overwritten:
![](Files/CreateVectorDatabase.en/4.gif)
Use OverwriteTargetTrue to overwrite the existing file:
Create a database at a specific location:
When generating a database with the same name in a new location, the name will always be updated:
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