pub struct TextContent {
pub text: String,
pub annotations: Option<Vec<Annotation>>,
pub refusal: bool,
}Expand description
Plain text content.
Fields§
§text: String§annotations: Option<Vec<Annotation>>§refusal: boolSet when this text is a provider refusal rather than an answer.
A refusal is the model declining to produce the requested output. It
arrives as text and reads like text, but it is not the answer, and
treating it as one is a silent correctness bug: a caller that asked
for JSON gets prose it will fail to parse, and a caller reading
Message::text gets a plausible-looking
string that answers nothing.
Mirrors upstream’s additional_properties["model_output_kind"] == "refusal" (#7992), as a typed field rather than an untyped bag since
that is the only marker this port needs to carry. Refusal text is kept
as its own content item and never merged with ordinary text — see
Message::text for how it is then
withheld.
Implementations§
Source§impl TextContent
impl TextContent
pub fn new(text: impl Into<String>) -> TextContent
Sourcepub fn refusal(text: impl Into<String>) -> TextContent
pub fn refusal(text: impl Into<String>) -> TextContent
A TextContent marked as a provider refusal — see
TextContent::refusal.
Trait Implementations§
Source§impl Clone for TextContent
impl Clone for TextContent
Source§fn clone(&self) -> TextContent
fn clone(&self) -> TextContent
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more