openapi: "3.0.0"
info:
  title: FastAPI
  version: 0.1.0
paths:
  /api/v1:
    get:
      summary: Root
      operationId: root
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties:
                  type: integer
                type: object
                title: Response Root Api V1 Get
  /api/v1/reset:
    post:
      summary: Reset
      operationId: reset
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: boolean
                title: Response Reset Api V1 Reset Post
  /api/v1/version:
    get:
      summary: Version
      operationId: version
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: string
                title: Response Version Api V1 Version Get
  /api/v1/heartbeat:
    get:
      summary: Heartbeat
      operationId: heartbeat
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties:
                  type: number
                type: object
                title: Response Heartbeat Api V1 Heartbeat Get
  /api/v1/raw_sql:
    post:
      summary: Raw Sql
      operationId: raw_sql
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RawSql'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/v1/collections:
    get:
      summary: List Collections
      operationId: list_collections
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
    post:
      summary: Create Collection
      operationId: create_collection
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateCollection'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/v1/collections/{collection_id}/add:
    post:
      summary: Add
      operationId: add
      parameters:
        - required: true
          schema:
            type: string
            title: Collection Id
          name: collection_id
          in: path
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AddEmbedding'
        required: true
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/v1/collections/{collection_id}/update:
    post:
      summary: Update
      operationId: update
      parameters:
        - required: true
          schema:
            type: string
            title: Collection Id
          name: collection_id
          in: path
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateEmbedding'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/v1/collections/{collection_id}/upsert:
    post:
      summary: Upsert
      operationId: upsert
      parameters:
        - required: true
          schema:
            type: string
            title: Collection Id
          name: collection_id
          in: path
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AddEmbedding'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/v1/collections/{collection_id}/get:
    post:
      summary: Get
      operationId: get
      parameters:
        - required: true
          schema:
            type: string
            title: Collection Id
          name: collection_id
          in: path
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GetEmbedding'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {} #TODO add actual GetResult Body
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/v1/collections/{collection_id}/delete:
    post:
      summary: Delete
      operationId: delete
      parameters:
        - required: true
          schema:
            type: string
            title: Collection Id
          name: collection_id
          in: path
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DeleteEmbedding'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/v1/collections/{collection_id}/count:
    get:
      summary: Count
      operationId: count
      parameters:
        - required: true
          schema:
            type: string
            title: Collection Id
          name: collection_id
          in: path
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: integer
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/v1/collections/{collection_id}/query:
    post:
      summary: Get Nearest Neighbors
      operationId: get_nearest_neighbors
      parameters:
        - required: true
          schema:
            type: string
            title: Collection Id
          name: collection_id
          in: path
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/QueryEmbedding'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/v1/collections/{collection_name}/create_index:
    post:
      summary: Create Index
      operationId: create_index
      parameters:
        - required: true
          schema:
            type: string
            title: Collection Name
          name: collection_name
          in: path
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: boolean
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/v1/collections/{collection_name}:
    get:
      summary: Get Collection
      operationId: get_collection
      parameters:
        - required: true
          schema:
            type: string
            title: Collection Name
          name: collection_name
          in: path
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      summary: Delete Collection
      operationId: delete_collection
      parameters:
        - required: true
          schema:
            type: string
            title: Collection Name
          name: collection_name
          in: path
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/v1/collections/{collection_id}:
    put:
      summary: Update Collection
      operationId: update_collection
      parameters:
        - required: true
          schema:
            type: string
            title: Collection Id
          name: collection_id
          in: path
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateCollection'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    AddEmbedding:
      properties:
        embeddings:
          items: {}
          type: array
          title: Embeddings
        metadatas:
          items:
            type: object
            additionalProperties: true
          type: array
          title: Metadatas
        documents:
          items:
            type: string
          type: array
          title: Documents
        ids:
          items:
            type: string
          type: array
          title: Ids
        increment_index:
          type: boolean
          title: Increment Index
          default: true
      type: object
      required:
        - ids
      title: AddEmbedding
    CreateCollection:
      properties:
        name:
          type: string
          title: Name
        metadata:
          type: object
          title: Metadata
        get_or_create:
          type: boolean
          title: Get Or Create
          default: false
      type: object
      required:
        - name
      title: CreateCollection
    DeleteEmbedding:
      properties:
        ids:
          items:
            type: string
          type: array
          title: Ids
        where:
          type: object
          title: Where
        where_document:
          type: object
          title: Where Document
      type: object
      title: DeleteEmbedding
    GetEmbedding:
      properties:
        ids:
          items:
            type: string
          type: array
          title: Ids
        where:
          type: object
          title: Where
        where_document:
          type: object
          title: Where Document
        sort:
          type: string
          title: Sort
        limit:
          type: integer
          title: Limit
        offset:
          type: integer
          title: Offset
        include:
          items:
            anyOf:
              - type: string
                enum:
                  - documents
              - type: string
                enum:
                  - embeddings
              - type: string
                enum:
                  - metadatas
              - type: string
                enum:
                  - distances
          type: array
          title: Include
          default:
            - metadatas
            - documents
      type: object
      title: GetEmbedding
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    QueryEmbedding:
      properties:
        where:
          type: object
          title: Where
          additionalProperties: true
          default: {}
        where_document:
          type: object
          title: Where Document
          additionalProperties: true
          default: {}
        query_embeddings:
          items: {}
          type: array
          additionalProperties: true
          title: Query Embeddings
        n_results:
          type: integer
          title: N Results
          default: 10
        include:
          items:
            type: string
            enum:
              - documents
              - embeddings
              - metadatas
              - distances
          type: array
          title: Include
          default:
            - metadatas
            - documents
            - distances
      type: object
      required:
        - query_embeddings
      title: QueryEmbedding
    RawSql:
      properties:
        raw_sql:
          type: string
          title: Raw Sql
      type: object
      required:
        - raw_sql
      title: RawSql
    UpdateCollection:
      properties:
        new_name:
          type: string
          title: New Name
        new_metadata:
          type: object
          title: New Metadata
      type: object
      title: UpdateCollection
    UpdateEmbedding:
      properties:
        embeddings:
          items: {}
          type: array
          title: Embeddings
        metadatas:
          items:
            type: object
          type: array
          title: Metadatas
        documents:
          items:
            type: string
          type: array
          title: Documents
        ids:
          items:
            type: string
          type: array
          title: Ids
        increment_index:
          type: boolean
          title: Increment Index
          default: true
      type: object
      required:
        - ids
      title: UpdateEmbedding
    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