whylogs_container.whylabs.container.responses

Functions

get_container_headers()

Get the headers that the container will send to the client

Classes

AddResponseHeaderMiddleWare(app[, dispatch])

Add headers to all responses for LLM container

AvailableMetrics(*, metrics_names)

EvaluationResult(*, metrics, ...[, ...])

LoggerStatusResponse(*, dataset_timestamps, ...)

MetadataField(value)

An enumeration.

StatusResponse(*, version, ...)

WhyLabsSecureHeaders(value)

An enumeration.

class whylogs_container.whylabs.container.responses.AddResponseHeaderMiddleWare(app: Callable[[MutableMapping[str, Any], Callable[[], Awaitable[MutableMapping[str, Any]]], Callable[[MutableMapping[str, Any]], Awaitable[None]]], Awaitable[None]], dispatch: Callable[[Request, Callable[[Request], Awaitable[Response]]], Awaitable[Response]] | None = None)

Bases: BaseHTTPMiddleware

Add headers to all responses for LLM container

async dispatch(request: Request, call_next)
class whylogs_container.whylabs.container.responses.AvailableMetrics(*, metrics_names: List[str])

Bases: BaseModel

metrics_names: List[str]
model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[Dict[str, FieldInfo]] = {'metrics_names': FieldInfo(annotation=List[str], required=True)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.

This replaces Model.__fields__ from Pydantic V1.

class whylogs_container.whylabs.container.responses.EvaluationResult(*, metrics: List[Dict[str, Any]], validation_results: ValidationResult, perf_info: RunPerf | None, action: Action, score_perf_info: RunPerf | None = None, scores: List[Dict[str, Any]] = [], metadata: Dict[str, Any] = {})

Bases: BaseModel

action: Action
static from_results(validator_output: ReturnType, config: ConfigInstance, request: LLMValidateRequest, api_key: WhyLabsApiKey, perf_info: bool = False, metadata_info: bool = False) EvaluationResult
metadata: Dict[str, Any]
metrics: List[Dict[str, Any]]
model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[Dict[str, FieldInfo]] = {'action': FieldInfo(annotation=Action, required=True), 'metadata': FieldInfo(annotation=Dict[str, Any], required=False, default={}), 'metrics': FieldInfo(annotation=List[Dict[str, Any]], required=True), 'perf_info': FieldInfo(annotation=Union[RunPerf, NoneType], required=True), 'score_perf_info': FieldInfo(annotation=Union[RunPerf, NoneType], required=False, default=None), 'scores': FieldInfo(annotation=List[Dict[str, Any]], required=False, default=[]), 'validation_results': FieldInfo(annotation=ValidationResult, required=True)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.

This replaces Model.__fields__ from Pydantic V1.

perf_info: RunPerf | None
score_perf_info: RunPerf | None
scores: List[Dict[str, Any]]
validation_results: ValidationResult
class whylogs_container.whylabs.container.responses.LoggerStatusResponse(*, dataset_timestamps: int, dataset_profiles: int, segment_caches: int, writers: int, pending_writables: int, pending_views: List[str], views: List[str])

Bases: BaseModel

dataset_profiles: int
dataset_timestamps: int
model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[Dict[str, FieldInfo]] = {'dataset_profiles': FieldInfo(annotation=int, required=True), 'dataset_timestamps': FieldInfo(annotation=int, required=True), 'pending_views': FieldInfo(annotation=List[str], required=True), 'pending_writables': FieldInfo(annotation=int, required=True), 'segment_caches': FieldInfo(annotation=int, required=True), 'views': FieldInfo(annotation=List[str], required=True), 'writers': FieldInfo(annotation=int, required=True)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.

This replaces Model.__fields__ from Pydantic V1.

pending_views: List[str]

Pending views are ones that have already been staged for writing. This happens whenever the rolling logger hits the time interal for uploading its internal state. If these fail to upload then they’ll remain pending until the next attempt.

pending_writables: int
segment_caches: int
views: List[str]

Views are currently being added to with new log messages. There haven’t been any attempts to write these yet.

writers: int
class whylogs_container.whylabs.container.responses.MetadataField(value)

Bases: Enum

An enumeration.

CONTAINER_VERSION = 'container_version'
METRIC_METADATA = 'metrics'
POLICY_ID = 'policy_id'
POLICY_LAST_UPDATED_MS = 'policy_last_updated_ms'
POLICY_VERSION = 'policy_version'
class whylogs_container.whylabs.container.responses.StatusResponse(*, version: str, whylogs_logger_status: Dict[str, LoggerStatusResponse], config: Dict[str, Any])

Bases: BaseModel

config: Dict[str, Any]
model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[Dict[str, FieldInfo]] = {'config': FieldInfo(annotation=Dict[str, Any], required=True), 'version': FieldInfo(annotation=str, required=True), 'whylogs_logger_status': FieldInfo(annotation=Dict[str, LoggerStatusResponse], required=True)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.

This replaces Model.__fields__ from Pydantic V1.

version: str
whylogs_logger_status: Dict[str, LoggerStatusResponse]
class whylogs_container.whylabs.container.responses.WhyLabsSecureHeaders(value)

Bases: str, Enum

An enumeration.

CLIENT_VERSION_CONSTRAINT = 'x-wls-verconstr'
SERVERSIDE_TRACED = 'x-wls-sst'
VERSION = 'x-wls-version'
whylogs_container.whylabs.container.responses.get_container_headers() Dict[str, str]

Get the headers that the container will send to the client