pub struct RewardObservation {
pub value: f64,
pub reward_type: RewardType,
pub scope: RewardScope,
pub source: RewardSource,
pub objective_key: ObjectiveKey,
pub event_id: Option<String>,
pub turn_number: Option<i32>,
pub metadata: HashMap<String, Value>,
}Expand description
A single reward observation.
Fields§
§value: f64The reward value.
reward_type: RewardTypeType of reward signal.
scope: RewardScopeWhether this is event-level or outcome-level.
source: RewardSourceSource of the reward signal.
objective_key: ObjectiveKeyWhich objective this reward corresponds to.
event_id: Option<String>Optional event ID (for event-level rewards).
turn_number: Option<i32>Optional turn number.
metadata: HashMap<String, Value>Additional metadata.
Implementations§
Source§impl RewardObservation
impl RewardObservation
Sourcepub fn new(value: f64) -> RewardObservation
pub fn new(value: f64) -> RewardObservation
Create a new reward observation.
Sourcepub fn outcome(value: f64) -> RewardObservation
pub fn outcome(value: f64) -> RewardObservation
Create an outcome-level reward.
Sourcepub fn event(value: f64, event_id: impl Into<String>) -> RewardObservation
pub fn event(value: f64, event_id: impl Into<String>) -> RewardObservation
Create an event-level reward.
Sourcepub fn with_type(self, reward_type: RewardType) -> RewardObservation
pub fn with_type(self, reward_type: RewardType) -> RewardObservation
Set the reward type.
Sourcepub fn with_scope(self, scope: RewardScope) -> RewardObservation
pub fn with_scope(self, scope: RewardScope) -> RewardObservation
Set the scope.
Sourcepub fn with_source(self, source: RewardSource) -> RewardObservation
pub fn with_source(self, source: RewardSource) -> RewardObservation
Set the source.
Trait Implementations§
Source§impl Clone for RewardObservation
impl Clone for RewardObservation
Source§fn clone(&self) -> RewardObservation
fn clone(&self) -> RewardObservation
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RewardObservation
impl Debug for RewardObservation
Source§impl<'de> Deserialize<'de> for RewardObservation
impl<'de> Deserialize<'de> for RewardObservation
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<RewardObservation, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<RewardObservation, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for RewardObservation
impl Serialize for RewardObservation
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for RewardObservation
impl RefUnwindSafe for RewardObservation
impl Send for RewardObservation
impl Sync for RewardObservation
impl Unpin for RewardObservation
impl UnwindSafe for RewardObservation
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§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>
Wrap the input message
T in a tonic::Request