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

# Chat Streaming

> Answers a chat message based on information inside AODocs and returns the response in a streaming fashion.<br>
    There are three kinds of messages differentiated by the prefix:<br>
    * "header: " JSON ChatResponseMetadata containing metadata about the answer such as the used sources and links. You can find the definition on the bottom of the page.<br>
    * "data: " contains the response chunks "data: {chunk}\n\n"<br>These chunks should be concatenated to form the full response.<br>
    * "progress: " contains the steps of the thinking process of the LLM model<br>



## OpenAPI

````yaml https://document-assistant.us.aodocs.app/openapi.json post /assistant/api/v1/tenants/{tenant}/chat:streamingResponse
openapi: 3.1.0
info:
  title: Document Assistant API
  description: |
    <p>
      The Document Assistant API enables developers to integrate document-based assistant
      functionalities into their applications using AODocs.
    </p>
    <p>
      The first step is to enable AIDA (AODocs Intelligent Document Assistant) in your tenant.
      The support team will provide you with the necessary information on how to get started.
    </p>
    <p>
      The second step is to enable AIDA on libraries. You need to be an administrator of the
      library to do this.<br />
      AIDA can answer questions only from those documents that are in an AIDA enabled
      library.<br />
      We create a vector store index for these documents. This can take some time. The get
      library API provides the status of the indexation and an estimate of the time
      remaining.<br />
      The content of the index is automatically kept up-to-date near real time with the
      content changes.
    </p>
    <p>
      The third step is to ask questions based on the AODocs documents.<br />
      AIDA automatically filters the results based on the user's permissions.
    </p>
    <p>
      <strong>Authentication:</strong> All API endpoints require a valid OAuth2 token in the
      Authorization header. Ensure the client ID of the OAuth2 token is whitelisted in AODocs.
    </p>
  version: 1.1.0
servers:
  - url: https://document-assistant.us.aodocs.app
    description: Production US
  - url: https://document-assistant.eu.aodocs.app
    description: Production EU
security: []
paths:
  /assistant/api/v1/tenants/{tenant}/chat:streamingResponse:
    post:
      tags:
        - chat
      summary: Chat Streaming
      description: >-
        Answers a chat message based on information inside AODocs and returns
        the response in a streaming fashion.<br>
            There are three kinds of messages differentiated by the prefix:<br>
            * "header: " JSON ChatResponseMetadata containing metadata about the answer such as the used sources and links. You can find the definition on the bottom of the page.<br>
            * "data: " contains the response chunks "data: {chunk}\n\n"<br>These chunks should be concatenated to form the full response.<br>
            * "progress: " contains the steps of the thinking process of the LLM model<br>
      operationId: >-
        chat_streaming_assistant_api_v1_tenants__tenant__chat_streamingResponse_post
      parameters:
        - name: tenant
          in: path
          required: true
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: The domain of the customer
            examples:
              - example.com
            title: Tenant
          description: The domain of the customer
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChatRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '400':
          description: The request contains conflicting document filters
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    ChatRequest:
      properties:
        message:
          type: string
          title: Message
          description: The message to be sent to the assistant
        agent_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Agent Id
          description: The id of the agent to scope this chat request
        conversation_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Conversation Id
          description: |-
            The conversation ID of the chat message.<br>
                        If not provided a new conversation will be created.
        library_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Library Id
          description: >-
            Use library_ids field, answer the question in the context of the
            library
          deprecated: true
        library_ids:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Library Ids
          description: Answer the question in the context of these libraries
        document_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Document Id
          description: >-
            DEPRECATED: use document_ids field, answer the question in the
            context of the document
          deprecated: true
        document_ids:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Document Ids
          description: Answer the question in the context of these documents
        view_id:
          anyOf:
            - type: string
            - type: 'null'
          title: View Id
          description: Answer the question in the context of the view
        filters:
          additionalProperties: true
          type: object
          title: Filters
          description: >-
            These filters limit which documents are considered as sources during
            the answer generation.
        timezone:
          type: integer
          title: Timezone
          description: >-
            Timezone of the user. If is not provided we use UTC timezone.<br> We
            use this information to accurately interpret time-related
            queries.<br> Format: offset from UTC, in minutes
          default: 0
        read_only:
          type: boolean
          title: Read Only
          description: Disable tools that can modify documents for this request
          default: false
      type: object
      required:
        - message
      title: ChatRequest
    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
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````