pub struct ModelLogger { /* private fields */ }Expand description
Encrypted model I/O logger
Implementations§
Source§impl ModelLogger
impl ModelLogger
Sourcepub fn new(
config: LoggingConfig,
secret_store: Option<Arc<dyn SecretStore>>,
) -> Result<Self, LoggingError>
pub fn new( config: LoggingConfig, secret_store: Option<Arc<dyn SecretStore>>, ) -> Result<Self, LoggingError>
Create a new model logger with the given configuration and secret store
Sourcepub fn with_defaults() -> Result<Self, LoggingError>
pub fn with_defaults() -> Result<Self, LoggingError>
Create a new logger with default configuration (no secret store)
Sourcepub async fn log_request(
&self,
agent_id: AgentId,
interaction_type: ModelInteractionType,
model_identifier: &str,
request_data: RequestData,
metadata: HashMap<String, String>,
) -> Result<String, LoggingError>
pub async fn log_request( &self, agent_id: AgentId, interaction_type: ModelInteractionType, model_identifier: &str, request_data: RequestData, metadata: HashMap<String, String>, ) -> Result<String, LoggingError>
Log a model request (before execution)
Sourcepub async fn log_response(
&self,
entry_id: &str,
response_data: ResponseData,
latency: Duration,
token_usage: Option<TokenUsage>,
error: Option<String>,
) -> Result<(), LoggingError>
pub async fn log_response( &self, entry_id: &str, response_data: ResponseData, latency: Duration, token_usage: Option<TokenUsage>, error: Option<String>, ) -> Result<(), LoggingError>
Log a model response (after execution)
Sourcepub async fn log_interaction(
&self,
agent_id: AgentId,
interaction_type: ModelInteractionType,
model_identifier: &str,
request_data: RequestData,
response_data: ResponseData,
latency: Duration,
metadata: HashMap<String, String>,
token_usage: Option<TokenUsage>,
error: Option<String>,
) -> Result<(), LoggingError>
pub async fn log_interaction( &self, agent_id: AgentId, interaction_type: ModelInteractionType, model_identifier: &str, request_data: RequestData, response_data: ResponseData, latency: Duration, metadata: HashMap<String, String>, token_usage: Option<TokenUsage>, error: Option<String>, ) -> Result<(), LoggingError>
Convenience method to log a complete interaction
Sourcepub async fn decrypt_log_entry(
&self,
encrypted_entry: &ModelLogEntry,
) -> Result<(RequestData, Option<ResponseData>), LoggingError>
pub async fn decrypt_log_entry( &self, encrypted_entry: &ModelLogEntry, ) -> Result<(RequestData, Option<ResponseData>), LoggingError>
Decrypt and read log entries (for debugging/analysis)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ModelLogger
impl !RefUnwindSafe for ModelLogger
impl Send for ModelLogger
impl Sync for ModelLogger
impl Unpin for ModelLogger
impl !UnwindSafe for ModelLogger
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 more