File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
lib/llm/src/protocols/common Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ use serde::{Deserialize, Serialize};
1818pub use super :: preprocessor:: PreprocessedRequest ;
1919pub use super :: FinishReason ;
2020use crate :: protocols:: TokenIdType ;
21+ use dynamo_runtime:: protocols:: is_error:: IsError ;
2122
2223pub type TokenType = Option < String > ;
2324pub type LogProbs = Vec < f64 > ;
@@ -133,3 +134,17 @@ impl LLMEngineOutput {
133134 }
134135 }
135136}
137+
138+ impl IsError for LLMEngineOutput {
139+ fn from_err ( err : Box < dyn std:: error:: Error > ) -> Self {
140+ LLMEngineOutput :: error ( format ! ( "{:?}" , err) )
141+ }
142+
143+ fn err ( & self ) -> Option < Box < dyn std:: error:: Error > > {
144+ if let Some ( FinishReason :: Error ( err_msg) ) = & self . finish_reason {
145+ Some ( anyhow:: Error :: msg ( err_msg. clone ( ) ) . into ( ) )
146+ } else {
147+ None
148+ }
149+ }
150+ }
You can’t perform that action at this time.
0 commit comments