To expose AI services to our system, we need an API to be exposed for the MediaHaven installation.
The contract of this API is as follows (anything can be added before the path):
GET /config-rules
Gives the possible configuration parameters for this connector
Ex.
{ "Rules": [ { "Name": "TextModel", "Type": "String|Integer|Boolean", "Required": false, "Default" : "ada2" } ] }
POST /text-embedding
Expected parameters:
Text as json body in Text
property 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
Expected parameters:
Record as json body in Metadata
property and Config
based on config rules
Ex.
{ "Metadata": { "RightsManagement": { "Permissions": { "Export": [ "058b5713-a7d6-45fe-81fc-bcb8b1925fbf", "dd100b7a-efd0-44e3-8816-0905572421da", "da100b7a-efd0-44e3-8816-0905572421da" ], "Write": [ "058b5713-a7d6-45fe-81fc-bcb8b1925fbf", "dd100b7a-efd0-44e3-8816-0905572421da", "da100b7a-efd0-44e3-8816-0905572421da" ], "Read": [ "058b5713-a7d6-45fe-81fc-bcb8b1925fbf", "dd100b7a-efd0-44e3-8816-0905572421da", "330060ae-548c-474f-a863-9673fdf99458", "de100b7a-efd0-44e3-8816-0905572421da", "df100b7a-efd0-44e3-8816-0905572421da", "da100b7a-efd0-44e3-8816-0905572421da" ] }, "RecordPhase": "Concept", "ExpiryDate": null, "ExpiryStatus": null, "Zone": {} } }, "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
Ex.
{ "Embedding": [ -0.006929283495992422, -0.005336422007530928, ... (omitted for spacing) -4.547132266452536e-05, -0.024047505110502243 ] }
POST /describe
Expected parameters:
Record as json body in Metadata
property and Config
based on config rules
Ex.
{ "Metadata": { "RightsManagement": { "Permissions": { "Export": [ "058b5713-a7d6-45fe-81fc-bcb8b1925fbf", "dd100b7a-efd0-44e3-8816-0905572421da", "da100b7a-efd0-44e3-8816-0905572421da" ], "Write": [ "058b5713-a7d6-45fe-81fc-bcb8b1925fbf", "dd100b7a-efd0-44e3-8816-0905572421da", "da100b7a-efd0-44e3-8816-0905572421da" ], "Read": [ "058b5713-a7d6-45fe-81fc-bcb8b1925fbf", "dd100b7a-efd0-44e3-8816-0905572421da", "330060ae-548c-474f-a863-9673fdf99458", "de100b7a-efd0-44e3-8816-0905572421da", "df100b7a-efd0-44e3-8816-0905572421da", "da100b7a-efd0-44e3-8816-0905572421da" ] }, "RecordPhase": "Concept", "ExpiryDate": null, "ExpiryStatus": null, "Zone": {} } }, "Config": { "TextModel" : "ada2" } }
Expected headers:
x-api-key: <optional api key>
Output
Textual string
Ex.
{ "Description": This is an image of a cat"}
POST /detailed-describe
Record as json body in Metadata
property, Describe
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.
{ "Metadata": { "RightsManagement": { "Permissions": { "Export": [ "058b5713-a7d6-45fe-81fc-bcb8b1925fbf", "dd100b7a-efd0-44e3-8816-0905572421da", "da100b7a-efd0-44e3-8816-0905572421da" ], "Write": [ "058b5713-a7d6-45fe-81fc-bcb8b1925fbf", "dd100b7a-efd0-44e3-8816-0905572421da", "da100b7a-efd0-44e3-8816-0905572421da" ], "Read": [ "058b5713-a7d6-45fe-81fc-bcb8b1925fbf", "dd100b7a-efd0-44e3-8816-0905572421da", "330060ae-548c-474f-a863-9673fdf99458", "de100b7a-efd0-44e3-8816-0905572421da", "df100b7a-efd0-44e3-8816-0905572421da", "da100b7a-efd0-44e3-8816-0905572421da" ] }, "RecordPhase": "Concept", "ExpiryDate": null, "ExpiryStatus": null, "Zone": {} } }, "Fields": { "Descriptive.Description": "Give a description for the image" } , "Locale": "en_US", "Config": { "TextModel" : "ada2" } }
Expected headers:
x-api-key: <optional api key>
Output
Follow the input fields, same structure should be returned
Ex:
{ "Descriptive.Description": "This is an image of a cat" }