pub enum GenerateError<E> {
Provider(E),
Parse {
source: Error,
response: String,
},
}Expand description
Why a structured-output call failed.
LanguageModel::respond reports provider failures through the model’s own
LanguageModel::Error. Structured output adds a second, separate way to
fail — the model answered, but not with the requested shape — so this keeps
the two distinguishable instead of flattening both into one opaque error.
Callers need that distinction: a rate limit is worth retrying, a schema
mismatch is worth re-prompting, and an auth failure is worth neither.
Variants§
Provider(E)
The provider itself failed: transport, rate limit, auth, and so on.
Parse
The provider answered, but the response did not match the schema.
Carries the text that could not be parsed so callers can log or retry.
Trait Implementations§
Source§impl<E: Debug> Debug for GenerateError<E>
impl<E: Debug> Debug for GenerateError<E>
Source§impl<E: Display> Display for GenerateError<E>
impl<E: Display> Display for GenerateError<E>
Source§impl<E: Error + 'static> Error for GenerateError<E>
impl<E: Error + 'static> Error for GenerateError<E>
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Auto Trait Implementations§
impl<E> Freeze for GenerateError<E>where
E: Freeze,
impl<E> RefUnwindSafe for GenerateError<E>where
E: RefUnwindSafe,
impl<E> Send for GenerateError<E>where
E: Send,
impl<E> Sync for GenerateError<E>where
E: Sync,
impl<E> Unpin for GenerateError<E>where
E: Unpin,
impl<E> UnsafeUnpin for GenerateError<E>where
E: UnsafeUnpin,
impl<E> UnwindSafe for GenerateError<E>where
E: UnwindSafe,
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