#[non_exhaustive]pub enum Value {
Tensor {
values: Arc<Vec<f64>>,
shape: Vec<usize>,
},
Text(Arc<str>),
Json(Arc<Value>),
Bytes(Arc<Vec<u8>>),
Object(Arc<Vec<u8>>),
Empty,
}Expand description
Typed values flowing between filters in a pipeline.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Tensor
Numeric tensor data (shape + flat data).
values is wrapped in Arc so that cloning a Value is O(1).
Fields
Text(Arc<str>)
UTF-8 text (Arc-wrapped for cheap cloning).
Distinct from Json(String): a prompt or completion is text, not a
JSON document that happens to be a string. Keeping them apart means
no round-trip through quoting/escaping on every hop, and lets a
schema say “this edge carries text” — see crate::schema::DataType.
Json(Arc<Value>)
Structured JSON data (Arc-wrapped for cheap cloning).
Bytes(Arc<Vec<u8>>)
Raw bytes (Arc-wrapped for cheap cloning).
Object(Arc<Vec<u8>>)
Opaque serialized object (e.g. Python pickle). Soma passes it through without interpreting the contents. Used for efficient inter-filter data transfer when the producing and consuming runtimes share a serialization format.
Empty
Empty / void value
Implementations§
Source§impl Value
impl Value
Sourcepub fn tensor(values: Vec<f64>, shape: Vec<usize>) -> Self
pub fn tensor(values: Vec<f64>, shape: Vec<usize>) -> Self
Create a tensor from flat row-major data and a shape.
Sourcepub fn object(data: Vec<u8>) -> Self
pub fn object(data: Vec<u8>) -> Self
Create an opaque serialized object (e.g. a Python pickle).
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Is this the Value::Empty variant?
Sourcepub fn as_text(&self) -> Option<&str>
pub fn as_text(&self) -> Option<&str>
Try to extract text.
A Json string counts: a filter that returns "hello" as JSON and one
that returns it as text should both satisfy a consumer wanting text.
Sourcepub fn to_plain_json(&self) -> Value
pub fn to_plain_json(&self) -> Value
Natural JSON form for user-facing fan-in: tensors become (nested) number arrays, Json unwraps, Empty is null. This is what a multi-predecessor node receives per upstream branch — never the internal serde-tagged encoding.