← Back to Gene Catalog

kb-rag-answer

Hybrid knowledge.qa

RAG answer: user question plus retrieved chunks (with ids) → markdown answer and citations. Host performs retrieval; keys via apiKeys only.

README

No documentation yet.

Gene authors can add a README when publishing.

Phenotype

Input

PropertyType Req
style object
chunks array
locale string = zh-CN
apiKeys object
question string

Output

PropertyType Req Description
notes string
refusal string Set when evidence insufficient
citations array
answer_markdown string
Raw JSON Schema

inputSchema

{
  "type": "object",
  "required": [
    "question",
    "chunks",
    "apiKeys"
  ],
  "properties": {
    "style": {
      "type": "object",
      "properties": {
        "tone": {
          "type": "string"
        },
        "require_citations": {
          "type": "boolean",
          "default": true
        }
      }
    },
    "chunks": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "chunk_id",
          "article_id",
          "text"
        ],
        "properties": {
          "text": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "chunk_id": {
            "type": "string"
          },
          "article_id": {
            "type": "string"
          },
          "published_at": {
            "type": "string"
          }
        }
      },
      "maxItems": 32,
      "minItems": 0
    },
    "locale": {
      "type": "string",
      "default": "zh-CN"
    },
    "apiKeys": {
      "type": "object",
      "required": [
        "llm"
      ],
      "properties": {
        "llm": {
          "type": "object",
          "required": [
            "apiKey"
          ],
          "properties": {
            "model": {
              "type": "string"
            },
            "apiKey": {
              "type": "string"
            },
            "baseUrl": {
              "type": "string"
            },
            "provider": {
              "enum": [
                "deepseek",
                "openai",
                "anthropic"
              ],
              "type": "string",
              "default": "deepseek"
            }
          }
        }
      }
    },
    "question": {
      "type": "string",
      "minLength": 1
    }
  }
}

outputSchema

{
  "type": "object",
  "required": [
    "answer_markdown",
    "citations"
  ],
  "properties": {
    "notes": {
      "type": "string"
    },
    "refusal": {
      "type": "string",
      "description": "Set when evidence insufficient"
    },
    "citations": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "quote": {
            "type": "string"
          },
          "chunk_id": {
            "type": "string"
          },
          "article_id": {
            "type": "string"
          },
          "source_index": {
            "type": "integer",
            "minimum": 1,
            "description": "Evidence line [#n], same as bracket [n] in answer"
          }
        }
      }
    },
    "answer_markdown": {
      "type": "string"
    }
  }
}