-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
generative_service.pb.go
executable file
·2894 lines (2618 loc) · 134 KB
/
generative_service.pb.go
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
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.31.0
// protoc v4.23.2
// source: google/ai/generativelanguage/v1beta/generative_service.proto
package generativelanguagepb
import (
context "context"
reflect "reflect"
sync "sync"
_ "google.golang.org/genproto/googleapis/api/annotations"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// Type of task for which the embedding will be used.
type TaskType int32
const (
// Unset value, which will default to one of the other enum values.
TaskType_TASK_TYPE_UNSPECIFIED TaskType = 0
// Specifies the given text is a query in a search/retrieval setting.
TaskType_RETRIEVAL_QUERY TaskType = 1
// Specifies the given text is a document from the corpus being searched.
TaskType_RETRIEVAL_DOCUMENT TaskType = 2
// Specifies the given text will be used for STS.
TaskType_SEMANTIC_SIMILARITY TaskType = 3
// Specifies that the given text will be classified.
TaskType_CLASSIFICATION TaskType = 4
// Specifies that the embeddings will be used for clustering.
TaskType_CLUSTERING TaskType = 5
)
// Enum value maps for TaskType.
var (
TaskType_name = map[int32]string{
0: "TASK_TYPE_UNSPECIFIED",
1: "RETRIEVAL_QUERY",
2: "RETRIEVAL_DOCUMENT",
3: "SEMANTIC_SIMILARITY",
4: "CLASSIFICATION",
5: "CLUSTERING",
}
TaskType_value = map[string]int32{
"TASK_TYPE_UNSPECIFIED": 0,
"RETRIEVAL_QUERY": 1,
"RETRIEVAL_DOCUMENT": 2,
"SEMANTIC_SIMILARITY": 3,
"CLASSIFICATION": 4,
"CLUSTERING": 5,
}
)
func (x TaskType) Enum() *TaskType {
p := new(TaskType)
*p = x
return p
}
func (x TaskType) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (TaskType) Descriptor() protoreflect.EnumDescriptor {
return file_google_ai_generativelanguage_v1beta_generative_service_proto_enumTypes[0].Descriptor()
}
func (TaskType) Type() protoreflect.EnumType {
return &file_google_ai_generativelanguage_v1beta_generative_service_proto_enumTypes[0]
}
func (x TaskType) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use TaskType.Descriptor instead.
func (TaskType) EnumDescriptor() ([]byte, []int) {
return file_google_ai_generativelanguage_v1beta_generative_service_proto_rawDescGZIP(), []int{0}
}
// Specifies what was the reason why prompt was blocked.
type GenerateContentResponse_PromptFeedback_BlockReason int32
const (
// Default value. This value is unused.
GenerateContentResponse_PromptFeedback_BLOCK_REASON_UNSPECIFIED GenerateContentResponse_PromptFeedback_BlockReason = 0
// Prompt was blocked due to safety reasons. You can inspect
// `safety_ratings` to understand which safety category blocked it.
GenerateContentResponse_PromptFeedback_SAFETY GenerateContentResponse_PromptFeedback_BlockReason = 1
// Prompt was blocked due to unknown reaasons.
GenerateContentResponse_PromptFeedback_OTHER GenerateContentResponse_PromptFeedback_BlockReason = 2
)
// Enum value maps for GenerateContentResponse_PromptFeedback_BlockReason.
var (
GenerateContentResponse_PromptFeedback_BlockReason_name = map[int32]string{
0: "BLOCK_REASON_UNSPECIFIED",
1: "SAFETY",
2: "OTHER",
}
GenerateContentResponse_PromptFeedback_BlockReason_value = map[string]int32{
"BLOCK_REASON_UNSPECIFIED": 0,
"SAFETY": 1,
"OTHER": 2,
}
)
func (x GenerateContentResponse_PromptFeedback_BlockReason) Enum() *GenerateContentResponse_PromptFeedback_BlockReason {
p := new(GenerateContentResponse_PromptFeedback_BlockReason)
*p = x
return p
}
func (x GenerateContentResponse_PromptFeedback_BlockReason) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (GenerateContentResponse_PromptFeedback_BlockReason) Descriptor() protoreflect.EnumDescriptor {
return file_google_ai_generativelanguage_v1beta_generative_service_proto_enumTypes[1].Descriptor()
}
func (GenerateContentResponse_PromptFeedback_BlockReason) Type() protoreflect.EnumType {
return &file_google_ai_generativelanguage_v1beta_generative_service_proto_enumTypes[1]
}
func (x GenerateContentResponse_PromptFeedback_BlockReason) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use GenerateContentResponse_PromptFeedback_BlockReason.Descriptor instead.
func (GenerateContentResponse_PromptFeedback_BlockReason) EnumDescriptor() ([]byte, []int) {
return file_google_ai_generativelanguage_v1beta_generative_service_proto_rawDescGZIP(), []int{3, 0, 0}
}
// Defines the reason why the model stopped generating tokens.
type Candidate_FinishReason int32
const (
// Default value. This value is unused.
Candidate_FINISH_REASON_UNSPECIFIED Candidate_FinishReason = 0
// Natural stop point of the model or provided stop sequence.
Candidate_STOP Candidate_FinishReason = 1
// The maximum number of tokens as specified in the request was reached.
Candidate_MAX_TOKENS Candidate_FinishReason = 2
// The candidate content was flagged for safety reasons.
Candidate_SAFETY Candidate_FinishReason = 3
// The candidate content was flagged for recitation reasons.
Candidate_RECITATION Candidate_FinishReason = 4
// Unknown reason.
Candidate_OTHER Candidate_FinishReason = 5
)
// Enum value maps for Candidate_FinishReason.
var (
Candidate_FinishReason_name = map[int32]string{
0: "FINISH_REASON_UNSPECIFIED",
1: "STOP",
2: "MAX_TOKENS",
3: "SAFETY",
4: "RECITATION",
5: "OTHER",
}
Candidate_FinishReason_value = map[string]int32{
"FINISH_REASON_UNSPECIFIED": 0,
"STOP": 1,
"MAX_TOKENS": 2,
"SAFETY": 3,
"RECITATION": 4,
"OTHER": 5,
}
)
func (x Candidate_FinishReason) Enum() *Candidate_FinishReason {
p := new(Candidate_FinishReason)
*p = x
return p
}
func (x Candidate_FinishReason) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (Candidate_FinishReason) Descriptor() protoreflect.EnumDescriptor {
return file_google_ai_generativelanguage_v1beta_generative_service_proto_enumTypes[2].Descriptor()
}
func (Candidate_FinishReason) Type() protoreflect.EnumType {
return &file_google_ai_generativelanguage_v1beta_generative_service_proto_enumTypes[2]
}
func (x Candidate_FinishReason) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use Candidate_FinishReason.Descriptor instead.
func (Candidate_FinishReason) EnumDescriptor() ([]byte, []int) {
return file_google_ai_generativelanguage_v1beta_generative_service_proto_rawDescGZIP(), []int{4, 0}
}
// Style for grounded answers.
type GenerateAnswerRequest_AnswerStyle int32
const (
// Unspecified answer style.
GenerateAnswerRequest_ANSWER_STYLE_UNSPECIFIED GenerateAnswerRequest_AnswerStyle = 0
// Succint but abstract style.
GenerateAnswerRequest_ABSTRACTIVE GenerateAnswerRequest_AnswerStyle = 1
// Very brief and extractive style.
GenerateAnswerRequest_EXTRACTIVE GenerateAnswerRequest_AnswerStyle = 2
// Verbose style including extra details. The response may be formatted as a
// sentence, paragraph, multiple paragraphs, or bullet points, etc.
GenerateAnswerRequest_VERBOSE GenerateAnswerRequest_AnswerStyle = 3
)
// Enum value maps for GenerateAnswerRequest_AnswerStyle.
var (
GenerateAnswerRequest_AnswerStyle_name = map[int32]string{
0: "ANSWER_STYLE_UNSPECIFIED",
1: "ABSTRACTIVE",
2: "EXTRACTIVE",
3: "VERBOSE",
}
GenerateAnswerRequest_AnswerStyle_value = map[string]int32{
"ANSWER_STYLE_UNSPECIFIED": 0,
"ABSTRACTIVE": 1,
"EXTRACTIVE": 2,
"VERBOSE": 3,
}
)
func (x GenerateAnswerRequest_AnswerStyle) Enum() *GenerateAnswerRequest_AnswerStyle {
p := new(GenerateAnswerRequest_AnswerStyle)
*p = x
return p
}
func (x GenerateAnswerRequest_AnswerStyle) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (GenerateAnswerRequest_AnswerStyle) Descriptor() protoreflect.EnumDescriptor {
return file_google_ai_generativelanguage_v1beta_generative_service_proto_enumTypes[3].Descriptor()
}
func (GenerateAnswerRequest_AnswerStyle) Type() protoreflect.EnumType {
return &file_google_ai_generativelanguage_v1beta_generative_service_proto_enumTypes[3]
}
func (x GenerateAnswerRequest_AnswerStyle) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use GenerateAnswerRequest_AnswerStyle.Descriptor instead.
func (GenerateAnswerRequest_AnswerStyle) EnumDescriptor() ([]byte, []int) {
return file_google_ai_generativelanguage_v1beta_generative_service_proto_rawDescGZIP(), []int{7, 0}
}
// Request to generate a completion from the model.
type GenerateContentRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// Required. The name of the `Model` to use for generating the completion.
//
// Format: `name=models/{model}`.
Model string `protobuf:"bytes,1,opt,name=model,proto3" json:"model,omitempty"`
// Required. The content of the current conversation with the model.
//
// For single-turn queries, this is a single instance. For multi-turn queries,
// this is a repeated field that contains conversation history + latest
// request.
Contents []*Content `protobuf:"bytes,2,rep,name=contents,proto3" json:"contents,omitempty"`
// Optional. A list of `Tools` the model may use to generate the next
// response.
//
// A `Tool` is a piece of code that enables the system to interact with
// external systems to perform an action, or set of actions, outside of
// knowledge and scope of the model. The only supported tool is currently
// `Function`.
Tools []*Tool `protobuf:"bytes,5,rep,name=tools,proto3" json:"tools,omitempty"`
// Optional. A list of unique `SafetySetting` instances for blocking unsafe
// content.
//
// This will be enforced on the `GenerateContentRequest.contents` and
// `GenerateContentResponse.candidates`. There should not be more than one
// setting for each `SafetyCategory` type. The API will block any contents and
// responses that fail to meet the thresholds set by these settings. This list
// overrides the default settings for each `SafetyCategory` specified in the
// safety_settings. If there is no `SafetySetting` for a given
// `SafetyCategory` provided in the list, the API will use the default safety
// setting for that category. Harm categories HARM_CATEGORY_HATE_SPEECH,
// HARM_CATEGORY_SEXUALLY_EXPLICIT, HARM_CATEGORY_DANGEROUS_CONTENT,
// HARM_CATEGORY_HARASSMENT are supported.
SafetySettings []*SafetySetting `protobuf:"bytes,3,rep,name=safety_settings,json=safetySettings,proto3" json:"safety_settings,omitempty"`
// Optional. Configuration options for model generation and outputs.
GenerationConfig *GenerationConfig `protobuf:"bytes,4,opt,name=generation_config,json=generationConfig,proto3,oneof" json:"generation_config,omitempty"`
}
func (x *GenerateContentRequest) Reset() {
*x = GenerateContentRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_google_ai_generativelanguage_v1beta_generative_service_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GenerateContentRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GenerateContentRequest) ProtoMessage() {}
func (x *GenerateContentRequest) ProtoReflect() protoreflect.Message {
mi := &file_google_ai_generativelanguage_v1beta_generative_service_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GenerateContentRequest.ProtoReflect.Descriptor instead.
func (*GenerateContentRequest) Descriptor() ([]byte, []int) {
return file_google_ai_generativelanguage_v1beta_generative_service_proto_rawDescGZIP(), []int{0}
}
func (x *GenerateContentRequest) GetModel() string {
if x != nil {
return x.Model
}
return ""
}
func (x *GenerateContentRequest) GetContents() []*Content {
if x != nil {
return x.Contents
}
return nil
}
func (x *GenerateContentRequest) GetTools() []*Tool {
if x != nil {
return x.Tools
}
return nil
}
func (x *GenerateContentRequest) GetSafetySettings() []*SafetySetting {
if x != nil {
return x.SafetySettings
}
return nil
}
func (x *GenerateContentRequest) GetGenerationConfig() *GenerationConfig {
if x != nil {
return x.GenerationConfig
}
return nil
}
// Configuration options for model generation and outputs. Not all parameters
// may be configurable for every model.
type GenerationConfig struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// Optional. Number of generated responses to return.
//
// This value must be between [1, 8], inclusive. If unset, this will default
// to 1.
CandidateCount *int32 `protobuf:"varint,1,opt,name=candidate_count,json=candidateCount,proto3,oneof" json:"candidate_count,omitempty"`
// Optional. The set of character sequences (up to 5) that will stop output
// generation. If specified, the API will stop at the first appearance of a
// stop sequence. The stop sequence will not be included as part of the
// response.
StopSequences []string `protobuf:"bytes,2,rep,name=stop_sequences,json=stopSequences,proto3" json:"stop_sequences,omitempty"`
// Optional. The maximum number of tokens to include in a candidate.
//
// If unset, this will default to output_token_limit specified in the `Model`
// specification.
MaxOutputTokens *int32 `protobuf:"varint,4,opt,name=max_output_tokens,json=maxOutputTokens,proto3,oneof" json:"max_output_tokens,omitempty"`
// Optional. Controls the randomness of the output.
// Note: The default value varies by model, see the `Model.temperature`
// attribute of the `Model` returned the `getModel` function.
//
// Values can range from [0.0,1.0],
// inclusive. A value closer to 1.0 will produce responses that are more
// varied and creative, while a value closer to 0.0 will typically result in
// more straightforward responses from the model.
Temperature *float32 `protobuf:"fixed32,5,opt,name=temperature,proto3,oneof" json:"temperature,omitempty"`
// Optional. The maximum cumulative probability of tokens to consider when
// sampling.
//
// The model uses combined Top-k and nucleus sampling.
//
// Tokens are sorted based on their assigned probabilities so that only the
// most likely tokens are considered. Top-k sampling directly limits the
// maximum number of tokens to consider, while Nucleus sampling limits number
// of tokens based on the cumulative probability.
//
// Note: The default value varies by model, see the `Model.top_p`
// attribute of the `Model` returned the `getModel` function.
TopP *float32 `protobuf:"fixed32,6,opt,name=top_p,json=topP,proto3,oneof" json:"top_p,omitempty"`
// Optional. The maximum number of tokens to consider when sampling.
//
// The model uses combined Top-k and nucleus sampling.
//
// Top-k sampling considers the set of `top_k` most probable tokens.
// Defaults to 40.
//
// Note: The default value varies by model, see the `Model.top_k`
// attribute of the `Model` returned the `getModel` function.
TopK *int32 `protobuf:"varint,7,opt,name=top_k,json=topK,proto3,oneof" json:"top_k,omitempty"`
}
func (x *GenerationConfig) Reset() {
*x = GenerationConfig{}
if protoimpl.UnsafeEnabled {
mi := &file_google_ai_generativelanguage_v1beta_generative_service_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GenerationConfig) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GenerationConfig) ProtoMessage() {}
func (x *GenerationConfig) ProtoReflect() protoreflect.Message {
mi := &file_google_ai_generativelanguage_v1beta_generative_service_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GenerationConfig.ProtoReflect.Descriptor instead.
func (*GenerationConfig) Descriptor() ([]byte, []int) {
return file_google_ai_generativelanguage_v1beta_generative_service_proto_rawDescGZIP(), []int{1}
}
func (x *GenerationConfig) GetCandidateCount() int32 {
if x != nil && x.CandidateCount != nil {
return *x.CandidateCount
}
return 0
}
func (x *GenerationConfig) GetStopSequences() []string {
if x != nil {
return x.StopSequences
}
return nil
}
func (x *GenerationConfig) GetMaxOutputTokens() int32 {
if x != nil && x.MaxOutputTokens != nil {
return *x.MaxOutputTokens
}
return 0
}
func (x *GenerationConfig) GetTemperature() float32 {
if x != nil && x.Temperature != nil {
return *x.Temperature
}
return 0
}
func (x *GenerationConfig) GetTopP() float32 {
if x != nil && x.TopP != nil {
return *x.TopP
}
return 0
}
func (x *GenerationConfig) GetTopK() int32 {
if x != nil && x.TopK != nil {
return *x.TopK
}
return 0
}
// Configuration for retrieving grounding content from a `Corpus` or
// `Document` created using the Semantic Retriever API.
type SemanticRetrieverConfig struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// Required. Name of the resource for retrieval, e.g. corpora/123 or
// corpora/123/documents/abc.
Source string `protobuf:"bytes,1,opt,name=source,proto3" json:"source,omitempty"`
// Required. Query to use for similarity matching `Chunk`s in the given
// resource.
Query *Content `protobuf:"bytes,2,opt,name=query,proto3" json:"query,omitempty"`
// Optional. Filters for selecting `Document`s and/or `Chunk`s from the
// resource.
MetadataFilters []*MetadataFilter `protobuf:"bytes,3,rep,name=metadata_filters,json=metadataFilters,proto3" json:"metadata_filters,omitempty"`
// Optional. Maximum number of relevant `Chunk`s to retrieve.
MaxChunksCount *int32 `protobuf:"varint,4,opt,name=max_chunks_count,json=maxChunksCount,proto3,oneof" json:"max_chunks_count,omitempty"`
// Optional. Minimum relevance score for retrieved relevant `Chunk`s.
MinimumRelevanceScore *float32 `protobuf:"fixed32,5,opt,name=minimum_relevance_score,json=minimumRelevanceScore,proto3,oneof" json:"minimum_relevance_score,omitempty"`
}
func (x *SemanticRetrieverConfig) Reset() {
*x = SemanticRetrieverConfig{}
if protoimpl.UnsafeEnabled {
mi := &file_google_ai_generativelanguage_v1beta_generative_service_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *SemanticRetrieverConfig) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SemanticRetrieverConfig) ProtoMessage() {}
func (x *SemanticRetrieverConfig) ProtoReflect() protoreflect.Message {
mi := &file_google_ai_generativelanguage_v1beta_generative_service_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use SemanticRetrieverConfig.ProtoReflect.Descriptor instead.
func (*SemanticRetrieverConfig) Descriptor() ([]byte, []int) {
return file_google_ai_generativelanguage_v1beta_generative_service_proto_rawDescGZIP(), []int{2}
}
func (x *SemanticRetrieverConfig) GetSource() string {
if x != nil {
return x.Source
}
return ""
}
func (x *SemanticRetrieverConfig) GetQuery() *Content {
if x != nil {
return x.Query
}
return nil
}
func (x *SemanticRetrieverConfig) GetMetadataFilters() []*MetadataFilter {
if x != nil {
return x.MetadataFilters
}
return nil
}
func (x *SemanticRetrieverConfig) GetMaxChunksCount() int32 {
if x != nil && x.MaxChunksCount != nil {
return *x.MaxChunksCount
}
return 0
}
func (x *SemanticRetrieverConfig) GetMinimumRelevanceScore() float32 {
if x != nil && x.MinimumRelevanceScore != nil {
return *x.MinimumRelevanceScore
}
return 0
}
// Response from the model supporting multiple candidates.
//
// Note on safety ratings and content filtering. They are reported for both
// prompt in `GenerateContentResponse.prompt_feedback` and for each candidate
// in `finish_reason` and in `safety_ratings`. The API contract is that:
// - either all requested candidates are returned or no candidates at all
// - no candidates are returned only if there was something wrong with the
// prompt (see `prompt_feedback`)
// - feedback on each candidate is reported on `finish_reason` and
// `safety_ratings`.
type GenerateContentResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// Candidate responses from the model.
Candidates []*Candidate `protobuf:"bytes,1,rep,name=candidates,proto3" json:"candidates,omitempty"`
// Returns the prompt's feedback related to the content filters.
PromptFeedback *GenerateContentResponse_PromptFeedback `protobuf:"bytes,2,opt,name=prompt_feedback,json=promptFeedback,proto3" json:"prompt_feedback,omitempty"`
}
func (x *GenerateContentResponse) Reset() {
*x = GenerateContentResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_google_ai_generativelanguage_v1beta_generative_service_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GenerateContentResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GenerateContentResponse) ProtoMessage() {}
func (x *GenerateContentResponse) ProtoReflect() protoreflect.Message {
mi := &file_google_ai_generativelanguage_v1beta_generative_service_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GenerateContentResponse.ProtoReflect.Descriptor instead.
func (*GenerateContentResponse) Descriptor() ([]byte, []int) {
return file_google_ai_generativelanguage_v1beta_generative_service_proto_rawDescGZIP(), []int{3}
}
func (x *GenerateContentResponse) GetCandidates() []*Candidate {
if x != nil {
return x.Candidates
}
return nil
}
func (x *GenerateContentResponse) GetPromptFeedback() *GenerateContentResponse_PromptFeedback {
if x != nil {
return x.PromptFeedback
}
return nil
}
// A response candidate generated from the model.
type Candidate struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// Output only. Index of the candidate in the list of candidates.
Index *int32 `protobuf:"varint,3,opt,name=index,proto3,oneof" json:"index,omitempty"`
// Output only. Generated content returned from the model.
Content *Content `protobuf:"bytes,1,opt,name=content,proto3" json:"content,omitempty"`
// Optional. Output only. The reason why the model stopped generating tokens.
//
// If empty, the model has not stopped generating the tokens.
FinishReason Candidate_FinishReason `protobuf:"varint,2,opt,name=finish_reason,json=finishReason,proto3,enum=google.ai.generativelanguage.v1beta.Candidate_FinishReason" json:"finish_reason,omitempty"`
// List of ratings for the safety of a response candidate.
//
// There is at most one rating per category.
SafetyRatings []*SafetyRating `protobuf:"bytes,5,rep,name=safety_ratings,json=safetyRatings,proto3" json:"safety_ratings,omitempty"`
// Output only. Citation information for model-generated candidate.
//
// This field may be populated with recitation information for any text
// included in the `content`. These are passages that are "recited" from
// copyrighted material in the foundational LLM's training data.
CitationMetadata *CitationMetadata `protobuf:"bytes,6,opt,name=citation_metadata,json=citationMetadata,proto3" json:"citation_metadata,omitempty"`
// Output only. Token count for this candidate.
TokenCount int32 `protobuf:"varint,7,opt,name=token_count,json=tokenCount,proto3" json:"token_count,omitempty"`
// Output only. Attribution information for sources that contributed to a
// grounded answer.
//
// This field is populated for `GenerateAnswer` calls.
GroundingAttributions []*GroundingAttribution `protobuf:"bytes,8,rep,name=grounding_attributions,json=groundingAttributions,proto3" json:"grounding_attributions,omitempty"`
}
func (x *Candidate) Reset() {
*x = Candidate{}
if protoimpl.UnsafeEnabled {
mi := &file_google_ai_generativelanguage_v1beta_generative_service_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Candidate) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Candidate) ProtoMessage() {}
func (x *Candidate) ProtoReflect() protoreflect.Message {
mi := &file_google_ai_generativelanguage_v1beta_generative_service_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Candidate.ProtoReflect.Descriptor instead.
func (*Candidate) Descriptor() ([]byte, []int) {
return file_google_ai_generativelanguage_v1beta_generative_service_proto_rawDescGZIP(), []int{4}
}
func (x *Candidate) GetIndex() int32 {
if x != nil && x.Index != nil {
return *x.Index
}
return 0
}
func (x *Candidate) GetContent() *Content {
if x != nil {
return x.Content
}
return nil
}
func (x *Candidate) GetFinishReason() Candidate_FinishReason {
if x != nil {
return x.FinishReason
}
return Candidate_FINISH_REASON_UNSPECIFIED
}
func (x *Candidate) GetSafetyRatings() []*SafetyRating {
if x != nil {
return x.SafetyRatings
}
return nil
}
func (x *Candidate) GetCitationMetadata() *CitationMetadata {
if x != nil {
return x.CitationMetadata
}
return nil
}
func (x *Candidate) GetTokenCount() int32 {
if x != nil {
return x.TokenCount
}
return 0
}
func (x *Candidate) GetGroundingAttributions() []*GroundingAttribution {
if x != nil {
return x.GroundingAttributions
}
return nil
}
// Identifier for the source contributing to this attribution.
type AttributionSourceId struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// Types that are assignable to Source:
// *AttributionSourceId_GroundingPassage
// *AttributionSourceId_SemanticRetrieverChunk_
Source isAttributionSourceId_Source `protobuf_oneof:"source"`
}
func (x *AttributionSourceId) Reset() {
*x = AttributionSourceId{}
if protoimpl.UnsafeEnabled {
mi := &file_google_ai_generativelanguage_v1beta_generative_service_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *AttributionSourceId) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*AttributionSourceId) ProtoMessage() {}
func (x *AttributionSourceId) ProtoReflect() protoreflect.Message {
mi := &file_google_ai_generativelanguage_v1beta_generative_service_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use AttributionSourceId.ProtoReflect.Descriptor instead.
func (*AttributionSourceId) Descriptor() ([]byte, []int) {
return file_google_ai_generativelanguage_v1beta_generative_service_proto_rawDescGZIP(), []int{5}
}
func (m *AttributionSourceId) GetSource() isAttributionSourceId_Source {
if m != nil {
return m.Source
}
return nil
}
func (x *AttributionSourceId) GetGroundingPassage() *AttributionSourceId_GroundingPassageId {
if x, ok := x.GetSource().(*AttributionSourceId_GroundingPassage); ok {
return x.GroundingPassage
}
return nil
}
func (x *AttributionSourceId) GetSemanticRetrieverChunk() *AttributionSourceId_SemanticRetrieverChunk {
if x, ok := x.GetSource().(*AttributionSourceId_SemanticRetrieverChunk_); ok {
return x.SemanticRetrieverChunk
}
return nil
}
type isAttributionSourceId_Source interface {
isAttributionSourceId_Source()
}
type AttributionSourceId_GroundingPassage struct {
// Identifier for an inline passage.
GroundingPassage *AttributionSourceId_GroundingPassageId `protobuf:"bytes,1,opt,name=grounding_passage,json=groundingPassage,proto3,oneof"`
}
type AttributionSourceId_SemanticRetrieverChunk_ struct {
// Identifier for a `Chunk` fetched via Semantic Retriever.
SemanticRetrieverChunk *AttributionSourceId_SemanticRetrieverChunk `protobuf:"bytes,2,opt,name=semantic_retriever_chunk,json=semanticRetrieverChunk,proto3,oneof"`
}
func (*AttributionSourceId_GroundingPassage) isAttributionSourceId_Source() {}
func (*AttributionSourceId_SemanticRetrieverChunk_) isAttributionSourceId_Source() {}
// Attribution for a source that contributed to an answer.
type GroundingAttribution struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// Output only. Identifier for the source contributing to this attribution.
SourceId *AttributionSourceId `protobuf:"bytes,3,opt,name=source_id,json=sourceId,proto3" json:"source_id,omitempty"`
// Grounding source content that makes up this attribution.
Content *Content `protobuf:"bytes,2,opt,name=content,proto3" json:"content,omitempty"`
}
func (x *GroundingAttribution) Reset() {
*x = GroundingAttribution{}
if protoimpl.UnsafeEnabled {
mi := &file_google_ai_generativelanguage_v1beta_generative_service_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GroundingAttribution) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GroundingAttribution) ProtoMessage() {}
func (x *GroundingAttribution) ProtoReflect() protoreflect.Message {
mi := &file_google_ai_generativelanguage_v1beta_generative_service_proto_msgTypes[6]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GroundingAttribution.ProtoReflect.Descriptor instead.
func (*GroundingAttribution) Descriptor() ([]byte, []int) {
return file_google_ai_generativelanguage_v1beta_generative_service_proto_rawDescGZIP(), []int{6}
}
func (x *GroundingAttribution) GetSourceId() *AttributionSourceId {
if x != nil {
return x.SourceId
}
return nil
}
func (x *GroundingAttribution) GetContent() *Content {
if x != nil {
return x.Content
}
return nil
}
// Request to generate a grounded answer from the model.
type GenerateAnswerRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// The sources in which to ground the answer.
//
// Types that are assignable to GroundingSource:
// *GenerateAnswerRequest_InlinePassages
// *GenerateAnswerRequest_SemanticRetriever
GroundingSource isGenerateAnswerRequest_GroundingSource `protobuf_oneof:"grounding_source"`
// Required. The name of the `Model` to use for generating the grounded
// response.
//
// Format: `model=models/{model}`.
Model string `protobuf:"bytes,1,opt,name=model,proto3" json:"model,omitempty"`
// Required. The content of the current conversation with the model. For
// single-turn queries, this is a single question to answer. For multi-turn
// queries, this is a repeated field that contains conversation history and
// the last `Content` in the list containing the question.
Contents []*Content `protobuf:"bytes,2,rep,name=contents,proto3" json:"contents,omitempty"`
// Required. Style in which answers should be returned.
AnswerStyle GenerateAnswerRequest_AnswerStyle `protobuf:"varint,5,opt,name=answer_style,json=answerStyle,proto3,enum=google.ai.generativelanguage.v1beta.GenerateAnswerRequest_AnswerStyle" json:"answer_style,omitempty"`
// Optional. A list of unique `SafetySetting` instances for blocking unsafe
// content.
//
// This will be enforced on the `GenerateAnswerRequest.contents` and
// `GenerateAnswerResponse.candidate`. There should not be more than one
// setting for each `SafetyCategory` type. The API will block any contents and
// responses that fail to meet the thresholds set by these settings. This list
// overrides the default settings for each `SafetyCategory` specified in the
// safety_settings. If there is no `SafetySetting` for a given
// `SafetyCategory` provided in the list, the API will use the default safety
// setting for that category.
SafetySettings []*SafetySetting `protobuf:"bytes,3,rep,name=safety_settings,json=safetySettings,proto3" json:"safety_settings,omitempty"`
// Optional. Controls the randomness of the output.
//
// Values can range from [0.0,1.0], inclusive. A value closer to 1.0 will
// produce responses that are more varied and creative, while a value closer
// to 0.0 will typically result in more straightforward responses from the
// model. A low temperature (~0.2) is usually recommended for
// Attributed-Question-Answering use cases.
Temperature *float32 `protobuf:"fixed32,4,opt,name=temperature,proto3,oneof" json:"temperature,omitempty"`
}
func (x *GenerateAnswerRequest) Reset() {
*x = GenerateAnswerRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_google_ai_generativelanguage_v1beta_generative_service_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GenerateAnswerRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GenerateAnswerRequest) ProtoMessage() {}
func (x *GenerateAnswerRequest) ProtoReflect() protoreflect.Message {
mi := &file_google_ai_generativelanguage_v1beta_generative_service_proto_msgTypes[7]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {