/// Errors from the API layer (HTTP, JSON, SSE, auth).pub enum ApiError {Http strJson strApi(uint, str, bool)Sse strAuth strRetriesExhausted uint}fn api_error_to_string(err ApiError) str {is err {ApiError.Http(msg) -> return f"Http: $msg",ApiError.Json(msg) -> return f"Json: $msg",ApiError.Api(status msg retry) -> return f"Api($status): $msg",ApiError.Sse(msg) -> return f"Sse: $msg",ApiError.Auth(msg) -> return f"Auth: $msg",ApiError.RetriesExhausted(n) -> return f"RetriesExhausted($n)"}return "Unknown ApiError"}/// Errors from tool execution.pub enum ToolError {ExecutionFailed strInvalidInput strPermissionDenied str}pub fn tool_error_to_string(err ToolError) str {is err {ToolError.ExecutionFailed(msg) -> return f"ExecutionFailed: $msg",ToolError.InvalidInput(msg) -> return f"InvalidInput: $msg",ToolError.PermissionDenied(msg) -> return f"PermissionDenied: $msg"}return "Unknown ToolError"}/// Errors from the agent runtime.pub enum RuntimeError {Api strMaxIterations uintEmptyResponse}fn runtime_error_to_string(err RuntimeError) str {is err {RuntimeError.Api(msg) -> return f"Api: $msg",RuntimeError.MaxIterations(n) -> return f"MaxIterations($n)",RuntimeError.EmptyResponse -> return "EmptyResponse"}return "Unknown RuntimeError"}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。