SurrealDB offers comprehensive support for vector embeddings, enabling powerful semantic search and machine learning capabilities across your data. Through integrations with leading embedding providers, you can easily store, index and query high-dimensional vectors alongside your regular data.
fnmain()->anyhow::Result<()> { // Set up the model builder, specifying the model type letmodel=SentenceEmbeddingsBuilder::remote( SentenceEmbeddingsModelType::AllMiniLmL6V2 ).create_model()?;
// Define the sentences to embed letsentences=[ "this is your text", "you can encode more than one in batch" ];
// Generate the embeddings letembeddings=model.encode(&sentences)?;
// Print the results for(i,embedding)inembeddings.iter().enumerate(){ // Truncate for display purposes lettruncated_embedding: Vec<_> =embedding.iter().take(5).cloned().collect();