pub struct TypeSafe { /* private fields */ }Expand description
Classifier over TypeSafe’s Jev evaluation API, billed to the
operator’s own key.
Implementations§
Source§impl TypeSafe
impl TypeSafe
Sourcepub fn new(
http: Arc<dyn HttpClient>,
clock: Arc<dyn Clock>,
api_key: Option<String>,
) -> Self
pub fn new( http: Arc<dyn HttpClient>, clock: Arc<dyn Clock>, api_key: Option<String>, ) -> Self
api_key: None (or a blank key) makes every ask answer
ClassifierError::NotConfigured before any network call. The model
is DEFAULT_MODEL and the endpoint DEFAULT_ENDPOINT; override
either with TypeSafe::with_model / TypeSafe::with_endpoint.
Sourcepub fn with_model(self, model: impl Into<String>) -> Self
pub fn with_model(self, model: impl Into<String>) -> Self
Pins the model every request carries. The default is already a
pinned version id rather than the jev-latest alias, because an
alias moves without notice; use this to move to a new version on
your own schedule.
Sourcepub fn with_endpoint(self, endpoint: impl Into<String>) -> Self
pub fn with_endpoint(self, endpoint: impl Into<String>) -> Self
Overrides the API endpoint (tests point this at a scripted client’s
expected host; production uses DEFAULT_ENDPOINT).
Sourcepub fn from_env(
http: Arc<dyn HttpClient>,
clock: Arc<dyn Clock>,
) -> Option<Self>
pub fn from_env( http: Arc<dyn HttpClient>, clock: Arc<dyn Clock>, ) -> Option<Self>
Some(...) only when TYPESAFE_API_KEY is set: an absent key means
the port is not provided at all. TYPESAFE_MODEL, when set and
non-blank, pins the model instead of DEFAULT_MODEL (the same
pattern ANTHROPIC_MODEL follows). On Workers the venture should
read the secret from its Env and use TypeSafe::new instead
(std::env has no Workers vars). A key that is set but blank still
constructs — and ask then answers NotConfigured.
Trait Implementations§
Source§impl Classifier for TypeSafe
impl Classifier for TypeSafe
Source§fn profile(&self) -> ClassifierProfile
fn profile(&self) -> ClassifierProfile
confidence comes from, and
how much state it will carry.