summaryrefslogtreecommitdiff
path: root/chat.proto
blob: cdf535491073821cc84337d42bb8b8738b3d8d4c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
syntax = "proto3";

package chatpb;

import "google/protobuf/timestamp.proto";
import "google/protobuf/struct.proto";

// Main request structure

message GeminiRequest {                                                                    // `autogenpb:marshal` `autogenpb:mutex`
        string                                     model                             = 1;
        Config                                     config                            = 2;
        repeated Content                           contents                          = 3;
}

// Abort signal for the request
message AbortSignal {
}

message Schema {
        string                                     type                              = 1;
        map<string, Schema>                        properties                        = 2;
        repeated string                            required                          = 3;
        string                                     description                       = 4;
        Schema                                     items                             = 5;
        repeated string                            enum                              = 6;
        int32                                      minimum                           = 7;
        int32                                      minLength                         = 8;
        int32                                      minItems                          = 9;
        google.protobuf.Value default_value = 10   [json_name                        = "default"];
}

message FunctionDeclaration {
        string                                     name                              = 1;
        string                                     description                       = 2;
        Schema                                     parameters_json_schema            = 3;
}

message GoogleSearch {
}

message Tool {
        repeated FunctionDeclaration               functionDeclarations              = 1;
        GoogleSearch                               googleSearch                      = 2;
}

// Configuration for the request
message Config {
        message ThinkingConfig {
                bool    includeThoughts     = 1;
                int32   thinkingBudget      = 2;
        }
        double                                     temperature                       = 2;
        double                                     topP                              = 3;
        string                                     systemInstruction                 = 4;
        ResponseJsonSchema                         responseJsonSchema                = 5;
        string                                     responseMimeType                  = 6;
        AbortSignal                                abort_signal                      = 7;
        ThinkingConfig                             thinkingConfig                    = 8;
        repeated Tool                              tools                             = 9;
}
// JSON schema for the response
message ResponseJsonSchema {
        string                                     type                              = 1;
        Properties                                 properties                        = 2;
        repeated string                            required                          = 3;
}

// Properties within the JSON schema
message Properties {
        Reasoning                                  reasoning                         = 1;
        NextSpeaker                                next_speaker                      = 2;
        CorrectedNewStringEscaping                 corrected_new_string_escaping     = 3;
        CorrectedTargetSnippet                     corrected_target_snippet          = 4;
        Confidence                                 confidence                        = 5;
}

message Confidence {
        string                                     type                              = 1;
        string                                     description                       = 2;
}

message CorrectedTargetSnippet {
        string                                     type                              = 1;
        string                                     description                       = 2;
}

// Reasoning property
message CorrectedNewStringEscaping {
        string                                     type                              = 1;
        string                                     description                       = 2;
}

message Reasoning {
        string                                     type                              = 1;
        string                                     description                       = 2;
}

// Next speaker property
message NextSpeaker {
        string                                     type                              = 1;
        repeated string                            enum                              = 2;
        string                                     description                       = 3;
}

// Content of the chat
message Content {
        string                                     role                              = 1;
        repeated Part                              parts                             = 2;
}

// Part of the content
message Part {
        oneof part_type {
                string             text                 = 1;
                FunctionCall       functionCall         = 2;
                FunctionResponse   functionResponse     = 3;
        }
        string                                     thoughtSignature                  = 4;
}
// Function call
message FunctionCall {
        string                                     name                              = 1;
        argsInfo                                   args                              = 3;
}

message argsInfo {
        string                                     absolute_path                     = 1;
        string                                     description                       = 2;
        string                                     command                           = 3;
        string                                     new_string                        = 4;
        string                                     old_string                        = 5;
        int32                                      expected_replacements             = 6;
        string                                     file_path                         = 7;
        string                                     directory                         = 8;
        string                                     path                              = 9;
        string                                     thinkingConfig                    = 10;
        string                                     pattern                           = 11;
        string                                     content                           = 12;
        string                                     fact                              = 13;
        repeated string                            paths                             = 14;
        string                                     query                             = 15;
}

// Function response
message FunctionResponse {
        string                                     id                                = 1;
        string                                     name                              = 2;
        Response                                   response                          = 3;
}

// Response from a function call
message Response {
        string                                     output                            = 1;
        string                                     error                             = 2;
}

message Row {
        repeated string                            fields                            = 1;
}

message Table {
        int32                                      columns                           = 1;
        repeated Row                               rows                              = 2;
}

enum Who {
        NOONE = 0;
        REGEX = 1;
        USER = 2;
}

message ToolCall {
        string                                     name                              = 1;
        string                                     input                             = 2;
        string                                     description                       = 3;
        string                                     output_stdout                     = 4;
        string                                     output_stderr                     = 5;
        int32                                      exit_code                         = 6;
}

message CodeSnippet {
        string                                     filename                          = 1;
        string                                     content                           = 2;
}

message ChatEntry {                                                                        // `autogenpb:marshal`
        Who                                        from                              = 1;
        google.protobuf.Timestamp                  ctime                             = 2;
        string                                     content                           = 3;
        Table                                      table                             = 4;
        repeated ToolCall                          ToolCalls                         = 5;
        string                                     ContentFile                       = 6;
        string                                     uuid                              = 7;
        repeated CodeSnippet                       Snippets                          = 8;
        repeated Part                              parts                             = 9;
        GeminiRequest                              GeminiRequest                     = 10;
        int32                                      RequestCounter                    = 11;
        repeated string                            paths                             = 12;
}

message SessionStats {
        string                                     uuid                              = 1;
}

message Chat {
        string                                     uuid                              = 1;  // `autogenpb:unique` `autogenpb:sort`
        google.protobuf.Timestamp                  ctime                             = 2;
        string                                     ChatName                          = 3;
        repeated ChatEntry                         Entries                           = 4;
        repeated SessionStats                      Session                           = 5;
}

message Chats {                                                                            // `autogenpb:marshal` `autogenpb:mutex` `autogenpb:gui`
        string                                     uuid                              = 1;  // `autogenpb:uuid:9fd31f10-c25d-4d66-bc8d-5f6eb7c79057` `autogenpb:primary`
        string                                     version                           = 2;  // `autogenpb:version:v0.0.1`
        repeated Chat                              Chats                             = 3;  // THIS MUST BE  Chat  and then  Chats
        string                                     filename                          = 4;  // `autogenpb:save` -- this enables autogenerated pb.Load() and pb.Save()
}