Skip to main content
When semantic search is enabled for your project, Replyke 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

Replyke embeds the following content types automatically, with no configuration required beyond enabling the feature:
Content TypeWhat is embedded
EntitiesTitle, body, and other text fields
CommentsComment text content
Chat messagesMessage text content
UsersProfile text assembled from name, username, and bio
SpacesSpace name, description, and related metadata
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:
EventDataDescription
token{ "content": "..." }One token of the generated answer
sourcesArray of content resultsThe hydrated source records used as context
done{}Stream complete
error{ "error": "..." }Only sent if an error occurs after streaming starts
const response = await fetch("/:projectId/api/v7/search/ask", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Authorization": `Bearer ${accessToken}`,
  },
  body: JSON.stringify({
    query: "What are the community rules about self-promotion?",
    sourceTypes: ["entity", "comment"],
    spaceId: "optional-space-id",
    limit: 10,
  }),
});

const reader = response.body!.getReader();
const decoder = new TextDecoder();

for await (const chunk of readLines(reader, decoder)) {
  if (chunk.startsWith("event: token")) {
    // append token to UI
  } else if (chunk.startsWith("event: sources")) {
    // display source citations
  } else if (chunk.startsWith("event: done")) {
    // finalize
  }
}

Parameters

ParameterTypeRequiredDescription
querystringYesThe natural-language question
sourceTypesstring[]YesContent types to search: "entity", "comment", "message"
spaceIdstringNoScope retrieval to a specific space
conversationIdstringNoScope retrieval to a specific conversation
limitnumberNoMax number of source records to return

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.