eldr.ai | ELDR AI - Predictions & Recommendations via URL
In the previous sections we looked at Predictions, Recommendations
and Insights. Now let's have a look at the various ways of getting this information from ELDR AI. You can Ask ELDR
via Form, API, CSV, URL, Text and Chart. Here we will explore the URL function which is primarily used to display Predictions and Recommendations
in pure JSON format in the browser and/or provide an alternative to a Body-requiring API call e.g. file_get_contents() in PHP or readString() in Java
can be used here.
You can skip this section if you're not going to use the ELDR AI URL function.
Navigate to "Ask ELDR" via the Dashboard, side bar or nav menu, and select your Model and Model Variant using the top two
drop downs.
You can toggle any of the Ask Methods (e.g. Form, API etc) by clicking on them.
Click on the URL heading:
As you can see, all parameters are sent in on the query line, something like this:
https://eldr.ai/api/ask-eldr/71?apiKey=[YOUR-API-KEY]&type=full&model-variant-id=523&PostCode=IP5&CreditScore=0.4&Age=0.6&Product=Potatoes&PaymentMethod=PayPal&PostCode1=CH45&CreditScore1=0.1&Age1=0.9&Product1=Vegetables&PaymentMethod1=PayPal
The URL to send the request to is https://eldr.ai/api/ask-eldr/{ModelId}?[QUERYSTRING].
Model Id will be shown by default in the URL section - in this case "71".
Query string parameters are as follows:
API KEY - if you are not logged in (as would be the case if you're contacting directly via URL and not via the Ask Page),
you need to supply an API KEY in the apiKey field for authentication. You get your API KEY from your User Profile:
User Management -> User Details.
Type - determines the coverage - type is always "full" until further notice.
Model Variant Id [OPTIONAL] - you can find this at the top of the page in the Model Variant
dropdown and is displayed by default in the sample URL of the Ask Page (in this case 523) - if you don't send it in, the last viable Model Variant
will be used - modeVariantId.
Inputs - a string containing each input label and value. In the example above we are sending 2 requests in at the
same time. To do this, as shown above, append 1,2,3, etc to each additional request. Don't worry if you have numbers in the field labels themselves, ELDR
AI will still recognise them.
If you click on Ask ELDR (URL) - a new browser tab will open with JSON detailing the response you will get with predictions and recommendations:
Expected Input Labels - a list of input labels - for reference and debugging - expectedInputLabels
Output Labels - a list of output labels for reference and debugging - outputLabels
Result - an array of inputs inputs, predictions outputs, ordered predictions outputsOrdered and
recommendations recommendations objects - one result object per set of inputs requested - result.
Success - boolean success of API call success.
That concludes the ELDR AI guide to getting Predictions and Recommendations via URL