pub struct EvalClient<'a> { /* private fields */ }Expand description
Eval API client.
Use this to submit, poll, and cancel evaluation jobs.
Implementations§
Source§impl<'a> EvalClient<'a>
impl<'a> EvalClient<'a>
Sourcepub async fn submit(&self, request: EvalJobRequest) -> Result<String, CoreError>
pub async fn submit(&self, request: EvalJobRequest) -> Result<String, CoreError>
Submit an evaluation job.
§Arguments
request- The eval job configuration
§Returns
The job ID on success.
§Example
ⓘ
let job_id = client.eval().submit(EvalJobRequest {
container_url: "http://localhost:8000".into(),
env_name: "default".into(),
seeds: vec![1, 2, 3, 4, 5],
policy: PolicyConfig::default(),
..Default::default()
}).await?;Sourcepub async fn submit_raw(&self, request: Value) -> Result<String, CoreError>
pub async fn submit_raw(&self, request: Value) -> Result<String, CoreError>
Submit a raw evaluation job from a JSON value.
Sourcepub async fn get_status(&self, job_id: &str) -> Result<EvalResult, CoreError>
pub async fn get_status(&self, job_id: &str) -> Result<EvalResult, CoreError>
Sourcepub async fn get_results(&self, job_id: &str) -> Result<Value, CoreError>
pub async fn get_results(&self, job_id: &str) -> Result<Value, CoreError>
Get detailed eval results for a job.
This includes per-seed metrics, tokens, costs, and errors.
Sourcepub async fn download_traces(&self, job_id: &str) -> Result<Vec<u8>, CoreError>
pub async fn download_traces(&self, job_id: &str) -> Result<Vec<u8>, CoreError>
Download traces for an eval job as a ZIP archive.
Sourcepub async fn poll_until_complete(
&self,
job_id: &str,
timeout_secs: f64,
interval_secs: f64,
) -> Result<EvalResult, CoreError>
pub async fn poll_until_complete( &self, job_id: &str, timeout_secs: f64, interval_secs: f64, ) -> Result<EvalResult, CoreError>
Poll an eval job until it reaches a terminal state.
§Arguments
job_id- The job ID to polltimeout_secs- Maximum time to wait (in seconds)interval_secs- Initial polling interval (in seconds)
§Returns
The final eval result.
§Example
ⓘ
let result = client.eval().poll_until_complete(&job_id, 1800.0, 10.0).await?;
println!("Mean reward: {:?}", result.mean_reward);Sourcepub async fn cancel(
&self,
job_id: &str,
reason: Option<String>,
) -> Result<Value, CoreError>
pub async fn cancel( &self, job_id: &str, reason: Option<String>, ) -> Result<Value, CoreError>
Cancel a running eval job.
§Arguments
job_id- The job ID to cancelreason- Optional cancellation reason
Auto Trait Implementations§
impl<'a> Freeze for EvalClient<'a>
impl<'a> !RefUnwindSafe for EvalClient<'a>
impl<'a> Send for EvalClient<'a>
impl<'a> Sync for EvalClient<'a>
impl<'a> Unpin for EvalClient<'a>
impl<'a> !UnwindSafe for EvalClient<'a>
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request