Home / Companies / SurrealDB / Blog / Post Details
Content Deep Dive

Generating embeddings inside SurrealQL with a custom function

Blog post from SurrealDB

Post Details
Company
Date Published
Author
Martin Schaer
Word Count
1,087
Company Posts That Month
12
Language
English
Hacker News Points
-
Summary

SurrealDB introduces an innovative approach to semantic search by integrating embedding generation directly within its SurrealQL language, eliminating the need for separate vectorization services or multiple network hops. By defining a custom function, fn::embed, users can embed text into vectors directly within the database, which streamlines the "text in, ranked results out" workflow by keeping the embedding logic centralized in SurrealQL. This method simplifies error handling, reduces latency, and enhances efficiency, as the embedding, vector indexing, and graph traversal occur server-side, allowing for seamless semantic search operations. The text emphasizes best practices such as managing API keys securely as database parameters and optimizing performance through capabilities like HNSW indexing and cosine distance metrics. SurrealDB's approach facilitates embedding at both write and query times, enabling enriched and ranked search results without requiring external microservices or additional coding layers, thus offering a robust solution for implementing efficient and scalable semantic search on user data.

Trends Found in this Post
Trend Post Mentions Total Month Mentions Posts Companies MoM
Vector Search 29 2,091 556 118 -8%
AI Agents 1 4,874 1,103 240 -1%