Package com.arize
Class ArizeClient
- java.lang.Object
-
- com.arize.ArizeClient
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classArizeClient.ClientBuilderstatic classArizeClient.Rankingstatic classArizeClient.ScoredCategorical
-
Constructor Summary
Constructors Constructor Description ArizeClient(String apiKey, String spaceKey)Deprecated.useArizeClient.ClientBuilderinstead.ArizeClient(String apiKey, String spaceKey, String uri)Deprecated.useArizeClient.ClientBuilderinstead.ArizeClient(org.apache.http.impl.nio.client.CloseableHttpAsyncClient client, String apiKey, String spaceKey, String uri)Deprecated.useArizeClient.ClientBuilderinstead.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static org.apache.http.client.methods.HttpPostbuildRequest(String body, URI host, String apiKey, String spaceKey, String spaceId)<T> ResponsebulkLog(String modelId, String modelVersion, List<String> predictionIds, List<Map<String,?>> features, List<Map<String,Embedding>> embeddingFeatures, List<Map<String,?>> tags, List<T> predictionLabels, List<T> actualLabels, List<Map<String,Double>> shapValues, List<Long> predictionTimestamps)logBulkPrediction builds and submits a Bulk Prediction record to the Arize API.voidclose()Closes the http client.URIgetHost()Get the host.StringgetSpaceKey()Get the space key in the Arize platform<T> Responselog(String modelId, String modelVersion, String predictionId, Map<String,?> features, Map<String,Embedding> embeddingFeatures, Map<String,?> tags, T predictionLabel, T actualLabel, Map<String,Double> shapValues, long predictionTimestamp)log builds and submits a record to the Arize API.<T> ResponselogTrainingRecords(String modelId, String modelVersion, List<Map<String,?>> features, List<Map<String,Embedding>> embeddingFeatures, List<Map<String,?>> tags, List<T> predictionLabels, List<T> actualLabels)<T> ResponselogValidationRecords(String modelId, String modelVersion, String batchId, List<Map<String,?>> features, List<Map<String,Embedding>> embeddingFeatures, List<Map<String,?>> tags, List<T> predictionLabels, List<T> actualLabels)
-
-
-
Constructor Detail
-
ArizeClient
@Deprecated public ArizeClient(org.apache.http.impl.nio.client.CloseableHttpAsyncClient client, String apiKey, String spaceKey, String uri) throws URISyntaxException
Deprecated.useArizeClient.ClientBuilderinstead. For example:ArizeClient client = new ArizeClient.ClientBuilder() .httpClient(httpClient) .apiKey(apiKey) .SpaceId(SpaceId) .uri(uri) .build();Constructor for passing in an httpClient, typically for mocking.- Parameters:
client- an Apache CloseableHttpAsyncClienturi- uri for Arize endpoint- Throws:
URISyntaxException- if uri string violates RFC 2396
-
ArizeClient
@Deprecated public ArizeClient(String apiKey, String spaceKey) throws URISyntaxException
Deprecated.useArizeClient.ClientBuilderinstead. For example:ArizeClient client = new ArizeClient.ClientBuilder() .apiKey(apiKey) .SpaceId(SpaceId) .build();Construct a new API wrapper.- Parameters:
apiKey- your Arize API KeyspaceKey- your Arize space key- Throws:
URISyntaxException- if uri string violates RFC 2396
-
ArizeClient
@Deprecated public ArizeClient(String apiKey, String spaceKey, String uri) throws URISyntaxException
Deprecated.useArizeClient.ClientBuilderinstead. For example:ArizeClient client = new ArizeClient.ClientBuilder() .apiKey(apiKey) .SpaceId(SpaceId) .uri(uri) .build();Construct a new API wrapper while overwriting the Arize endpoint, typically for custom integrations and e2e testing.- Parameters:
apiKey- your Arize API KeyspaceKey- your Arize space keyuri- uri for Arize endpoint- Throws:
URISyntaxException- if uri string violates RFC 2396
-
-
Method Detail
-
buildRequest
protected static org.apache.http.client.methods.HttpPost buildRequest(String body, URI host, String apiKey, String spaceKey, String spaceId)
-
getHost
public URI getHost()
Get the host.- Returns:
- the host
-
getSpaceKey
public String getSpaceKey()
Get the space key in the Arize platform- Returns:
- the Arize supplied space key
-
log
public <T> Response log(String modelId, String modelVersion, String predictionId, Map<String,?> features, Map<String,Embedding> embeddingFeatures, Map<String,?> tags, T predictionLabel, T actualLabel, Map<String,Double> shapValues, long predictionTimestamp) throws IOException, IllegalArgumentException
log builds and submits a record to the Arize API.log constructs a record and executes the API call asynchronously returning a future.
- Specified by:
login interfaceArizeAPI- Type Parameters:
T- Boxed type for predictionLabel. Supported boxed types are: boolean, string, int, long, short, float, double.- Parameters:
modelId- Unique identifier for a given model.modelVersion- Model version identifier used to group together a subset of predictions and actuals for a given modelId.predictionId- Required unique identifier for a given prediction.features- OptionalMapcontaining model features. Map key must beStringand values are one of: string, int, long, short, float, double, boolean.embeddingFeatures- OptionalMapcontaining model embedding features. Map key must beStringand valuesEmbeddingtags- OptionalMapcontaining record tags (aka metadata) that can be associated with a prediction. This can be used to filter during analysis. Map key must beStringand values are one of: string, int, long, short, float, double, boolean. by non-feature data.predictionLabel- Predicted value for a given set of model inputs. Supported boxed types are: boolean, string, int, long, short, float, double. Not required if sending latent actual or feature importance.actualLabel- The latent truth value for a given set of model inputs. Supported boxed types are: boolean, string, int, long, short, float, double. This can either be supplied at the same time as the predictionLabel or on its own once it is known, and it will be linked back by the predictionIdshapValues- OptionalMapfrom feature name to shap value. This can either be supplied at the same time as the predictionLabel or on its own, and it will be linked back by the predictionIdpredictionTimestamp- The timestamp to which the prediction should be attributed. If not set this defaults to the time of receipt- Returns:
Response- Throws:
IOException- in case of a network errorIllegalArgumentException- in case data type for features or label are not supported.
-
bulkLog
public <T> Response bulkLog(String modelId, String modelVersion, List<String> predictionIds, List<Map<String,?>> features, List<Map<String,Embedding>> embeddingFeatures, List<Map<String,?>> tags, List<T> predictionLabels, List<T> actualLabels, List<Map<String,Double>> shapValues, List<Long> predictionTimestamps) throws IOException, IllegalArgumentException
logBulkPrediction builds and submits a Bulk Prediction record to the Arize API.bulkLog constructs a bulk record and executes the API call asynchronously returning a future response.
- Specified by:
bulkLogin interfaceArizeAPI- Type Parameters:
T- Boxed type for predictionLabel and actualLabel. Supported boxed types are: boolean, string, int, long, short, float, double.- Parameters:
modelId- UniqueStringidentifier for a given model.modelVersion- OptionalStringidentifier used to group together a subset of predictions and actuals for a given modelId.predictionIds-Listof uniqueStringindentifiers for predictions. This value is used to match latent actual labels to their original predictions.features- OptionalListofMapvarargs containing human-readable and debuggable model features. Map key must beStringand values are one of: string, int, long, short, float, double, boolean.embeddingFeatures- OptionalListofMapvarargs containing human-readable and debuggable model embedding features. Map key must beStringand valuesEmbedding.tags- OptionalListofMapvarargs containing record tags/metadata. Map key must beStringand values are one of: string, int, long, short, float, double, boolean.predictionLabels-Listof predicted values. Supported boxed types are: boolean, string, int, long, short, float, double.actualLabels-Listof latent actual values. Supported boxed types are: boolean, string, int, long, short, float, double. This can either be supplied at the same time as the predictionLabels or on their own once they are known, and they will be linked back by the corresponding predictionIdsshapValues- OptionalListofMapfrom feature name to shap value. Can be provided at the same time as the predictionLabels or on their own and they will be linked back by the corresponding predictionIdspredictionTimestamps- OptionalListofLongof unix epoch time in milliseconds used to overwrite timestamp for a prediction.- Returns:
Response- Throws:
IOException- in case of a network errorIllegalArgumentException- in case data type for features or label are not supported.
-
logTrainingRecords
public <T> Response logTrainingRecords(String modelId, String modelVersion, List<Map<String,?>> features, List<Map<String,Embedding>> embeddingFeatures, List<Map<String,?>> tags, List<T> predictionLabels, List<T> actualLabels) throws IOException
- Specified by:
logTrainingRecordsin interfaceArizeAPI- Type Parameters:
T- Boxed type for predictionLabel and actualLabel. Supported boxed types are: boolean, string, int, long, short, float, double.- Parameters:
modelId- UniqueStringidentifier for a given model.modelVersion- OptionalStringidentifier used to group together a subset of predictions and actuals for a given modelId.features- OptionalListofMapvarargs containing human-readable and debuggable model features. Map key must beStringand values are one of: string, int, long, short, float, double, boolean.embeddingFeatures- OptionalListofMapvarargs containing human-readable and debuggable model embedding features. Map key must beStringand valuesEmbedding.tags- OptionalListofMapvarargs containing record tags/metadata. Map key must beStringand values are one of: string, int, long, short, float, double, boolean.predictionLabels-Listof predicted values. Supported boxed types are: boolean, string, int, long, short, float, double.actualLabels-Listof latent actual values. Supported boxed types are: boolean, string, int, long, short, float, double. This can either be supplied at the same time as the predictionLabels or on their own once they are known, and they will be linked back by the corresponding predictionIds- Returns:
Response- Throws:
IOException- in case of a network error
-
logValidationRecords
public <T> Response logValidationRecords(String modelId, String modelVersion, String batchId, List<Map<String,?>> features, List<Map<String,Embedding>> embeddingFeatures, List<Map<String,?>> tags, List<T> predictionLabels, List<T> actualLabels) throws IOException
- Specified by:
logValidationRecordsin interfaceArizeAPI- Type Parameters:
T- Boxed type for predictionLabel and actualLabel. Supported boxed types are: boolean, string, int, long, short, float, double.- Parameters:
modelId- UniqueStringidentifier for a given model.modelVersion- OptionalStringidentifier used to group together a subset of predictions and actuals for a given modelId.batchId- Unique identifier for the validation batch we are adding data tofeatures- OptionalListofMapvarargs containing human readable and debuggable model features. Map key must beStringand values are one of: string, int, long, short, float, double, boolean.embeddingFeatures- OptionalListofMapvarargs containing human-readable and debuggable model embedding features. Map key must beStringand valuesEmbedding.tags- OptionalListofMapvarargs containing record tags/metadata. Map key must beStringand values are one of: string, int, long, short, float, double, boolean.predictionLabels-Listof predicted values. Supported boxed types are: boolean, string, int, long, short, float, double.actualLabels-Listof latent actual values. Supported boxed types are: boolean, string, int, long, short, float, double. This can either be supplied at the same time as the predictionLabels or on their own once they are known, and they will be linked back by the corresponding predictionIds- Returns:
Response- Throws:
IOException- in case of a network error
-
close
public void close() throws IOExceptionCloses the http client.- Throws:
IOException- in case of a network error
-
-