SemanticSearch
SemanticSearch[index,query]
finds the items similar to query inside index.
SemanticSearch[index,query->f]
filters the results using the function f.
SemanticSearch[index,query,prop]
returns the specified property prop.
Details and Options
- SemanticSearch performs a search on the semantic index using a query to find and retrieve similar text items.
- Valid index specifications are:
-
"name" a string matching a named semantic search index SemanticSearchIndex[…] a valid SemanticSearchIndex object - The input to the function f is the same annotation specified when the index was created.
- Possible values for prop include:
-
"Distance" distance between the encoded query and item "Item" item that matches "query" (default) "ItemEmbedding" encoded item "Label" item label "Query" specified query "QueryEmbedding" encoded query "Source" item source "Tags" item tags "Tags""tag" a single item tag "Tags"{"tag1",…} multiple item tags {prop1,…} a list of properties All an Association with all the properties - The following options can be given:
-
MaxItems 10 how many items are returned ProgressReporting $ProgressReporting whether to display progress information
Examples
open allclose allBasic Examples (1)
Create a SemanticSearchIndex:
Scope (3)
Create a SemanticSearchIndex with a single source:
Find index items closest to a given query:
Get a list of available result properties:
Extract a specific item property:
Retrieve all available properties:
Define an index with labeled sources:
The label is automatically returned when searching:
Return the item and the label:
Filter to only search items with a specific label:
Define an index with tagged sources:
The tags are automatically returned when searching:
Applications (3)
Retrieve the index of the Wolfram Function Repository:
Search for custom functions that can generate an graphic of the solar system:
Search for a specific example in the given function:
Run the example function from the given item:
Create an index from a set of books:
Find some examples on a topic of interest:
Use LLMSynthesize to give a summary contrasting the differences:
Create an index containing German and English text:
The embeddings of the same meanings are similar across languages. Search in English for information in the German source:
Properties & Relations (2)
When performing a search, the distance function specified in CreateSemanticSearchIndex is used:
The distance function setting can be retrieved from the VectorDatabaseObject backing the index:
Items will always share the tag of their source:
To get list of source tags, use unique tags and DeleteDuplicates:
Text
Wolfram Research (2024), SemanticSearch, Wolfram Language function, https://reference.wolfram.com/language/ref/SemanticSearch.html.
CMS
Wolfram Language. 2024. "SemanticSearch." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/SemanticSearch.html.
APA
Wolfram Language. (2024). SemanticSearch. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/SemanticSearch.html