Class OnlineQueryParams

java.lang.Object
ai.chalk.models.OnlineQueryParams
Direct Known Subclasses:
OnlineQueryParamsComplete

public class OnlineQueryParams extends Object
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
         }
         
     

  • Constructor Details

  • Method Details

    • builder

      public static OnlineQueryParams.BuilderSeed builder()
    • getInputs

      public Map<String,List<?>> getInputs()
      The features for which there are known values, mapped to those values. Set by `OnlineQueryParams.builder().withInput`.
    • getOutputs

      public List<String> getOutputs()
      The features that you'd like to compute from the inputs. Set by `OnlineQueryParams.builder().withOutputs`.
    • getStaleness

      public Map<String,Duration> getStaleness()
      Maximum staleness overrides for any output features or intermediate features. Set by `OnlineQueryParams.builder().withStaleness`.
    • getMeta

      public Map<String,String> getMeta()
      Metadata to attach to the query. Set by `OnlineQueryParams.builder().withMeta`.
    • getTags

      public List<String> 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

      public String getEnvironmentId()
      The environment under which to run the resolvers.
    • getPreviewDeploymentId

      public String getPreviewDeploymentId()
      If specified, Chalk will route your request to the relevant preview deployment.
    • getQueryName

      public String 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

      public String getQueryNameVersion()
    • getCorrelationId

      public String 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

      public String getBranch()
      If specified, Chalk will route your request to the relevant branch.
    • getNow

      public List<ZonedDateTime> 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

      public List<String> getRequiredResolverTags()
      If specified, *all* required_resolver_tags must be present on a resolver for it to be considered eligible to execute.
    • getPlannerOptions

      public Map<String,Object> 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

      public Duration getTimeout()
      Timeout for the query. Defaults to no timeout. Timeout of 0 means the request times out immediately.
    • getInputSchemaHint

      public Map<String,String> 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.