Skip to main content

objectiveai_api/functions/executions/usage_handler/
usage_handler.rs

1//! Trait for handling Function execution usage.
2
3use crate::ctx;
4use std::sync::Arc;
5
6/// Handler for recording usage after Function execution.
7#[async_trait::async_trait]
8pub trait UsageHandler<CTXEXT> {
9    /// Records usage from a completed Function execution.
10    async fn handle_usage(
11        &self,
12        ctx: ctx::Context<CTXEXT>,
13        request: Arc<objectiveai::functions::executions::request::Request>,
14        response: objectiveai::functions::executions::response::unary::FunctionExecution,
15    );
16}