pub struct TokenUsageInsertParams {
pub user_id: i64,
pub service: String,
pub amount: i64,
pub model: Option<String>,
pub input_tokens: Option<i32>,
pub output_tokens: Option<i32>,
pub api_path: Option<String>,
pub duration_ms: Option<i32>,
pub biz_id: Option<String>,
pub remark: Option<String>,
}Expand description
记录一次消耗的参数,由调用方(如 tibba-llm)填写后传入。
Fields§
§user_id: i64§service: String§amount: i64§model: Option<String>LLM 场景填模型名,其他场景留空
input_tokens: Option<i32>LLM 输入 token 数
output_tokens: Option<i32>LLM 输出 token 数
api_path: Option<String>通用 API 场景的路径
duration_ms: Option<i32>调用耗时(毫秒)
biz_id: Option<String>关联业务 ID(请求 ID、任务 ID 等)
remark: Option<String>Trait Implementations§
Source§impl Clone for TokenUsageInsertParams
impl Clone for TokenUsageInsertParams
Source§fn clone(&self) -> TokenUsageInsertParams
fn clone(&self) -> TokenUsageInsertParams
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TokenUsageInsertParams
impl Debug for TokenUsageInsertParams
Source§impl Default for TokenUsageInsertParams
impl Default for TokenUsageInsertParams
Source§fn default() -> TokenUsageInsertParams
fn default() -> TokenUsageInsertParams
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for TokenUsageInsertParams
impl<'de> Deserialize<'de> for TokenUsageInsertParams
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>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for TokenUsageInsertParams
impl RefUnwindSafe for TokenUsageInsertParams
impl Send for TokenUsageInsertParams
impl Sync for TokenUsageInsertParams
impl Unpin for TokenUsageInsertParams
impl UnsafeUnpin for TokenUsageInsertParams
impl UnwindSafe for TokenUsageInsertParams
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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