openapi: 3.0.0
servers:
  - url: http://seldon.local
  - url: https://{host}:{port}
    variables:
      host:
        default: localhost
        description: host running seldon core
      port:
        default: "80"
  - description: fixed host as swagger UI has bug with variables for auth
    url: https://localhost:8002
info:
  contact:
    name: Seldon Core
    url: https://github.com/SeldonIO/seldon-core
  title: Seldon External API
  version: "0.1"
  x-apisguru-categories:
    - machine_learning
  x-origin:
    - format: openapi
      url: https://raw.githubusercontent.com/SeldonIO/seldon-core/master/openapi/engine.oas3.json
      version: "3.0"
  x-providerName: seldon.local
  x-serviceName: engine
externalDocs:
  description: Seldon Core Documentation
  url: https://github.com/SeldonIO/seldon-core
paths:
  "/seldon/{namespace}/{deployment}/api/v1.0/feedback":
    post:
      operationId: SendFeedback
      parameters:
        - in: path
          name: namespace
          required: true
          schema:
            maxLength: 2097152
            pattern: ^.{1,2097152}
            type: string
        - in: path
          name: deployment
          required: true
          schema:
            maxLength: 2097152
            pattern: ^.{1,2097152}
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/Feedback"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SeldonMessage"
          description: A successful response.
      security:
        - HTTPBearer: []
      tags:
        - External Ambassador API
  "/seldon/{namespace}/{deployment}/api/v1.0/predictions":
    post:
      operationId: Predict
      parameters:
        - in: path
          name: namespace
          required: true
          schema:
            maxLength: 2097152
            pattern: ^.{1,2097152}
            type: string
        - in: path
          name: deployment
          required: true
          schema:
            maxLength: 2097152
            pattern: ^.{1,2097152}
            type: string
      requestBody:
        content:
          application/json:
            example:
              data:
                names:
                  - feature1
                tensor:
                  shape:
                    - 1
                    - 1
                  values:
                    - 1
            schema:
              $ref: "#/components/schemas/SeldonMessage"
          application/octet-stream:
            schema:
              format: binary
              maxLength: 2097152
              pattern: ^.{1,2097152}
              type: string
          text/*:
            schema:
              maxLength: 2097152
              pattern: ^.{1,2097152}
              type: string
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SeldonMessage"
          description: A successful response.
      security:
        - HTTPBearer: []
      tags:
        - External Ambassador API
components:
  schemas:
    AnyValue:
      description: "Can be anything: string, number, array, object, etc."
    DefaultData:
      additionalProperties: false
      properties:
        names:
          items:
            maxLength: 2097152
            pattern: ^.{1,2097152}
            type: string
          maxItems: 2097152
          type: array
        ndarray:
          items:
            $ref: "#/components/schemas/AnyValue"
          maxItems: 2097152
          type: array
        tensor:
          $ref: "#/components/schemas/Tensor"
        tftensor:
          $ref: "#/components/schemas/TensorflowTensorProto"
      type: object
    Feedback:
      additionalProperties: false
      properties:
        request:
          $ref: "#/components/schemas/SeldonMessage"
        response:
          $ref: "#/components/schemas/SeldonMessage"
        reward:
          format: float
          type: number
        truth:
          $ref: "#/components/schemas/SeldonMessage"
      type: object
    Meta:
      additionalProperties: false
      properties:
        metrics:
          items:
            $ref: "#/components/schemas/Metric"
          maxItems: 2097152
          type: array
        puid:
          maxLength: 2097152
          pattern: ^.{1,2097152}
          type: string
        requestPath:
          additionalProperties:
            maxLength: 2097152
            pattern: ^.{1,2097152}
            type: string
          example:
            classifier: seldonio/mock_classifier:1.0
          type: object
        routing:
          additionalProperties:
            format: int32
            type: integer
          example:
            router1: 1
          type: object
        tags:
          additionalProperties:
            $ref: "#/components/schemas/AnyValue"
          example:
            mytag: myvalue
          type: object
      type: object
    Metric:
      additionalProperties: false
      properties:
        key:
          maxLength: 2097152
          pattern: ^.{1,2097152}
          type: string
        type:
          $ref: "#/components/schemas/MetricType"
        value:
          format: float
          type: number
      type: object
    MetricType:
      default: COUNTER
      enum:
        - COUNTER
        - GAUGE
        - TIMER
      maxLength: 2097152
      pattern: ^.{1,2097152}
      type: string
    SeldonMessage:
      additionalProperties: false
      properties:
        binData:
          format: byte
          maxLength: 2097152
          pattern: ^.{1,2097152}
          type: string
        data:
          $ref: "#/components/schemas/DefaultData"
        meta:
          $ref: "#/components/schemas/Meta"
        status:
          $ref: "#/components/schemas/Status"
        strData:
          maxLength: 2097152
          pattern: ^.{1,2097152}
          type: string
      type: object
    SeldonMessageList:
      additionalProperties: false
      properties:
        seldonMessages:
          items:
            $ref: "#/components/schemas/SeldonMessage"
          maxItems: 2097152
          type: array
      type: object
    Status:
      additionalProperties: false
      properties:
        code:
          format: int32
          type: integer
        info:
          maxLength: 2097152
          pattern: ^.{1,2097152}
          type: string
        reason:
          maxLength: 2097152
          pattern: ^.{1,2097152}
          type: string
        status:
          $ref: "#/components/schemas/StatusStatusFlag"
      type: object
    StatusStatusFlag:
      default: SUCCESS
      enum:
        - SUCCESS
        - FAILURE
      maxLength: 2097152
      pattern: ^.{1,2097152}
      type: string
    Tensor:
      additionalProperties: false
      properties:
        shape:
          items:
            format: int32
            type: integer
          maxItems: 2097152
          type: array
        values:
          items:
            format: double
            type: number
          maxItems: 2097152
          type: array
      type: object
    TensorShapeProtoDim:
      additionalProperties: false
      description: One dimension of the tensor.
      properties:
        name:
          description: Optional name of the tensor dimension.
          maxLength: 2097152
          pattern: ^.{1,2097152}
          type: string
        size:
          description: Size of the tensor in that dimension. This value must be >= -1, but values of -1 are reserved for "unknown" shapes (values of -1 mean "unknown" dimension).  Certain wrappers that work with TensorShapeProto may fail at runtime when deserializing a TensorShapeProto containing a dim value of -1.
          format: int64
          maxLength: 2097152
          pattern: ^.{1,2097152}
          type: string
      type: object
    TensorflowDataType:
      default: DT_INVALID
      description: "- DT_INVALID: Not a legal value for DataType.  Used to indicate a DataType field has not been set. - DT_FLOAT: Data types that all computation devices are expected to be capable to support. - DT_FLOAT_REF: Do not use!  These are only for parameters.  Every enum above should have a corresponding value below (verified by types_test)."
      enum:
        - DT_INVALID
        - DT_FLOAT
        - DT_DOUBLE
        - DT_INT32
        - DT_UINT8
        - DT_INT16
        - DT_INT8
        - DT_STRING
        - DT_COMPLEX64
        - DT_INT64
        - DT_BOOL
        - DT_QINT8
        - DT_QUINT8
        - DT_QINT32
        - DT_BFLOAT16
        - DT_QINT16
        - DT_QUINT16
        - DT_UINT16
        - DT_COMPLEX128
        - DT_HALF
        - DT_RESOURCE
        - DT_VARIANT
        - DT_UINT32
        - DT_UINT64
        - DT_FLOAT_REF
        - DT_DOUBLE_REF
        - DT_INT32_REF
        - DT_UINT8_REF
        - DT_INT16_REF
        - DT_INT8_REF
        - DT_STRING_REF
        - DT_COMPLEX64_REF
        - DT_INT64_REF
        - DT_BOOL_REF
        - DT_QINT8_REF
        - DT_QUINT8_REF
        - DT_QINT32_REF
        - DT_BFLOAT16_REF
        - DT_QINT16_REF
        - DT_QUINT16_REF
        - DT_UINT16_REF
        - DT_COMPLEX128_REF
        - DT_HALF_REF
        - DT_RESOURCE_REF
        - DT_VARIANT_REF
        - DT_UINT32_REF
        - DT_UINT64_REF
      maxLength: 2097152
      pattern: ^.{1,2097152}
      title: LINT.IfChange
      type: string
    TensorflowResourceHandleProto:
      additionalProperties: false
      description: Protocol buffer representing a handle to a tensorflow resource. Handles are not valid across executions, but can be serialized back and forth from within a single run.
      properties:
        container:
          description: Container in which this resource is placed.
          maxLength: 2097152
          pattern: ^.{1,2097152}
          type: string
        device:
          description: Unique name for the device containing the resource.
          maxLength: 2097152
          pattern: ^.{1,2097152}
          type: string
        hash_code:
          description: Hash code for the type of the resource. Is only valid in the same device and in the same execution.
          format: uint64
          maxLength: 2097152
          pattern: ^.{1,2097152}
          type: string
        maybe_type_name:
          description: For debug-only, the name of the type pointed to by this handle, if available.
          maxLength: 2097152
          pattern: ^.{1,2097152}
          type: string
        name:
          description: Unique name of this resource.
          maxLength: 2097152
          pattern: ^.{1,2097152}
          type: string
      type: object
    TensorflowTensorProto:
      additionalProperties: false
      description: Protocol buffer representing a tensor.
      properties:
        bool_val:
          items:
            format: boolean
            type: boolean
          maxItems: 2097152
          title: DT_BOOL
          type: array
        dcomplex_val:
          description: DT_COMPLEX128. dcomplex_val(2*i) and dcomplex_val(2*i+1) are real and imaginary parts of i-th double precision complex.
          items:
            format: double
            type: number
          maxItems: 2097152
          type: array
        double_val:
          description: DT_DOUBLE.
          items:
            format: double
            type: number
          maxItems: 2097152
          type: array
        dtype:
          $ref: "#/components/schemas/TensorflowDataType"
        float_val:
          description: DT_FLOAT.
          items:
            format: float
            type: number
          maxItems: 2097152
          type: array
        half_val:
          description: DT_HALF, DT_BFLOAT16. Note that since protobuf has no int16 type, we'll have some pointless zero padding for each value here.
          items:
            format: int32
            type: integer
          maxItems: 2097152
          type: array
        int64_val:
          items:
            format: int64
            maxLength: 2097152
            pattern: ^.{1,2097152}
            type: string
          maxItems: 2097152
          title: DT_INT64
          type: array
        int_val:
          description: DT_INT32, DT_INT16, DT_INT8, DT_UINT8.
          items:
            format: int32
            type: integer
          maxItems: 2097152
          type: array
        resource_handle_val:
          items:
            $ref: "#/components/schemas/TensorflowResourceHandleProto"
          maxItems: 2097152
          title: DT_RESOURCE
          type: array
        scomplex_val:
          description: DT_COMPLEX64. scomplex_val(2*i) and scomplex_val(2*i+1) are real and imaginary parts of i-th single precision complex.
          items:
            format: float
            type: number
          maxItems: 2097152
          type: array
        string_val:
          items:
            format: byte
            maxLength: 2097152
            pattern: ^.{1,2097152}
            type: string
          maxItems: 2097152
          title: DT_STRING
          type: array
        tensor_content:
          description: Serialized raw tensor content from either Tensor::AsProtoTensorContent or memcpy in tensorflow::grpc::EncodeTensorToByteBuffer. This representation can be used for all tensor types. The purpose of this representation is to reduce serialization overhead during RPC call by avoiding serialization of many repeated small items.
          format: byte
          pattern: ".* maxLength: 2097152"
          type: string
        tensor_shape:
          $ref: "#/components/schemas/TensorflowTensorShapeProto"
          description: "Shape of the tensor.  TODO(touts): sort out the 0-rank issues."
        uint32_val:
          items:
            format: int64
            type: integer
          maxItems: 2097152
          title: DT_UINT32
          type: array
        uint64_val:
          items:
            format: uint64
            maxLength: 2097152
            pattern: ^.{1,2097152}
            type: string
          maxItems: 2097152
          title: DT_UINT64
          type: array
        variant_val:
          items:
            $ref: "#/components/schemas/TensorflowVariantTensorDataProto"
          maxItems: 2097152
          title: DT_VARIANT
          type: array
        version_number:
          description: |-
            Version number.
            In version 0, if the "repeated xxx" representations contain only one element, that element is repeated to fill the shape.  This makes it easy to represent a constant Tensor with a single value.
          format: int32
          type: integer
      type: object
    TensorflowTensorShapeProto:
      additionalProperties: false
      description: Dimensions of a tensor.
      properties:
        dim:
          description: |-
            Dimensions of the tensor, such as {"input", 30}, {"output", 40} for a 30 x 40 2D tensor.  If an entry has size -1, this corresponds to a dimension of unknown size. The names are optional.
            The order of entries in "dim" matters: It indicates the layout of the values in the tensor in-memory representation.
            The first entry in "dim" is the outermost dimension used to layout the values, the last entry is the innermost dimension.  This matches the in-memory layout of RowMajor Eigen tensors.
            If "dim.size()" > 0, "unknown_rank" must be false.
          items:
            $ref: "#/components/schemas/TensorShapeProtoDim"
          maxItems: 2097152
          type: array
        unknown_rank:
          description: |-
            If true, the number of dimensions in the shape is unknown.
            If true, "dim.size()" must be 0.
          format: boolean
          type: boolean
      type: object
    TensorflowVariantTensorDataProto:
      additionalProperties: false
      description: Protocol buffer representing the serialization format of DT_VARIANT tensors.
      properties:
        metadata:
          description: Portions of the object that are not Tensors.
          format: byte
          maxLength: 2097152
          pattern: ^.{1,2097152}
          type: string
        tensors:
          description: Tensors contained within objects being serialized.
          items:
            $ref: "#/components/schemas/TensorflowTensorProto"
          maxItems: 2097152
          type: array
        type_name:
          description: Name of the type of objects being serialized.
          maxLength: 2097152
          pattern: ^.{1,2097152}
          type: string
      type: object
  securitySchemes:
    HTTPBearer:
      scheme: bearer
      type: http
