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

# Table Rag Retrieve

> Table RAG检索接口，执行table_rag检索并返回结果。

返回的markdown字段包含三部分（有标注说明）：
- [INSTRUCTION]: 提示词，指导LLM如何使用召回的知识数据
- [KNOWLEDGE]: 召回的表格数据（SQL查询结果），是实际的RAG知识内容
- [EXTRA_INSTRUCTION]: 额外提示词，如截断提醒、格式化要求等

Args:
    ai_id: 机器人ID
    request: 包含查询参数的请求体

Returns:
    Dict[str, Any]: 包含table_rag检索结果的响应



## OpenAPI

````yaml https://api.gbase.ai/openapi-redoc.json post /v1/table_rag_retrieve/{ai_id}
openapi: 3.1.0
info:
  title: GBase
  description: >
    # Introduce

    This API document can help you understand GBase more deeply. 

    You can train your own AI directly through the interface of this document.



    ##  Authentication


    Home page: [https://gbase.ai](https://gbase.ai)


    Huggingface:
    [https://huggingface.co/gptbase](https://huggingface.co/gptbase)


    The GBase API uses API keys for authentication. Visit your API Keys page to
    retrieve the API key you'll use in your requests.


    Remember that your API key is a secret! Do not share it with others or
    expose it in any client-side code (browsers, apps). 

    Production requests must be routed through your own backend server where
    your API key can be securely loaded from an environment variable or key
    management service.


    All API requests should include your API key in an Authorization HTTP header
    as follows:


    Parameter name: Authorization


    Value: Bearer [YOUR_API_KEY](https://admin.gbase.ai/keys)


    ```

    Authorization: Bearer YOUR_API_KEY

    ```


    ## Use steps

    1.Fill in your API keys.


    2.You can create an AI by using either the API interface or the
    administrative backend. Once created, the AI will generate an ID which will
    be required for the subsequent steps.


    3.Use the generated ID to call the file upload interface.


    4.After uploading the file, you can use the question interface to inquire
    about it.
  version: 0.0.1
servers:
  - url: https://api.gbase.ai
security: []
paths:
  /v1/table_rag_retrieve/{ai_id}:
    post:
      tags:
        - Question
      summary: Table Rag Retrieve
      description: |-
        Table RAG检索接口，执行table_rag检索并返回结果。

        返回的markdown字段包含三部分（有标注说明）：
        - [INSTRUCTION]: 提示词，指导LLM如何使用召回的知识数据
        - [KNOWLEDGE]: 召回的表格数据（SQL查询结果），是实际的RAG知识内容
        - [EXTRA_INSTRUCTION]: 额外提示词，如截断提醒、格式化要求等

        Args:
            ai_id: 机器人ID
            request: 包含查询参数的请求体

        Returns:
            Dict[str, Any]: 包含table_rag检索结果的响应
      operationId: table_rag_retrieve_v1_table_rag_retrieve__ai_id__post
      parameters:
        - required: true
          schema:
            type: string
            format: uuid
            title: Ai Id
          name: ai_id
          in: path
        - required: false
          schema:
            type: string
            title: Authorization
          name: authorization
          in: header
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RAGRetrieveRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                title: Response Table Rag Retrieve V1 Table Rag Retrieve  Ai Id  Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    RAGRetrieveRequest:
      properties:
        query:
          type: string
          title: Query
        top_k:
          type: integer
          title: Top K
          default: 8
        include_citation:
          type: boolean
          title: Include Citation
          default: true
      type: object
      required:
        - query
      title: RAGRetrieveRequest
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````