Skip to main content

PreviousResponseIdResolver

Type Alias PreviousResponseIdResolver 

Source
pub type PreviousResponseIdResolver<R> = Arc<dyn Fn(&CompletionResponse<R>) -> Option<String> + Send + Sync>;
Expand description

Caller-supplied resolver that returns the chain ancestor for the current turn (the previous_response_id argument sent to the provider) so it can be stamped on prompt.completed.

Useful for stateful endpoints — OpenAI Responses, future Anthropic and Google equivalents — where the host runtime tracks the chain itself (typically in a task-local or session object) and the provider response payload does not echo the value back. The Rig PromptHook signature does not currently propagate it, so this is the escape hatch.

When set and the resolver returns Some(id), that value is stamped on prompt.completed; None leaves the field unset.

Aliased Type§

pub struct PreviousResponseIdResolver<R> { /* private fields */ }