#[non_exhaustive]pub struct Request {
pub state: Content,
pub model: String,
pub questions: IndexMap<String, Question>,
pub extra: IndexMap<String, Value>,
}Expand description
An evaluation request: one state, judged by every question independently and in parallel.
use jev_client::{Choice, Noul, Request};
let request = Request::new("Help! My payouts have been failing for 3 days.", "jev-latest")
.question("is_urgent", Noul::new("Does this convey urgency?"))
.question(
"department",
Choice::new("Which team should handle this?")
.option("billing", "Payments, invoicing, refunds")
.option("technical", "Bugs, outages, integrations")
.bare_option("other"),
);
assert_eq!(request.questions.len(), 2);Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.state: ContentThe content to evaluate: a string, or structured data such as a chat log or a record.
The API rejects null and scalar values here.
model: StringThe model that handles the request: an alias such as jev-latest, or a versioned id such
as jev-1.13.0. Aliases move without notice; pin a versioned id once thresholds are tuned.
questions: IndexMap<String, Question>The questions, keyed by an id the caller chooses. Answers come back under the same ids.
Questions keep the order they were written in. Ids are never sent to the model. A repeated id is a parse error when reading JSON or YAML text directly (a parser that has already collapsed the document into a generic value keeps only the last one).
extra: IndexMap<String, Value>Top-level fields this version of the crate does not know, sent to the API unchanged.
The API currently rejects any unknown top-level field with an uninformative
400 Invalid request., so validation reports these before a request is spent.
Implementations§
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Request
impl<'de> Deserialize<'de> for Request
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>,
Source§impl JsonSchema for Request
impl JsonSchema for Request
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read more