Package ai.chalk.models
Class OnlineQueryParams
java.lang.Object
ai.chalk.models.OnlineQueryParams
- Direct Known Subclasses:
OnlineQueryParamsComplete
OnlineQueryParams holds the parameters for an online query.
It is the starting point for constructing an instance of
OnlineQueryParamsComplete. Both `withInput` and `withOutput`
must be called at least once.
Example usage:
OnlineQueryParamsComplete params = OnlineQueryParams.builder()
.withInput("user.id", Arrays.asList(1, 2, 3))
.withOutputs("user.email", "user.transactions")
.build();
try (OnlineQueryResult result = client.onlineQuery(params)) {
// do something with the result
}
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classOnlineQueryParams.Builder<T extends OnlineQueryParams.Builder<T>>static classstatic classstatic classstatic classstatic classHelper class for building input data for single-row online queries. -
Constructor Summary
ConstructorsConstructorDescriptionOnlineQueryParams(Map<String, List<?>> inputs, List<String> outputs, Map<String, Duration> staleness, Map<String, String> meta, List<String> tags, boolean includeMeta, boolean storePlanStages, boolean explain, String environmentId, String previewDeploymentId, String queryName, String queryNameVersion, String correlationId, String branch, List<ZonedDateTime> now, List<String> requiredResolverTags, Map<String, Object> plannerOptions, Duration timeout, Map<String, String> inputSchemaHint) -
Method Summary
Modifier and TypeMethodDescriptionbuilder()If specified, Chalk will route your request to the relevant branch.You can specify a correlation ID to be used in logs and web interfaces.The environment under which to run the resolvers.The features for which there are known values, mapped to those values.Schema hints for has-many input features.getMeta()Metadata to attach to the query.getNow()The time at which to evaluate the query.The features that you'd like to compute from the inputs.Map of additional options to pass to the Chalk query engine.If specified, Chalk will route your request to the relevant preview deployment.The semantic name for the query you're making, for example, `"loan_application_model"`.If specified, *all* required_resolver_tags must be present on a resolver for it to be considered eligible to execute.Maximum staleness overrides for any output features or intermediate features.getTags()Timeout for the query.booleanLog the query execution plan.booleanTriggers returning metadata about the query execution.booleanIf true, the output of each of the query plan stages will be stored in S3/GCS.
-
Constructor Details
-
OnlineQueryParams
public OnlineQueryParams(Map<String, List<?>> inputs, List<String> outputs, Map<String, Duration> staleness, Map<String, String> meta, List<String> tags, boolean includeMeta, boolean storePlanStages, boolean explain, String environmentId, String previewDeploymentId, String queryName, String queryNameVersion, String correlationId, String branch, List<ZonedDateTime> now, List<String> requiredResolverTags, Map<String, Object> plannerOptions, Duration timeout, Map<String, String> inputSchemaHint)
-
-
Method Details
-
builder
-
getInputs
The features for which there are known values, mapped to those values. Set by `OnlineQueryParams.builder().withInput`. -
getOutputs
The features that you'd like to compute from the inputs. Set by `OnlineQueryParams.builder().withOutputs`. -
getStaleness
Maximum staleness overrides for any output features or intermediate features. Set by `OnlineQueryParams.builder().withStaleness`. -
getMeta
Metadata to attach to the query. Set by `OnlineQueryParams.builder().withMeta`. -
getTags
-
isIncludeMeta
public boolean isIncludeMeta()Triggers returning metadata about the query execution. This could make the query slightly slower. For more information, see https://docs.chalk.ai/docs/query-basics. -
isStorePlanStages
public boolean isStorePlanStages()If true, the output of each of the query plan stages will be stored in S3/GCS. This will dramatically impact the performance of the query, so it should only be used for debugging. These files will be visible in the web dashboard's query detail view, and can be downloaded in full by clicking on a plan node in the query plan visualizer. -
isExplain
public boolean isExplain()Log the query execution plan. Requests using `explain=True` will be slower than requests using `explain=False`. If `True`, 'includeMeta' will be set to `True` as well. -
getEnvironmentId
The environment under which to run the resolvers. -
getPreviewDeploymentId
If specified, Chalk will route your request to the relevant preview deployment. -
getQueryName
The semantic name for the query you're making, for example, `"loan_application_model"`. Typically, each query that you make from your application should have a name. Chalk will present metrics and dashboard functionality grouped by 'query_name'. -
getQueryNameVersion
-
getCorrelationId
You can specify a correlation ID to be used in logs and web interfaces. This should be globally unique, i.e. a `uuid` or similar. Logs generated during the execution of your query will be tagged with this correlation id. -
getBranch
If specified, Chalk will route your request to the relevant branch. -
getNow
The time at which to evaluate the query. If not specified, the current time will be used. The length of this list must be the same as the length of the values in `inputs`. -
getRequiredResolverTags
If specified, *all* required_resolver_tags must be present on a resolver for it to be considered eligible to execute. -
getPlannerOptions
Map of additional options to pass to the Chalk query engine. Values may be provided as part of conversations with Chalk Support to enable or disable specific functionality. -
getTimeout
Timeout for the query. Defaults to no timeout. Timeout of 0 means the request times out immediately. -
getInputSchemaHint
Schema hints for has-many input features. Maps a has-many feature FQN to its bracketed column projection string, e.g."user.txns" -> "user.txns[user.txns.txn_id,user.txns.amount]". Required when passing empty has-many inputs so the server knows the expected schema. Auto-generated from non-empty has-many input data when not explicitly set.
-