azure.cognitiveservices.personalizer.models module

exception azure.cognitiveservices.personalizer.models.ErrorResponseException(deserialize, response, *args)[source]

Bases: msrest.exceptions.HttpOperationError

Server responsed with exception of type: ‘ErrorResponse’.

Parameters
  • deserialize – A deserializer

  • response – Server response to be deserialized.

class azure.cognitiveservices.personalizer.models.InternalError(*, code: str = None, innererror=None, **kwargs)[source]

Bases: msrest.serialization.Model

An object containing more specific information than the parent object about the error.

Parameters
  • code (str) – Detailed error code.

  • innererror (InternalError) – The error object.

class azure.cognitiveservices.personalizer.models.PersonalizerError(*, code, message: str, target: str = None, details=None, inner_error=None, **kwargs)[source]

Bases: msrest.serialization.Model

The error object.

All required parameters must be populated in order to send to Azure.

Parameters
  • code (str or ErrorCode) – Required. High level error code. Possible values include: ‘BadRequest’, ‘ResourceNotFound’, ‘InternalServerError’

  • message (str) – Required. A message explaining the error reported by the service.

  • target (str) – Error source element.

  • details (list[PersonalizerError]) – An array of details about specific errors that led to this reported error.

  • inner_error (InternalError) – Finer error details.

class azure.cognitiveservices.personalizer.models.ErrorResponse(*, error, **kwargs)[source]

Bases: msrest.serialization.Model

Used to return an error to the client.

All required parameters must be populated in order to send to Azure.

Parameters

error (PersonalizerError) – Required. The error object.

class azure.cognitiveservices.personalizer.models.RewardRequest(*, value: float, **kwargs)[source]

Bases: msrest.serialization.Model

Reward given to a rank response.

All required parameters must be populated in order to send to Azure.

Parameters

value (float) – Required. Reward to be assigned to an action. Value should be between -1 and 1 inclusive.

class azure.cognitiveservices.personalizer.models.RankableAction(*, id: str, features, **kwargs)[source]

Bases: msrest.serialization.Model

An action with it’s associated features used for ranking.

All required parameters must be populated in order to send to Azure.

Parameters
  • id (str) – Required. Id of the action.

  • features (list[object]) – Required. List of dictionaries containing features.

class azure.cognitiveservices.personalizer.models.RankRequest(*, actions, context_features=None, excluded_actions=None, event_id: str = None, defer_activation: bool = False, **kwargs)[source]

Bases: msrest.serialization.Model

Request a set of actions to be ranked by the Personalizer service.

All required parameters must be populated in order to send to Azure.

Parameters
  • context_features (list[object]) – Features of the context used for Personalizer as a dictionary of dictionaries. This depends on the application, and typically includes features about the current user, their device, profile information, data about time and date, etc.

  • actions (list[RankableAction]) – Required. The set of actions the Personalizer service can pick from. The set should not contain more than 50 actions. The order of the actions does not affect the rank result but the order should match the sequence your application would have used to display them.

  • excluded_actions (list[str]) – The set of action ids to exclude from ranking.

  • event_id (str) – Optionally pass an eventId that uniquely identifies this Rank event. If null, the service generates a unique eventId. The eventId will be used for associating this request with its reward, as well as seeding the pseudo-random generator when making a Personalizer call.

  • defer_activation (bool) – Send false if the user will see the rank results, therefore Personalizer will expect a Reward call, otherwise it will assign the default Reward to the event. Send true if it is possible the user will not see the rank results, because the page is rendering later, or the Rank results may be overridden by code further downstream. Default value: False .

class azure.cognitiveservices.personalizer.models.RankedAction(**kwargs)[source]

Bases: msrest.serialization.Model

A ranked action with its resulting probability.

Variables are only populated by the server, and will be ignored when sending a request.

Variables
  • id (str) – Id of the action

  • probability (float) – Probability of the action

class azure.cognitiveservices.personalizer.models.RankResponse(**kwargs)[source]

Bases: msrest.serialization.Model

A resulting ordered list of actions that result from a rank request.

Variables are only populated by the server, and will be ignored when sending a request.

Variables
  • ranking (list[RankedAction]) – The calculated ranking for the current request.

  • event_id (str) – The eventId for the round trip from request to response.

  • reward_action_id (str) – The action chosen by the Personalizer service. This is the action for which to report the reward. This might not be the first found in ‘ranking’ if an action in the request in first position was part of the excluded ids.

class azure.cognitiveservices.personalizer.models.ErrorCode[source]

Bases: str, enum.Enum

An enumeration.

bad_request = 'BadRequest'

Request could not be understood by the server.

internal_server_error = 'InternalServerError'

A generic error has occurred on the server.

resource_not_found = 'ResourceNotFound'

Requested resource does not exist on the server.