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

# QnA

> Ask a question and get an AI-generated answer based on your indexed sources or memories.

    The response includes both the AI answer and the source chunks used to generate it,
    enabling full transparency and citation capabilities.

    Use `search_mode` to specify what to search:
    - "sources" (default): Search over indexed documents
    - "memories": Search over user memories

    Use `mode` to control retrieval quality:
    - "fast" (default): Single query, faster response
    - "accurate": Multi-query generation with reranking, higher quality

export const TableOfContents = ({title = 'On this page', items, minHeadingLevel = 2, maxHeadingLevel = 3, className = '', activeClassName = 'text-primary dark:text-primary-light border-primary dark:border-primary-light hover:border-primary dark:hover:border-primary-light', inactiveClassName = 'hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300'}) => {
  const [toc, setToc] = useState(items ?? []);
  const [activeId, setActiveId] = useState('');
  useEffect(() => {
    if (items && items.length) return;
    if (typeof document === 'undefined') return;
    const selectors = [];
    for (let lvl = minHeadingLevel; lvl <= maxHeadingLevel; lvl++) {
      selectors.push(`h${lvl}`);
    }
    const nodes = Array.from(document.querySelectorAll(selectors.join(','))).filter(el => el.id);
    const built = [];
    let currentTop = null;
    nodes.forEach(el => {
      const level = Number(el.tagName.slice(1));
      const node = {
        id: el.id,
        label: el.textContent.trim(),
        href: `#${el.id}`,
        children: []
      };
      if (level === minHeadingLevel) {
        built.push(node);
        currentTop = node;
      } else if (level > minHeadingLevel && currentTop) {
        currentTop.children.push(node);
      } else {
        built.push(node);
      }
    });
    setToc(built);
  }, [items, minHeadingLevel, maxHeadingLevel]);
  useEffect(() => {
    if (typeof document === 'undefined') return;
    const applyHash = () => {
      const h = window.location.hash.replace('#', '');
      if (h) setActiveId(h);
    };
    applyHash();
    const observer = new IntersectionObserver(entries => {
      entries.forEach(entry => {
        if (entry.isIntersecting) {
          setActiveId(entry.target.id);
        }
      });
    }, {
      rootMargin: '0px 0px -70% 0px',
      threshold: 0.1
    });
    const ids = toc.flatMap(i => [i, ...i.children ?? []]).map(i => i.id);
    ids.forEach(id => {
      const el = document.getElementById(id);
      if (el) observer.observe(el);
    });
    window.addEventListener('hashchange', applyHash);
    return () => {
      window.removeEventListener('hashchange', applyHash);
      observer.disconnect();
    };
  }, [toc]);
  const Item = ({node, depth = 0}) => {
    const isActive = activeId === node.id;
    return <li className="toc-item relative ml-6" data-depth={depth}>
        <a href={node.href} className={`py-1 block font-medium ${isActive ? activeClassName : inactiveClassName}`} style={depth > 0 ? {
      marginLeft: `${depth}rem`
    } : {}} onClick={() => setActiveId(node.id)}>
          {node.label}
        </a>
        {node.children && node.children.length > 0 && <>
            {node.children.map(child => <Item node={child} depth={depth + 1} key={child.href} />)}
          </>}
      </li>;
  };
  const data = toc && toc.length ? toc : items || [];
  return <div className={`text-gray-600 text-sm leading-6 w-[18rem] pb-4 -mt-10 pt-10 hidden xl:block ${className}`} id="table-of-contents-custom">
      <ul id="table-of-contents-custom-content" className="toc">
        <li className="toc-item relative">
          <div className="text-gray-700 dark:text-gray-300 font-medium flex items-center space-x-2 py-1">
            <svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" strokeWidth="2" xmlns="http://www.w3.org/2000/svg" className="h-3 w-3">
              <path d="M2.44434 12.6665H13.5554" strokeLinecap="round" strokeLinejoin="round"></path>
              <path d="M2.44434 3.3335H13.5554" strokeLinecap="round" strokeLinejoin="round"></path>
              <path d="M2.44434 8H7.33323" strokeLinecap="round" strokeLinejoin="round"></path>
            </svg>
            <span>{title}</span>
          </div>
        </li>
        {data.map(node => <Item node={node} key={node.href} />)}
      </ul>
    </div>;
};

<Note>
  ⚠️ **Deprecating**: This endpoint is being deprecated.
</Note>

<Panel>
  <TableOfContents />
</Panel>

<Tip> Hit the `Try it` button to try this API now in our playground. It's the best way to check the full request and response in one place, customize your parameters, and generate ready-to-use code snippets.</Tip>

### Examples

<Tabs>
  <Tab title="API Request">
    ```bash theme={null}
    curl --request POST \
      --url https://api.usecortex.ai/search/qna \
      --header 'Authorization: Bearer <token>' \
      --header 'Content-Type: application/json' \
      --data '{
      "question": "What is Cortex AI",
      "session_id": "chat_session_1234",
      "tenant_id": "tenant_1234",
      "sub_tenant_id": "sub_tenant_4567",
      "highlight_chunks": false,
      "stream": false,
      "search_alpha": 0.8,
      "recency_bias": 0.2,
      "ai_generation": true,
      "user_name": "John Doe",
      "user_instructions": "",
      "multi_step_reasoning": true,
      "auto_agent_routing": true
    }'
    ```
  </Tab>

  <Tab title="TypeScript">
    ```ts theme={null}
    const answer = await client.search.qna({
      question: "What is Cortex AI",
      session_id: "chat_session_1234",
      tenant_id: "tenant_1234",
      sub_tenant_id: "sub_tenant_4567",
      highlight_chunks: false,
      stream: false,
      search_alpha: 0.8,
      recency_bias: 0.2,
      ai_generation: true,
      user_name: "John Doe",
      multi_step_reasoning: true,
      auto_agent_routing: true
    });
    ```
  </Tab>

  <Tab title="Python (Sync)">
    ```python theme={null}
    # Async usage is similar, just use async_client and await
    answer = client.search.qna(
        question="What is Cortex AI",
        session_id="chat_session_1234",
        tenant_id="tenant_1234",
        sub_tenant_id="sub_tenant_4567",
        highlight_chunks=False,
        stream=False,
        search_alpha=0.8,
        recency_bias=0.2,
        ai_generation=True,
        user_name="John Doe",
        multi_step_reasoning=True,
        auto_agent_routing=True
    )
    ```
  </Tab>
</Tabs>

Ask questions and get AI-generated answers based on your tenant's knowledge base with conversational responses and citations.

<Note>
  **Default Sub-Tenant Behavior**: If you don't specify a `sub_tenant_id`, the QnA will search within the default sub-tenant created when your tenant was set up. This searches across organization-wide documents and knowledge.
</Note>

## QnA Capabilities

The QnA endpoint provides intelligent question-answering with several powerful features:

### AI-Generated Responses

* **Natural Language Processing**: Understands complex questions and context
* **Citation-Based Answers**: Every answer includes source references with exact locations
* **Conversational Context**: Maintains conversation history through session management
* **Multi-Step Reasoning**: Can break down complex questions into logical steps

### Advanced Search Integration

* **Hybrid Search**: Combines semantic and keyword search for optimal results
* **Context-Aware Retrieval**: Finds relevant information based on question context
* **Source Highlighting**: Identifies and highlights the most relevant content chunks

### Customization Options

* **User Instructions**: Provide custom instructions to guide AI behavior
* **Metadata Filtering**: Filter results by source type, title, or other metadata
* **Streaming Support**: Get real-time responses for better user experience
* **Auto-Agent Routing**: Automatically route queries to specialized agents

## Key Parameters

### Core Parameters

#### Question & Session Management

* **`question`**: The question you want answered (required)
* **`session_id`**: Unique identifier for maintaining conversation context
* **`user_name`**: Optional user identifier for personalized responses

#### Search Configuration

* **`search_alpha`**: Balance between semantic and keyword search (0.0-1.0)
* **`top_n`**: Number of relevant chunks to retrieve for context
* **`recency_bias`**: Prioritize recent content (0.0-1.0)

#### AI Generation Control

* **`ai_generation`**: Enable/disable AI response generation
* **`multi_step_reasoning`**: Enable complex reasoning for difficult questions
* **`user_instructions`**: Custom instructions to guide AI behavior
* **`auto_agent_routing`**: Automatically route to specialized agents

#### Response Formatting

* **`stream`**: Enable streaming responses for real-time output
* **`highlight_chunks`**: Include highlighted relevant chunks in response
* **`context_list`**: Provide additional context for the AI

### Advanced Features

#### Metadata Filtering

Use the `metadata` object to filter results:

```json theme={null}
{
  "metadata": {
    "source_title": "Specific Document Title",
    "source_type": "file",
    "custom_field": "value"
  }
}
```

#### Session Management

* **Persistent Context**: Maintain conversation history across multiple questions
* **Context Accumulation**: Build understanding over multiple interactions
* **User Personalization**: Adapt responses based on user preferences

#### Multi-Step Reasoning

When enabled, the AI can:

* Break down complex questions into smaller parts
* Analyze multiple sources of information
* Synthesize information from different documents
* Provide step-by-step explanations

## Use Cases

### Customer Support

* **FAQ Automation**: Answer common customer questions automatically
* **Product Information**: Provide detailed product specifications and features
* **Troubleshooting**: Guide users through problem-solving steps

### Knowledge Management

* **Document Q\&A**: Ask questions about uploaded documents and manuals
* **Research Assistance**: Find and synthesize information from multiple sources
* **Training Support**: Answer questions about company policies and procedures

### Content Discovery

* **Information Retrieval**: Find specific information within large document collections
* **Contextual Search**: Get answers that understand the broader context
* **Citation Tracking**: See exactly where information comes from

## Best Practices

### Question Formulation

* **Be Specific**: Ask clear, specific questions for better results
* **Provide Context**: Include relevant background information when needed
* **Use Natural Language**: Ask questions as you would to a human expert

### Session Management

* **Maintain Context**: Use consistent session IDs for related questions
* **Build Understanding**: Ask follow-up questions to deepen the conversation
* **Reset When Needed**: Start new sessions for unrelated topics

### Response Optimization

* **Enable Highlighting**: Use `highlight_chunks` to see source relevance
* **Adjust Search Alpha**: Experiment with different values for your content type
* **Use Metadata Filtering**: Narrow results to specific document types when needed

### Response

Returns a JSON object containing the AI-generated answer and supporting source chunks with layout information for creating bounding boxes around cited sources.

```json theme={null}
{
  "answer": "Based on the uploaded knowledge, here is the answer to your question...",
  "session_id": "session_123",
  "sources": [
    {
      "id": "source_123",
      "url": "https://example.com/document.pdf",
      "title": "Document Title",
      "timestamp": "2024-01-15T10:30:00Z",
      "context": "This is the relevant text chunk from the document...",
      "source": "document",
      "layout": {
        "page": 1,
        "coordinates": {
          "x": 100,
          "y": 200,
          "width": 200,
          "height": 50
        }
      },
      "hybrid_score": 0.85
    }
  ],
  "highlight_chunks": [
    {
      "source_id": "CortexDoc1234",
      "subject": "Document Title",
      "timestamp": "1750697263.2323804",
      "context": "Highlighted text chunk...",
      "source": "document",
      "hybrid_score": 0.85,
      "layout": {
        "page": 1,
        "coordinates": {
          "x": 100,
          "y": 200,
          "width": 200,
          "height": 50
        }
      }
    }
  ],
  "source_id_map": {
    "s0": {
      "chunk_uuid": "05631d4e-4d24-4a9c-9e7a-e61a3100cafb",
      "source_id": "CortexDoc8156c6834c304451ab569d264da5f38a1750697087"
    },
    "s1": {
      "chunk_uuid": "f7c98cae-566b-4bf1-8d66-9bb556c090b0",
      "source_id": "CortexDoc8156c6834c304451ab569d264da5f38a1750697087"
    },
    "s2": {
      "chunk_uuid": "47a30767-0a79-4960-bb16-e817833f42e8",
      "source_id": "CortexDoc1c8e2cdc1b924cd0951b940ae8f511c91750697218"
    },
    "s3": {
      "chunk_uuid": "419b52e2-65c7-43d1-a4ed-109662c0d130",
      "source_id": "CortexDoc1c8e2cdc1b924cd0951b940ae8f511c91750697218"
    },
    "s4": {
      "chunk_uuid": "7af5563f-04c0-4c3a-b633-815945f5cc2e",
      "source_id": "CortexDocc77864b3aba34e40afcced8b0257f26b1750697112"
    }
  }
}
```

### 📍 Layout Field

The layout field provides coordinates for creating bounding boxes around cited sources:

> **Note:** For PowerPoint (PPT) and Excel (XLSX) files, the `page` field will be returned as an empty string since these file formats don’t use traditional page numbering.

* `page` (number): The page number where the content appears
* `coordinates` (object): Alternative coordinate format with:
  * `x` (number): Left position
  * `y` (number): Top position
  * `width` (number): Width of the bounding box
  * `height` (number): Height of the bounding box

This layout information enables you to highlight or create visual indicators around the exact location of cited content within documents.

> **Important Note:** Cortex internally uses Cortex Metadata Agent which is an expert at performing metadata-specific search. Using the `metadata` field as a filter should only be reserved when you want to deterministically fetch results from specific documents based on their metadata.

## Error Responses

All endpoints return consistent error responses following the standard format. For detailed error information, see our [Error Responses](/api-reference/error-responses) documentation.


## OpenAPI

````yaml POST /search/qna
openapi: 3.1.0
info:
  title: Cortex SDK API
  description: REST APIs for Cortex AI retrieval engine
  version: 0.0.1
servers:
  - url: /
    description: Local
    x-fern-server-name: cortex-backend-local
  - url: https://api.usecortex.ai
    description: Production
    x-fern-server-name: cortex-prod
    x-fern-audiences:
      - public
  - url: https://preprod.usecortex.ai
    description: Staging
    x-fern-server-name: cortex-staging
security: []
paths:
  /search/qna:
    post:
      tags:
        - Search
      summary: Question & Answer with retrieval
      description: >-
        Ask a question and get an AI-generated answer based on your indexed
        sources or memories.

            The response includes both the AI answer and the source chunks used to generate it,
            enabling full transparency and citation capabilities.

            Use `search_mode` to specify what to search:
            - "sources" (default): Search over indexed documents
            - "memories": Search over user memories

            Use `mode` to control retrieval quality:
            - "fast" (default): Single query, faster response
            - "accurate": Multi-query generation with reranking, higher quality
      operationId: qna_search_search_qna_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/QnASearchRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/QnASearchResponse'
        '400':
          description: Bad Request - Invalid input parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ActualErrorResponse'
        '401':
          description: Unauthorized - Authentication required
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ActualErrorResponse'
        '403':
          description: Forbidden - Access denied
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ActualErrorResponse'
        '404':
          description: Not Found - Resource does not exist
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ActualErrorResponse'
        '422':
          description: Unprocessable Entity - Validation failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ActualErrorResponse'
        '429':
          description: Too Many Requests - Rate limit exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ActualErrorResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ActualErrorResponse'
        '503':
          description: Service Unavailable
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ActualErrorResponse'
      security:
        - HTTPBearer: []
components:
  schemas:
    QnASearchRequest:
      properties:
        tenant_id:
          type: string
          title: Tenant Id
          description: Unique identifier for the tenant/organization
          example: tenant_1234
        sub_tenant_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Sub Tenant Id
          description: >-
            Optional sub-tenant identifier used to organize data within a
            tenant. If omitted, the default sub-tenant created during tenant
            setup will be used.
          example: sub_tenant_4567
        question:
          type: string
          minLength: 1
          title: Question
          description: The question to answer based on indexed sources
          example: What is Cortex AI
        max_chunks:
          type: integer
          maximum: 50
          minimum: 1
          title: Max Chunks
          description: Maximum number of context chunks to retrieve
          default: 10
          example: 1
        mode:
          $ref: '#/components/schemas/RetrieveMode'
          description: >-
            Retrieval mode: 'fast' for single query, 'accurate' for multi-query
            with reranking
          default: fast
        alpha:
          type: number
          maximum: 1
          minimum: 0
          title: Alpha
          description: Hybrid search alpha (0.0 = sparse/keyword, 1.0 = dense/semantic)
          default: 0.8
          example: 1
        search_mode:
          $ref: '#/components/schemas/SearchMode'
          description: >-
            What to search: 'sources' for documents or 'memories' for user
            memories
          default: sources
        include_graph_context:
          type: boolean
          title: Include Graph Context
          description: Whether to include knowledge graph context for enhanced answers
          default: true
          example: true
        extra_context:
          anyOf:
            - type: string
            - type: 'null'
          title: Extra Context
          description: Additional context to guide retrieval and answer generation
        llm_provider:
          $ref: '#/components/schemas/SupportedLLMProviders'
          description: LLM provider for answer generation
          default: groq
        model:
          anyOf:
            - type: string
            - type: 'null'
          title: Model
          description: Specific model to use (defaults to provider's default model)
        temperature:
          type: number
          maximum: 2
          minimum: 0
          title: Temperature
          description: LLM temperature for answer generation (lower = more focused)
          default: 0.3
          example: 1
        max_tokens:
          type: integer
          maximum: 16000
          minimum: 100
          title: Max Tokens
          description: Maximum tokens for the generated answer
          default: 4096
          example: 1
      type: object
      required:
        - tenant_id
        - question
      title: QnASearchRequest
      description: Request model for the QnA search API.
    QnASearchResponse:
      properties:
        success:
          type: boolean
          title: Success
          default: true
          example: true
        answer:
          type: string
          title: Answer
          description: The AI-generated answer based on retrieved context
          example: <answer>
        chunks:
          items:
            $ref: '#/components/schemas/VectorStoreChunk'
          type: array
          title: Chunks
          description: Retrieved context chunks used to generate the answer
          example: []
        graph_context:
          $ref: '#/components/schemas/GraphContext'
          description: Knowledge graph context (entity paths and chunk relations)
        model_used:
          anyOf:
            - type: string
            - type: 'null'
          title: Model Used
          description: The LLM model used for answer generation
        timing:
          additionalProperties:
            type: number
          type: object
          title: Timing
          description: Timing information (retrieval_ms, answer_generation_ms, total_ms)
      type: object
      required:
        - answer
      title: QnASearchResponse
      description: Response model for the QnA search API.
    ActualErrorResponse:
      properties:
        detail:
          $ref: '#/components/schemas/ErrorResponse'
      type: object
      required:
        - detail
      title: ActualErrorResponse
    RetrieveMode:
      type: string
      enum:
        - fast
        - accurate
      title: RetrieveMode
    SearchMode:
      type: string
      enum:
        - sources
        - memories
      title: SearchMode
      description: Search mode to specify what type of content to search.
    SupportedLLMProviders:
      type: string
      enum:
        - groq
        - cerebras
        - openai
        - anthropic
        - gemini
      title: SupportedLLMProviders
    VectorStoreChunk:
      properties:
        chunk_uuid:
          type: string
          title: Chunk Uuid
          description: Unique identifier for this content chunk
          examples:
            - a1b2c3d4-e5f6-7890-1234-567890abcdef
          example: <chunk_uuid>
        source_id:
          type: string
          title: Source Id
          description: Unique identifier for the source document
          examples:
            - doc_12345
          example: CortexDoc1234
        chunk_content:
          type: string
          title: Chunk Content
          description: The actual text content of this chunk
          examples:
            - This is a chunk of text from the source document.
          example: <chunk_content>
        source_type:
          type: string
          title: Source Type
          description: Type of the source document (file, webpage, etc.)
          default: ''
          examples:
            - file
          example: <source_type>
        source_upload_time:
          type: string
          title: Source Upload Time
          description: When the source document was originally uploaded
          default: ''
          examples:
            - '2023-10-27T10:00:00Z'
          example: <source_upload_time>
        source_title:
          type: string
          title: Source Title
          description: Title or name of the source document
          default: ''
          examples:
            - Project Phoenix Overview
          example: <source_title>
        source_last_updated_time:
          type: string
          title: Source Last Updated Time
          description: When the source document was last modified
          default: ''
          examples:
            - '2023-10-27T12:30:00Z'
          example: <source_last_updated_time>
        layout:
          anyOf:
            - type: string
            - type: 'null'
          title: Layout
          description: >-
            Layout of the chunk in original document. You will generally
            receive        a stringified dict with 2 keys, `offsets` and
            `page`(optional). Offsets will have       
            `document_level_start_index` and `page_level_start_index`(optional)
          examples:
            - '{"offsets": {"document_level_start_index": 1024}, "page": 2}'
        relevancy_score:
          anyOf:
            - type: number
            - type: 'null'
          title: Relevancy Score
          description: >-
            Score indicating how relevant this chunk is to your search
            query,         with higher values indicating better matches
        document_metadata:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Document Metadata
          description: Metadata extracted from the source document
          examples:
            - author: John Doe
              category: Internal
        tenant_metadata:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Tenant Metadata
          description: Custom metadata associated with your tenant
          examples:
            - department: R&D
      type: object
      required:
        - chunk_uuid
        - source_id
        - chunk_content
      title: VectorStoreChunk
    GraphContext:
      properties:
        query_paths:
          items:
            $ref: '#/components/schemas/ScoredPathResponse'
          type: array
          title: Query Paths
          example: []
        chunk_relations:
          items:
            $ref: '#/components/schemas/ScoredPathResponse'
          type: array
          title: Chunk Relations
          example: []
        chunk_id_to_group_ids:
          additionalProperties:
            items:
              type: string
            type: array
          type: object
          title: Chunk Id To Group Ids
      type: object
      title: GraphContext
      description: >-
        Graph context containing query-based paths and chunk-based relation
        paths.
    ErrorResponse:
      properties:
        success:
          type: boolean
          title: Success
          default: false
        message:
          type: string
          minLength: 1
          title: Message
          default: Error occurred
        error_code:
          anyOf:
            - type: string
            - type: 'null'
          title: Error Code
      type: object
      title: ErrorResponse
    ScoredPathResponse:
      properties:
        triplets:
          items:
            $ref: '#/components/schemas/PathTriplet'
          type: array
          title: Triplets
          example: []
        relevancy_score:
          type: number
          title: Relevancy Score
          example: 1
        combined_context:
          anyOf:
            - type: string
            - type: 'null'
          title: Combined Context
        group_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Group Id
          description: Path group identifier (e.g., 'p_0') for chunk mapping
      type: object
      required:
        - triplets
        - relevancy_score
      title: ScoredPathResponse
    PathTriplet:
      properties:
        source:
          $ref: '#/components/schemas/Entity'
        relation:
          $ref: '#/components/schemas/RelationEvidence'
        target:
          $ref: '#/components/schemas/Entity'
      type: object
      required:
        - source
        - relation
        - target
      title: PathTriplet
    Entity:
      properties:
        name:
          type: string
          title: Name
          description: Normalized entity name
          example: <name>
        type:
          type: string
          title: Type
          description: PERSON, ORGANIZATION, PROJECT, PRODUCT, ERROR_CODE, etc.
          example: <type>
        namespace:
          type: string
          title: Namespace
          description: Context category like 'employees', 'projects'
          default: default
          example: <namespace>
        entity_id:
          type: string
          title: Entity Id
          description: Internal unique entity ID from graph database
          example: <entity_id>
        identifier:
          anyOf:
            - type: string
            - type: 'null'
          title: Identifier
          description: Unique ID like email, employee_id, URL
      type: object
      required:
        - name
        - type
        - entity_id
      title: Entity
    RelationEvidence:
      properties:
        canonical_predicate:
          type: string
          title: Canonical Predicate
          description: Relationship phrase like 'works for', 'reports to'
          example: <canonical_predicate>
        raw_predicate:
          type: string
          title: Raw Predicate
          description: Original predicate from text
          example: <raw_predicate>
        context:
          type: string
          title: Context
          description: >-
            Rich contextual description of the relationship with surrounding
            information, details about how/why/when, and any relevant
            background. Should be comprehensive enough to understand the
            relationship without referring back to source.
          example: <context>
        confidence:
          type: number
          maximum: 1
          minimum: 0
          title: Confidence
          description: Confidence score
          default: 0.8
          example: 1
        temporal_details:
          anyOf:
            - type: string
            - type: 'null'
          title: Temporal Details
          description: >-
            Temporal timing information extracted from text (e.g., 'last week',
            'in 2023', 'yesterday')
        timestamp:
          type: string
          format: date-time
          title: Timestamp
          description: Timestamp when this relation was introduced
          example: <timestamp>
        relationship_id:
          type: string
          title: Relationship Id
          description: Unique ID for this relationship from graph database
          example: <relationship_id>
        chunk_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Chunk Id
          description: ID of the chunk this relation was extracted from
        source_entity_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Source Entity Id
          description: The entity ID of source node
        target_entity_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Target Entity Id
          description: The entity ID of target node
      type: object
      required:
        - canonical_predicate
        - raw_predicate
        - context
        - relationship_id
      title: RelationEvidence
      description: Single piece of evidence for a relationship between two entities
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````