pub struct SystemOneRequest {
pub state: Value,
pub model: Option<String>,
pub questions: BTreeMap<String, Question>,
}Expand description
A request to answer questions about some content.
The state is the content to evaluate — anything that serializes to a
JSON string, object, or array (numbers, booleans, and null are rejected
by client-side validation). Questions are keyed by caller-chosen IDs that
the response uses to key its answers.
let request = SystemOneRequest::new("Please help.")
.model("jev-1.13.0")
.question("billing", Noul::new("Is this about billing?"))
.question(
"urgency",
Score::new("How urgent?", ["Can wait", "Needs attention today"]),
);Fields§
§state: ValueThe content to evaluate: JSON string, object, or array.
model: Option<String>Model name or alias; None uses the client’s default model.
questions: BTreeMap<String, Question>Questions keyed by caller-chosen IDs.
Implementations§
Source§impl SystemOneRequest
impl SystemOneRequest
Sourcepub fn new(state: impl Into<Value>) -> Self
pub fn new(state: impl Into<Value>) -> Self
Creates a request from state that is already a JSON value.
The state must serialize to a JSON string, object, or array;
numbers, booleans, and null are rejected by
Client::system_one before any network
I/O.
Sourcepub fn with_state_serialize<T: Serialize>(state: &T) -> Result<Self, Error>
pub fn with_state_serialize<T: Serialize>(state: &T) -> Result<Self, Error>
Creates a request by serializing any Serialize value as the state.
The serialized state must be a JSON string, object, or array.