/// <summary> Report reward between 0 and 1 that resulted from using the action specified in rewardActionId, for the specified event. </summary> /// <param name="eventId"> The event id this reward applies to. </param> /// <param name="reward"> The reward should be a floating point number, typically between 0 and 1. </param> /// <param name="cancellationToken"> The cancellation token to use. </param> public virtual Response Reward(string eventId, float reward, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("PersonalizerClient.Reward"); scope.Start(); try { PersonalizerRewardOptions rewardOptions = new PersonalizerRewardOptions(reward); return(EventsRestClient.Reward(eventId, rewardOptions, cancellationToken)); } catch (Exception e) { scope.Failed(e); throw; } }
/// <summary> Report reward between 0 and 1 that resulted from using the action specified in rewardActionId, for the specified event. </summary> /// <param name="eventId"> The event id this reward applies to. </param> /// <param name="reward"> The reward should be a floating point number, typically between 0 and 1. </param> /// <param name="cancellationToken"> The cancellation token to use. </param> public virtual Response Reward(string eventId, float reward, CancellationToken cancellationToken = default) { using var scope = clientDiagnostics.CreateScope("PersonalizerClient.Reward"); scope.Start(); try { if (useLocalInference) { validateAndUpdateLiveModelConfig(); return(rlNetProcessor.Value.Reward(eventId, reward)); } else { PersonalizerRewardOptions rewardOptions = new PersonalizerRewardOptions(reward); return(EventsRestClient.Reward(eventId, rewardOptions, cancellationToken)); } } catch (Exception e) { scope.Failed(e); throw; } }