VectorDatabaseSearch
VectorDatabaseSearch[db,vector]
gives the element of the vector database db closest to vector.
VectorDatabaseSearch[db,vector,n]
gives the n nearest vectors.
VectorDatabaseSearch[db,vector,prop,n]
returns the property prop associated with the result
Details
![](Files/VectorDatabaseSearch.en/details_1.png)
- VectorDatabaseSearch performs a search on the vector database using a query to find and retrieve similar items.
- This function is used for tasks like finding similar documents, images or products via their vector representation, enhancing capabilities in recommendation systems and content discovery.
- The database db must be a VectorDatabaseObject or a valid database name.
- The search vectors must have the same length as the vector stored in the database.
- Possible property values prop include:
-
"Distance" the distance from vector "Element" the vector found to be nearest "Index" the element position in the database "Metadata" metadata associated with the element "Metadata"tag a specific metadata value {prop1,…} a list of properties All a Dataset with all the properties
Examples
open allclose allBasic Examples (1)
Scope (3)
Initialize a new vector database with a list of vectors:
Find the first nearest vector:
Find the list of the first three nearest vectors:
Find the vectors together with their distance:
List all the properties of each result:
Create a vector database with labeled arrays:
The label is automatically returned when searching:
Filter the result to only contain vectors with a specific label:
Create a vector database with metadata associated to each vector:
Applications (1)
Image Search (1)
Text
Wolfram Research (2024), VectorDatabaseSearch, Wolfram Language function, https://reference.wolfram.com/language/ref/VectorDatabaseSearch.html.
CMS
Wolfram Language. 2024. "VectorDatabaseSearch." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/VectorDatabaseSearch.html.
APA
Wolfram Language. (2024). VectorDatabaseSearch. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/VectorDatabaseSearch.html