Request Parameters
Providers
Using Eden AI, you can make a call to one provider or multiple providers at once.
The providers
field requires a string as input including the provider name:
- if only one provider, just input the provider name (eg:
providers="amazon"
) - if requesting multiple providers: enter them by separating them with commas (eg:
providers="google,amazon,microsoft"
You can see the list of available providers per feature on our API Reference.
Fallback
You can set a list of providers to use as fallback in case the primary provider fails.
The fallback_providers
parameter must be comma-separated list, same as the providers
parameter.
- If this parameter is set,
providers
must contain only one entry
- It doesn't work with asynchronous features
Example
{
"providers": "openai",
"fallback_providers": "microsoft, amazon",
"settings": {
"openai": "davinci
}
In this example, if openai fails, a call to microsoft will be made, and if microsoft fails as well, a amazon will be called.
Languages
Some features support languages inputs (Translation for example).
If you browse our API Reference on features supporting languages inputs, you will be presented a table listing the supported languages for this feature. On this table you might see values like: en
, en-US
, auto-detect
.
Let's see the difference between theses values:
auto-detect
: self-explanatory, the provider will detect the language from your text/document.en
(and other 2 char language codes): Language code of your text/document's language.en-US
: if the value is longer than 2 characters, what comes after the "-" indicate the language's regional code, this is more detailed and might result in a more accurate response, but less providers supports it.
A more Detailed Article on how we standardized languages can be found here.
Formatting Response
Some parameters allow you to customize the response format to your needs:
response_as_dict
response_as_dict
Default to true
Allows the response to be returned as a json dict containing providers as keys and their results as values.
Example:
{
"emvista": {
"status": "success",
...
},
"amazon": {
"status": "success",
...
},
"openai": {
"status": "success",
...
}
}
if set to false
the response will be a list of provider responses dicts as shown below:
[
{
"status": "success",
"provider": "emvista"
...
},
{
"status": "success",
"provider": "amazon"
...
},
{
"status": "success",
"provider": "openai"
...
}
]
attributes_as_list
attributes_as_list
Defaults to false
If parameter is set to true
and the result contains a list of dict objects like:
{
"microsoft": {
"status": "success",
"items": [
{
"keyword": "U.S. senator",
"importance": null
},
{
"keyword": "first African-American president",
"importance": null
},
{
"keyword": "Barack Hussein Obama",
"importance": null
},
...
]
}
}
Then the list of dict will be formatted into multiple lists (one per key present in the dict), here is the above response formatted using attributes_as_list
:
{
"microsoft": {
"status": "success",
"keyword": ["U.S. senator","first African-American president","Barack Hussein Obama"],
"importance": [null, null, null]
}
}
This can ease the response parsing workflow in some programming languages, or if you only need one particular field in the response.
show_original_response
show_original_response
Defaults to false
Whether or not to show the provider original response in addition to the standardized response we provide
if set to true
and additional field original_response
will be present in the providers result.
Updated 12 months ago