pub struct LlmResponse {
pub hs_code: String,
pub confidence: f32,
pub rationale: String,
pub alternatives: Vec<LlmAlternative>,
}Expand description
Response that LlmClassifier::classify must return.
All fields map directly to fields of HsPrediction.
§JSON schema expected from the LLM
{
"hs_code": "291511",
"confidence": 0.85,
"rationale": "Acetic acid → heading 29.15 (saturated acyclic carboxylic acid).",
"alternatives": [
{ "hs_code": "291519", "confidence": 0.10, "reason": "If purity threshold not met." }
]
}Fields§
§hs_code: StringSix-digit HS 2022 code, no punctuation (e.g. "291511").
The pipeline validates this is exactly 6 ASCII digits before accepting it.
confidence: f32Confidence score in [0.0, 1.0].
rationale: StringNatural-language rationale (1–3 sentences).
alternatives: Vec<LlmAlternative>Alternative HS codes with lower confidence. May be empty.
Trait Implementations§
Source§impl Clone for LlmResponse
impl Clone for LlmResponse
Source§fn clone(&self) -> LlmResponse
fn clone(&self) -> LlmResponse
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for LlmResponse
impl Debug for LlmResponse
Source§impl<'de> Deserialize<'de> for LlmResponse
impl<'de> Deserialize<'de> for LlmResponse
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for LlmResponse
impl RefUnwindSafe for LlmResponse
impl Send for LlmResponse
impl Sync for LlmResponse
impl Unpin for LlmResponse
impl UnsafeUnpin for LlmResponse
impl UnwindSafe for LlmResponse
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