makepad_studio/ai_chat/
google_ai_data.rs1use crate::makepad_micro_serde::*;
2
3#[derive(Debug, SerJson, DeJson)]
4pub struct GoogleAiChatPrompt {
5 pub contents: Vec<GoogleAiContent>,
6}
7
8#[derive(Debug, SerJson, DeJson)]
9pub struct GoogleAiContent {
10 pub role: Option<String>,
11 pub parts: Vec<GoogleAiPart>,
12}
13
14#[derive(Debug, SerJson, DeJson)]
15pub struct GoogleAiPart {
16 pub text: String,
17}
18
19#[allow(non_snake_case)]
20#[derive(Debug, SerJson, DeJson)]
21pub struct GoogleAiResponse{
22 pub candidates: Vec<GoogleAiCandidate>,
23 pub usageMetadata: GoogleAiMetadata,
24 pub modelVersion: String,
25}
26
27#[allow(non_snake_case)]
28#[derive(Debug, SerJson, DeJson)]
29pub struct GoogleAiCitation {
30 pub citationSources: Vec<GoogleAiCitationSource>,
31}
32
33#[allow(non_snake_case)]
34#[derive(Debug, SerJson, DeJson)]
35pub struct GoogleAiCitationSource {
36 pub startIndex: usize,
37 pub endIndex: usize,
38 pub uri: String,
39 pub license: String,
40}
41
42#[allow(non_snake_case)]
43#[derive(Debug, SerJson, DeJson)]
44pub struct GoogleAiMetadata {
45 pub promptTokenCount: usize,
46 pub candidatesTokenCount: usize,
47 pub totalTokenCount: usize,
48 pub thoughtsTokenCount: usize,
49 pub promptTokensDetails: Vec<GoogleAiTokenDetail>
50}
51
52#[allow(non_snake_case)]
53#[derive(Debug, SerJson, DeJson)]
54pub struct GoogleAiTokenDetail {
55 modality: String,
56 tokenCount: usize
57}
58
59#[allow(non_snake_case)]
60#[derive(Debug, SerJson, DeJson)]
61pub struct GoogleAiCandidate {
62 pub content: GoogleAiContent,
63 pub finishReason: Option<String>,
64 pub index: usize,
65 pub citationMetadata: Option<GoogleAiCitation>,
66}