Skip to main content
When semantic search is enabled for your project, Sublay automatically generates vector embeddings for content as it is created or updated. Those embeddings power two capabilities:
  1. Semantic search — find content, users, and spaces by meaning, not just keywords
  2. AI ask — a retrieval-augmented endpoint that synthesizes a streamed answer from your content in response to a natural-language question
Semantic search and AI features require a paid plan. Projects on the free tier cannot use embedding-based endpoints.

What Gets Embedded

Sublay embeds the following content types automatically, with no configuration required beyond enabling the feature: Embeddings are generated asynchronously after content is created or updated.
There are three search endpoints, each scoped to a different content domain:

Search Content

Searches across entities, comments, and chat messages. You can filter by source type and optionally scope results to a specific space or conversation.
  • Parameters: query, sourceTypes (array of "entity" | "comment" | "message"), spaceId (optional), conversationId (optional), limit
  • Returns: Array of results, each with sourceType, similarity score (0–1), and the full hydrated record (entity, comment, or message object)

Search Users

Searches user profiles by semantic similarity to the query. Useful for finding users by description, interests, or bio content.
  • Parameters: query, limit
  • Returns: Array of results, each with similarity score and the full record (user object)

Search Spaces

Searches spaces by semantic similarity.
  • Parameters: query, limit
  • Returns: Array of results, each with similarity score and the full record (space object)
Results across all three endpoints include a similarity field (cosine similarity, 0–1) alongside the hydrated record, so you can display or filter by relevance score.

AI Ask

The ask endpoint takes a natural-language question, retrieves the most relevant content chunks from your project, and streams a synthesized answer using an LLM — grounded entirely in your content.

How It Works

1

Query embedding

The question is embedded into a vector using the same model used for content.
2

Retrieval

The most semantically similar content is retrieved from your project’s embeddings. Results can be scoped to a specific space or conversation.
3

Generation

The retrieved content is used as context for the LLM, which synthesizes an answer grounded in your data. If the context does not contain enough information to answer, the model says so.
4

Streaming response

The answer is streamed back via Server-Sent Events (SSE). After the answer completes, a sources event delivers the hydrated source records that were used as context.

Response Format (SSE)

The ask endpoint responds with Content-Type: text/event-stream. Events are delivered in this order:

Parameters


SDK Integration

The SDK provides hooks for all three search endpoints and the ask endpoint:
  • useSearchContent — search entities, comments, and messages
  • useSearchUsers — search user profiles
  • useSearchSpaces — search spaces
  • useAskContent — ask a question and receive a streamed answer
See SDK Reference → Search & AI and the Hooks Reference → Search for detailed usage.