> ## 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.

# Ask Question

> When you upload a file through the file upload interface,
you can use this interface to ask questions about the content of the file you upload,
and this interface will return the retrieved answer.



## OpenAPI

````yaml https://api.gbase.ai/openapi-redoc.json post /v1/question/{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/question/{ai_id}:
    post:
      tags:
        - Question
      summary: Ask Question
      description: >-
        When you upload a file through the file upload interface,

        you can use this interface to ask questions about the content of the
        file you upload,

        and this interface will return the retrieved answer.
      operationId: ask_question_v1_question__ai_id__post
      parameters:
        - required: true
          schema:
            type: string
            title: Ai Id
          name: ai_id
          in: path
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/QuestionIn'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/QuestionOut'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - Auth0HTTPBearer: []
        - HTTPBearer: []
components:
  schemas:
    QuestionIn:
      properties:
        question:
          type: string
          title: Question
        session_id:
          type: string
          maxLength: 100
          title: Session Id
          description: |-
            Session ID
            It is recommended to use uuid
        message_id:
          type: string
          format: uuid
          title: Message Id
        anonymous_username:
          type: string
          title: Anonymous Username
          default: ''
        use_faq:
          type: boolean
          title: Use Faq
          default: true
        max_tokens:
          type: integer
          title: Max Tokens
          default: 3000
        stream:
          type: boolean
          title: Stream
          default: true
        stream_obj:
          type: boolean
          title: Stream Obj
          default: false
        format:
          allOf:
            - $ref: '#/components/schemas/StreamingMessageDataFormat'
          default: PLAIN_TEXT
        with_source:
          type: boolean
          title: With Source
          default: false
        with_images:
          type: boolean
          title: With Images
        debug_with_messages:
          type: boolean
          title: Debug With Messages
          description: >-
            Debug only, use `debug_with_messages: true, stream: false` to get
            prompt messages
          default: false
        recommend_faq_id:
          type: string
          format: uuid
          title: Recommend Faq Id
        created_by:
          type: string
          title: Created By
          default: ''
        page_info:
          type: object
          title: Page Info
        is_test:
          type: boolean
          title: Is Test
          default: false
        metadata:
          items:
            $ref: '#/components/schemas/QuestionMetadata'
          type: array
          title: Metadata
          default: []
        prompt_custom_goal:
          type: string
          maxLength: 200
          title: Prompt Custom Goal
          description: custom goal for prompt
          default: ''
        dynamic_background:
          anyOf:
            - type: string
            - items: {}
              type: array
          title: Dynamic Background
          description: >-
            JSON string or dict for dynamic background information, used to add
            to agent meta prompt
          default: ''
        language:
          type: string
          title: Language
        agent_mode:
          type: string
          title: Agent Mode
        model:
          type: string
          title: Model
        user_identifier:
          type: string
          title: User Identifier
        tool_response:
          type: boolean
          title: Tool Response
          default: false
        image_contents:
          items:
            type: object
          type: array
          title: Image Contents
          description: >-
            多模态图片内容列表，格式: [{'url': 'data:image/png;base64,...', 'detail':
            'auto'}]
      type: object
      required:
        - question
        - session_id
      title: QuestionIn
    QuestionOut:
      properties:
        answer:
          anyOf:
            - type: string
            - type: object
            - items: {}
              type: array
          title: Answer
        messages:
          items: {}
          type: array
          title: Messages
        tool_calls:
          items: {}
          type: array
          title: Tool Calls
      type: object
      title: QuestionOut
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    StreamingMessageDataFormat:
      type: string
      enum:
        - PLAIN_TEXT
        - JSON_AST
        - OPENAI_AST
      title: StreamingMessageDataFormat
      description: An enumeration.
    QuestionMetadata:
      properties:
        key:
          type: string
          title: Key
        value:
          type: string
          title: Value
        type:
          type: string
          title: Type
      type: object
      required:
        - key
      title: QuestionMetadata
    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
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````