pub struct JevClient {
pub api_key: Option<String>,
pub base_url: String,
pub model: String,
pub model_source: String,
pub provider: String,
pub timeout_ms: u64,
pub force_mock: bool,
pub fail_open: bool,
pub max_retries: u32,
pub retry_base_delay_ms: u64,
/* private fields */
}Fields§
§api_key: Option<String>§base_url: String§model: String§model_source: StringWhere the effective model came from: “argument” | “env” | “.jev.json” | “provider_default”.
provider: String§timeout_ms: u64§force_mock: bool§fail_open: boolFail-open (default): degrade to the offline engine and mark the response.
max_retries: u32Maximum provider attempts for retryable failures (429/5xx/timeout/network).
retry_base_delay_ms: u64Base delay for exponential backoff in ms.
Implementations§
Source§impl JevClient
impl JevClient
pub fn new( api_key: Option<String>, base_url: Option<String>, model: Option<String>, timeout_ms: Option<u64>, force_mock: bool, ) -> Self
Sourcepub fn resolve_model(
model: Option<String>,
provider: &str,
) -> (String, &'static str)
pub fn resolve_model( model: Option<String>, provider: &str, ) -> (String, &'static str)
Resolution order: explicit argument > JEV_MODEL env var > repository .jev.json
override > provider default. The generic placeholder (jev-latest, what
jev-harness init scaffolds) is treated as “no override” so scaffolded configs never
clobber provider model IDs.
pub fn with_mock() -> Self
pub fn with_provider(provider: &str, api_key: Option<String>) -> Self
pub fn redact_secrets(text: &str, secret: Option<&str>) -> String
Sourcepub fn with_failure_policy(
self,
fail_open: bool,
max_retries: u32,
retry_base_delay_ms: u64,
) -> Self
pub fn with_failure_policy( self, fail_open: bool, max_retries: u32, retry_base_delay_ms: u64, ) -> Self
Builder for the failure policy used by every command: fail-open is the default for gates; fail-closed surfaces errors instead.
Sourcepub fn retry_delay_ms(&self, attempt: u32, retry_after: Option<f64>) -> u64
pub fn retry_delay_ms(&self, attempt: u32, retry_after: Option<f64>) -> u64
Exponential backoff honoring a provider Retry-After. Fractional seconds are accepted so
the three runtimes agree on the delay; the value is capped for fast CI.
pub async fn system_one( &self, state: &str, questions: HashMap<String, Question>, ) -> Result<JevResponse, JevError>
Sourcepub fn parse_api_response(&self, val: &Value) -> Result<JevResponse, JevError>
pub fn parse_api_response(&self, val: &Value) -> Result<JevResponse, JevError>
Strictly parses a provider payload. A 200 whose fields have the wrong types is an error (handled by the failure policy), never a silently dropped answer or a defaulted score.
Sourcepub fn simulate_system_one(
&self,
state: &str,
questions: &HashMap<String, Question>,
model_name: &str,
) -> JevResponse
pub fn simulate_system_one( &self, state: &str, questions: &HashMap<String, Question>, model_name: &str, ) -> JevResponse
Fast regex-based deterministic decision simulation (< 500µs).