🟢API for Algorithm Applications

This page contains description of algorithms applications management via API.

Algorithms is an AI core functionality of Haut.AI products. Algorithms enable AI image analysis. Algorithms are organized into Applications, that combine one or more algorithms.

What is algorithm application?

What can you do?


List available applications


Attach algorithms application to dataset

Example: Attaching Face Skin Metrics 2.0

For simplicity, let’s consider one of the most commonly used applications: Face Skin Metrics 2.0. This application is identified by its tech_name: face_skin_metrics_2.0. The tech_name is used in the API to specify which application you want to work with.


Applications dependencies

Some applications have dependencies on others. If you try to attach an application that requires another to be attached (but it isn’t), you will receive an error.

Example: If you try to attach the Recommendation Engine without first attaching the Face Skin Metrics 2.0 application, you'll receive an error response indicating the unmet dependency.

Example Error Response:

If you attempt to attach the Recommendation Engine without having Face Skin Metrics 2.0 attached to the dataset, the API will return an error like this:

{
  "type": "validation_error",
  "errors": [
    {
      "code": "missing_dependencies",
      "detail": "Missing dependencies.",
      "attr": null,
      "extra": {
        "missing_application_tech_names": [
          "face_skin_metrics_2.0"
        ],
        "missing_algorithms": []
      }
    }
  ]
}

When you encounter an error due to missing dependencies while attaching an algorithm application, you have two ways to resolve this issue:

1. Attach Dependent Applications Explicitly:

  • You can manually attach the required dependencies by making API requests for each application that needs to be attached before the primary one.

  • This requires knowing the dependencies ahead of time and attaching them in the correct order.

2. Use resolve_dependencies=true:

  • A simpler method is to resend the POST /runs/ TODO: UPDATE method request with the query parameter resolve_dependencies=true. This will automatically handle and attach any required dependencies for you.

  • This option ensures that the API will resolve all necessary dependencies without you having to manually attach them.

Which Method to Use?

  • Explicit Attachment: Use this if you prefer full control over the attachment process and know exactly what dependencies are required.

  • resolve_dependencies=true: Use this for convenience, as it automates the process of attaching dependencies without needing to track them manually.

Example Workflow:

  1. Error Handling: If you try to attach an application and receive a dependency error:

    • Manually attach the required applications or

    • Resend the request with resolve_dependencies=true.

This flexibility allows you to manage application dependencies based on your preferred workflow.


Detach algorithms applications

Not possible :(


Reattach algorithms applications

Just attach the applicaiton again.


Enable/disable algorithms for attached algorithms applications

Reattach application and set enabled_algorithms key to a list of tech names of algorithms.

You can retrieve all possible algorithms included in application from the response of Get application info method.

Example of enabled algorithms value
curl -X POST \
    https://saas.haut.ai/api/v1/companies/{company_id}/applications/face_skin_metrics_2.0/attach-to-dataset/ \
    -H "Authorization: Bearer {token}" \
    -H "Content-Type: application/json" \
    -d '{"enabled_algorithms": ["selfie_v2.age", "selfie_v2.quality", "selfie_v2.lines", "selfie_v2.redness"]}'
    

Last updated