Struct Plugin Runtime
Generated from cargo doc --no-deps -p nemo-relay-builtins -p nemo-relay-diagnostics -p nemo-relay-logging -p nemo-relay-plugin-host -p nemo-relay-codecs -p nemo-relay -p nemo-relay-runtime -p nemo-relay-model-pricing -p nemo-relay-resource-metrics -p nemo-relay-observability -p nemo-relay-adaptive -p nemo-relay-pii-redaction -p nemo-relay-ffi -p nemo-relay-types -p nemo-relay-plugin -p nemo-relay-worker-proto -p nemo-relay-worker.
Implementations
impl PluginRuntime
impl PluginRuntime
diagnostics
pub fn diagnostics(&self) -> Diagnostics
current_scope_stack_snapshot
pub fn current_scope_stack_snapshot(&self) -> Result<Option<ScopeStackSnapshot>>
list_runtime_registrations
pub fn list_runtime_registrations(
&self,
kinds: Option<&BTreeSet<RuntimeRegistrationKind>>,
) -> Result<Vec<RuntimeRegistrationIdentity>>
scope_stack_active
pub fn scope_stack_active(&self) -> bool
current_scope
pub fn current_scope(&self) -> Result<ScopeHandle<'_>>
Get the current scope handle or fail if the host reports no current scope.
push_scope
pub fn push_scope(
&self,
name: &str,
scope_type: ScopeType,
data: Option<&Json>,
metadata: Option<&Json>,
input: Option<&Json>,
) -> Result<ScopeHandle<'_>>
push_scope_with_options
pub fn push_scope_with_options(
&self,
name: &str,
scope_type: ScopeType,
data: Option<&Json>,
metadata: Option<&Json>,
input: Option<&Json>,
options: ScopeOptions<'_>,
) -> Result<ScopeHandle<'_>>
Push a scope with an explicit parent, behavior flags, or start time.
pop_scope
pub fn pop_scope(
&self,
handle: &ScopeHandle<'_>,
output: Option<&Json>,
metadata: Option<&Json>,
) -> Result<()>
scope
pub fn scope(
&self,
name: &str,
scope_type: ScopeType,
data: Option<&Json>,
metadata: Option<&Json>,
input: Option<&Json>,
) -> Result<ScopeGuard<'_>>
Push a scope and return a guard that closes it when dropped.
scope_with_options
pub fn scope_with_options(
&self,
name: &str,
scope_type: ScopeType,
data: Option<&Json>,
metadata: Option<&Json>,
input: Option<&Json>,
options: ScopeOptions<'_>,
) -> Result<ScopeGuard<'_>>
Open a scope guard with an explicit parent, behavior flags, or start time.
scope_at
pub fn scope_at(
&self,
name: &str,
scope_type: ScopeType,
data: Option<&Json>,
metadata: Option<&Json>,
input: Option<&Json>,
started_at: SystemTime,
) -> Result<ScopeGuard<'_>>
emit_mark
pub fn emit_mark(
&self,
name: &str,
data: Option<&Json>,
metadata: Option<&Json>,
) -> Result<()>
emit_mark_with_options
pub fn emit_mark_with_options(
&self,
name: &str,
data: Option<&Json>,
metadata: Option<&Json>,
data_schema: Option<&DataSchema>,
severity: Option<LogSeverity>,
) -> Result<()>
emit_mark_with_context
pub fn emit_mark_with_context(
&self,
name: &str,
data: Option<&Json>,
metadata: Option<&Json>,
options: EmitMarkOptions<'_>,
) -> Result<()>
Emit a mark with an explicit parent, timestamp, schema, or severity.
emit_metric
pub fn emit_metric(
&self,
name: &str,
measurements: Vec<MetricMeasurement>,
metadata: Option<&Json>,
) -> Result<()>
Validate metric measurements and emit them using Relay’s reserved metric schema.
runtime_diagnostics
pub fn runtime_diagnostics(&self) -> Result<RuntimeDiagnostics>
estimate_cost_for_provider
pub fn estimate_cost_for_provider(
&self,
provider: Option<&str>,
model: &str,
usage: &Usage,
) -> Result<Option<CostEstimate>>
Estimate cost with the host’s active model pricing catalog.
Returns Ok(None) when the catalog has no pricing for the model. Hosts older than this operation return an error, which callers should treat as an unknown cost.
response_cost_for_provider
pub fn response_cost_for_provider(
&self,
response: &AnnotatedLlmResponse,
provider: Option<&str>,
) -> Result<Option<CostEstimate>>
Price a normalized response with the host’s full pricing rules.
Returns the response’s reported cost when present; otherwise the host’s estimate for its model and usage, or Ok(None) when unknown. Hosts older than this operation return an error, which callers should treat as an unknown cost.
log
pub fn log(
&self,
level: PluginLogLevel,
target: &str,
message: &str,
fields: Option<&Json>,
) -> Result<()>
Send a process log record with optional structured fields through the host runtime capability.
create_scope_stack
pub fn create_scope_stack(&self) -> Result<ScopeStack<'_>>
Create an isolated host-owned scope stack whose handle releases it when dropped.
capture_scope_stack_thread
pub fn capture_scope_stack_thread(&self) -> Result<ScopeStackBinding<'_>>
Capture this thread’s scope binding so it can be restored later.
bind_scope_stack_thread
pub fn bind_scope_stack_thread<'a>(
&'a self,
stack: &'a ScopeStack<'a>,
) -> Result<ThreadScopeStackGuard<'a>>
Install an isolated stack until the returned guard restores the previous thread binding.
register_conditional_middleware_guardrail
pub fn register_conditional_middleware_guardrail<F>(
&self,
name: &str,
kinds: &BTreeSet<RuntimeRegistrationKind>,
registration_name: &str,
callback: F,
) -> Result<ConditionalMiddlewareGuardrailHandle>where
F: Fn(&BTreeSet<RuntimeRegistrationKind>, &str) -> Option<String> + Send + Sync + 'static,
Register a revocable synchronous gate scoped to this component’s lifetime.
deregister_conditional_middleware_guardrail
pub fn deregister_conditional_middleware_guardrail(
&self,
handle: &ConditionalMiddlewareGuardrailHandle,
) -> Result<bool>
impl PluginRuntime
impl PluginRuntime
trace
pub fn trace(
&self,
target: &str,
message: &str,
fields: Option<&Json>,
) -> Result<()>
impl PluginRuntime
impl PluginRuntime
debug
pub fn debug(
&self,
target: &str,
message: &str,
fields: Option<&Json>,
) -> Result<()>
impl PluginRuntime
impl PluginRuntime
info
pub fn info(
&self,
target: &str,
message: &str,
fields: Option<&Json>,
) -> Result<()>
impl PluginRuntime
impl PluginRuntime
warn
pub fn warn(
&self,
target: &str,
message: &str,
fields: Option<&Json>,
) -> Result<()>
impl PluginRuntime
impl PluginRuntime
error
pub fn error(
&self,
target: &str,
message: &str,
fields: Option<&Json>,
) -> Result<()>
Trait Implementations
impl Clone for PluginRuntime
impl Clone for PluginRuntime
clone
fn clone(&self) -> PluginRuntime
clone_from
fn clone_from(&mut self, source: &Self)