#[non_exhaustive]pub enum PromptError {
CompletionError(CompletionError),
MemoryError(MemoryError),
MaxTurnsError {
max_turns: usize,
chat_history: Box<Vec<Message>>,
prompt: Box<Message>,
},
PromptCancelled {
chat_history: Vec<Message>,
reason: String,
},
UnknownToolCall {
tool_name: String,
available_tools: Vec<String>,
allowed_tools: Vec<String>,
chat_history: Box<Vec<Message>>,
},
}Expand description
Errors from classic agent prompting.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
CompletionError(CompletionError)
A provider completion failed.
MemoryError(MemoryError)
Conversation memory failed to load or persist history.
MaxTurnsError
The run exhausted its total model-call budget.
Fields
PromptCancelled
A prompting loop was cancelled.
Fields
UnknownToolCall
The model attempted to call a tool unavailable for the current turn.
Implementations§
Source§impl PromptError
impl PromptError
Sourcepub fn provider_response_body(&self) -> Option<&str>
pub fn provider_response_body(&self) -> Option<&str>
Returns the provider response body exposed by a wrapped completion error.
Sourcepub fn provider_response_json(&self) -> Result<Option<Value>, Error>
pub fn provider_response_json(&self) -> Result<Option<Value>, Error>
Parses a wrapped provider response body as JSON when present.
Sourcepub fn provider_response_status(&self) -> Option<StatusCode>
pub fn provider_response_status(&self) -> Option<StatusCode>
Returns the HTTP status exposed by a wrapped completion error.
Trait Implementations§
Source§impl Debug for PromptError
impl Debug for PromptError
Source§impl Display for PromptError
impl Display for PromptError
Source§impl Error for PromptError
impl Error for PromptError
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()
Source§impl From<Box<PromptError>> for StreamingError
impl From<Box<PromptError>> for StreamingError
Source§fn from(source: Box<PromptError>) -> Self
fn from(source: Box<PromptError>) -> Self
Converts to this type from the input type.
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
Converts to this type from the input type.
Source§impl From<CompletionError> for PromptError
impl From<CompletionError> for PromptError
Source§fn from(source: CompletionError) -> Self
fn from(source: CompletionError) -> Self
Converts to this type from the input type.
Source§impl From<MemoryError> for PromptError
impl From<MemoryError> for PromptError
Source§fn from(source: MemoryError) -> Self
fn from(source: MemoryError) -> Self
Converts to this type from the input type.
Source§impl From<PromptError> for ExtractionError
impl From<PromptError> for ExtractionError
Source§fn from(source: PromptError) -> Self
fn from(source: PromptError) -> Self
Converts to this type from the input type.
Source§impl From<PromptError> for ScenarioError
Available on crate feature test-utils only.
impl From<PromptError> for ScenarioError
Available on crate feature
test-utils only.Source§fn from(source: PromptError) -> Self
fn from(source: PromptError) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl !Freeze for PromptError
impl !RefUnwindSafe for PromptError
impl !UnwindSafe for PromptError
impl Send for PromptError
impl Sync for PromptError
impl Unpin for PromptError
impl UnsafeUnpin for PromptError
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
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> 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.