Capabilities with media via JSON config
Capability endpoints with media allows you to use the model
form field to pass configuration. The configuration is consistent with the other form fields exposed, and in some cases the model
form field augments the possibilities. The model
field has to be a string formatted as JSON. When using model
field the other form fields are ignored, except the file fields themselves. The existence of model
field is for convenience and preference of using JSON schema validations and certainly the endpoints will parse and perform the validation, but most OpenApi processing tools have poor support for string form fields that require JSON schema validation.
Summarize media
The Summarize media endpoint has the fields format
, length
, lang
and summary_hint
that can be moved to the model
field as shown in the following example.
With model
fields:
curl --request POST \
--url https://api.maisa.ai/v1/capabilities/summarize/media \
--header 'X-API-Key: ${API_KEY}' \
--header 'accept: application/json' \
--header 'content-type: multipart/form-data' \
--form model='{"format":"paragraph","length":"long","lang":"en"}' \
--form [email protected]
The previous request is equivalent to:
curl --request POST \
--url https://api.maisa.ai/v1/capabilities/summarize/media \
--header 'X-API-Key: ${API_KEY}' \
--header 'accept: application/json' \
--header 'content-type: multipart/form-data' \
--form format=paragraph \
--form length=long \
--form lang=en \
--form [email protected]
Extract from media
The Extract media endpoint has the fields variables
and lang
that can be moved to the model
field as shown in the following example. In this case the model
field represents better the array of objects nature of the variables
field.
With model
fields:
curl --request POST
--url https://api.maisa.ai/v1/capabilities/extract/media \
--header 'X-API-Key: ${API_KEY}' \
--header 'accept: application/json' \
--header 'content-type: multipart/form-data' \
--form [email protected] \
--form model='{
"variables": {
"Name": {
"type": "string",
"description": "Name of the sender"
},
"Subject": {
"type": "string",
"description": "Subject of the email"
}
},
"lang": "en"
}'
The previous request is equivalent to:
curl --request POST
--url https://api.maisa.ai/v1/capabilities/extract/media \
--header 'X-API-Key: ${API_KEY}' \
--header 'accept: application/json' \
--header 'content-type: multipart/form-data' \
--form [email protected] \
--form variable1_name=Name \
--form variable1_type=string \
--form 'variable1_description=Name of the sender' \
--form variable2_name=Subject \
--form variable2_type=string \
--form 'variable2_description=Subject of the email' \
--form lang=en
Compare media
The Compare media endpoint has the fields variables
prompt
and lang
that can be moved to the model
field as shown in the following example. In this case the model
field represents better the array of objects nature of the variables
field.
With model
fields:
curl --request POST
--url https://api.maisa.ai/v1/capabilities/compare/media \
--header 'X-API-Key: ${API_KEY}' \
--header 'accept: application/json' \
--header 'content-type: multipart/form-data' \
--form [email protected] \
--form [email protected] \
--form model='{
"prompt": "Economic comparison, the higher amount the better.",
"variables": {
"Purchase amount": {
"type": "string",
"description": "The amount of units the customer is willing to purchase"
}
},
"lang": "en"
}'
The previous request is equivalent to:
curl --request POST
--url https://api.maisa.ai/v1/capabilities/compare/media \
--header 'X-API-Key: ${API_KEY}' \
--header 'accept: application/json' \
--header 'content-type: multipart/form-data' \
--form [email protected] \
--form [email protected] \
--form 'prompt=Economic comparison, the higher amount the better.' \
--form 'variable1_name=Purchase amount' \
--form variable1_type=string \
--form 'variable1_description=The amount of units the customer is willing to purchase' \
--form lang=en
Metadata field
Additionally to the translation from form fields to the model
field for each capability above the model
field allows for the following extra json keys:
Key | Value | Example | Description |
---|---|---|---|
"metadata" | List of strings | `["GMB product"] ` | List of keywords to add to the audio to text model when transcribing the audio contents. |
Support of model field
The API and documentation supports this field as documented here. However SDKs do not support this feature.
Updated 8 months ago