pub enum PromptError {
CompletionError(ProviderError),
Report(ErrorReport),
MemoryError(MemoryError),
MaxTurnsError {
max_turns: usize,
chat_history: Vec<Message>,
prompt: Message,
},
PromptCancelled {
chat_history: Vec<Message>,
reason: String,
},
UnknownToolCall {
tool_name: String,
available_tools: Vec<String>,
allowed_tools: Vec<String>,
chat_history: Vec<Message>,
},
}Expand description
Errors from classic agent prompting.
Variants§
CompletionError(ProviderError)
A provider completion failed.
Report(ErrorReport)
Structured effect failure from the bus, a handler, a hook, or a stream item.
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 the provider response body of a wrapped completion error as JSON when present.
Sourcepub fn provider_request_id(&self) -> Option<&str>
pub fn provider_request_id(&self) -> Option<&str>
Returns the provider transport request id exposed by a wrapped completion error, or carried by a wire report.
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, or carried by a wire report.
Sourcepub fn provider_response_headers(&self) -> Option<&HeaderMap>
pub fn provider_response_headers(&self) -> Option<&HeaderMap>
Returns the response headers exposed by a wrapped completion error or report.
Source§impl PromptError
impl PromptError
Sourcepub fn prompt_cancelled(
chat_history: impl IntoIterator<Item = Message>,
reason: impl Into<String>,
) -> Self
pub fn prompt_cancelled( chat_history: impl IntoIterator<Item = Message>, reason: impl Into<String>, ) -> Self
Build a PromptError::PromptCancelled from the history available at
cancellation and a reason.
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)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl From<ErrorReport> for PromptError
impl From<ErrorReport> for PromptError
Source§fn from(source: ErrorReport) -> Self
fn from(source: ErrorReport) -> Self
Source§impl From<MemoryError> for PromptError
impl From<MemoryError> for PromptError
Source§fn from(source: MemoryError) -> Self
fn from(source: MemoryError) -> Self
Source§impl From<PromptError> for StreamingError
impl From<PromptError> for StreamingError
Source§fn from(source: PromptError) -> Self
fn from(source: PromptError) -> Self
Source§impl From<PromptError> for StructuredOutputError
impl From<PromptError> for StructuredOutputError
Source§fn from(source: PromptError) -> Self
fn from(source: PromptError) -> Self
Source§impl From<PromptError> for ScenarioError
Available on crate feature test-utils only.
impl From<PromptError> for ScenarioError
test-utils only.