pub struct PromptLearningJob { /* private fields */ }Expand description
High-level prompt learning job orchestration.
Implementations§
Source§impl PromptLearningJob
impl PromptLearningJob
Sourcepub fn from_dict(
config: Value,
api_key: Option<&str>,
base_url: Option<&str>,
container_worker_token: Option<String>,
) -> Result<PromptLearningJob, CoreError>
pub fn from_dict( config: Value, api_key: Option<&str>, base_url: Option<&str>, container_worker_token: Option<String>, ) -> Result<PromptLearningJob, CoreError>
Create a job from a configuration dict.
§Arguments
config- Job configuration (algorithm, container_url, policy, etc.)api_key- Optional API key (uses env if not provided)base_url- Optional base URL (uses default if not provided)
§Example
ⓘ
let job = PromptLearningJob::from_dict(
serde_json::json!({
"algorithm": "gepa",
"container_url": "http://localhost:8000",
"env_name": "default",
"policy": { "model": "gpt-4o-mini", "provider": "openai" },
"gepa": { "rollout_budget": 100 }
}),
None,
None,
None,
)?;Sourcepub fn from_job_id(
job_id: &str,
api_key: Option<&str>,
base_url: Option<&str>,
) -> Result<PromptLearningJob, CoreError>
pub fn from_job_id( job_id: &str, api_key: Option<&str>, base_url: Option<&str>, ) -> Result<PromptLearningJob, CoreError>
Reconnect to an existing job by ID.
§Arguments
job_id- Existing job IDapi_key- Optional API keybase_url- Optional base URL
Sourcepub fn tracker(&self) -> &ProgressTracker
pub fn tracker(&self) -> &ProgressTracker
Get the progress tracker.
Sourcepub async fn submit(&mut self) -> Result<String, CoreError>
pub async fn submit(&mut self) -> Result<String, CoreError>
Submit the job to the backend.
Returns the job ID on success.
Sourcepub async fn get_status(&self) -> Result<PromptLearningResult, CoreError>
pub async fn get_status(&self) -> Result<PromptLearningResult, CoreError>
Get the current job status.
Sourcepub async fn poll_until_complete(
&self,
timeout_secs: f64,
interval_secs: f64,
) -> Result<PromptLearningResult, CoreError>
pub async fn poll_until_complete( &self, timeout_secs: f64, interval_secs: f64, ) -> Result<PromptLearningResult, CoreError>
Poll until the job reaches a terminal state.
§Arguments
timeout_secs- Maximum time to waitinterval_secs- Polling interval
Sourcepub async fn stream_until_complete<F>(
&mut self,
timeout_secs: f64,
on_event: Option<F>,
) -> Result<PromptLearningResult, CoreError>where
F: FnMut(&ParsedEvent),
pub async fn stream_until_complete<F>(
&mut self,
timeout_secs: f64,
on_event: Option<F>,
) -> Result<PromptLearningResult, CoreError>where
F: FnMut(&ParsedEvent),
Stream events until completion with callback.
§Arguments
timeout_secs- Maximum time to waiton_event- Optional callback for each event
Sourcepub async fn get_results(&self) -> Result<PromptResults, CoreError>
pub async fn get_results(&self) -> Result<PromptResults, CoreError>
Get detailed results including prompt extraction.
This fetches events to extract the best prompts.
Auto Trait Implementations§
impl Freeze for PromptLearningJob
impl !RefUnwindSafe for PromptLearningJob
impl Send for PromptLearningJob
impl Sync for PromptLearningJob
impl Unpin for PromptLearningJob
impl !UnwindSafe for PromptLearningJob
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