type: object
description: |
    Result of a natural-language query to the knowledge base — the LLM-generated
    answer plus the source chunks that were retrieved to ground it. Returned by
    `POST /admin/kb/query`.
required: [answer, sources, metadata]
properties:
    answer:
        type: string
        description: LLM-generated answer to the user's query.
    sources:
        type: array
        description: Document chunks the answer was grounded in.
        items:
            type: object
            properties:
                title: { type: string }
                sourceType:
                    type: string
                    description: "e.g. `discord`, `github`, `document`."
                sourceUrl: { type: string }
                relevance:
                    type: number
                    description: Cosine similarity between query and chunk (0–1).
                excerpt:
                    type: string
                    description: First ~200 chars of the chunk; only present when `options.includeContext` is true.
    metadata:
        type: object
        properties:
            retrievalTimeMs: { type: integer }
            generationTimeMs: { type: integer }
            totalTimeMs: { type: integer }
example:
    answer: "The shipping pipeline is split between BigShipperApi and ShippingAdminApi. BigShipperApi handles the picking/packing state machine; ShippingAdminApi covers Shippo integration and analytics."
    sources:
        - title: "Shipping module overview"
          sourceType: "document"
          sourceUrl: "docs/services/admin-api/shipping.md"
          relevance: 0.91
        - title: "BigShipperApi handler"
          sourceType: "github"
          sourceUrl: "https://github.com/bigscreenvr/cloud/blob/master/api/src/fabricator/ShippingAdminApi.ts"
          relevance: 0.84
    metadata:
        retrievalTimeMs: 142
        generationTimeMs: 1482
        totalTimeMs: 1624
