pub struct ScheduledPrompt {
pub id: String,
pub name: String,
pub schedule: CronExpression,
pub prompt_template: String,
pub session_id: Option<String>,
pub enabled: bool,
pub metadata: HashMap<String, String>,
}Expand description
A prompt template paired with a cron schedule and target pipeline.
Created via ScheduledPrompt::new and registered with a Scheduler.
Each ScheduledPrompt carries a unique id (UUID v4) assigned at
construction time.
Fields§
§id: StringUnique identifier, auto-assigned at construction.
name: StringHuman-readable label (e.g. "health-check" or "daily-summary").
schedule: CronExpressionThe cron expression controlling when this prompt fires.
prompt_template: StringThe prompt text template submitted to the pipeline.
session_id: Option<String>Optional session identifier. When None, a new UUID is used per run.
enabled: boolWhether this scheduled prompt is currently active.
metadata: HashMap<String, String>Optional arbitrary metadata forwarded with each submitted request.
Implementations§
Source§impl ScheduledPrompt
impl ScheduledPrompt
Sourcepub fn new(
name: impl Into<String>,
cron_expr: &str,
prompt_template: impl Into<String>,
) -> Result<Self, OrchestratorError>
pub fn new( name: impl Into<String>, cron_expr: &str, prompt_template: impl Into<String>, ) -> Result<Self, OrchestratorError>
Construct a new ScheduledPrompt with a generated UUID and enabled by default.
§Errors
Returns OrchestratorError::ConfigError when cron_expr cannot be
parsed.
§Examples
use tokio_prompt_orchestrator::scheduler::ScheduledPrompt;
let sp = ScheduledPrompt::new("health", "*/5 *", "ping").unwrap();
assert!(sp.enabled);
assert!(!sp.id.is_empty());Sourcepub fn with_session(self, session_id: impl Into<String>) -> Self
pub fn with_session(self, session_id: impl Into<String>) -> Self
Builder: set a fixed session identifier for all runs of this prompt.
§Panics
This function does not panic.
Trait Implementations§
Source§impl Clone for ScheduledPrompt
impl Clone for ScheduledPrompt
Source§fn clone(&self) -> ScheduledPrompt
fn clone(&self) -> ScheduledPrompt
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ScheduledPrompt
impl Debug for ScheduledPrompt
Source§impl<'de> Deserialize<'de> for ScheduledPrompt
impl<'de> Deserialize<'de> for ScheduledPrompt
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for ScheduledPrompt
impl RefUnwindSafe for ScheduledPrompt
impl Send for ScheduledPrompt
impl Sync for ScheduledPrompt
impl Unpin for ScheduledPrompt
impl UnsafeUnpin for ScheduledPrompt
impl UnwindSafe for ScheduledPrompt
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§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>
T in a tonic::Request