pub enum StructuredOutputError {
PromptError(Box<PromptError>),
DeserializationError(Error),
EmptyResponse,
}Expand description
Errors that can occur when using typed structured output via TypedPrompt::prompt_typed.
When the failure wraps PromptError that in turn wraps a CompletionError
exposing a provider response, Self::provider_response_body,
Self::provider_response_json, and Self::provider_response_status forward
through the chain.
Variants§
PromptError(Box<PromptError>)
An error occurred during the prompt execution.
DeserializationError(Error)
Failed to deserialize the model’s response into the target type.
EmptyResponse
The model returned an empty response.
Implementations§
Source§impl StructuredOutputError
impl StructuredOutputError
Sourcepub fn provider_response_body(&self) -> Option<&str>
pub fn provider_response_body(&self) -> Option<&str>
Returns the provider response body when this wraps a prompt error that exposes one.
Sourcepub fn provider_response_json(&self) -> Result<Option<Value>, Error>
pub fn provider_response_json(&self) -> Result<Option<Value>, Error>
Parses the provider response body as JSON when available through a wrapped prompt error.
Returns:
Ok(Some(value))when a body is present and valid JSON.Ok(None)when no provider response body is available.Err(error)when a body is present but isn’t valid JSON.
Sourcepub fn provider_response_status(&self) -> Option<StatusCode>
pub fn provider_response_status(&self) -> Option<StatusCode>
Returns the HTTP status when this wraps a prompt error that preserves one.
Trait Implementations§
Source§impl Debug for StructuredOutputError
impl Debug for StructuredOutputError
Source§impl Display for StructuredOutputError
impl Display for StructuredOutputError
Source§impl Error for StructuredOutputError
impl Error for StructuredOutputError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl From<Box<PromptError>> for StructuredOutputError
impl From<Box<PromptError>> for StructuredOutputError
Source§fn from(source: Box<PromptError>) -> Self
fn from(source: Box<PromptError>) -> Self
Auto Trait Implementations§
impl !RefUnwindSafe for StructuredOutputError
impl !UnwindSafe for StructuredOutputError
impl Freeze for StructuredOutputError
impl Send for StructuredOutputError
impl Sync for StructuredOutputError
impl Unpin for StructuredOutputError
impl UnsafeUnpin for StructuredOutputError
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> DebuggableStorage for T
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> 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>
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>
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> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.