Adds a count_token methods to the Gemini Clent

This commit is contained in:
2024-02-29 19:48:42 +00:00
parent f2da435af8
commit 8e9a186ba9
3 changed files with 68 additions and 5 deletions

View File

@@ -8,7 +8,14 @@ pub struct CountTokensRequest {
}
#[derive(Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct CountTokensResponse {
pub total_tokens: i32,
#[serde(untagged)]
pub enum CountTokensResponse {
#[serde(rename_all = "camelCase")]
Ok {
total_tokens: i32,
total_billable_characters: u32,
},
Error {
error: super::Error,
},
}