Semantic search with SurrealDB and OpenAI
Blog post from SurrealDB
The blog post details a method for implementing semantic search using SurrealDB and OpenAI embeddings through the Rust SDK. The guide explains how to set up an embedded SurrealDB database and store OpenAI-generated embeddings as SurrealDB vectors, emphasizing the use of Rust’s async-openai crate for generating these embeddings. It includes step-by-step instructions on creating a vector table, defining fields and indexes, and storing the embeddings in the database. The post also covers performing semantic searches using different algorithms like cosine similarity and HNSW indexing, providing sample code for embedding generation and database querying. It culminates with examples of semantic search queries, demonstrating how the system identifies and returns documents closest in meaning to a given input.