Label Studio subpackage_projects.subpackage_projects/metrics.subpackage_projects/metrics/custom API

The subpackage_projects.subpackage_projects/metrics.subpackage_projects/metrics/custom API from Label Studio — 6 operation(s) for subpackage_projects.subpackage_projects/metrics.subpackage_projects/metrics/custom.

OpenAPI Specification

label-studio-subpackage-projects-subpackage-projects-metrics-subpackage-projects-metrics-custom-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: API Reference subpackage_actions subpackage_projects.subpackage_projects/metrics.subpackage_projects/metrics/custom API
  version: 1.0.0
servers:
- url: http://localhost:8000
tags:
- name: subpackage_projects.subpackage_projects/metrics.subpackage_projects/metrics/custom
paths:
  /api/projects/{id}/aws-custom-function:
    get:
      operationId: get-lambda
      summary: ✨ Get AWS custom metric code
      description: "<Card href=\"https://humansignal.com/goenterprise\">\n        <img style=\"pointer-events: none; margin-left: 0px; margin-right: 0px;\" src=\"https://docs.humansignal.com/images/badge.svg\" alt=\"Label Studio Enterprise badge\"/>\n        <p style=\"margin-top: 10px; font-size: 14px;\">\n            This endpoint is not available in Label Studio Community Edition. [Learn more about Label Studio Enterprise](https://humansignal.com/goenterprise)\n        </p>\n    </Card>\nGet the AWS Lambda code for the custom metric configured for this project."
      tags:
      - subpackage_projects.subpackage_projects/metrics.subpackage_projects/metrics/custom
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: integer
      - name: Authorization
        in: header
        description: 'The token (or API key) must be passed as a request header. You can find your user token on the User Account page in Label Studio. Example: <br><pre><code class="language-bash">curl https://label-studio-host/api/projects -H "Authorization: Token [your-token]"</code></pre>'
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Lambda code and deployment status
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/projects_metrics_custom_get_lambda_Response_200'
    post:
      operationId: update-lambda
      summary: ✨ Update AWS custom metric Lambda
      description: "<Card href=\"https://humansignal.com/goenterprise\">\n        <img style=\"pointer-events: none; margin-left: 0px; margin-right: 0px;\" src=\"https://docs.humansignal.com/images/badge.svg\" alt=\"Label Studio Enterprise badge\"/>\n        <p style=\"margin-top: 10px; font-size: 14px;\">\n            This endpoint is not available in Label Studio Community Edition. [Learn more about Label Studio Enterprise](https://humansignal.com/goenterprise)\n        </p>\n    </Card>\nCreate or update the AWS Lambda function used for custom metrics in this project."
      tags:
      - subpackage_projects.subpackage_projects/metrics.subpackage_projects/metrics/custom
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: integer
      - name: Authorization
        in: header
        description: 'The token (or API key) must be passed as a request header. You can find your user token on the User Account page in Label Studio. Example: <br><pre><code class="language-bash">curl https://label-studio-host/api/projects -H "Authorization: Token [your-token]"</code></pre>'
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/projects_metrics_custom_update_lambda_Response_200'
        '500':
          description: Error updating function
          content:
            application/json:
              schema:
                description: Any type
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AWSCustomFunctionUpdateRequest'
  /api/projects/{id}/aws-custom-function-logs:
    get:
      operationId: logs
      summary: ✨ Get AWS lambda logs for project
      description: "<Card href=\"https://humansignal.com/goenterprise\">\n        <img style=\"pointer-events: none; margin-left: 0px; margin-right: 0px;\" src=\"https://docs.humansignal.com/images/badge.svg\" alt=\"Label Studio Enterprise badge\"/>\n        <p style=\"margin-top: 10px; font-size: 14px;\">\n            This endpoint is not available in Label Studio Community Edition. [Learn more about Label Studio Enterprise](https://humansignal.com/goenterprise)\n        </p>\n    </Card>\nGet AWS lambda logs for project, including filtering by start and end dates"
      tags:
      - subpackage_projects.subpackage_projects/metrics.subpackage_projects/metrics/custom
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: integer
      - name: end_date
        in: query
        description: End date for AWS logs filtering in format %Y-%m-%d
        required: false
        schema:
          type: string
      - name: limit
        in: query
        description: Limit the number of logs to return
        required: false
        schema:
          type: integer
          default: 100
      - name: start_date
        in: query
        description: Start date for AWS logs filtering in format %Y-%m-%d
        required: false
        schema:
          type: string
      - name: Authorization
        in: header
        description: 'The token (or API key) must be passed as a request header. You can find your user token on the User Account page in Label Studio. Example: <br><pre><code class="language-bash">curl https://label-studio-host/api/projects -H "Authorization: Token [your-token]"</code></pre>'
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Successful response returns list of AWS lambda logs
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/projects_metrics_custom_logs_Response_200'
  /api/projects/{id}/check-function:
    post:
      operationId: check-function
      summary: ✨ Check custom matching function code
      description: "<Card href=\"https://humansignal.com/goenterprise\">\n        <img style=\"pointer-events: none; margin-left: 0px; margin-right: 0px;\" src=\"https://docs.humansignal.com/images/badge.svg\" alt=\"Label Studio Enterprise badge\"/>\n        <p style=\"margin-top: 10px; font-size: 14px;\">\n            This endpoint is not available in Label Studio Community Edition. [Learn more about Label Studio Enterprise](https://humansignal.com/goenterprise)\n        </p>\n    </Card>\nValidate custom matching function code for the project."
      tags:
      - subpackage_projects.subpackage_projects/metrics.subpackage_projects/metrics/custom
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: integer
      - name: Authorization
        in: header
        description: 'The token (or API key) must be passed as a request header. You can find your user token on the User Account page in Label Studio. Example: <br><pre><code class="language-bash">curl https://label-studio-host/api/projects -H "Authorization: Token [your-token]"</code></pre>'
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Code is valid
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/projects_metrics_custom_check_function_Response_200'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CheckMatchingFunctionRequestRequest'
  /api/projects/{id}/custom-function:
    get:
      operationId: get-function
      summary: ✨ Get custom metric code
      description: "<Card href=\"https://humansignal.com/goenterprise\">\n        <img style=\"pointer-events: none; margin-left: 0px; margin-right: 0px;\" src=\"https://docs.humansignal.com/images/badge.svg\" alt=\"Label Studio Enterprise badge\"/>\n        <p style=\"margin-top: 10px; font-size: 14px;\">\n            This endpoint is not available in Label Studio Community Edition. [Learn more about Label Studio Enterprise](https://humansignal.com/goenterprise)\n        </p>\n    </Card>\nGet the custom metric function code for this project. The server routes to the active cloud provider (AWS Lambda or GCP Cloud Functions) based on the CUSTOM_METRIC_PROVIDER setting."
      tags:
      - subpackage_projects.subpackage_projects/metrics.subpackage_projects/metrics/custom
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: integer
      - name: Authorization
        in: header
        description: 'The token (or API key) must be passed as a request header. You can find your user token on the User Account page in Label Studio. Example: <br><pre><code class="language-bash">curl https://label-studio-host/api/projects -H "Authorization: Token [your-token]"</code></pre>'
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Function code and deployment status
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/projects_metrics_custom_get_function_Response_200'
    post:
      operationId: deploy-function
      summary: ✨ Deploy custom metric function
      description: "<Card href=\"https://humansignal.com/goenterprise\">\n        <img style=\"pointer-events: none; margin-left: 0px; margin-right: 0px;\" src=\"https://docs.humansignal.com/images/badge.svg\" alt=\"Label Studio Enterprise badge\"/>\n        <p style=\"margin-top: 10px; font-size: 14px;\">\n            This endpoint is not available in Label Studio Community Edition. [Learn more about Label Studio Enterprise](https://humansignal.com/goenterprise)\n        </p>\n    </Card>\nCreate or update the custom metric function for this project. The server routes to the active cloud provider (AWS Lambda or GCP Cloud Functions) based on the CUSTOM_METRIC_PROVIDER setting."
      tags:
      - subpackage_projects.subpackage_projects/metrics.subpackage_projects/metrics/custom
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: integer
      - name: Authorization
        in: header
        description: 'The token (or API key) must be passed as a request header. You can find your user token on the User Account page in Label Studio. Example: <br><pre><code class="language-bash">curl https://label-studio-host/api/projects -H "Authorization: Token [your-token]"</code></pre>'
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/projects_metrics_custom_deploy_function_Response_200'
        '500':
          description: Error updating function
          content:
            application/json:
              schema:
                description: Any type
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CustomFunctionCodeRequestRequest'
  /api/projects/{id}/custom-function-logs:
    get:
      operationId: get-function-logs
      summary: ✨ Get custom metric function logs
      description: "<Card href=\"https://humansignal.com/goenterprise\">\n        <img style=\"pointer-events: none; margin-left: 0px; margin-right: 0px;\" src=\"https://docs.humansignal.com/images/badge.svg\" alt=\"Label Studio Enterprise badge\"/>\n        <p style=\"margin-top: 10px; font-size: 14px;\">\n            This endpoint is not available in Label Studio Community Edition. [Learn more about Label Studio Enterprise](https://humansignal.com/goenterprise)\n        </p>\n    </Card>\nGet execution logs for the custom metric function. The server routes to the active cloud provider based on the CUSTOM_METRIC_PROVIDER setting."
      tags:
      - subpackage_projects.subpackage_projects/metrics.subpackage_projects/metrics/custom
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: integer
      - name: end_date
        in: query
        description: End date for log filtering in format %Y-%m-%d
        required: false
        schema:
          type: string
      - name: limit
        in: query
        description: Limit the number of logs to return
        required: false
        schema:
          type: integer
          default: 100
      - name: start_date
        in: query
        description: Start date for log filtering in format %Y-%m-%d
        required: false
        schema:
          type: string
      - name: Authorization
        in: header
        description: 'The token (or API key) must be passed as a request header. You can find your user token on the User Account page in Label Studio. Example: <br><pre><code class="language-bash">curl https://label-studio-host/api/projects -H "Authorization: Token [your-token]"</code></pre>'
        required: true
        schema:
          type: string
      responses:
        '200':
          description: List of function execution logs
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/projects_metrics_custom_get_function_logs_Response_200'
  /api/projects/{id}/gcp-custom-function:
    get:
      operationId: get-gcp-function
      summary: ✨ Get GCP custom metric code
      description: "<Card href=\"https://humansignal.com/goenterprise\">\n        <img style=\"pointer-events: none; margin-left: 0px; margin-right: 0px;\" src=\"https://docs.humansignal.com/images/badge.svg\" alt=\"Label Studio Enterprise badge\"/>\n        <p style=\"margin-top: 10px; font-size: 14px;\">\n            This endpoint is not available in Label Studio Community Edition. [Learn more about Label Studio Enterprise](https://humansignal.com/goenterprise)\n        </p>\n    </Card>\nGet the GCP Cloud Function code for the custom metric configured for this project."
      tags:
      - subpackage_projects.subpackage_projects/metrics.subpackage_projects/metrics/custom
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: integer
      - name: Authorization
        in: header
        description: 'The token (or API key) must be passed as a request header. You can find your user token on the User Account page in Label Studio. Example: <br><pre><code class="language-bash">curl https://label-studio-host/api/projects -H "Authorization: Token [your-token]"</code></pre>'
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Cloud Function code and deployment status
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/projects_metrics_custom_get_gcp_function_Response_200'
    post:
      operationId: update-gcp-function
      summary: ✨ Update GCP custom metric Cloud Function
      description: "<Card href=\"https://humansignal.com/goenterprise\">\n        <img style=\"pointer-events: none; margin-left: 0px; margin-right: 0px;\" src=\"https://docs.humansignal.com/images/badge.svg\" alt=\"Label Studio Enterprise badge\"/>\n        <p style=\"margin-top: 10px; font-size: 14px;\">\n            This endpoint is not available in Label Studio Community Edition. [Learn more about Label Studio Enterprise](https://humansignal.com/goenterprise)\n        </p>\n    </Card>\nCreate or update the GCP Cloud Function used for custom metrics in this project."
      tags:
      - subpackage_projects.subpackage_projects/metrics.subpackage_projects/metrics/custom
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: integer
      - name: Authorization
        in: header
        description: 'The token (or API key) must be passed as a request header. You can find your user token on the User Account page in Label Studio. Example: <br><pre><code class="language-bash">curl https://label-studio-host/api/projects -H "Authorization: Token [your-token]"</code></pre>'
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/projects_metrics_custom_update_gcp_function_Response_200'
        '500':
          description: Error updating function
          content:
            application/json:
              schema:
                description: Any type
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GCPCustomFunctionUpdateRequest'
components:
  schemas:
    ApiProjectsIdCustomFunctionGetResponsesContentApplicationJsonSchemaStatus:
      type: string
      enum:
      - NotDeployed
      - Active
      - Pending
      - Failed
      - NotFound
      - Error
      title: ApiProjectsIdCustomFunctionGetResponsesContentApplicationJsonSchemaStatus
    GCPCustomFunctionUpdateRequest:
      type: object
      properties:
        code:
          type: string
          description: The Python code for the custom metric function.
        project:
          type:
          - string
          - 'null'
          description: The GCP project ID. Uses default if not provided.
        region:
          type:
          - string
          - 'null'
          description: The GCP region for the Cloud Function. Uses default if not provided.
      required:
      - code
      description: Serializer for updating GCP Cloud Function custom metric.
      title: GCPCustomFunctionUpdateRequest
    projects_metrics_custom_deploy_function_Response_200:
      type: object
      properties: {}
      description: Empty response body
      title: projects_metrics_custom_deploy_function_Response_200
    AWSCustomFunctionUpdateRequest:
      type: object
      properties:
        code:
          type: string
          description: The Python code for the custom metric function.
        region:
          type:
          - string
          - 'null'
          description: The AWS region for the Lambda function. Uses default if not provided.
        role:
          type:
          - string
          - 'null'
          description: The AWS IAM role ARN for the Lambda function. Uses default if not provided.
      required:
      - code
      description: Serializer for updating AWS Lambda custom metric function.
      title: AWSCustomFunctionUpdateRequest
    projects_metrics_custom_update_gcp_function_Response_200:
      type: object
      properties: {}
      description: Empty response body
      title: projects_metrics_custom_update_gcp_function_Response_200
    projects_metrics_custom_get_function_logs_Response_200:
      type: object
      properties: {}
      title: projects_metrics_custom_get_function_logs_Response_200
    projects_metrics_custom_logs_Response_200:
      type: object
      properties: {}
      description: List of AWS lambda logs
      title: projects_metrics_custom_logs_Response_200
    ApiProjectsIdAwsCustomFunctionGetResponsesContentApplicationJsonSchemaStatus:
      type: string
      enum:
      - NotDeployed
      - Active
      - Pending
      - Inactive
      - Failed
      - NotFound
      - Error
      description: Deployment status of the Lambda function.
      title: ApiProjectsIdAwsCustomFunctionGetResponsesContentApplicationJsonSchemaStatus
    projects_metrics_custom_check_function_Response_200:
      type: object
      properties: {}
      description: Empty response body
      title: projects_metrics_custom_check_function_Response_200
    CustomFunctionCodeRequestRequest:
      type: object
      properties:
        code:
          type: string
      required:
      - code
      title: CustomFunctionCodeRequestRequest
    projects_metrics_custom_get_function_Response_200:
      type: object
      properties:
        code:
          type: string
        status:
          $ref: '#/components/schemas/ApiProjectsIdCustomFunctionGetResponsesContentApplicationJsonSchemaStatus'
      required:
      - code
      - status
      title: projects_metrics_custom_get_function_Response_200
    CheckMatchingFunctionRequestRequest:
      type: object
      properties:
        code:
          type: string
      required:
      - code
      title: CheckMatchingFunctionRequestRequest
    ApiProjectsIdGcpCustomFunctionGetResponsesContentApplicationJsonSchemaStatus:
      type: string
      enum:
      - NotDeployed
      - Active
      - Pending
      - Failed
      - NotFound
      - Error
      title: ApiProjectsIdGcpCustomFunctionGetResponsesContentApplicationJsonSchemaStatus
    projects_metrics_custom_update_lambda_Response_200:
      type: object
      properties: {}
      description: Empty response body
      title: projects_metrics_custom_update_lambda_Response_200
    projects_metrics_custom_get_lambda_Response_200:
      type: object
      properties:
        code:
          type: string
        status:
          $ref: '#/components/schemas/ApiProjectsIdAwsCustomFunctionGetResponsesContentApplicationJsonSchemaStatus'
          description: Deployment status of the Lambda function.
      required:
      - code
      - status
      title: projects_metrics_custom_get_lambda_Response_200
    projects_metrics_custom_get_gcp_function_Response_200:
      type: object
      properties:
        code:
          type: string
        status:
          $ref: '#/components/schemas/ApiProjectsIdGcpCustomFunctionGetResponsesContentApplicationJsonSchemaStatus'
      required:
      - code
      - status
      title: projects_metrics_custom_get_gcp_function_Response_200
  securitySchemes:
    Token:
      type: apiKey
      in: header
      name: Authorization
      description: 'The token (or API key) must be passed as a request header. You can find your user token on the User Account page in Label Studio. Example: <br><pre><code class="language-bash">curl https://label-studio-host/api/projects -H "Authorization: Token [your-token]"</code></pre>'