> ## Documentation Index
> Fetch the complete documentation index at: https://strattumai.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Semantic search over indexed knowledge documents

> Embed the query using the configured LLM embedding model and perform
semantic search against the Qdrant collection.

Returns chunks ranked by cosine similarity score (highest first).
Optional ``filters`` narrow results by source or document tags.



## OpenAPI

````yaml /api-reference/knowledge-api.json post /v1/knowledge/search
openapi: 3.1.0
info:
  title: Strattum Knowledge API
  description: >-
    REST API that serves semantic document search — embeddings via the
    configured LLM provider, indexed in Qdrant, with metadata stored in
    PostgreSQL. (PRD-004, Workstream 1.4)
  version: 1.0.0
servers: []
security: []
paths:
  /v1/knowledge/search:
    post:
      tags:
        - knowledge
      summary: Semantic search over indexed knowledge documents
      description: |-
        Embed the query using the configured LLM embedding model and perform
        semantic search against the Qdrant collection.

        Returns chunks ranked by cosine similarity score (highest first).
        Optional ``filters`` narrow results by source or document tags.
      operationId: search_knowledge_v1_knowledge_search_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SearchRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SearchResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '503':
          description: Qdrant is unavailable
components:
  schemas:
    SearchRequest:
      properties:
        query:
          type: string
          minLength: 1
          title: Query
          description: Free-text question or query to embed and search semantically.
          examples:
            - Qual a politica de SLA para clientes Enterprise?
        top_k:
          type: integer
          maximum: 50
          minimum: 1
          title: Top K
          description: Maximum number of chunks to return.
          default: 5
        filters:
          anyOf:
            - $ref: '#/components/schemas/SearchFilters'
            - type: 'null'
          description: Optional filters applied to the Qdrant search.
        search_mode:
          type: string
          enum:
            - hybrid
            - dense
          title: Search Mode
          description: >-
            Search mode: 'hybrid' uses RRF fusion (dense + sparse BM25) for
            improved recall — requires collection with named vectors (text-dense
            + text-sparse). 'dense' uses only the embedding vector (cosine
            similarity). Falls back to 'dense' automatically for collections
            with old schema.
          default: hybrid
      type: object
      required:
        - query
      title: SearchRequest
      description: Request body for POST /v1/knowledge/search.
    SearchResponse:
      properties:
        results:
          items:
            $ref: '#/components/schemas/SearchResult'
          type: array
          title: Results
        query_embedding_model:
          type: string
          title: Query Embedding Model
        total_results:
          type: integer
          title: Total Results
      type: object
      required:
        - results
        - query_embedding_model
        - total_results
      title: SearchResponse
      description: Response for POST /v1/knowledge/search.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    SearchFilters:
      properties:
        source:
          anyOf:
            - type: string
            - type: 'null'
          title: Source
          description: Filter by document source ('gdrive', 'sharepoint').
        tags:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Tags
          description: Return only chunks from documents that have ALL these tags.
      type: object
      title: SearchFilters
      description: Optional filters for semantic search.
    SearchResult:
      properties:
        chunk_id:
          type: string
          title: Chunk Id
        content:
          type: string
          title: Content
        score:
          type: number
          title: Score
          description: Cosine similarity score (0-1).
        document:
          $ref: '#/components/schemas/ChunkDocumentRef'
        metadata:
          $ref: '#/components/schemas/ChunkMetadata'
      type: object
      required:
        - chunk_id
        - content
        - score
        - document
        - metadata
      title: SearchResult
      description: A single ranked search result.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    ChunkDocumentRef:
      properties:
        doc_id:
          type: string
          title: Doc Id
        title:
          type: string
          title: Title
        source:
          type: string
          title: Source
      type: object
      required:
        - doc_id
        - title
        - source
      title: ChunkDocumentRef
      description: Document reference embedded in a search result chunk.
    ChunkMetadata:
      properties:
        position:
          anyOf:
            - type: integer
            - type: 'null'
          title: Position
        indexed_at:
          anyOf:
            - type: string
            - type: 'null'
          title: Indexed At
      type: object
      title: ChunkMetadata
      description: Positional and indexing metadata for a chunk.

````