Skip to content

RAG retriever — vector search endpoint returning top-K chunks for a query #6

@Punkte

Description

@Punkte

What to build

A retriever service and supporting endpoint that embeds an incoming query and returns the top-K most semantically similar conversation chunks from pgvector. Used by the chat engine to inject factual context into each prompt.

Acceptance criteria

  • retrieveContext(conversationId, query, { topK, scoreThreshold }) returns ranked chunks with cosine similarity scores
  • Uses pgvector <=> cosine distance operator
  • Default: top 5 chunks, minimum score 0.3
  • GET /conversations/:id/context?q=... endpoint exposes retriever for testing
  • Returns chunks with metadata (date range, participants, score)
  • Verified: semantically relevant chunks rank higher than unrelated ones on a test query

Blocked by

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-triageMaintainer needs to evaluate this issue

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions