Responses

tecton_client.responses module

This module consists of classes that help represent the responses from the Tecton API.

class tecton_client.responses.FeatureServiceType(value)[source]

Bases: str, Enum

Enum to represent the type of the feature service.

DEFAULT = 'DEFAULT'

The feature service is a default feature service.

WILDCARD = 'WILDCARD'

The feature service is a wildcard feature service.

class tecton_client.responses.FeatureStatus(value)[source]

Bases: str, Enum

Enum to represent the serving status of a feature.

MISSING_DATA = 'MISSING_DATA'

The feature values were not found in the online store either because the join keys do not exist or the feature values are outside ttl.

PRESENT = 'PRESENT'

The feature values were found in the online store for the join keys requested.

UNKNOWN = 'UNKNOWN'

An unknown status code occurred, most likely because an error occurred during feature retrieval.

class tecton_client.responses.FeatureValue(name: str, data_type: str, feature_value: str | None | list, effective_time: str | None = None, element_type: dict | None = None, fields: list | None = None, feature_status: str | None = None)[source]

Bases: object

Class encapsulating all the data for a Feature value returned from a GetFeatures API call.

data_type

The type of the feature value. Tecton supports the following data types: Int, Float, String, Bool, Array, and Struct.

Type:

DataType

feature_value

The value of the feature.

Type:

Union[str, int, float, bool, list, dict, None]

feature_namespace

The namespace that the feature belongs to.

Type:

str

feature_name

The name of the feature.

Type:

str

feature_status

The status of the feature.

Type:

FeatureStatus

effective_time

The effective serving time for this feature. This is the most recent time that’s aligned to the interval for which a full aggregation is available for this feature. Passing this in the spine of an offline feature request should guarantee retrieving the same value as is in this response.

Type:

datetime

class tecton_client.responses.GetFeatureServiceMetadataResponse(http_response: HTTPResponse)[source]

Bases: object

Response object for GetFeatureServiceMetadata API call.

feature_service_type

The type of the feature service.

Type:

FeatureServiceType

input_join_keys

Dictionary of names mapping to NameAndType objects representing the input join keys.

Type:

Dict[str, NameAndType]

input_request_context_keys

Dictionary of names mapping to NameAndType objects representing the input request context keys.

Type:

Dict[str, NameAndType]

feature_values

Dictionary of names mapping to NameAndType objects representing the feature values.

Type:

Dict[str, NameAndType]

output_join_keys

Dictionary of names mapping to NameAndType objects representing the output join keys.

Type:

Dict[str, NameAndType]

class tecton_client.responses.GetFeaturesBatchResponse(responses_list: List[HTTPResponse | None], request_latency: timedelta, micro_batch_size: int)[source]

Bases: object

A class that represents the response from the HTTP API when fetching batch features. The class provides methods to access the list of feature vectors returned, along with their metadata, if present.

The list of GetFeaturesResponse objects represents the list of responses, each of which encapsulates a feature vector and its metadata, in case of a successful request, or None if the request timed out.

The batch SLO information is only present for batch requests to the /get-features-batch endpoint (i.e., micro_batch_size > 1)

batch_response_list

List of GetFeaturesResponse objects, one for each feature vector requested, or None if the request timed out.

Type:

List[Optional[GetFeaturesResponse]]

batch_slo_info

SloInformation object containing information on the batch request’s SLO, present only for batch requests to the /get-features-batch endpoint and if the MetadataOption SLO_INFO is requested in the request.

Type:

Optional[SloInformation]

request_latency

The response time for GetFeaturesBatch call (network latency + online store latency).

Type:

timedelta

class tecton_client.responses.GetFeaturesResponse(http_response: HTTPResponse | None = None, feature_values: Dict[str, FeatureValue] | None = None, slo_info: SloInformation | None = None, request_latency: timedelta = datetime.timedelta(0))[source]

Bases: object

Response object for GetFeatures API call.

feature_values

Dictionary with feature names as keys and their corresponding feature values, one for each feature in the feature vector.

Type:

Dict[str, FeatureValue]

slo_info

SloInformation object containing information on the feature vector’s SLO, present only if the MetadataOption SLO_INFO is requested in the request.

Type:

Optional[SloInformation]

request_latency

The response time for GetFeatures API call (network latency + online store latency).

Type:

timedelta

class tecton_client.responses.SloIneligibilityReason(value)[source]

Bases: str, Enum

Reasons due to which the Feature Serving Response may be ineligible for SLO.

DYNAMODB_RESPONSE_SIZE_LIMIT_EXCEEDED = 'DYNAMODB_RESPONSE_SIZE_LIMIT_EXCEEDED'

The 2MiB limit for DynamoDB response size was exceeded.

REDIS_LATENCY_LIMIT_EXCEEDED = 'REDIS_LATENCY_LIMIT_EXCEEDED'

The 25ms limit for Redis retrieval latency was exceeded.

REDIS_RESPONSE_SIZE_LIMIT_EXCEEDED = 'REDIS_RESPONSE_SIZE_LIMIT_EXCEEDED'

The 2MiB limit for Redis response size was exceeded.

UNKNOWN = 'UNKNOWN'

Reason is unknown.

class tecton_client.responses.SloInformation(slo_information: dict)[source]

Bases: object

Class that represents SLO Information provided by Tecton when serving feature values.

Refer to the official documentation here for more information.

slo_eligible

Whether the request was eligible for the latency SLO.

Type:

Optional[bool]

server_time_seconds

This includes the total time spent in the feature server, including online transforms and store latency.

Type:

Optional[float]

slo_server_time_seconds

The server time minus any time spent waiting for online transforms to finish after all table transforms have finished. This is the indicator used for determining whether we are meeting the SLO.

Type:

Optional[float]

store_max_latency

Max latency observed by the request from the store in seconds. Tecton fetches multiple feature views in parallel.

Type:

Optional[float]

store_response_size_bytes

Total store response size in bytes.

Type:

Optional[int]

dynamodb_response_size_bytes

The total DynamoDB response size processed to serve this request, in bytes. If this is greater than 2 MiB (i.e. 2097152), then the request is not SLO-Eligible.

Type:

Optional[int]

slo_ineligibility_reasons

List of one or more reasons indicating why the feature was not SLO eligible. Only present if slo_eligible is False.

Type:

Optional[List[SloIneligibilityReason]]

FeatureServiceType(value)

Enum to represent the type of the feature service.

FeatureStatus(value)

Enum to represent the serving status of a feature.

FeatureValue(name, data_type, feature_value)

Class encapsulating all the data for a Feature value returned from a GetFeatures API call.

SloInformation(slo_information)

Class that represents SLO Information provided by Tecton when serving feature values.

SloIneligibilityReason(value)

Reasons due to which the Feature Serving Response may be ineligible for SLO.

GetFeaturesResponse([http_response, ...])

Response object for GetFeatures API call.

GetFeaturesBatchResponse(responses_list, ...)

A class that represents the response from the HTTP API when fetching batch features.

GetFeatureServiceMetadataResponse(http_response)

Response object for GetFeatureServiceMetadata API call.