Skip to main content

ProviderAttemptRecord

Struct ProviderAttemptRecord 

Source
pub struct ProviderAttemptRecord {
Show 13 fields pub attempt: u32, pub purpose: String, pub provider_key: ProviderKey, pub model_key: ModelKey, pub request_id: String, pub prompt_version: Option<String>, pub prompt_ref: Option<PromptRef>, pub outcome: ProviderAttemptOutcome, pub latency_ms: Option<u64>, pub input_tokens: Option<u64>, pub output_tokens: Option<u64>, pub temperature: Option<f32>, pub finish_reasons: Vec<String>,
}
Expand description

One model call (spec §20.7: “record every provider attempt”).

§Why attempt is a number and AttemptId is an identifier

A model call leaves nothing behind outside the process. When one fails or times out, the only thing anyone needs to know is which try it was inside a stage this record already identifies — the turn, the purpose, the provider and the model — so a position in that sequence says everything, and nothing else ever refers to it.

An external effect attempt is the opposite: it may have happened even though the answer never arrived (spec §16.5), and settling it means naming that exact attempt to a remote system. That is what AttemptId is for, why CommandOutcome::OutcomeUnknown carries one, and why ReplayRecord::reconciliation_attempt_ids lists them. The asymmetry is the difference between counting retries and naming an effect, not an oversight.

Note that this record is compared with PartialEq only: temperature is a float, so Eq would be a promise about NaN that the type cannot keep.

Fields§

§attempt: u32

1-based attempt number within the stage. A plain ordinal on purpose; see the type documentation.

§purpose: String

Stage purpose (e.g. "extract").

§provider_key: ProviderKey

Provider key.

§model_key: ModelKey

Model key.

§request_id: String

Stable request id sent to the provider.

§prompt_version: Option<String>

Prompt or template version, when known.

§prompt_ref: Option<PromptRef>

The exact prompt text this call ran under, when a prompt source supplied it (roadmap: “prompt management, with an optional Langfuse prompt source”).

None for a stage whose instructions are compiled into the library — which is every stage until an application configures a turnframe-prompt source — and also for a stage whose configured source failed and fell back to those built-in instructions. That is deliberate: the absence of a reference is the audit signal that the text was not the text the source was asked for.

Unlike prompt_version, which is a bare label, this carries the digest of the text, so the record can be falsified rather than merely believed.

§outcome: ProviderAttemptOutcome

Outcome.

§latency_ms: Option<u64>

Latency in milliseconds.

§input_tokens: Option<u64>

Input tokens, when reported.

§output_tokens: Option<u64>

Output tokens, when reported.

§temperature: Option<f32>

Sampling temperature the request carried, when the stage set one.

None means the call left the provider’s default in place, which is not the same as Some(0.0). An observability bridge reports it as gen_ai.request.temperature; kept at the request’s own f32 precision so the audit value is the value that was sent, not a widened copy of it.

§finish_reasons: Vec<String>

Finish reasons the provider reported for the response, in the order it reported them, verbatim.

Empty when the attempt produced none — a transport failure, a cancellation, or a provider that does not report them. Providers spell these differently ("stop", "length", "max_tokens", …) and the strings are kept as received: normalizing them here would erase the distinction an audit is being read for. An observability bridge reports them as gen_ai.response.finish_reasons.

Trait Implementations§

Source§

impl Clone for ProviderAttemptRecord

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ProviderAttemptRecord

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for ProviderAttemptRecord

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for ProviderAttemptRecord

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for ProviderAttemptRecord

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for ProviderAttemptRecord

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.