pub struct Client { /* private fields */ }Expand description
Client for the TypeSafe System One API. Cheap to clone; shares one HTTP pool.
Implementations§
Source§impl Client
impl Client
Sourcepub fn builder() -> ClientBuilder
pub fn builder() -> ClientBuilder
Start configuring a client.
Sourcepub fn from_env() -> Result<Self>
pub fn from_env() -> Result<Self>
Client configured entirely from TYPESAFE_API_KEY, TYPESAFE_DEFAULT_MODEL and
TYPESAFE_BASE_URL.
Sourcepub fn default_model(&self) -> &str
pub fn default_model(&self) -> &str
The model used when Client::system_one is called.
Sourcepub fn system_one(&self) -> SystemOneRequest<'_>
pub fn system_one(&self) -> SystemOneRequest<'_>
Start building a POST /v1/systemone call: state, questions, then .send().
Sourcepub async fn evaluate<K>(
&self,
state: impl Serialize,
questions: impl IntoIterator<Item = (K, Question)>,
) -> Result<SystemOneResponse>
pub async fn evaluate<K>( &self, state: impl Serialize, questions: impl IntoIterator<Item = (K, Question)>, ) -> Result<SystemOneResponse>
Evaluate state against an existing map of questions with the client’s default
model. The builder form is Client::system_one.
Questions are keyed by the ids you choose; answers come back under the same ids. All questions see the same state and are evaluated independently.
Sourcepub async fn evaluate_with_model<K>(
&self,
model: &str,
state: impl Serialize,
questions: impl IntoIterator<Item = (K, Question)>,
) -> Result<SystemOneResponse>
pub async fn evaluate_with_model<K>( &self, model: &str, state: impl Serialize, questions: impl IntoIterator<Item = (K, Question)>, ) -> Result<SystemOneResponse>
Client::evaluate with an explicit model.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Client
impl !UnwindSafe for Client
impl Freeze for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl UnsafeUnpin for Client
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more