Endpoint Configuration
Basic Endpoint Parameters
The basic endpoint parameters like its title, name and the http methods are set in the section [ENDPOINT]
.
title
(str): The full title of the endpointname
(str): The name of the endpoint to address itdescription
(str): The full description of the endpointmethods
(array[str]): The allowed http methods. Available methods:"GET"
,"POST"
version
(int): The endpoint version no.
Example:
[ENDPOINT]
title = "This is the endpoint title"
name = "endpoint_name"
description = "The full description of the endpoint"
methods = [ "GET", "POST" ]
version = 0
Worker Parameters
The section [WORKER]
deals with worker related parameters.
job_type
(str): The type of jobs the related worker is assigned forauth_key
(str): The authorization key the worker job request has to containjob_timeout
(int): Timeout in seconds after the worker will receive the response “no_job”, if no job was offered
Example:
[WORKER]
job_type = "endpoint_name_job_type_a"
auth_key = "XXX"
job_timeout = 60
Client Parameters
Configuration concerning the clients like its authorization and authentication. If not specified here, the default values from the server configuration file are used.
authentication
(str): Method for the client login authenticationAvailable settings:
"None"
: The client login request has no restrictions"User"
: The client login request has to contain the name of the user
authorization
(str): Method for the client login authorizationAvailable settings:
"None"
: The client login request has no restrictions"Key"
: The client login request has to contain the name of the user (authentication
has to be"User"
) and the related key listed inauthorization_keys
authorization_keys
(dict): Authorized user name - key pairs{ "name" = "key" }
provide_worker_meta_data
(bool): Whether the client receives meta data about the job from the worker.client_request_limit
(int): The maximum allowed number of requests per client. 0 = not limited
Example:
[CLIENTS]
authentification = "User"
authorization = "Key"
authorization_keys = { "aime" = "XXX" }
client_request_limit = 0
provide_worker_meta_data = true
Input Parameters
All job input parameters will be validated by the AIME API Server for security reasons before getting forwarded to the workers.
The [INPUTS]
section offers configuration of the following attributes to adjust that validation to your needs:
type
(str): The most important attribute. Each input parameter needs at least the specification of its type or the related client request will be rejected by the AIME API Server. Also if the specified type doesn’t match the recognized type of the parameter and the attributeauto_convert
is not set totrue
(It’sfalse
by default). Available types:"boolean"
/"bool"
,"string"
/"str"
,"integer"
/"int"
,"float"
,"selection"
,"json"
,"image"
,"image_list"
,"audio"
All parameter types:
required
(bool): Whether the parameter needs to be present in the client request or not. Client requests with missing required parameters will be rejected ifauto_convert
is false. Ifauto_convert
is true, required parameters need a default value the parameter will be converted to if missing.default
(same type as parameter): The value missing required parameters will be converted to.auto_convert
(bool): Whether invalid parameters will be automatically converted to valid parameters if possible. Default is false.
Types "integer"
and "float"
:
minimum
ormin
(int/float): The smallest allowed value. Ifauto_convert = true
, smaller values will be converted to themin
value.maximum
ormax
(int/float):The highest allowed value. Ifauto_convert = true
, higher values will be converted to themax
value.align
(int/float): Only multiples of the align value are allowed. Ifauto_convert = true
, parameters with values not aligning will be converted to the nearest aligned value.
Type "string"
:
max_length
(int): The maximum allowed length of the string. Ifauto_convert = true
, longer strings will be cut to themax_length
value.
Type "json"
:
For more complex input data like chat contexts there is the input type "json"
, allowing to transmit an array of objects. The input data has to be in a valid json format.
Example data:
json_param = [ { "role": "system", "content": "System prompt" }, { "role": "user", "content": "User question" }, { "role": "assistant", "content": "Assistant answer" } ]
Type "selection"
:
If there are only certain values supported by the worker, the type "selection"
is the best choice.
supported
(array): The array of supported values. Ifauto_convert = true
, different values will be converted to thedefault
value or the first element of thesupported
array, if nodefault
value is found.
Types "image"
and "audio"
:
format
(str): The format supported by the workersAvailable values for the type
"audio"
:"wav"
,"mp3"
,"ogg"
,"webm"
,"mp4"
*Available values for the type
"image"
:"jpeg"
/"jpg"
,"png"
,"tiff"
,"bmp"
,"gif"
,"webp"
*
color_space
(str): The color space of images supported by the workers. Available values:"rgb"
,"yuv"
,"rgba"
,"yuva"
,"bgr"
,"gbr"
,"gbr_alpha"
,"gray"
,"monochrome"
,"palette"
,"alpha"
,"other"
size
(array): The size of images [width, height] in pixelsample_rate
(int): The sample rate in Hz of the audio data supported by the workerssample_bit_depth
(int): The sample bit depth in bits per sample of audio data supported by the workersaudio_bit_rate
(int): The audio bit rate in bits/second supported by the workerschannels
(int): The number of channels (Mono=1, Stereo=2, etc.) of audio data supported by the workersduration
(int): The duration in seconds of audio data supported by the workersresize_method
(str): The method to use for resizing images. Availabe values:"crop"
and"scale"
check_conversion
(bool): Whether to perform another ffprobe check after conversion and log a warning if the target media parameters are different to the measured media parametersinput_temp_file
(str): Whether an input temp file is generated for media conversion."auto"
: temp file is generated for image format “tiff” and “gif” and for input type “audio”. Availabe values:"yes"
,"no"
and"auto"
output_temp_file
(str): Whether an input temp file is generated for media conversion."auto"
: temp file is generated automatically for conversion to"mp4"
format. Availabe values:"yes"
,"no"
and"auto"
Since the attributes of media data need specifications for each attribute seperately, we use nested attributes to do so. That means each attribute above will be configured using the following attributes:
supported
(array): Values supported by the workers. Values not listed here will be rejected by the AIME API Server, ifauto_convert
is false.auto_convert
(bool): Whether invalid parameters will be automatically converted to valid parameters if possible. Default is falsedefault
(same type as parent attribute): Ifauto_convert = true
parameters with values not listed insupported
, will be converted to thedefault
value.minimum
ormin
(int/float): The smallest allowed value. Ifauto_convert = true
, parameters with smaller values will be converted to themin
value.maximum
ormax
(int/float):The highest allowed value. Ifauto_convert = true
, parameters with higher values will be converted to themax
value.align
(int): Only multiples of the align value are allowed. Ifauto_convert = true
, parameters with values not aligning will be converted to the nearest aligned value.keep_aspect_ratio
(bool): Used for the attributesize
ifresize_method = "scale"
to keep the original aspect ratio within the restrictions set bymin
,max
andalign
. Default is false
Example:
[INPUTS]
integer_param = { type = "integer", min = 0, max = 10, default = 1, auto_convert = true }
float_param = { type = "float", minimum = 0.0, maximum = 10.0, default = 1.0, auto_convert = true }
string_param = { type = "string", max_length = 200, auto_convert = true }
json_param = { type = "json", default = [] }
selection_string_param.type = "selection"
selection_string_param.supported = [ "option_1", "option_2", "option_3" ]
selection_string_param.default = "option_2"
selection_string_param.auto_convert = true
selection_int_param.type = "selection"
selection_int_param.supported = [ 1, 2, 4, 8, 16 ]
selection_int_param.default = 8
selection_int_param.auto_convert = true
audio_param.type = "audio"
audio_param.format = { supported = [ "mp3", "wav" ], default = "wav", auto_convert = true } # bits per sample
audio_param.sample_rate = { supported = [ 16000 ], default = 16000, auto_convert = true } # in Hz
audio_param.sample_bit_depth = { supported = [ 16, 32 ], default = 16, auto_convert = true }
audio_param.audio_bit_rate = { max = 192000, auto_convert = true } # in bits/s
audio_param.channels = { supported = [ 1 ], default = 1, auto_convert = true }
audio_param.duration = { max = 30, auto_convert = true } # in seconds
audio_param.check_conversion = true
audio_param.input_temp_file = "auto"
audio_param.output_temp_file = "auto"
image_param.type = "image"
image_param.format = { supported = [ "JPG", "PNG" ], default = "JPG", auto_convert = true, keep_aspect_ratio = true }
image_param.color_space = { supported = [ "RGB" ], default = "RGB", auto_convert = true }
image_param.check_conversion = true
image_param.input_temp_file = "auto"
image_param.output_temp_file = "auto"
image_param.resize_method = "scale"
Output Parameters
Similar to the input parameters, the output parameters need to be declared as well. Job result parameters coming from the worker not being listed in the section [OUTPUTS]
won’t be forwarded to the clients.
In opposite to the input paramters, output parameters also support the type "image_list"
to send multiple images as result. The output types "image"
and "image_list"
provide automatic conversion in the worker interface to the defined format and color space.
Example:
[OUTPUTS]
integer_param = { type = "integer" }
float_param = { type = "float" }
string_param = { type = "string" }
image_param.type = "image"
image_param.format = { supported = [ "JPG", "PNG" ], default = "JPG", auto_convert = true }
image_param.color_space = { supported = [ "RGB" ], default = "RGB", auto_convert = true }
image_list_param.type = "image_list"
image_list_param.format = { supported = [ "jpeg", "png" ], default = "jpeg", auto_convert = true }
image_list_param.color_space = { supported = [ "rgb" ], default = "rgb", auto_convert = true }
audio_param.type = "audio"
Progress
The AIME API Server offers the possibility to transmit data between the workers and the clients during ongoing worker computations.
Equivalent to the input and output parameters, the progress parameters need to be declared in the subsection [OUTPUTS]
. (Currently only progress outputs are implemented)
Example:
[PROGRESS]
[PROGRESS.OUTPUTS]
text = { type = "string" }
num_generated_tokens = { type = "integer" }
Static Routes
In the section [STATIC]
the static routes of your endpoint can be redirected to a desired destination the same way as in the server configuration files. All destinations here are relative to the location of the configuration file. Be aware that overwriting routes already declared in the server configuration will raise errors.
file
(str): To redirect a single filepath
(str): To redirect a whole pathcompile
(str): To compile certain file types to a designated formatAvailable values:
"None"
(default): No compilation."scss"
: scss files will be compiled to css and saved incompiled_path
."md"
: Markdown files will be compiled to html sand saved incompiled_path
with related css file incss_file
.
compiled_path
(str): Path to save the compiled filescss_file
(str): Destination to the related css files for html compiled files
Example:
[STATIC]
"/your_endpoint_name/" = { file = "./destination/of/your/js/client/index.html" }
"/your_endpoint_name/desired/destination/to/your/js/client/path/" = { path = "./destination/to/your/js/client/path/" }
"/your_endpoint_name/desired/destination/to/your/css/style.css" = { file = "./destination/to/your/css/style.css" }