Skip to end of banner
Go to start of banner

AI Connector API contract

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 26 Next »

Introduction

To expose AI services to our system, we need an API to be exposed for the MediaHaven installation. When creating new Plugins having of the following https://mediahaven.atlassian.net/wiki/spaces/CS/pages/edit-v2/4438884395#Categories

  • Embedding

  • Generative

then MediaHaven will connect to this plugin using REST API calls, which must implement the following methods depending on the category.

Methods

GET /config-rules ALL CATEGORIES

It gives the possible configuration parameters for this connector

Ex.

{
  "Rules": [
    {
      "Name": "TextModel",
      "Type": "String|Integer|Boolean",
      "Required": false,
      "Default" : "ada2"
    }
  ]
}

POST /text-embedding EMBEDDING

Expected parameters

Text as JSON body in Textproperty and Config based on config rules

Ex.

{
  "Text": "Given me pictures of lamas",
  "Config": {
    "TextModel" : "ada2"
  }
}

Expected headers

x-api-key: <optional api key>

Output

Array of float (vector) with size equal to dimensions. The vector is normalized

POST /embedding EMBEDDING

Expected parameters

Record as JSON body in Metadata property and Config based on config rules

Ex.

{
  "Config": {
    "TextModel" : "ada2"
  },
  "Metadata": {
    "RightsManagement": {
        "Permissions": {...},
        "RecordPhase": "Concept",
        "ExpiryDate": null,
        "ExpiryStatus": null,
        "Zone": {}
    }
  }
}

Expected headers

x-api-key: <optional api key>

Output

Array of float (vector) with size equal to dimensions. The vector is normalized

Ex.

{
  "Embedding": [ 
    -0.006929283495992422,
    -0.005336422007530928,
    ... (omitted for spacing)
    -4.547132266452536e-05,
    -0.024047505110502243]
}

POST /describe
POST /generative-metadata/description GENERATIVE

Expected parameters

Record as JSON body in Metadata property and Config based on config rules

Ex.

{
  "Config": {
    "TextModel" : "ada2"
  },
  "Metadata": {
    "RightsManagement": {
        "Permissions": {...},
        "RecordPhase": "Concept",
        "ExpiryDate": null,
        "ExpiryStatus": null,
        "Zone": {}
    }
  }
}

Expected headers

x-api-key: <optional api key>

Output

Textual string

Ex.

{
  "Description": "This is an image of a cat"
}

POST /generative-metadata GENERATIVE

Record as JSON body in Metadata property, Fields with as items dotted keys and AI hint as value, Locale as the requested target locale for the output and finally Config based on config rules

Ex.

{
  "Fields": { 
    "Descriptive.Description": "Give a description for the image"
  },
  "Locale": "en_US",
  "Config": {
    "TextModel" : "ada2"
  },
  "Metadata": {
    "RightsManagement": {
        "Permissions": {...},
        "RecordPhase": "Concept",
        "ExpiryDate": null,
        "ExpiryStatus": null,
        "Zone": {}
    }
  }
}

Expected headers

x-api-key: <optional api key>

Output

Follow the input fields, the same structure should be returned

Ex:

{ 
  "Fields": {
    "Descriptive.Description": "This is an image of a cat"  
  }
}

  • No labels