pub struct ChalkClient { /* private fields */ }Expand description
An HTTP/REST client for the Chalk feature store.
Implementations§
Source§impl ChalkClient
impl ChalkClient
Sourcepub fn new() -> ChalkClientBuilder
pub fn new() -> ChalkClientBuilder
Start building a new ChalkClient.
Source§impl ChalkClient
impl ChalkClient
Sourcepub async fn query(
&self,
inputs: HashMap<String, Value>,
outputs: Vec<String>,
options: QueryOptions,
) -> Result<OnlineQueryResponse>
pub async fn query( &self, inputs: HashMap<String, Value>, outputs: Vec<String>, options: QueryOptions, ) -> Result<OnlineQueryResponse>
Query features online (single entity, JSON request/response).
§Arguments
inputs— Known feature values, e.g.{"user.id": 42}.outputs— Which features to compute, e.g.["user.age", "user.name"].options— Optional settings (staleness, tags, etc.).
Sourcepub async fn query_bulk(
&self,
inputs: &RecordBatch,
outputs: Vec<String>,
options: QueryOptions,
) -> Result<BulkQueryResult>
pub async fn query_bulk( &self, inputs: &RecordBatch, outputs: Vec<String>, options: QueryOptions, ) -> Result<BulkQueryResult>
Query features in bulk using the Chalk feather protocol.
You provide inputs as an Arrow RecordBatch (one column per input
feature, one row per entity) and get back a BulkQueryResult containing
the output features as raw Feather bytes.
Sourcepub async fn offline_query(
&self,
params: OfflineQueryParams,
) -> Result<OfflineQueryResponse>
pub async fn offline_query( &self, params: OfflineQueryParams, ) -> Result<OfflineQueryResponse>
Run an offline query using the builder pattern.
§Example
let response = client.offline_query(
OfflineQueryParams::new()
.with_input("user.id", vec![serde_json::json!(1), serde_json::json!(2)])
.with_output("user.email")
).await?;Sourcepub async fn offline_query_raw(
&self,
request: OfflineQueryRequest,
) -> Result<OfflineQueryResponse>
pub async fn offline_query_raw( &self, request: OfflineQueryRequest, ) -> Result<OfflineQueryResponse>
Run an offline query with a raw OfflineQueryRequest.
Sourcepub async fn get_offline_query_status(
&self,
job_id: &str,
) -> Result<GetOfflineQueryStatusResponse>
pub async fn get_offline_query_status( &self, job_id: &str, ) -> Result<GetOfflineQueryStatusResponse>
Get the status of an offline query job.
Sourcepub async fn wait_for_offline_query(
&self,
response: &OfflineQueryResponse,
timeout: Option<Duration>,
) -> Result<()>
pub async fn wait_for_offline_query( &self, response: &OfflineQueryResponse, timeout: Option<Duration>, ) -> Result<()>
Wait for an offline query job to complete.
Polls get_offline_query_status every
second until the job reaches "COMPLETED" or "FAILED" status.
Sourcepub async fn get_offline_query_download_urls(
&self,
response: &OfflineQueryResponse,
timeout: Option<Duration>,
) -> Result<Vec<String>>
pub async fn get_offline_query_download_urls( &self, response: &OfflineQueryResponse, timeout: Option<Duration>, ) -> Result<Vec<String>>
Get download URLs for an offline query’s result Parquet files.
Sourcepub async fn upload_features(
&self,
features: &RecordBatch,
) -> Result<UploadFeaturesResult>
pub async fn upload_features( &self, features: &RecordBatch, ) -> Result<UploadFeaturesResult>
Upload feature values to the Chalk feature store.
§Arguments
features— An Arrow RecordBatch where each column is a feature (column names are feature FQNs like"user.age").
Sourcepub async fn upload_features_map(
&self,
inputs: HashMap<String, Vec<Value>>,
) -> Result<UploadFeaturesResult>
pub async fn upload_features_map( &self, inputs: HashMap<String, Vec<Value>>, ) -> Result<UploadFeaturesResult>
Upload feature values from a map of feature names to value arrays.
§Example
let inputs = HashMap::from([
("user.id".to_string(), vec![serde_json::json!(1), serde_json::json!(2)]),
("user.name".to_string(), vec![serde_json::json!("Alice"), serde_json::json!("Bob")]),
]);
let result = client.upload_features_map(inputs).await?;Sourcepub fn environment_id(&self) -> &str
pub fn environment_id(&self) -> &str
Returns the resolved environment ID.
Sourcepub fn query_server(&self) -> &str
pub fn query_server(&self) -> &str
Returns the resolved query server URL.
Auto Trait Implementations§
impl Freeze for ChalkClient
impl !RefUnwindSafe for ChalkClient
impl Send for ChalkClient
impl Sync for ChalkClient
impl Unpin for ChalkClient
impl UnsafeUnpin for ChalkClient
impl !UnwindSafe for ChalkClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request