Skip to content

Commit c734141

Browse files
committed
vertex AI has this extra field called trafficType
1 parent 5d7e204 commit c734141

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

src/types.rs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use std::collections::HashMap;
1+
use std::collections::{BTreeSet, HashMap};
22

33
use serde::{Deserialize, Serialize};
44
use serde_json::Value;
@@ -278,6 +278,8 @@ pub struct UsageMetadata {
278278
candidates_tokens_details: Vec<ModalityTokenCount>,
279279
#[serde(default)]
280280
tool_use_prompt_tokens_details: Vec<ModalityTokenCount>,
281+
#[serde(skip_serializing_if = "Option::is_none")]
282+
pub traffic_type: Option<TrafficType>,
281283
}
282284

283285
#[derive(Debug, Serialize, Deserialize, Clone)]
@@ -287,6 +289,20 @@ pub struct ModalityTokenCount {
287289
token_count: u32,
288290
}
289291

292+
/// Request traffic type. Indicates whether the request consumes Pay-As-You-Go or
293+
/// Provisioned Throughput quota.
294+
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq)]
295+
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
296+
pub enum TrafficType {
297+
/// Unspecified request traffic type.
298+
#[default]
299+
TrafficTypeUnspecified,
300+
/// Type for Pay-As-You-Go traffic.
301+
OnDemand,
302+
/// Type for Provisioned Throughput traffic.
303+
ProvisionedThroughput,
304+
}
305+
290306
/// Content Part modality
291307
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq)]
292308
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]

0 commit comments

Comments
 (0)