Predictions
Predictions on everything everywhere all at once.
"""
Prediction.
"""
interface Prediction {
...
}
Predictions are why you're using Function, so here's everything you need to know about them 😆
The Prediction
Interface
The prediction interface provides the foundation of all predictions that will be made on the Function platform, now and in the future
Identifying the Prediction
"""
Prediction ID.
"""
id: ID!
All predictions made on Function have a unique ID. Although there are no current uses of the prediction ID, we could add uses in the future to support asynchronous and batched predictions.
Identifying the Predictor
"""
Predictor tag.
"""
tag: Tag!
The prediction reports the tag
of the predictor from which it was made.
Inspecting the Predictor Type
"""
Prediction type.
"""
type: PredictorType!
The prediction type
identifies what type of prediction it is.
PredictorType
. Inspecting the Creation Date
"""
Date created.
"""
created: DateTime!
The prediction provides the date that it was created
.
The CloudPrediction
Type
"""
Cloud prediction.
"""
type CloudPrediction implements Prediction {
...
}
The cloud prediction represents a prediction that was run in the cloud.
Accessing the Prediction Results
"""
Prediction results.
"""
results: [Feature!]
The results
contain each of the prediction results from the predictor, in order.
null
if the prediction was not successfully completed. Inspecting the Prediction Latency
"""
Prediction latency in milliseconds.
"""
latency: Float
The prediction reports its latency
, which is the amount of time taken to run the prediction, in milliseconds.
Inspecting the Prediction Error
"""
Prediction error.
"""
error: String
If the predictor encounters an error while making a prediction, the error
will be populated with the stringified exception, including a stack trace.
null
if the prediction completed successfully. Inspecting the Prediction Logs
"""
Prediction logs.
"""
logs: String
The prediction reports any logs
generated within the same process during execution.
Making Predictions
Create a prediction by specifying the predictor tag and the prediction inputs. The request accepts the following input parameters:
input CreatePredictionInput {
"""
Predictor tag.
"""
tag: Tag!
"""
Client identifier.
"""
client: Client!
"""
Input features.
This is required for making predictions with `CLOUD` predictors.
"""
inputs: [FeatureInput!]
"""
Return a data URL if a given output feature is smaller than this limit in bytes.
This only applies for `CLOUD` predictors.
"""
dataUrlLimit: Int
}
Prediction Clients in Function
The prediction Client
identifies what platform you are making the prediction request from. This can be used to optimize how predictions are made, and how results are sent back to your device. We currently support the following clients:
Client | Notes |
---|---|
android | |
browser | |
deno | Client library coming soon! |
discord | |
ios | |
linux | |
macos | |
node | |
slack | |
webworker | |
windows | |
zapier |
When making predictions with any of our client libraries, the client
is automatically populated.
function-client
header with your corresponding client.