pub struct Response {
pub id: String,
pub model: String,
pub role: Role,
pub content: Vec<ContentBlock>,
pub stop_reason: Option<String>,
pub usage: Option<TokenUsage>,
}Expand description
The types a host-supplied provider is written with.
RuntimeBuilder::with_provider_instance takes an impl Provider — the
trait itself is re-exported at the crate root, beside the other types
basis’s surface makes a caller name — and implementing it touches exactly
this set: ProviderDescriptor (naming itself by ProviderId) and
ProviderCapabilities to say who and what, ModelInfo to list
models, Request to receive, mentra’s ProviderError to fail with,
and a ProviderEventStream to answer with — assembled whole from a
Response (content in ContentBlocks, spoken in a Role, costed
in TokenUsage) via provider_event_stream_from_response, or event
by event from ProviderEvent (ContentBlockStart,
ContentBlockDelta). Re-exported beside the executor types above and
under their rule: the builder makes a host name these, so basis
re-exports them rather than costing the host a mentra dependency and a
version pin that can skew. Mind the name: this ProviderError is
mentra’s — the one a Provider implementation answers with — not
crate::provider::ProviderError, which is how basis’s own resolution
refuses.
A complete response collected from a provider stream.
Fields§
§id: String§model: String§role: Role§content: Vec<ContentBlock>§stop_reason: Option<String>§usage: Option<TokenUsage>Implementations§
Source§impl Response
impl Response
pub fn into_provider_events(self) -> Vec<ProviderEvent>
Sourcepub fn into_compaction_response(self) -> CompactionResponse
pub fn into_compaction_response(self) -> CompactionResponse
Converts a normal response into a compaction response by collecting its text output.
Sourcepub fn into_memory_summarize_response(
self,
) -> Result<MemorySummarizeResponse, ProviderError>
pub fn into_memory_summarize_response( self, ) -> Result<MemorySummarizeResponse, ProviderError>
Converts a normal response into a memory summarize response by parsing its text output.