Constants
GenerativeService_GenerateContent_FullMethodName, GenerativeService_StreamGenerateContent_FullMethodName, GenerativeService_EmbedContent_FullMethodName, GenerativeService_BatchEmbedContents_FullMethodName, GenerativeService_CountTokens_FullMethodName
const (
GenerativeService_GenerateContent_FullMethodName = "/google.ai.generativelanguage.v1.GenerativeService/GenerateContent"
GenerativeService_StreamGenerateContent_FullMethodName = "/google.ai.generativelanguage.v1.GenerativeService/StreamGenerateContent"
GenerativeService_EmbedContent_FullMethodName = "/google.ai.generativelanguage.v1.GenerativeService/EmbedContent"
GenerativeService_BatchEmbedContents_FullMethodName = "/google.ai.generativelanguage.v1.GenerativeService/BatchEmbedContents"
GenerativeService_CountTokens_FullMethodName = "/google.ai.generativelanguage.v1.GenerativeService/CountTokens"
)ModelService_GetModel_FullMethodName, ModelService_ListModels_FullMethodName
const (
ModelService_GetModel_FullMethodName = "/google.ai.generativelanguage.v1.ModelService/GetModel"
ModelService_ListModels_FullMethodName = "/google.ai.generativelanguage.v1.ModelService/ListModels"
)Variables
Modality_name, Modality_value
var (
Modality_name = map[int32]string{
0: "MODALITY_UNSPECIFIED",
1: "TEXT",
2: "IMAGE",
3: "VIDEO",
4: "AUDIO",
5: "DOCUMENT",
}
Modality_value = map[string]int32{
"MODALITY_UNSPECIFIED": 0,
"TEXT": 1,
"IMAGE": 2,
"VIDEO": 3,
"AUDIO": 4,
"DOCUMENT": 5,
}
)Enum value maps for Modality.
TaskType_name, TaskType_value
var (
TaskType_name = map[int32]string{
0: "TASK_TYPE_UNSPECIFIED",
1: "RETRIEVAL_QUERY",
2: "RETRIEVAL_DOCUMENT",
3: "SEMANTIC_SIMILARITY",
4: "CLASSIFICATION",
5: "CLUSTERING",
6: "QUESTION_ANSWERING",
7: "FACT_VERIFICATION",
8: "CODE_RETRIEVAL_QUERY",
}
TaskType_value = map[string]int32{
"TASK_TYPE_UNSPECIFIED": 0,
"RETRIEVAL_QUERY": 1,
"RETRIEVAL_DOCUMENT": 2,
"SEMANTIC_SIMILARITY": 3,
"CLASSIFICATION": 4,
"CLUSTERING": 5,
"QUESTION_ANSWERING": 6,
"FACT_VERIFICATION": 7,
"CODE_RETRIEVAL_QUERY": 8,
}
)Enum value maps for TaskType.
GenerateContentResponse_PromptFeedback_BlockReason_name, GenerateContentResponse_PromptFeedback_BlockReason_value
var (
GenerateContentResponse_PromptFeedback_BlockReason_name = map[int32]string{
0: "BLOCK_REASON_UNSPECIFIED",
1: "SAFETY",
2: "OTHER",
3: "BLOCKLIST",
4: "PROHIBITED_CONTENT",
5: "IMAGE_SAFETY",
}
GenerateContentResponse_PromptFeedback_BlockReason_value = map[string]int32{
"BLOCK_REASON_UNSPECIFIED": 0,
"SAFETY": 1,
"OTHER": 2,
"BLOCKLIST": 3,
"PROHIBITED_CONTENT": 4,
"IMAGE_SAFETY": 5,
}
)Enum value maps for GenerateContentResponse_PromptFeedback_BlockReason.
Candidate_FinishReason_name, Candidate_FinishReason_value
var (
Candidate_FinishReason_name = map[int32]string{
0: "FINISH_REASON_UNSPECIFIED",
1: "STOP",
2: "MAX_TOKENS",
3: "SAFETY",
4: "RECITATION",
6: "LANGUAGE",
5: "OTHER",
7: "BLOCKLIST",
8: "PROHIBITED_CONTENT",
9: "SPII",
10: "MALFORMED_FUNCTION_CALL",
11: "IMAGE_SAFETY",
14: "IMAGE_PROHIBITED_CONTENT",
15: "IMAGE_OTHER",
16: "NO_IMAGE",
17: "IMAGE_RECITATION",
12: "UNEXPECTED_TOOL_CALL",
13: "TOO_MANY_TOOL_CALLS",
}
Candidate_FinishReason_value = map[string]int32{
"FINISH_REASON_UNSPECIFIED": 0,
"STOP": 1,
"MAX_TOKENS": 2,
"SAFETY": 3,
"RECITATION": 4,
"LANGUAGE": 6,
"OTHER": 5,
"BLOCKLIST": 7,
"PROHIBITED_CONTENT": 8,
"SPII": 9,
"MALFORMED_FUNCTION_CALL": 10,
"IMAGE_SAFETY": 11,
"IMAGE_PROHIBITED_CONTENT": 14,
"IMAGE_OTHER": 15,
"NO_IMAGE": 16,
"IMAGE_RECITATION": 17,
"UNEXPECTED_TOOL_CALL": 12,
"TOO_MANY_TOOL_CALLS": 13,
}
)Enum value maps for Candidate_FinishReason.
UrlMetadata_UrlRetrievalStatus_name, UrlMetadata_UrlRetrievalStatus_value
var (
UrlMetadata_UrlRetrievalStatus_name = map[int32]string{
0: "URL_RETRIEVAL_STATUS_UNSPECIFIED",
1: "URL_RETRIEVAL_STATUS_SUCCESS",
2: "URL_RETRIEVAL_STATUS_ERROR",
3: "URL_RETRIEVAL_STATUS_PAYWALL",
4: "URL_RETRIEVAL_STATUS_UNSAFE",
}
UrlMetadata_UrlRetrievalStatus_value = map[string]int32{
"URL_RETRIEVAL_STATUS_UNSPECIFIED": 0,
"URL_RETRIEVAL_STATUS_SUCCESS": 1,
"URL_RETRIEVAL_STATUS_ERROR": 2,
"URL_RETRIEVAL_STATUS_PAYWALL": 3,
"URL_RETRIEVAL_STATUS_UNSAFE": 4,
}
)Enum value maps for UrlMetadata_UrlRetrievalStatus.
HarmCategory_name, HarmCategory_value
var (
HarmCategory_name = map[int32]string{
0: "HARM_CATEGORY_UNSPECIFIED",
1: "HARM_CATEGORY_DEROGATORY",
2: "HARM_CATEGORY_TOXICITY",
3: "HARM_CATEGORY_VIOLENCE",
4: "HARM_CATEGORY_SEXUAL",
5: "HARM_CATEGORY_MEDICAL",
6: "HARM_CATEGORY_DANGEROUS",
7: "HARM_CATEGORY_HARASSMENT",
8: "HARM_CATEGORY_HATE_SPEECH",
9: "HARM_CATEGORY_SEXUALLY_EXPLICIT",
10: "HARM_CATEGORY_DANGEROUS_CONTENT",
11: "HARM_CATEGORY_CIVIC_INTEGRITY",
}
HarmCategory_value = map[string]int32{
"HARM_CATEGORY_UNSPECIFIED": 0,
"HARM_CATEGORY_DEROGATORY": 1,
"HARM_CATEGORY_TOXICITY": 2,
"HARM_CATEGORY_VIOLENCE": 3,
"HARM_CATEGORY_SEXUAL": 4,
"HARM_CATEGORY_MEDICAL": 5,
"HARM_CATEGORY_DANGEROUS": 6,
"HARM_CATEGORY_HARASSMENT": 7,
"HARM_CATEGORY_HATE_SPEECH": 8,
"HARM_CATEGORY_SEXUALLY_EXPLICIT": 9,
"HARM_CATEGORY_DANGEROUS_CONTENT": 10,
"HARM_CATEGORY_CIVIC_INTEGRITY": 11,
}
)Enum value maps for HarmCategory.
SafetyRating_HarmProbability_name, SafetyRating_HarmProbability_value
var (
SafetyRating_HarmProbability_name = map[int32]string{
0: "HARM_PROBABILITY_UNSPECIFIED",
1: "NEGLIGIBLE",
2: "LOW",
3: "MEDIUM",
4: "HIGH",
}
SafetyRating_HarmProbability_value = map[string]int32{
"HARM_PROBABILITY_UNSPECIFIED": 0,
"NEGLIGIBLE": 1,
"LOW": 2,
"MEDIUM": 3,
"HIGH": 4,
}
)Enum value maps for SafetyRating_HarmProbability.
SafetySetting_HarmBlockThreshold_name, SafetySetting_HarmBlockThreshold_value
var (
SafetySetting_HarmBlockThreshold_name = map[int32]string{
0: "HARM_BLOCK_THRESHOLD_UNSPECIFIED",
1: "BLOCK_LOW_AND_ABOVE",
2: "BLOCK_MEDIUM_AND_ABOVE",
3: "BLOCK_ONLY_HIGH",
4: "BLOCK_NONE",
5: "OFF",
}
SafetySetting_HarmBlockThreshold_value = map[string]int32{
"HARM_BLOCK_THRESHOLD_UNSPECIFIED": 0,
"BLOCK_LOW_AND_ABOVE": 1,
"BLOCK_MEDIUM_AND_ABOVE": 2,
"BLOCK_ONLY_HIGH": 3,
"BLOCK_NONE": 4,
"OFF": 5,
}
)Enum value maps for SafetySetting_HarmBlockThreshold.
File_google_ai_generativelanguage_v1_citation_proto
var File_google_ai_generativelanguage_v1_citation_proto protoreflect.FileDescriptorFile_google_ai_generativelanguage_v1_content_proto
var File_google_ai_generativelanguage_v1_content_proto protoreflect.FileDescriptorFile_google_ai_generativelanguage_v1_generative_service_proto
var File_google_ai_generativelanguage_v1_generative_service_proto protoreflect.FileDescriptorFile_google_ai_generativelanguage_v1_model_proto
var File_google_ai_generativelanguage_v1_model_proto protoreflect.FileDescriptorFile_google_ai_generativelanguage_v1_model_service_proto
var File_google_ai_generativelanguage_v1_model_service_proto protoreflect.FileDescriptorFile_google_ai_generativelanguage_v1_safety_proto
var File_google_ai_generativelanguage_v1_safety_proto protoreflect.FileDescriptorGenerativeService_ServiceDesc
var GenerativeService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "google.ai.generativelanguage.v1.GenerativeService",
HandlerType: (*GenerativeServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "GenerateContent",
Handler: _GenerativeService_GenerateContent_Handler,
},
{
MethodName: "EmbedContent",
Handler: _GenerativeService_EmbedContent_Handler,
},
{
MethodName: "BatchEmbedContents",
Handler: _GenerativeService_BatchEmbedContents_Handler,
},
{
MethodName: "CountTokens",
Handler: _GenerativeService_CountTokens_Handler,
},
},
Streams: []grpc.StreamDesc{
{
StreamName: "StreamGenerateContent",
Handler: _GenerativeService_StreamGenerateContent_Handler,
ServerStreams: true,
},
},
Metadata: "google/ai/generativelanguage/v1/generative_service.proto",
}GenerativeService_ServiceDesc is the grpc.ServiceDesc for GenerativeService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
ModelService_ServiceDesc
var ModelService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "google.ai.generativelanguage.v1.ModelService",
HandlerType: (*ModelServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "GetModel",
Handler: _ModelService_GetModel_Handler,
},
{
MethodName: "ListModels",
Handler: _ModelService_ListModels_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "google/ai/generativelanguage/v1/model_service.proto",
}ModelService_ServiceDesc is the grpc.ServiceDesc for ModelService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions
func RegisterGenerativeServiceServer
func RegisterGenerativeServiceServer(s grpc.ServiceRegistrar, srv GenerativeServiceServer)func RegisterModelServiceServer
func RegisterModelServiceServer(s grpc.ServiceRegistrar, srv ModelServiceServer)BatchEmbedContentsRequest
type BatchEmbedContentsRequest struct {
// Required. The model's resource name. This serves as an ID for the Model to
// use.
//
// This name should match a model name returned by the `ListModels` method.
//
// Format: `models/{model}`
Model string `protobuf:"bytes,1,opt,name=model,proto3" json:"model,omitempty"`
// Required. Embed requests for the batch. The model in each of these requests
// must match the model specified `BatchEmbedContentsRequest.model`.
Requests []*EmbedContentRequest `protobuf:"bytes,2,rep,name=requests,proto3" json:"requests,omitempty"`
// contains filtered or unexported fields
}Batch request to get embeddings from the model for a list of prompts.
func (*BatchEmbedContentsRequest) Descriptor
func (*BatchEmbedContentsRequest) Descriptor() ([]byte, []int)Deprecated: Use BatchEmbedContentsRequest.ProtoReflect.Descriptor instead.
func (*BatchEmbedContentsRequest) GetModel
func (x *BatchEmbedContentsRequest) GetModel() stringfunc (*BatchEmbedContentsRequest) GetRequests
func (x *BatchEmbedContentsRequest) GetRequests() []*EmbedContentRequestfunc (*BatchEmbedContentsRequest) ProtoMessage
func (*BatchEmbedContentsRequest) ProtoMessage()func (*BatchEmbedContentsRequest) ProtoReflect
func (x *BatchEmbedContentsRequest) ProtoReflect() protoreflect.Messagefunc (*BatchEmbedContentsRequest) Reset
func (x *BatchEmbedContentsRequest) Reset()func (*BatchEmbedContentsRequest) String
func (x *BatchEmbedContentsRequest) String() stringBatchEmbedContentsResponse
type BatchEmbedContentsResponse struct {
// Output only. The embeddings for each request, in the same order as provided
// in the batch request.
Embeddings []*ContentEmbedding `protobuf:"bytes,1,rep,name=embeddings,proto3" json:"embeddings,omitempty"`
// contains filtered or unexported fields
}The response to a BatchEmbedContentsRequest.
func (*BatchEmbedContentsResponse) Descriptor
func (*BatchEmbedContentsResponse) Descriptor() ([]byte, []int)Deprecated: Use BatchEmbedContentsResponse.ProtoReflect.Descriptor instead.
func (*BatchEmbedContentsResponse) GetEmbeddings
func (x *BatchEmbedContentsResponse) GetEmbeddings() []*ContentEmbeddingfunc (*BatchEmbedContentsResponse) ProtoMessage
func (*BatchEmbedContentsResponse) ProtoMessage()func (*BatchEmbedContentsResponse) ProtoReflect
func (x *BatchEmbedContentsResponse) ProtoReflect() protoreflect.Messagefunc (*BatchEmbedContentsResponse) Reset
func (x *BatchEmbedContentsResponse) Reset()func (*BatchEmbedContentsResponse) String
func (x *BatchEmbedContentsResponse) String() stringBlob
type Blob struct {
// The IANA standard MIME type of the source data.
// Examples:
// - image/png
// - image/jpeg
//
// If an unsupported MIME type is provided, an error will be returned. For a
// complete list of supported types, see [Supported file
// formats](https://ai.google.dev/gemini-api/docs/prompting_with_media#supported_file_formats).
MimeType string `protobuf:"bytes,1,opt,name=mime_type,json=mimeType,proto3" json:"mime_type,omitempty"`
// Raw bytes for media formats.
Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
// contains filtered or unexported fields
}Raw media bytes.
Text should not be sent as raw bytes, use the 'text' field.
func (*Blob) Descriptor
Deprecated: Use Blob.ProtoReflect.Descriptor instead.
func (*Blob) GetData
func (*Blob) GetMimeType
func (*Blob) ProtoMessage
func (*Blob) ProtoMessage()func (*Blob) ProtoReflect
func (x *Blob) ProtoReflect() protoreflect.Messagefunc (*Blob) Reset
func (x *Blob) Reset()func (*Blob) String
Candidate
type Candidate struct {
// Output only. Index of the candidate in the list of response 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 tokens.
FinishReason Candidate_FinishReason `protobuf:"varint,2,opt,name=finish_reason,json=finishReason,proto3,enum=google.ai.generativelanguage.v1.Candidate_FinishReason" json:"finish_reason,omitempty"`
// Optional. Output only. Details the reason why the model stopped generating
// tokens. This is populated only when `finish_reason` is set.
FinishMessage *string `protobuf:"bytes,4,opt,name=finish_message,json=finishMessage,proto3,oneof" json:"finish_message,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. Grounding metadata for the candidate.
//
// This field is populated for `GenerateContent` calls.
GroundingMetadata *GroundingMetadata `protobuf:"bytes,9,opt,name=grounding_metadata,json=groundingMetadata,proto3" json:"grounding_metadata,omitempty"`
// Output only. Average log probability score of the candidate.
AvgLogprobs float64 `protobuf:"fixed64,10,opt,name=avg_logprobs,json=avgLogprobs,proto3" json:"avg_logprobs,omitempty"`
// Output only. Log-likelihood scores for the response tokens and top tokens
LogprobsResult *LogprobsResult `protobuf:"bytes,11,opt,name=logprobs_result,json=logprobsResult,proto3" json:"logprobs_result,omitempty"`
// Output only. Metadata related to url context retrieval tool.
UrlContextMetadata *UrlContextMetadata `protobuf:"bytes,13,opt,name=url_context_metadata,json=urlContextMetadata,proto3" json:"url_context_metadata,omitempty"`
// contains filtered or unexported fields
}A response candidate generated from the model.
func (*Candidate) Descriptor
Deprecated: Use Candidate.ProtoReflect.Descriptor instead.
func (*Candidate) GetAvgLogprobs
func (*Candidate) GetCitationMetadata
func (x *Candidate) GetCitationMetadata() *CitationMetadatafunc (*Candidate) GetContent
func (*Candidate) GetFinishMessage
func (*Candidate) GetFinishReason
func (x *Candidate) GetFinishReason() Candidate_FinishReasonfunc (*Candidate) GetGroundingMetadata
func (x *Candidate) GetGroundingMetadata() *GroundingMetadatafunc (*Candidate) GetIndex
func (*Candidate) GetLogprobsResult
func (x *Candidate) GetLogprobsResult() *LogprobsResultfunc (*Candidate) GetSafetyRatings
func (x *Candidate) GetSafetyRatings() []*SafetyRatingfunc (*Candidate) GetTokenCount
func (*Candidate) GetUrlContextMetadata
func (x *Candidate) GetUrlContextMetadata() *UrlContextMetadatafunc (*Candidate) ProtoMessage
func (*Candidate) ProtoMessage()func (*Candidate) ProtoReflect
func (x *Candidate) ProtoReflect() protoreflect.Messagefunc (*Candidate) Reset
func (x *Candidate) Reset()func (*Candidate) String
Candidate_FinishReason
type Candidate_FinishReason int32Defines the reason why the model stopped generating tokens.
Candidate_FINISH_REASON_UNSPECIFIED, Candidate_STOP, Candidate_MAX_TOKENS, Candidate_SAFETY, Candidate_RECITATION, Candidate_LANGUAGE, Candidate_OTHER, Candidate_BLOCKLIST, Candidate_PROHIBITED_CONTENT, Candidate_SPII, Candidate_MALFORMED_FUNCTION_CALL, Candidate_IMAGE_SAFETY, Candidate_IMAGE_PROHIBITED_CONTENT, Candidate_IMAGE_OTHER, Candidate_NO_IMAGE, Candidate_IMAGE_RECITATION, Candidate_UNEXPECTED_TOOL_CALL, Candidate_TOO_MANY_TOOL_CALLS
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 response candidate content was flagged for safety reasons.
Candidate_SAFETY Candidate_FinishReason = 3
// The response candidate content was flagged for recitation reasons.
Candidate_RECITATION Candidate_FinishReason = 4
// The response candidate content was flagged for using an unsupported
// language.
Candidate_LANGUAGE Candidate_FinishReason = 6
// Unknown reason.
Candidate_OTHER Candidate_FinishReason = 5
// Token generation stopped because the content contains forbidden terms.
Candidate_BLOCKLIST Candidate_FinishReason = 7
// Token generation stopped for potentially containing prohibited content.
Candidate_PROHIBITED_CONTENT Candidate_FinishReason = 8
// Token generation stopped because the content potentially contains
// Sensitive Personally Identifiable Information (SPII).
Candidate_SPII Candidate_FinishReason = 9
// The function call generated by the model is invalid.
Candidate_MALFORMED_FUNCTION_CALL Candidate_FinishReason = 10
// Token generation stopped because generated images contain safety
// violations.
Candidate_IMAGE_SAFETY Candidate_FinishReason = 11
// Image generation stopped because generated images has other prohibited
// content.
Candidate_IMAGE_PROHIBITED_CONTENT Candidate_FinishReason = 14
// Image generation stopped because of other miscellaneous issue.
Candidate_IMAGE_OTHER Candidate_FinishReason = 15
// The model was expected to generate an image, but none was generated.
Candidate_NO_IMAGE Candidate_FinishReason = 16
// Image generation stopped due to recitation.
Candidate_IMAGE_RECITATION Candidate_FinishReason = 17
// Model generated a tool call but no tools were enabled in the request.
Candidate_UNEXPECTED_TOOL_CALL Candidate_FinishReason = 12
// Model called too many tools consecutively, thus the system exited
// execution.
Candidate_TOO_MANY_TOOL_CALLS Candidate_FinishReason = 13
)func (Candidate_FinishReason) Descriptor
func (Candidate_FinishReason) Descriptor() protoreflect.EnumDescriptorfunc (Candidate_FinishReason) Enum
func (x Candidate_FinishReason) Enum() *Candidate_FinishReasonfunc (Candidate_FinishReason) EnumDescriptor
func (Candidate_FinishReason) EnumDescriptor() ([]byte, []int)Deprecated: Use Candidate_FinishReason.Descriptor instead.
func (Candidate_FinishReason) Number
func (x Candidate_FinishReason) Number() protoreflect.EnumNumberfunc (Candidate_FinishReason) String
func (x Candidate_FinishReason) String() stringfunc (Candidate_FinishReason) Type
func (Candidate_FinishReason) Type() protoreflect.EnumTypeCitationMetadata
type CitationMetadata struct {
// Citations to sources for a specific response.
CitationSources []*CitationSource `protobuf:"bytes,1,rep,name=citation_sources,json=citationSources,proto3" json:"citation_sources,omitempty"`
// contains filtered or unexported fields
}A collection of source attributions for a piece of content.
func (*CitationMetadata) Descriptor
func (*CitationMetadata) Descriptor() ([]byte, []int)Deprecated: Use CitationMetadata.ProtoReflect.Descriptor instead.
func (*CitationMetadata) GetCitationSources
func (x *CitationMetadata) GetCitationSources() []*CitationSourcefunc (*CitationMetadata) ProtoMessage
func (*CitationMetadata) ProtoMessage()func (*CitationMetadata) ProtoReflect
func (x *CitationMetadata) ProtoReflect() protoreflect.Messagefunc (*CitationMetadata) Reset
func (x *CitationMetadata) Reset()func (*CitationMetadata) String
func (x *CitationMetadata) String() stringCitationSource
type CitationSource struct {
// Optional. Start of segment of the response that is attributed to this
// source.
//
// Index indicates the start of the segment, measured in bytes.
StartIndex *int32 `protobuf:"varint,1,opt,name=start_index,json=startIndex,proto3,oneof" json:"start_index,omitempty"`
// Optional. End of the attributed segment, exclusive.
EndIndex *int32 `protobuf:"varint,2,opt,name=end_index,json=endIndex,proto3,oneof" json:"end_index,omitempty"`
// Optional. URI that is attributed as a source for a portion of the text.
Uri *string `protobuf:"bytes,3,opt,name=uri,proto3,oneof" json:"uri,omitempty"`
// Optional. License for the GitHub project that is attributed as a source for
// segment.
//
// License info is required for code citations.
License *string `protobuf:"bytes,4,opt,name=license,proto3,oneof" json:"license,omitempty"`
// contains filtered or unexported fields
}A citation to a source for a portion of a specific response.
func (*CitationSource) Descriptor
func (*CitationSource) Descriptor() ([]byte, []int)Deprecated: Use CitationSource.ProtoReflect.Descriptor instead.
func (*CitationSource) GetEndIndex
func (x *CitationSource) GetEndIndex() int32func (*CitationSource) GetLicense
func (x *CitationSource) GetLicense() stringfunc (*CitationSource) GetStartIndex
func (x *CitationSource) GetStartIndex() int32func (*CitationSource) GetUri
func (x *CitationSource) GetUri() stringfunc (*CitationSource) ProtoMessage
func (*CitationSource) ProtoMessage()func (*CitationSource) ProtoReflect
func (x *CitationSource) ProtoReflect() protoreflect.Messagefunc (*CitationSource) Reset
func (x *CitationSource) Reset()func (*CitationSource) String
func (x *CitationSource) String() stringContent
type Content struct {
// Ordered `Parts` that constitute a single message. Parts may have different
// MIME types.
Parts []*Part `protobuf:"bytes,1,rep,name=parts,proto3" json:"parts,omitempty"`
// Optional. The producer of the content. Must be either 'user' or 'model'.
//
// Useful to set for multi-turn conversations, otherwise can be left blank
// or unset.
Role string `protobuf:"bytes,2,opt,name=role,proto3" json:"role,omitempty"`
// contains filtered or unexported fields
}The base structured datatype containing multi-part content of a message.
A Content includes a role field designating the producer of the Content
and a parts field containing multi-part data that contains the content of
the message turn.
func (*Content) Descriptor
Deprecated: Use Content.ProtoReflect.Descriptor instead.
func (*Content) GetParts
func (*Content) GetRole
func (*Content) ProtoMessage
func (*Content) ProtoMessage()func (*Content) ProtoReflect
func (x *Content) ProtoReflect() protoreflect.Messagefunc (*Content) Reset
func (x *Content) Reset()func (*Content) String
ContentEmbedding
type ContentEmbedding struct {
// The embedding values.
Values []float32 `protobuf:"fixed32,1,rep,packed,name=values,proto3" json:"values,omitempty"`
// contains filtered or unexported fields
}A list of floats representing an embedding.
func (*ContentEmbedding) Descriptor
func (*ContentEmbedding) Descriptor() ([]byte, []int)Deprecated: Use ContentEmbedding.ProtoReflect.Descriptor instead.
func (*ContentEmbedding) GetValues
func (x *ContentEmbedding) GetValues() []float32func (*ContentEmbedding) ProtoMessage
func (*ContentEmbedding) ProtoMessage()func (*ContentEmbedding) ProtoReflect
func (x *ContentEmbedding) ProtoReflect() protoreflect.Messagefunc (*ContentEmbedding) Reset
func (x *ContentEmbedding) Reset()func (*ContentEmbedding) String
func (x *ContentEmbedding) String() stringCountTokensRequest
type CountTokensRequest struct {
// Required. The model's resource name. This serves as an ID for the Model to
// use.
//
// This name should match a model name returned by the `ListModels` method.
//
// Format: `models/{model}`
Model string `protobuf:"bytes,1,opt,name=model,proto3" json:"model,omitempty"`
// Optional. The input given to the model as a prompt. This field is ignored
// when `generate_content_request` is set.
Contents []*Content `protobuf:"bytes,2,rep,name=contents,proto3" json:"contents,omitempty"`
// Optional. The overall input given to the `Model`. This includes the prompt
// as well as other model steering information like [system
// instructions](https://ai.google.dev/gemini-api/docs/system-instructions),
// and/or function declarations for [function
// calling](https://ai.google.dev/gemini-api/docs/function-calling).
// `Model`s/`Content`s and `generate_content_request`s are mutually
// exclusive. You can either send `Model` + `Content`s or a
// `generate_content_request`, but never both.
GenerateContentRequest *GenerateContentRequest `protobuf:"bytes,3,opt,name=generate_content_request,json=generateContentRequest,proto3" json:"generate_content_request,omitempty"`
// contains filtered or unexported fields
}Counts the number of tokens in the prompt sent to a model.
Models may tokenize text differently, so each model may return a different
token_count.
func (*CountTokensRequest) Descriptor
func (*CountTokensRequest) Descriptor() ([]byte, []int)Deprecated: Use CountTokensRequest.ProtoReflect.Descriptor instead.
func (*CountTokensRequest) GetContents
func (x *CountTokensRequest) GetContents() []*Contentfunc (*CountTokensRequest) GetGenerateContentRequest
func (x *CountTokensRequest) GetGenerateContentRequest() *GenerateContentRequestfunc (*CountTokensRequest) GetModel
func (x *CountTokensRequest) GetModel() stringfunc (*CountTokensRequest) ProtoMessage
func (*CountTokensRequest) ProtoMessage()func (*CountTokensRequest) ProtoReflect
func (x *CountTokensRequest) ProtoReflect() protoreflect.Messagefunc (*CountTokensRequest) Reset
func (x *CountTokensRequest) Reset()func (*CountTokensRequest) String
func (x *CountTokensRequest) String() stringCountTokensResponse
type CountTokensResponse struct {
// The number of tokens that the `Model` tokenizes the `prompt` into. Always
// non-negative.
TotalTokens int32 `protobuf:"varint,1,opt,name=total_tokens,json=totalTokens,proto3" json:"total_tokens,omitempty"`
// Output only. List of modalities that were processed in the request input.
PromptTokensDetails []*ModalityTokenCount `protobuf:"bytes,6,rep,name=prompt_tokens_details,json=promptTokensDetails,proto3" json:"prompt_tokens_details,omitempty"`
// Output only. List of modalities that were processed in the cached content.
CacheTokensDetails []*ModalityTokenCount `protobuf:"bytes,7,rep,name=cache_tokens_details,json=cacheTokensDetails,proto3" json:"cache_tokens_details,omitempty"`
// contains filtered or unexported fields
}A response from CountTokens.
It returns the model's token_count for the prompt.
func (*CountTokensResponse) Descriptor
func (*CountTokensResponse) Descriptor() ([]byte, []int)Deprecated: Use CountTokensResponse.ProtoReflect.Descriptor instead.
func (*CountTokensResponse) GetCacheTokensDetails
func (x *CountTokensResponse) GetCacheTokensDetails() []*ModalityTokenCountfunc (*CountTokensResponse) GetPromptTokensDetails
func (x *CountTokensResponse) GetPromptTokensDetails() []*ModalityTokenCountfunc (*CountTokensResponse) GetTotalTokens
func (x *CountTokensResponse) GetTotalTokens() int32func (*CountTokensResponse) ProtoMessage
func (*CountTokensResponse) ProtoMessage()func (*CountTokensResponse) ProtoReflect
func (x *CountTokensResponse) ProtoReflect() protoreflect.Messagefunc (*CountTokensResponse) Reset
func (x *CountTokensResponse) Reset()func (*CountTokensResponse) String
func (x *CountTokensResponse) String() stringEmbedContentRequest
type EmbedContentRequest struct {
// Required. The model's resource name. This serves as an ID for the Model to
// use.
//
// This name should match a model name returned by the `ListModels` method.
//
// Format: `models/{model}`
Model string `protobuf:"bytes,1,opt,name=model,proto3" json:"model,omitempty"`
// Required. The content to embed. Only the `parts.text` fields will be
// counted.
Content *Content `protobuf:"bytes,2,opt,name=content,proto3" json:"content,omitempty"`
// Optional. Optional task type for which the embeddings will be used. Not
// supported on earlier models (`models/embedding-001`).
TaskType *TaskType `protobuf:"varint,3,opt,name=task_type,json=taskType,proto3,enum=google.ai.generativelanguage.v1.TaskType,oneof" json:"task_type,omitempty"`
// Optional. An optional title for the text. Only applicable when TaskType is
// `RETRIEVAL_DOCUMENT`.
//
// Note: Specifying a `title` for `RETRIEVAL_DOCUMENT` provides better quality
// embeddings for retrieval.
Title *string `protobuf:"bytes,4,opt,name=title,proto3,oneof" json:"title,omitempty"`
// Optional. Optional reduced dimension for the output embedding. If set,
// excessive values in the output embedding are truncated from the end.
// Supported by newer models since 2024 only. You cannot set this value if
// using the earlier model (`models/embedding-001`).
OutputDimensionality *int32 `protobuf:"varint,5,opt,name=output_dimensionality,json=outputDimensionality,proto3,oneof" json:"output_dimensionality,omitempty"`
// contains filtered or unexported fields
}Request containing the Content for the model to embed.
func (*EmbedContentRequest) Descriptor
func (*EmbedContentRequest) Descriptor() ([]byte, []int)Deprecated: Use EmbedContentRequest.ProtoReflect.Descriptor instead.
func (*EmbedContentRequest) GetContent
func (x *EmbedContentRequest) GetContent() *Contentfunc (*EmbedContentRequest) GetModel
func (x *EmbedContentRequest) GetModel() stringfunc (*EmbedContentRequest) GetOutputDimensionality
func (x *EmbedContentRequest) GetOutputDimensionality() int32func (*EmbedContentRequest) GetTaskType
func (x *EmbedContentRequest) GetTaskType() TaskTypefunc (*EmbedContentRequest) GetTitle
func (x *EmbedContentRequest) GetTitle() stringfunc (*EmbedContentRequest) ProtoMessage
func (*EmbedContentRequest) ProtoMessage()func (*EmbedContentRequest) ProtoReflect
func (x *EmbedContentRequest) ProtoReflect() protoreflect.Messagefunc (*EmbedContentRequest) Reset
func (x *EmbedContentRequest) Reset()func (*EmbedContentRequest) String
func (x *EmbedContentRequest) String() stringEmbedContentResponse
type EmbedContentResponse struct {
// Output only. The embedding generated from the input content.
Embedding *ContentEmbedding `protobuf:"bytes,1,opt,name=embedding,proto3" json:"embedding,omitempty"`
// contains filtered or unexported fields
}The response to an EmbedContentRequest.
func (*EmbedContentResponse) Descriptor
func (*EmbedContentResponse) Descriptor() ([]byte, []int)Deprecated: Use EmbedContentResponse.ProtoReflect.Descriptor instead.
func (*EmbedContentResponse) GetEmbedding
func (x *EmbedContentResponse) GetEmbedding() *ContentEmbeddingfunc (*EmbedContentResponse) ProtoMessage
func (*EmbedContentResponse) ProtoMessage()func (*EmbedContentResponse) ProtoReflect
func (x *EmbedContentResponse) ProtoReflect() protoreflect.Messagefunc (*EmbedContentResponse) Reset
func (x *EmbedContentResponse) Reset()func (*EmbedContentResponse) String
func (x *EmbedContentResponse) String() stringGenerateContentRequest
type GenerateContentRequest struct {
// Required. The name of the `Model` to use for generating the completion.
//
// Format: `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
// like [chat](https://ai.google.dev/gemini-api/docs/text-generation#chat),
// this is a repeated field that contains the conversation history and the
// latest request.
Contents []*Content `protobuf:"bytes,2,rep,name=contents,proto3" json:"contents,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, HARM_CATEGORY_CIVIC_INTEGRITY are supported.
// Refer to the [guide](https://ai.google.dev/gemini-api/docs/safety-settings)
// for detailed information on available safety settings. Also refer to the
// [Safety guidance](https://ai.google.dev/gemini-api/docs/safety-guidance) to
// learn how to incorporate safety considerations in your AI applications.
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"`
// contains filtered or unexported fields
}Request to generate a completion from the model.
func (*GenerateContentRequest) Descriptor
func (*GenerateContentRequest) Descriptor() ([]byte, []int)Deprecated: Use GenerateContentRequest.ProtoReflect.Descriptor instead.
func (*GenerateContentRequest) GetContents
func (x *GenerateContentRequest) GetContents() []*Contentfunc (*GenerateContentRequest) GetGenerationConfig
func (x *GenerateContentRequest) GetGenerationConfig() *GenerationConfigfunc (*GenerateContentRequest) GetModel
func (x *GenerateContentRequest) GetModel() stringfunc (*GenerateContentRequest) GetSafetySettings
func (x *GenerateContentRequest) GetSafetySettings() []*SafetySettingfunc (*GenerateContentRequest) ProtoMessage
func (*GenerateContentRequest) ProtoMessage()func (*GenerateContentRequest) ProtoReflect
func (x *GenerateContentRequest) ProtoReflect() protoreflect.Messagefunc (*GenerateContentRequest) Reset
func (x *GenerateContentRequest) Reset()func (*GenerateContentRequest) String
func (x *GenerateContentRequest) String() stringGenerateContentResponse
type GenerateContentResponse struct {
// 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"`
// Output only. Metadata on the generation requests' token usage.
UsageMetadata *GenerateContentResponse_UsageMetadata `protobuf:"bytes,3,opt,name=usage_metadata,json=usageMetadata,proto3" json:"usage_metadata,omitempty"`
// Output only. The model version used to generate the response.
ModelVersion string `protobuf:"bytes,4,opt,name=model_version,json=modelVersion,proto3" json:"model_version,omitempty"`
// Output only. response_id is used to identify each response.
ResponseId string `protobuf:"bytes,5,opt,name=response_id,json=responseId,proto3" json:"response_id,omitempty"`
// contains filtered or unexported fields
}Response from the model supporting multiple candidate responses.
Safety ratings and content filtering are reported for both
prompt in GenerateContentResponse.prompt_feedback and for each candidate
in finish_reason and in safety_ratings. The API:
- Returns either all requested candidates or none of them
- Returns no candidates at all only if there was something wrong with the
prompt (check
prompt_feedback) - Reports feedback on each candidate in
finish_reasonandsafety_ratings.
func (*GenerateContentResponse) Descriptor
func (*GenerateContentResponse) Descriptor() ([]byte, []int)Deprecated: Use GenerateContentResponse.ProtoReflect.Descriptor instead.
func (*GenerateContentResponse) GetCandidates
func (x *GenerateContentResponse) GetCandidates() []*Candidatefunc (*GenerateContentResponse) GetModelVersion
func (x *GenerateContentResponse) GetModelVersion() stringfunc (*GenerateContentResponse) GetPromptFeedback
func (x *GenerateContentResponse) GetPromptFeedback() *GenerateContentResponse_PromptFeedbackfunc (*GenerateContentResponse) GetResponseId
func (x *GenerateContentResponse) GetResponseId() stringfunc (*GenerateContentResponse) GetUsageMetadata
func (x *GenerateContentResponse) GetUsageMetadata() *GenerateContentResponse_UsageMetadatafunc (*GenerateContentResponse) ProtoMessage
func (*GenerateContentResponse) ProtoMessage()func (*GenerateContentResponse) ProtoReflect
func (x *GenerateContentResponse) ProtoReflect() protoreflect.Messagefunc (*GenerateContentResponse) Reset
func (x *GenerateContentResponse) Reset()func (*GenerateContentResponse) String
func (x *GenerateContentResponse) String() stringGenerateContentResponse_PromptFeedback
type GenerateContentResponse_PromptFeedback struct {
// Optional. If set, the prompt was blocked and no candidates are returned.
// Rephrase the prompt.
BlockReason GenerateContentResponse_PromptFeedback_BlockReason `protobuf:"varint,1,opt,name=block_reason,json=blockReason,proto3,enum=google.ai.generativelanguage.v1.GenerateContentResponse_PromptFeedback_BlockReason" json:"block_reason,omitempty"`
// Ratings for safety of the prompt.
// There is at most one rating per category.
SafetyRatings []*SafetyRating `protobuf:"bytes,2,rep,name=safety_ratings,json=safetyRatings,proto3" json:"safety_ratings,omitempty"`
// contains filtered or unexported fields
}A set of the feedback metadata the prompt specified in
GenerateContentRequest.content.
func (*GenerateContentResponse_PromptFeedback) Descriptor
func (*GenerateContentResponse_PromptFeedback) Descriptor() ([]byte, []int)Deprecated: Use GenerateContentResponse_PromptFeedback.ProtoReflect.Descriptor instead.
func (*GenerateContentResponse_PromptFeedback) GetBlockReason
func (x *GenerateContentResponse_PromptFeedback) GetBlockReason() GenerateContentResponse_PromptFeedback_BlockReasonfunc (*GenerateContentResponse_PromptFeedback) GetSafetyRatings
func (x *GenerateContentResponse_PromptFeedback) GetSafetyRatings() []*SafetyRatingfunc (*GenerateContentResponse_PromptFeedback) ProtoMessage
func (*GenerateContentResponse_PromptFeedback) ProtoMessage()func (*GenerateContentResponse_PromptFeedback) ProtoReflect
func (x *GenerateContentResponse_PromptFeedback) ProtoReflect() protoreflect.Messagefunc (*GenerateContentResponse_PromptFeedback) Reset
func (x *GenerateContentResponse_PromptFeedback) Reset()func (*GenerateContentResponse_PromptFeedback) String
func (x *GenerateContentResponse_PromptFeedback) String() stringGenerateContentResponse_PromptFeedback_BlockReason
type GenerateContentResponse_PromptFeedback_BlockReason int32Specifies the reason why the prompt was blocked.
GenerateContentResponse_PromptFeedback_BLOCK_REASON_UNSPECIFIED, GenerateContentResponse_PromptFeedback_SAFETY, GenerateContentResponse_PromptFeedback_OTHER, GenerateContentResponse_PromptFeedback_BLOCKLIST, GenerateContentResponse_PromptFeedback_PROHIBITED_CONTENT, GenerateContentResponse_PromptFeedback_IMAGE_SAFETY
const (
// Default value. This value is unused.
GenerateContentResponse_PromptFeedback_BLOCK_REASON_UNSPECIFIED GenerateContentResponse_PromptFeedback_BlockReason = 0
// Prompt was blocked due to safety reasons. Inspect `safety_ratings`
// to understand which safety category blocked it.
GenerateContentResponse_PromptFeedback_SAFETY GenerateContentResponse_PromptFeedback_BlockReason = 1
// Prompt was blocked due to unknown reasons.
GenerateContentResponse_PromptFeedback_OTHER GenerateContentResponse_PromptFeedback_BlockReason = 2
// Prompt was blocked due to the terms which are included from the
// terminology blocklist.
GenerateContentResponse_PromptFeedback_BLOCKLIST GenerateContentResponse_PromptFeedback_BlockReason = 3
// Prompt was blocked due to prohibited content.
GenerateContentResponse_PromptFeedback_PROHIBITED_CONTENT GenerateContentResponse_PromptFeedback_BlockReason = 4
// Candidates blocked due to unsafe image generation content.
GenerateContentResponse_PromptFeedback_IMAGE_SAFETY GenerateContentResponse_PromptFeedback_BlockReason = 5
)func (GenerateContentResponse_PromptFeedback_BlockReason) Descriptor
func (GenerateContentResponse_PromptFeedback_BlockReason) Descriptor() protoreflect.EnumDescriptorfunc (GenerateContentResponse_PromptFeedback_BlockReason) Enum
func (x GenerateContentResponse_PromptFeedback_BlockReason) Enum() *GenerateContentResponse_PromptFeedback_BlockReasonfunc (GenerateContentResponse_PromptFeedback_BlockReason) EnumDescriptor
func (GenerateContentResponse_PromptFeedback_BlockReason) EnumDescriptor() ([]byte, []int)Deprecated: Use GenerateContentResponse_PromptFeedback_BlockReason.Descriptor instead.
func (GenerateContentResponse_PromptFeedback_BlockReason) Number
func (x GenerateContentResponse_PromptFeedback_BlockReason) Number() protoreflect.EnumNumberfunc (GenerateContentResponse_PromptFeedback_BlockReason) String
func (x GenerateContentResponse_PromptFeedback_BlockReason) String() stringfunc (GenerateContentResponse_PromptFeedback_BlockReason) Type
GenerateContentResponse_UsageMetadata
type GenerateContentResponse_UsageMetadata struct {
// Number of tokens in the prompt. When `cached_content` is set, this is
// still the total effective prompt size meaning this includes the number of
// tokens in the cached content.
PromptTokenCount int32 `protobuf:"varint,1,opt,name=prompt_token_count,json=promptTokenCount,proto3" json:"prompt_token_count,omitempty"`
// Total number of tokens across all the generated response candidates.
CandidatesTokenCount int32 `protobuf:"varint,2,opt,name=candidates_token_count,json=candidatesTokenCount,proto3" json:"candidates_token_count,omitempty"`
// Output only. Number of tokens present in tool-use prompt(s).
ToolUsePromptTokenCount int32 `protobuf:"varint,8,opt,name=tool_use_prompt_token_count,json=toolUsePromptTokenCount,proto3" json:"tool_use_prompt_token_count,omitempty"`
// Output only. Number of tokens of thoughts for thinking models.
ThoughtsTokenCount int32 `protobuf:"varint,10,opt,name=thoughts_token_count,json=thoughtsTokenCount,proto3" json:"thoughts_token_count,omitempty"`
// Total token count for the generation request (prompt + response
// candidates).
TotalTokenCount int32 `protobuf:"varint,3,opt,name=total_token_count,json=totalTokenCount,proto3" json:"total_token_count,omitempty"`
// Output only. List of modalities that were processed in the request input.
PromptTokensDetails []*ModalityTokenCount `protobuf:"bytes,5,rep,name=prompt_tokens_details,json=promptTokensDetails,proto3" json:"prompt_tokens_details,omitempty"`
// Output only. List of modalities of the cached content in the request
// input.
CacheTokensDetails []*ModalityTokenCount `protobuf:"bytes,6,rep,name=cache_tokens_details,json=cacheTokensDetails,proto3" json:"cache_tokens_details,omitempty"`
// Output only. List of modalities that were returned in the response.
CandidatesTokensDetails []*ModalityTokenCount `protobuf:"bytes,7,rep,name=candidates_tokens_details,json=candidatesTokensDetails,proto3" json:"candidates_tokens_details,omitempty"`
// Output only. List of modalities that were processed for tool-use request
// inputs.
ToolUsePromptTokensDetails []*ModalityTokenCount `protobuf:"bytes,9,rep,name=tool_use_prompt_tokens_details,json=toolUsePromptTokensDetails,proto3" json:"tool_use_prompt_tokens_details,omitempty"`
// contains filtered or unexported fields
}Metadata on the generation request's token usage.
func (*GenerateContentResponse_UsageMetadata) Descriptor
func (*GenerateContentResponse_UsageMetadata) Descriptor() ([]byte, []int)Deprecated: Use GenerateContentResponse_UsageMetadata.ProtoReflect.Descriptor instead.
func (*GenerateContentResponse_UsageMetadata) GetCacheTokensDetails
func (x *GenerateContentResponse_UsageMetadata) GetCacheTokensDetails() []*ModalityTokenCountfunc (*GenerateContentResponse_UsageMetadata) GetCandidatesTokenCount
func (x *GenerateContentResponse_UsageMetadata) GetCandidatesTokenCount() int32func (*GenerateContentResponse_UsageMetadata) GetCandidatesTokensDetails
func (x *GenerateContentResponse_UsageMetadata) GetCandidatesTokensDetails() []*ModalityTokenCountfunc (*GenerateContentResponse_UsageMetadata) GetPromptTokenCount
func (x *GenerateContentResponse_UsageMetadata) GetPromptTokenCount() int32func (*GenerateContentResponse_UsageMetadata) GetPromptTokensDetails
func (x *GenerateContentResponse_UsageMetadata) GetPromptTokensDetails() []*ModalityTokenCountfunc (*GenerateContentResponse_UsageMetadata) GetThoughtsTokenCount
func (x *GenerateContentResponse_UsageMetadata) GetThoughtsTokenCount() int32func (*GenerateContentResponse_UsageMetadata) GetToolUsePromptTokenCount
func (x *GenerateContentResponse_UsageMetadata) GetToolUsePromptTokenCount() int32func (*GenerateContentResponse_UsageMetadata) GetToolUsePromptTokensDetails
func (x *GenerateContentResponse_UsageMetadata) GetToolUsePromptTokensDetails() []*ModalityTokenCountfunc (*GenerateContentResponse_UsageMetadata) GetTotalTokenCount
func (x *GenerateContentResponse_UsageMetadata) GetTotalTokenCount() int32func (*GenerateContentResponse_UsageMetadata) ProtoMessage
func (*GenerateContentResponse_UsageMetadata) ProtoMessage()func (*GenerateContentResponse_UsageMetadata) ProtoReflect
func (x *GenerateContentResponse_UsageMetadata) ProtoReflect() protoreflect.Messagefunc (*GenerateContentResponse_UsageMetadata) Reset
func (x *GenerateContentResponse_UsageMetadata) Reset()func (*GenerateContentResponse_UsageMetadata) String
func (x *GenerateContentResponse_UsageMetadata) String() stringGenerationConfig
type GenerationConfig struct {
// Optional. Number of generated responses to return. If unset, this will
// default to 1. Please note that this doesn't work for previous generation
// models (Gemini 1.0 family)
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 response candidate.
//
// Note: The default value varies by model, see the `Model.output_token_limit`
// attribute of the `Model` returned from the `getModel` function.
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 from the `getModel` function.
//
// Values can range from [0.0, 2.0].
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 Top-p (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 the
// number of tokens based on the cumulative probability.
//
// Note: The default value varies by `Model` and is specified by
// the`Model.top_p` attribute returned from the `getModel` function. An empty
// `top_k` attribute indicates that the model doesn't apply top-k sampling
// and doesn't allow setting `top_k` on requests.
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.
//
// Gemini models use Top-p (nucleus) sampling or a combination of Top-k and
// nucleus sampling. Top-k sampling considers the set of `top_k` most probable
// tokens. Models running with nucleus sampling don't allow top_k setting.
//
// Note: The default value varies by `Model` and is specified by
// the`Model.top_p` attribute returned from the `getModel` function. An empty
// `top_k` attribute indicates that the model doesn't apply top-k sampling
// and doesn't allow setting `top_k` on requests.
TopK *int32 `protobuf:"varint,7,opt,name=top_k,json=topK,proto3,oneof" json:"top_k,omitempty"`
// Optional. Seed used in decoding. If not set, the request uses a randomly
// generated seed.
Seed *int32 `protobuf:"varint,8,opt,name=seed,proto3,oneof" json:"seed,omitempty"`
// Optional. An internal detail. Use `responseJsonSchema` rather than this
// field.
ResponseJsonSchemaOrdered *structpb.Value `protobuf:"bytes,28,opt,name=response_json_schema_ordered,json=responseJsonSchema,proto3" json:"response_json_schema_ordered,omitempty"`
// Optional. Presence penalty applied to the next token's logprobs if the
// token has already been seen in the response.
//
// This penalty is binary on/off and not dependant on the number of times the
// token is used (after the first). Use
// [frequency_penalty][google.ai.generativelanguage.v1.GenerationConfig.frequency_penalty]
// for a penalty that increases with each use.
//
// A positive penalty will discourage the use of tokens that have already
// been used in the response, increasing the vocabulary.
//
// A negative penalty will encourage the use of tokens that have already been
// used in the response, decreasing the vocabulary.
PresencePenalty *float32 `protobuf:"fixed32,15,opt,name=presence_penalty,json=presencePenalty,proto3,oneof" json:"presence_penalty,omitempty"`
// Optional. Frequency penalty applied to the next token's logprobs,
// multiplied by the number of times each token has been seen in the respponse
// so far.
//
// A positive penalty will discourage the use of tokens that have already
// been used, proportional to the number of times the token has been used:
// The more a token is used, the more difficult it is for the model to use
// that token again increasing the vocabulary of responses.
//
// Caution: A _negative_ penalty will encourage the model to reuse tokens
// proportional to the number of times the token has been used. Small
// negative values will reduce the vocabulary of a response. Larger negative
// values will cause the model to start repeating a common token until it
// hits the
// [max_output_tokens][google.ai.generativelanguage.v1.GenerationConfig.max_output_tokens]
// limit.
FrequencyPenalty *float32 `protobuf:"fixed32,16,opt,name=frequency_penalty,json=frequencyPenalty,proto3,oneof" json:"frequency_penalty,omitempty"`
// Optional. If true, export the logprobs results in response.
ResponseLogprobs *bool `protobuf:"varint,17,opt,name=response_logprobs,json=responseLogprobs,proto3,oneof" json:"response_logprobs,omitempty"`
// Optional. Only valid if
// [response_logprobs=True][google.ai.generativelanguage.v1.GenerationConfig.response_logprobs].
// This sets the number of top logprobs to return at each decoding step in the
// [Candidate.logprobs_result][google.ai.generativelanguage.v1.Candidate.logprobs_result].
// The number must be in the range of [0, 20].
Logprobs *int32 `protobuf:"varint,18,opt,name=logprobs,proto3,oneof" json:"logprobs,omitempty"`
// Optional. Enables enhanced civic answers. It may not be available for all
// models.
EnableEnhancedCivicAnswers *bool `protobuf:"varint,19,opt,name=enable_enhanced_civic_answers,json=enableEnhancedCivicAnswers,proto3,oneof" json:"enable_enhanced_civic_answers,omitempty"`
// contains filtered or unexported fields
}Configuration options for model generation and outputs. Not all parameters are configurable for every model.
func (*GenerationConfig) Descriptor
func (*GenerationConfig) Descriptor() ([]byte, []int)Deprecated: Use GenerationConfig.ProtoReflect.Descriptor instead.
func (*GenerationConfig) GetCandidateCount
func (x *GenerationConfig) GetCandidateCount() int32func (*GenerationConfig) GetEnableEnhancedCivicAnswers
func (x *GenerationConfig) GetEnableEnhancedCivicAnswers() boolfunc (*GenerationConfig) GetFrequencyPenalty
func (x *GenerationConfig) GetFrequencyPenalty() float32func (*GenerationConfig) GetLogprobs
func (x *GenerationConfig) GetLogprobs() int32func (*GenerationConfig) GetMaxOutputTokens
func (x *GenerationConfig) GetMaxOutputTokens() int32func (*GenerationConfig) GetPresencePenalty
func (x *GenerationConfig) GetPresencePenalty() float32func (*GenerationConfig) GetResponseJsonSchemaOrdered
func (x *GenerationConfig) GetResponseJsonSchemaOrdered() *structpb.Valuefunc (*GenerationConfig) GetResponseLogprobs
func (x *GenerationConfig) GetResponseLogprobs() boolfunc (*GenerationConfig) GetSeed
func (x *GenerationConfig) GetSeed() int32func (*GenerationConfig) GetStopSequences
func (x *GenerationConfig) GetStopSequences() []stringfunc (*GenerationConfig) GetTemperature
func (x *GenerationConfig) GetTemperature() float32func (*GenerationConfig) GetTopK
func (x *GenerationConfig) GetTopK() int32func (*GenerationConfig) GetTopP
func (x *GenerationConfig) GetTopP() float32func (*GenerationConfig) ProtoMessage
func (*GenerationConfig) ProtoMessage()func (*GenerationConfig) ProtoReflect
func (x *GenerationConfig) ProtoReflect() protoreflect.Messagefunc (*GenerationConfig) Reset
func (x *GenerationConfig) Reset()func (*GenerationConfig) String
func (x *GenerationConfig) String() stringGenerativeServiceClient
type GenerativeServiceClient interface {
// Generates a model response given an input `GenerateContentRequest`.
// Refer to the [text generation
// guide](https://ai.google.dev/gemini-api/docs/text-generation) for detailed
// usage information. Input capabilities differ between models, including
// tuned models. Refer to the [model
// guide](https://ai.google.dev/gemini-api/docs/models/gemini) and [tuning
// guide](https://ai.google.dev/gemini-api/docs/model-tuning) for details.
GenerateContent(ctx context.Context, in *GenerateContentRequest, opts ...grpc.CallOption) (*GenerateContentResponse, error)
// Generates a [streamed
// response](https://ai.google.dev/gemini-api/docs/text-generation?lang=python#generate-a-text-stream)
// from the model given an input `GenerateContentRequest`.
StreamGenerateContent(ctx context.Context, in *GenerateContentRequest, opts ...grpc.CallOption) (GenerativeService_StreamGenerateContentClient, error)
// Generates a text embedding vector from the input `Content` using the
// specified [Gemini Embedding
// model](https://ai.google.dev/gemini-api/docs/models/gemini#text-embedding).
EmbedContent(ctx context.Context, in *EmbedContentRequest, opts ...grpc.CallOption) (*EmbedContentResponse, error)
// Generates multiple embedding vectors from the input `Content` which
// consists of a batch of strings represented as `EmbedContentRequest`
// objects.
BatchEmbedContents(ctx context.Context, in *BatchEmbedContentsRequest, opts ...grpc.CallOption) (*BatchEmbedContentsResponse, error)
// Runs a model's tokenizer on input `Content` and returns the token count.
// Refer to the [tokens guide](https://ai.google.dev/gemini-api/docs/tokens)
// to learn more about tokens.
CountTokens(ctx context.Context, in *CountTokensRequest, opts ...grpc.CallOption) (*CountTokensResponse, error)
}GenerativeServiceClient is the client API for GenerativeService service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
func NewGenerativeServiceClient
func NewGenerativeServiceClient(cc grpc.ClientConnInterface) GenerativeServiceClientGenerativeServiceServer
type GenerativeServiceServer interface {
// Generates a model response given an input `GenerateContentRequest`.
// Refer to the [text generation
// guide](https://ai.google.dev/gemini-api/docs/text-generation) for detailed
// usage information. Input capabilities differ between models, including
// tuned models. Refer to the [model
// guide](https://ai.google.dev/gemini-api/docs/models/gemini) and [tuning
// guide](https://ai.google.dev/gemini-api/docs/model-tuning) for details.
GenerateContent(context.Context, *GenerateContentRequest) (*GenerateContentResponse, error)
// Generates a [streamed
// response](https://ai.google.dev/gemini-api/docs/text-generation?lang=python#generate-a-text-stream)
// from the model given an input `GenerateContentRequest`.
StreamGenerateContent(*GenerateContentRequest, GenerativeService_StreamGenerateContentServer) error
// Generates a text embedding vector from the input `Content` using the
// specified [Gemini Embedding
// model](https://ai.google.dev/gemini-api/docs/models/gemini#text-embedding).
EmbedContent(context.Context, *EmbedContentRequest) (*EmbedContentResponse, error)
// Generates multiple embedding vectors from the input `Content` which
// consists of a batch of strings represented as `EmbedContentRequest`
// objects.
BatchEmbedContents(context.Context, *BatchEmbedContentsRequest) (*BatchEmbedContentsResponse, error)
// Runs a model's tokenizer on input `Content` and returns the token count.
// Refer to the [tokens guide](https://ai.google.dev/gemini-api/docs/tokens)
// to learn more about tokens.
CountTokens(context.Context, *CountTokensRequest) (*CountTokensResponse, error)
}GenerativeServiceServer is the server API for GenerativeService service. All implementations should embed UnimplementedGenerativeServiceServer for forward compatibility
GenerativeService_StreamGenerateContentClient
type GenerativeService_StreamGenerateContentClient interface {
Recv() (*GenerateContentResponse, error)
grpc.ClientStream
}GenerativeService_StreamGenerateContentServer
type GenerativeService_StreamGenerateContentServer interface {
Send(*GenerateContentResponse) error
grpc.ServerStream
}GetModelRequest
type GetModelRequest struct {
// Required. The resource name of the model.
//
// This name should match a model name returned by the `ListModels` method.
//
// Format: `models/{model}`
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
// contains filtered or unexported fields
}Request for getting information about a specific Model.
func (*GetModelRequest) Descriptor
func (*GetModelRequest) Descriptor() ([]byte, []int)Deprecated: Use GetModelRequest.ProtoReflect.Descriptor instead.
func (*GetModelRequest) GetName
func (x *GetModelRequest) GetName() stringfunc (*GetModelRequest) ProtoMessage
func (*GetModelRequest) ProtoMessage()func (*GetModelRequest) ProtoReflect
func (x *GetModelRequest) ProtoReflect() protoreflect.Messagefunc (*GetModelRequest) Reset
func (x *GetModelRequest) Reset()func (*GetModelRequest) String
func (x *GetModelRequest) String() stringGroundingChunk
type GroundingChunk struct {
// Chunk type.
//
// Types that are valid to be assigned to ChunkType:
//
// *GroundingChunk_Web_
ChunkType isGroundingChunk_ChunkType `protobuf_oneof:"chunk_type"`
// contains filtered or unexported fields
}Grounding chunk.
func (*GroundingChunk) Descriptor
func (*GroundingChunk) Descriptor() ([]byte, []int)Deprecated: Use GroundingChunk.ProtoReflect.Descriptor instead.
func (*GroundingChunk) GetChunkType
func (x *GroundingChunk) GetChunkType() isGroundingChunk_ChunkTypefunc (*GroundingChunk) GetWeb
func (x *GroundingChunk) GetWeb() *GroundingChunk_Webfunc (*GroundingChunk) ProtoMessage
func (*GroundingChunk) ProtoMessage()func (*GroundingChunk) ProtoReflect
func (x *GroundingChunk) ProtoReflect() protoreflect.Messagefunc (*GroundingChunk) Reset
func (x *GroundingChunk) Reset()func (*GroundingChunk) String
func (x *GroundingChunk) String() stringGroundingChunk_Web
type GroundingChunk_Web struct {
// URI reference of the chunk.
Uri *string `protobuf:"bytes,1,opt,name=uri,proto3,oneof" json:"uri,omitempty"`
// Title of the chunk.
Title *string `protobuf:"bytes,2,opt,name=title,proto3,oneof" json:"title,omitempty"`
// contains filtered or unexported fields
}Chunk from the web.
func (*GroundingChunk_Web) Descriptor
func (*GroundingChunk_Web) Descriptor() ([]byte, []int)Deprecated: Use GroundingChunk_Web.ProtoReflect.Descriptor instead.
func (*GroundingChunk_Web) GetTitle
func (x *GroundingChunk_Web) GetTitle() stringfunc (*GroundingChunk_Web) GetUri
func (x *GroundingChunk_Web) GetUri() stringfunc (*GroundingChunk_Web) ProtoMessage
func (*GroundingChunk_Web) ProtoMessage()func (*GroundingChunk_Web) ProtoReflect
func (x *GroundingChunk_Web) ProtoReflect() protoreflect.Messagefunc (*GroundingChunk_Web) Reset
func (x *GroundingChunk_Web) Reset()func (*GroundingChunk_Web) String
func (x *GroundingChunk_Web) String() stringGroundingChunk_Web_
type GroundingChunk_Web_ struct {
// Grounding chunk from the web.
Web *GroundingChunk_Web `protobuf:"bytes,1,opt,name=web,proto3,oneof"`
}GroundingMetadata
type GroundingMetadata struct {
// Optional. Google search entry for the following-up web searches.
SearchEntryPoint *SearchEntryPoint `protobuf:"bytes,1,opt,name=search_entry_point,json=searchEntryPoint,proto3,oneof" json:"search_entry_point,omitempty"`
// List of supporting references retrieved from specified grounding source.
GroundingChunks []*GroundingChunk `protobuf:"bytes,2,rep,name=grounding_chunks,json=groundingChunks,proto3" json:"grounding_chunks,omitempty"`
// List of grounding support.
GroundingSupports []*GroundingSupport `protobuf:"bytes,3,rep,name=grounding_supports,json=groundingSupports,proto3" json:"grounding_supports,omitempty"`
// Metadata related to retrieval in the grounding flow.
RetrievalMetadata *RetrievalMetadata `protobuf:"bytes,4,opt,name=retrieval_metadata,json=retrievalMetadata,proto3,oneof" json:"retrieval_metadata,omitempty"`
// Web search queries for the following-up web search.
WebSearchQueries []string `protobuf:"bytes,5,rep,name=web_search_queries,json=webSearchQueries,proto3" json:"web_search_queries,omitempty"`
// Optional. Resource name of the Google Maps widget context token that can be
// used with the PlacesContextElement widget in order to render contextual
// data. Only populated in the case that grounding with Google Maps is
// enabled.
GoogleMapsWidgetContextToken *string `protobuf:"bytes,7,opt,name=google_maps_widget_context_token,json=googleMapsWidgetContextToken,proto3,oneof" json:"google_maps_widget_context_token,omitempty"`
// contains filtered or unexported fields
}Metadata returned to client when grounding is enabled.
func (*GroundingMetadata) Descriptor
func (*GroundingMetadata) Descriptor() ([]byte, []int)Deprecated: Use GroundingMetadata.ProtoReflect.Descriptor instead.
func (*GroundingMetadata) GetGoogleMapsWidgetContextToken
func (x *GroundingMetadata) GetGoogleMapsWidgetContextToken() stringfunc (*GroundingMetadata) GetGroundingChunks
func (x *GroundingMetadata) GetGroundingChunks() []*GroundingChunkfunc (*GroundingMetadata) GetGroundingSupports
func (x *GroundingMetadata) GetGroundingSupports() []*GroundingSupportfunc (*GroundingMetadata) GetRetrievalMetadata
func (x *GroundingMetadata) GetRetrievalMetadata() *RetrievalMetadatafunc (*GroundingMetadata) GetSearchEntryPoint
func (x *GroundingMetadata) GetSearchEntryPoint() *SearchEntryPointfunc (*GroundingMetadata) GetWebSearchQueries
func (x *GroundingMetadata) GetWebSearchQueries() []stringfunc (*GroundingMetadata) ProtoMessage
func (*GroundingMetadata) ProtoMessage()func (*GroundingMetadata) ProtoReflect
func (x *GroundingMetadata) ProtoReflect() protoreflect.Messagefunc (*GroundingMetadata) Reset
func (x *GroundingMetadata) Reset()func (*GroundingMetadata) String
func (x *GroundingMetadata) String() stringGroundingSupport
type GroundingSupport struct {
// Segment of the content this support belongs to.
Segment *Segment `protobuf:"bytes,1,opt,name=segment,proto3,oneof" json:"segment,omitempty"`
// A list of indices (into 'grounding_chunk') specifying the
// citations associated with the claim. For instance [1,3,4] means
// that grounding_chunk[1], grounding_chunk[3],
// grounding_chunk[4] are the retrieved content attributed to the claim.
GroundingChunkIndices []int32 `protobuf:"varint,2,rep,packed,name=grounding_chunk_indices,json=groundingChunkIndices,proto3" json:"grounding_chunk_indices,omitempty"`
// Confidence score of the support references. Ranges from 0 to 1. 1 is the
// most confident. This list must have the same size as the
// grounding_chunk_indices.
ConfidenceScores []float32 `protobuf:"fixed32,3,rep,packed,name=confidence_scores,json=confidenceScores,proto3" json:"confidence_scores,omitempty"`
// contains filtered or unexported fields
}Grounding support.
func (*GroundingSupport) Descriptor
func (*GroundingSupport) Descriptor() ([]byte, []int)Deprecated: Use GroundingSupport.ProtoReflect.Descriptor instead.
func (*GroundingSupport) GetConfidenceScores
func (x *GroundingSupport) GetConfidenceScores() []float32func (*GroundingSupport) GetGroundingChunkIndices
func (x *GroundingSupport) GetGroundingChunkIndices() []int32func (*GroundingSupport) GetSegment
func (x *GroundingSupport) GetSegment() *Segmentfunc (*GroundingSupport) ProtoMessage
func (*GroundingSupport) ProtoMessage()func (*GroundingSupport) ProtoReflect
func (x *GroundingSupport) ProtoReflect() protoreflect.Messagefunc (*GroundingSupport) Reset
func (x *GroundingSupport) Reset()func (*GroundingSupport) String
func (x *GroundingSupport) String() stringHarmCategory
type HarmCategory int32The category of a rating.
These categories cover various kinds of harms that developers may wish to adjust.
HarmCategory_HARM_CATEGORY_UNSPECIFIED, HarmCategory_HARM_CATEGORY_DEROGATORY, HarmCategory_HARM_CATEGORY_TOXICITY, HarmCategory_HARM_CATEGORY_VIOLENCE, HarmCategory_HARM_CATEGORY_SEXUAL, HarmCategory_HARM_CATEGORY_MEDICAL, HarmCategory_HARM_CATEGORY_DANGEROUS, HarmCategory_HARM_CATEGORY_HARASSMENT, HarmCategory_HARM_CATEGORY_HATE_SPEECH, HarmCategory_HARM_CATEGORY_SEXUALLY_EXPLICIT, HarmCategory_HARM_CATEGORY_DANGEROUS_CONTENT, HarmCategory_HARM_CATEGORY_CIVIC_INTEGRITY
const (
// Category is unspecified.
HarmCategory_HARM_CATEGORY_UNSPECIFIED HarmCategory = 0
// **PaLM** - Negative or harmful comments targeting identity and/or protected
// attribute.
HarmCategory_HARM_CATEGORY_DEROGATORY HarmCategory = 1
// **PaLM** - Content that is rude, disrespectful, or profane.
HarmCategory_HARM_CATEGORY_TOXICITY HarmCategory = 2
// **PaLM** - Describes scenarios depicting violence against an individual or
// group, or general descriptions of gore.
HarmCategory_HARM_CATEGORY_VIOLENCE HarmCategory = 3
// **PaLM** - Contains references to sexual acts or other lewd content.
HarmCategory_HARM_CATEGORY_SEXUAL HarmCategory = 4
// **PaLM** - Promotes unchecked medical advice.
HarmCategory_HARM_CATEGORY_MEDICAL HarmCategory = 5
// **PaLM** - Dangerous content that promotes, facilitates, or encourages
// harmful acts.
HarmCategory_HARM_CATEGORY_DANGEROUS HarmCategory = 6
// **Gemini** - Harassment content.
HarmCategory_HARM_CATEGORY_HARASSMENT HarmCategory = 7
// **Gemini** - Hate speech and content.
HarmCategory_HARM_CATEGORY_HATE_SPEECH HarmCategory = 8
// **Gemini** - Sexually explicit content.
HarmCategory_HARM_CATEGORY_SEXUALLY_EXPLICIT HarmCategory = 9
// **Gemini** - Dangerous content.
HarmCategory_HARM_CATEGORY_DANGEROUS_CONTENT HarmCategory = 10
// **Gemini** - Content that may be used to harm civic integrity.
// DEPRECATED: use enable_enhanced_civic_answers instead.
//
// Deprecated: Marked as deprecated in google/ai/generativelanguage/v1/safety.proto.
HarmCategory_HARM_CATEGORY_CIVIC_INTEGRITY HarmCategory = 11
)func (HarmCategory) Descriptor
func (HarmCategory) Descriptor() protoreflect.EnumDescriptorfunc (HarmCategory) Enum
func (x HarmCategory) Enum() *HarmCategoryfunc (HarmCategory) EnumDescriptor
func (HarmCategory) EnumDescriptor() ([]byte, []int)Deprecated: Use HarmCategory.Descriptor instead.
func (HarmCategory) Number
func (x HarmCategory) Number() protoreflect.EnumNumberfunc (HarmCategory) String
func (x HarmCategory) String() stringfunc (HarmCategory) Type
func (HarmCategory) Type() protoreflect.EnumTypeListModelsRequest
type ListModelsRequest struct {
// The maximum number of `Models` to return (per page).
//
// If unspecified, 50 models will be returned per page.
// This method returns at most 1000 models per page, even if you pass a larger
// page_size.
PageSize int32 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"`
// A page token, received from a previous `ListModels` call.
//
// Provide the `page_token` returned by one request as an argument to the next
// request to retrieve the next page.
//
// When paginating, all other parameters provided to `ListModels` must match
// the call that provided the page token.
PageToken string `protobuf:"bytes,3,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"`
// contains filtered or unexported fields
}Request for listing all Models.
func (*ListModelsRequest) Descriptor
func (*ListModelsRequest) Descriptor() ([]byte, []int)Deprecated: Use ListModelsRequest.ProtoReflect.Descriptor instead.
func (*ListModelsRequest) GetPageSize
func (x *ListModelsRequest) GetPageSize() int32func (*ListModelsRequest) GetPageToken
func (x *ListModelsRequest) GetPageToken() stringfunc (*ListModelsRequest) ProtoMessage
func (*ListModelsRequest) ProtoMessage()func (*ListModelsRequest) ProtoReflect
func (x *ListModelsRequest) ProtoReflect() protoreflect.Messagefunc (*ListModelsRequest) Reset
func (x *ListModelsRequest) Reset()func (*ListModelsRequest) String
func (x *ListModelsRequest) String() stringListModelsResponse
type ListModelsResponse struct {
// The returned Models.
Models []*Model `protobuf:"bytes,1,rep,name=models,proto3" json:"models,omitempty"`
// A token, which can be sent as `page_token` to retrieve the next page.
//
// If this field is omitted, there are no more pages.
NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"`
// contains filtered or unexported fields
}Response from ListModel containing a paginated list of Models.
func (*ListModelsResponse) Descriptor
func (*ListModelsResponse) Descriptor() ([]byte, []int)Deprecated: Use ListModelsResponse.ProtoReflect.Descriptor instead.
func (*ListModelsResponse) GetModels
func (x *ListModelsResponse) GetModels() []*Modelfunc (*ListModelsResponse) GetNextPageToken
func (x *ListModelsResponse) GetNextPageToken() stringfunc (*ListModelsResponse) ProtoMessage
func (*ListModelsResponse) ProtoMessage()func (*ListModelsResponse) ProtoReflect
func (x *ListModelsResponse) ProtoReflect() protoreflect.Messagefunc (*ListModelsResponse) Reset
func (x *ListModelsResponse) Reset()func (*ListModelsResponse) String
func (x *ListModelsResponse) String() stringLogprobsResult
type LogprobsResult struct {
// Sum of log probabilities for all tokens.
LogProbabilitySum *float32 `protobuf:"fixed32,3,opt,name=log_probability_sum,json=logProbabilitySum,proto3,oneof" json:"log_probability_sum,omitempty"`
// Length = total number of decoding steps.
TopCandidates []*LogprobsResult_TopCandidates `protobuf:"bytes,1,rep,name=top_candidates,json=topCandidates,proto3" json:"top_candidates,omitempty"`
// Length = total number of decoding steps.
// The chosen candidates may or may not be in top_candidates.
ChosenCandidates []*LogprobsResult_Candidate `protobuf:"bytes,2,rep,name=chosen_candidates,json=chosenCandidates,proto3" json:"chosen_candidates,omitempty"`
// contains filtered or unexported fields
}Logprobs Result
func (*LogprobsResult) Descriptor
func (*LogprobsResult) Descriptor() ([]byte, []int)Deprecated: Use LogprobsResult.ProtoReflect.Descriptor instead.
func (*LogprobsResult) GetChosenCandidates
func (x *LogprobsResult) GetChosenCandidates() []*LogprobsResult_Candidatefunc (*LogprobsResult) GetLogProbabilitySum
func (x *LogprobsResult) GetLogProbabilitySum() float32func (*LogprobsResult) GetTopCandidates
func (x *LogprobsResult) GetTopCandidates() []*LogprobsResult_TopCandidatesfunc (*LogprobsResult) ProtoMessage
func (*LogprobsResult) ProtoMessage()func (*LogprobsResult) ProtoReflect
func (x *LogprobsResult) ProtoReflect() protoreflect.Messagefunc (*LogprobsResult) Reset
func (x *LogprobsResult) Reset()func (*LogprobsResult) String
func (x *LogprobsResult) String() stringLogprobsResult_Candidate
type LogprobsResult_Candidate struct {
// The candidate’s token string value.
Token *string `protobuf:"bytes,1,opt,name=token,proto3,oneof" json:"token,omitempty"`
// The candidate’s token id value.
TokenId *int32 `protobuf:"varint,3,opt,name=token_id,json=tokenId,proto3,oneof" json:"token_id,omitempty"`
// The candidate's log probability.
LogProbability *float32 `protobuf:"fixed32,2,opt,name=log_probability,json=logProbability,proto3,oneof" json:"log_probability,omitempty"`
// contains filtered or unexported fields
}Candidate for the logprobs token and score.
func (*LogprobsResult_Candidate) Descriptor
func (*LogprobsResult_Candidate) Descriptor() ([]byte, []int)Deprecated: Use LogprobsResult_Candidate.ProtoReflect.Descriptor instead.
func (*LogprobsResult_Candidate) GetLogProbability
func (x *LogprobsResult_Candidate) GetLogProbability() float32func (*LogprobsResult_Candidate) GetToken
func (x *LogprobsResult_Candidate) GetToken() stringfunc (*LogprobsResult_Candidate) GetTokenId
func (x *LogprobsResult_Candidate) GetTokenId() int32func (*LogprobsResult_Candidate) ProtoMessage
func (*LogprobsResult_Candidate) ProtoMessage()func (*LogprobsResult_Candidate) ProtoReflect
func (x *LogprobsResult_Candidate) ProtoReflect() protoreflect.Messagefunc (*LogprobsResult_Candidate) Reset
func (x *LogprobsResult_Candidate) Reset()func (*LogprobsResult_Candidate) String
func (x *LogprobsResult_Candidate) String() stringLogprobsResult_TopCandidates
type LogprobsResult_TopCandidates struct {
// Sorted by log probability in descending order.
Candidates []*LogprobsResult_Candidate `protobuf:"bytes,1,rep,name=candidates,proto3" json:"candidates,omitempty"`
// contains filtered or unexported fields
}Candidates with top log probabilities at each decoding step.
func (*LogprobsResult_TopCandidates) Descriptor
func (*LogprobsResult_TopCandidates) Descriptor() ([]byte, []int)Deprecated: Use LogprobsResult_TopCandidates.ProtoReflect.Descriptor instead.
func (*LogprobsResult_TopCandidates) GetCandidates
func (x *LogprobsResult_TopCandidates) GetCandidates() []*LogprobsResult_Candidatefunc (*LogprobsResult_TopCandidates) ProtoMessage
func (*LogprobsResult_TopCandidates) ProtoMessage()func (*LogprobsResult_TopCandidates) ProtoReflect
func (x *LogprobsResult_TopCandidates) ProtoReflect() protoreflect.Messagefunc (*LogprobsResult_TopCandidates) Reset
func (x *LogprobsResult_TopCandidates) Reset()func (*LogprobsResult_TopCandidates) String
func (x *LogprobsResult_TopCandidates) String() stringModality
type Modality int32Content Part modality
Modality_MODALITY_UNSPECIFIED, Modality_TEXT, Modality_IMAGE, Modality_VIDEO, Modality_AUDIO, Modality_DOCUMENT
const (
// Unspecified modality.
Modality_MODALITY_UNSPECIFIED Modality = 0
// Plain text.
Modality_TEXT Modality = 1
// Image.
Modality_IMAGE Modality = 2
// Video.
Modality_VIDEO Modality = 3
// Audio.
Modality_AUDIO Modality = 4
// Document, e.g. PDF.
Modality_DOCUMENT Modality = 5
)func (Modality) Descriptor
func (Modality) Descriptor() protoreflect.EnumDescriptorfunc (Modality) Enum
func (Modality) EnumDescriptor
Deprecated: Use Modality.Descriptor instead.
func (Modality) Number
func (x Modality) Number() protoreflect.EnumNumberfunc (Modality) String
func (Modality) Type
func (Modality) Type() protoreflect.EnumTypeModalityTokenCount
type ModalityTokenCount struct {
// The modality associated with this token count.
Modality Modality `protobuf:"varint,1,opt,name=modality,proto3,enum=google.ai.generativelanguage.v1.Modality" json:"modality,omitempty"`
// Number of tokens.
TokenCount int32 `protobuf:"varint,2,opt,name=token_count,json=tokenCount,proto3" json:"token_count,omitempty"`
// contains filtered or unexported fields
}Represents token counting info for a single modality.
func (*ModalityTokenCount) Descriptor
func (*ModalityTokenCount) Descriptor() ([]byte, []int)Deprecated: Use ModalityTokenCount.ProtoReflect.Descriptor instead.
func (*ModalityTokenCount) GetModality
func (x *ModalityTokenCount) GetModality() Modalityfunc (*ModalityTokenCount) GetTokenCount
func (x *ModalityTokenCount) GetTokenCount() int32func (*ModalityTokenCount) ProtoMessage
func (*ModalityTokenCount) ProtoMessage()func (*ModalityTokenCount) ProtoReflect
func (x *ModalityTokenCount) ProtoReflect() protoreflect.Messagefunc (*ModalityTokenCount) Reset
func (x *ModalityTokenCount) Reset()func (*ModalityTokenCount) String
func (x *ModalityTokenCount) String() stringModel
type Model struct {
// Required. The resource name of the `Model`. Refer to [Model
// variants](https://ai.google.dev/gemini-api/docs/models/gemini#model-variations)
// for all allowed values.
//
// Format: `models/{model}` with a `{model}` naming convention of:
//
// * "{base_model_id}-{version}"
//
// Examples:
//
// * `models/gemini-1.5-flash-001`
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
// Required. The name of the base model, pass this to the generation request.
//
// Examples:
//
// * `gemini-1.5-flash`
BaseModelId string `protobuf:"bytes,2,opt,name=base_model_id,json=baseModelId,proto3" json:"base_model_id,omitempty"`
// Required. The version number of the model.
//
// This represents the major version (`1.0` or `1.5`)
Version string `protobuf:"bytes,3,opt,name=version,proto3" json:"version,omitempty"`
// The human-readable name of the model. E.g. "Gemini 1.5 Flash".
//
// The name can be up to 128 characters long and can consist of any UTF-8
// characters.
DisplayName string `protobuf:"bytes,4,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"`
// A short description of the model.
Description string `protobuf:"bytes,5,opt,name=description,proto3" json:"description,omitempty"`
// Maximum number of input tokens allowed for this model.
InputTokenLimit int32 `protobuf:"varint,6,opt,name=input_token_limit,json=inputTokenLimit,proto3" json:"input_token_limit,omitempty"`
// Maximum number of output tokens available for this model.
OutputTokenLimit int32 `protobuf:"varint,7,opt,name=output_token_limit,json=outputTokenLimit,proto3" json:"output_token_limit,omitempty"`
// The model's supported generation methods.
//
// The corresponding API method names are defined as Pascal case
// strings, such as `generateMessage` and `generateContent`.
SupportedGenerationMethods []string `protobuf:"bytes,8,rep,name=supported_generation_methods,json=supportedGenerationMethods,proto3" json:"supported_generation_methods,omitempty"`
// Controls the randomness of the output.
//
// Values can range over `[0.0,max_temperature]`, inclusive. A higher value
// will produce responses that are more varied, while a value closer to `0.0`
// will typically result in less surprising responses from the model.
// This value specifies default to be used by the backend while making the
// call to the model.
Temperature *float32 `protobuf:"fixed32,9,opt,name=temperature,proto3,oneof" json:"temperature,omitempty"`
// The maximum temperature this model can use.
MaxTemperature *float32 `protobuf:"fixed32,13,opt,name=max_temperature,json=maxTemperature,proto3,oneof" json:"max_temperature,omitempty"`
// For [Nucleus
// sampling](https://ai.google.dev/gemini-api/docs/prompting-strategies#top-p).
//
// Nucleus sampling considers the smallest set of tokens whose probability
// sum is at least `top_p`.
// This value specifies default to be used by the backend while making the
// call to the model.
TopP *float32 `protobuf:"fixed32,10,opt,name=top_p,json=topP,proto3,oneof" json:"top_p,omitempty"`
// For Top-k sampling.
//
// Top-k sampling considers the set of `top_k` most probable tokens.
// This value specifies default to be used by the backend while making the
// call to the model.
// If empty, indicates the model doesn't use top-k sampling, and `top_k` isn't
// allowed as a generation parameter.
TopK *int32 `protobuf:"varint,11,opt,name=top_k,json=topK,proto3,oneof" json:"top_k,omitempty"`
// Whether the model supports thinking.
Thinking bool `protobuf:"varint,15,opt,name=thinking,proto3" json:"thinking,omitempty"`
// contains filtered or unexported fields
}Information about a Generative Language Model.
func (*Model) Descriptor
Deprecated: Use Model.ProtoReflect.Descriptor instead.
func (*Model) GetBaseModelId
func (*Model) GetDescription
func (*Model) GetDisplayName
func (*Model) GetInputTokenLimit
func (*Model) GetMaxTemperature
func (*Model) GetName
func (*Model) GetOutputTokenLimit
func (*Model) GetSupportedGenerationMethods
func (*Model) GetTemperature
func (*Model) GetThinking
func (*Model) GetTopK
func (*Model) GetTopP
func (*Model) GetVersion
func (*Model) ProtoMessage
func (*Model) ProtoMessage()func (*Model) ProtoReflect
func (x *Model) ProtoReflect() protoreflect.Messagefunc (*Model) Reset
func (x *Model) Reset()func (*Model) String
ModelServiceClient
type ModelServiceClient interface {
// Gets information about a specific `Model` such as its version number, token
// limits,
// [parameters](https://ai.google.dev/gemini-api/docs/models/generative-models#model-parameters)
// and other metadata. Refer to the [Gemini models
// guide](https://ai.google.dev/gemini-api/docs/models/gemini) for detailed
// model information.
GetModel(ctx context.Context, in *GetModelRequest, opts ...grpc.CallOption) (*Model, error)
// Lists the [`Model`s](https://ai.google.dev/gemini-api/docs/models/gemini)
// available through the Gemini API.
ListModels(ctx context.Context, in *ListModelsRequest, opts ...grpc.CallOption) (*ListModelsResponse, error)
}ModelServiceClient is the client API for ModelService service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
func NewModelServiceClient
func NewModelServiceClient(cc grpc.ClientConnInterface) ModelServiceClientModelServiceServer
type ModelServiceServer interface {
// Gets information about a specific `Model` such as its version number, token
// limits,
// [parameters](https://ai.google.dev/gemini-api/docs/models/generative-models#model-parameters)
// and other metadata. Refer to the [Gemini models
// guide](https://ai.google.dev/gemini-api/docs/models/gemini) for detailed
// model information.
GetModel(context.Context, *GetModelRequest) (*Model, error)
// Lists the [`Model`s](https://ai.google.dev/gemini-api/docs/models/gemini)
// available through the Gemini API.
ListModels(context.Context, *ListModelsRequest) (*ListModelsResponse, error)
}ModelServiceServer is the server API for ModelService service. All implementations should embed UnimplementedModelServiceServer for forward compatibility
Part
type Part struct {
// Types that are valid to be assigned to Data:
//
// *Part_Text
// *Part_InlineData
Data isPart_Data `protobuf_oneof:"data"`
// Controls extra preprocessing of data.
//
// Types that are valid to be assigned to Metadata:
//
// *Part_VideoMetadata
Metadata isPart_Metadata `protobuf_oneof:"metadata"`
// contains filtered or unexported fields
}A datatype containing media that is part of a multi-part Content message.
A Part consists of data which has an associated datatype. A Part can only
contain one of the accepted types in Part.data.
A Part must have a fixed IANA MIME type identifying the type and subtype
of the media if the inline_data field is filled with raw bytes.
func (*Part) Descriptor
Deprecated: Use Part.ProtoReflect.Descriptor instead.
func (*Part) GetData
func (x *Part) GetData() isPart_Datafunc (*Part) GetInlineData
func (*Part) GetMetadata
func (x *Part) GetMetadata() isPart_Metadatafunc (*Part) GetText
func (*Part) GetVideoMetadata
func (x *Part) GetVideoMetadata() *VideoMetadatafunc (*Part) ProtoMessage
func (*Part) ProtoMessage()func (*Part) ProtoReflect
func (x *Part) ProtoReflect() protoreflect.Messagefunc (*Part) Reset
func (x *Part) Reset()func (*Part) String
Part_InlineData
type Part_InlineData struct {
// Inline media bytes.
InlineData *Blob `protobuf:"bytes,3,opt,name=inline_data,json=inlineData,proto3,oneof"`
}Part_Text
type Part_Text struct {
// Inline text.
Text string `protobuf:"bytes,2,opt,name=text,proto3,oneof"`
}Part_VideoMetadata
type Part_VideoMetadata struct {
// Optional. Video metadata. The metadata should only be specified while the
// video data is presented in inline_data or file_data.
VideoMetadata *VideoMetadata `protobuf:"bytes,14,opt,name=video_metadata,json=videoMetadata,proto3,oneof"`
}RetrievalMetadata
type RetrievalMetadata struct {
// Optional. Score indicating how likely information from google search could
// help answer the prompt. The score is in the range [0, 1], where 0 is the
// least likely and 1 is the most likely. This score is only populated when
// google search grounding and dynamic retrieval is enabled. It will be
// compared to the threshold to determine whether to trigger google search.
GoogleSearchDynamicRetrievalScore float32 `protobuf:"fixed32,2,opt,name=google_search_dynamic_retrieval_score,json=googleSearchDynamicRetrievalScore,proto3" json:"google_search_dynamic_retrieval_score,omitempty"`
// contains filtered or unexported fields
}Metadata related to retrieval in the grounding flow.
func (*RetrievalMetadata) Descriptor
func (*RetrievalMetadata) Descriptor() ([]byte, []int)Deprecated: Use RetrievalMetadata.ProtoReflect.Descriptor instead.
func (*RetrievalMetadata) GetGoogleSearchDynamicRetrievalScore
func (x *RetrievalMetadata) GetGoogleSearchDynamicRetrievalScore() float32func (*RetrievalMetadata) ProtoMessage
func (*RetrievalMetadata) ProtoMessage()func (*RetrievalMetadata) ProtoReflect
func (x *RetrievalMetadata) ProtoReflect() protoreflect.Messagefunc (*RetrievalMetadata) Reset
func (x *RetrievalMetadata) Reset()func (*RetrievalMetadata) String
func (x *RetrievalMetadata) String() stringSafetyRating
type SafetyRating struct {
// Required. The category for this rating.
Category HarmCategory `protobuf:"varint,3,opt,name=category,proto3,enum=google.ai.generativelanguage.v1.HarmCategory" json:"category,omitempty"`
// Required. The probability of harm for this content.
Probability SafetyRating_HarmProbability `protobuf:"varint,4,opt,name=probability,proto3,enum=google.ai.generativelanguage.v1.SafetyRating_HarmProbability" json:"probability,omitempty"`
// Was this content blocked because of this rating?
Blocked bool `protobuf:"varint,5,opt,name=blocked,proto3" json:"blocked,omitempty"`
// contains filtered or unexported fields
}Safety rating for a piece of content.
The safety rating contains the category of harm and the harm probability level in that category for a piece of content. Content is classified for safety across a number of harm categories and the probability of the harm classification is included here.
func (*SafetyRating) Descriptor
func (*SafetyRating) Descriptor() ([]byte, []int)Deprecated: Use SafetyRating.ProtoReflect.Descriptor instead.
func (*SafetyRating) GetBlocked
func (x *SafetyRating) GetBlocked() boolfunc (*SafetyRating) GetCategory
func (x *SafetyRating) GetCategory() HarmCategoryfunc (*SafetyRating) GetProbability
func (x *SafetyRating) GetProbability() SafetyRating_HarmProbabilityfunc (*SafetyRating) ProtoMessage
func (*SafetyRating) ProtoMessage()func (*SafetyRating) ProtoReflect
func (x *SafetyRating) ProtoReflect() protoreflect.Messagefunc (*SafetyRating) Reset
func (x *SafetyRating) Reset()func (*SafetyRating) String
func (x *SafetyRating) String() stringSafetyRating_HarmProbability
type SafetyRating_HarmProbability int32The probability that a piece of content is harmful.
The classification system gives the probability of the content being unsafe. This does not indicate the severity of harm for a piece of content.
SafetyRating_HARM_PROBABILITY_UNSPECIFIED, SafetyRating_NEGLIGIBLE, SafetyRating_LOW, SafetyRating_MEDIUM, SafetyRating_HIGH
const (
// Probability is unspecified.
SafetyRating_HARM_PROBABILITY_UNSPECIFIED SafetyRating_HarmProbability = 0
// Content has a negligible chance of being unsafe.
SafetyRating_NEGLIGIBLE SafetyRating_HarmProbability = 1
// Content has a low chance of being unsafe.
SafetyRating_LOW SafetyRating_HarmProbability = 2
// Content has a medium chance of being unsafe.
SafetyRating_MEDIUM SafetyRating_HarmProbability = 3
// Content has a high chance of being unsafe.
SafetyRating_HIGH SafetyRating_HarmProbability = 4
)func (SafetyRating_HarmProbability) Descriptor
func (SafetyRating_HarmProbability) Descriptor() protoreflect.EnumDescriptorfunc (SafetyRating_HarmProbability) Enum
func (x SafetyRating_HarmProbability) Enum() *SafetyRating_HarmProbabilityfunc (SafetyRating_HarmProbability) EnumDescriptor
func (SafetyRating_HarmProbability) EnumDescriptor() ([]byte, []int)Deprecated: Use SafetyRating_HarmProbability.Descriptor instead.
func (SafetyRating_HarmProbability) Number
func (x SafetyRating_HarmProbability) Number() protoreflect.EnumNumberfunc (SafetyRating_HarmProbability) String
func (x SafetyRating_HarmProbability) String() stringfunc (SafetyRating_HarmProbability) Type
func (SafetyRating_HarmProbability) Type() protoreflect.EnumTypeSafetySetting
type SafetySetting struct {
// Required. The category for this setting.
Category HarmCategory `protobuf:"varint,3,opt,name=category,proto3,enum=google.ai.generativelanguage.v1.HarmCategory" json:"category,omitempty"`
// Required. Controls the probability threshold at which harm is blocked.
Threshold SafetySetting_HarmBlockThreshold `protobuf:"varint,4,opt,name=threshold,proto3,enum=google.ai.generativelanguage.v1.SafetySetting_HarmBlockThreshold" json:"threshold,omitempty"`
// contains filtered or unexported fields
}Safety setting, affecting the safety-blocking behavior.
Passing a safety setting for a category changes the allowed probability that content is blocked.
func (*SafetySetting) Descriptor
func (*SafetySetting) Descriptor() ([]byte, []int)Deprecated: Use SafetySetting.ProtoReflect.Descriptor instead.
func (*SafetySetting) GetCategory
func (x *SafetySetting) GetCategory() HarmCategoryfunc (*SafetySetting) GetThreshold
func (x *SafetySetting) GetThreshold() SafetySetting_HarmBlockThresholdfunc (*SafetySetting) ProtoMessage
func (*SafetySetting) ProtoMessage()func (*SafetySetting) ProtoReflect
func (x *SafetySetting) ProtoReflect() protoreflect.Messagefunc (*SafetySetting) Reset
func (x *SafetySetting) Reset()func (*SafetySetting) String
func (x *SafetySetting) String() stringSafetySetting_HarmBlockThreshold
type SafetySetting_HarmBlockThreshold int32Block at and beyond a specified harm probability.
SafetySetting_HARM_BLOCK_THRESHOLD_UNSPECIFIED, SafetySetting_BLOCK_LOW_AND_ABOVE, SafetySetting_BLOCK_MEDIUM_AND_ABOVE, SafetySetting_BLOCK_ONLY_HIGH, SafetySetting_BLOCK_NONE, SafetySetting_OFF
const (
// Threshold is unspecified.
SafetySetting_HARM_BLOCK_THRESHOLD_UNSPECIFIED SafetySetting_HarmBlockThreshold = 0
// Content with NEGLIGIBLE will be allowed.
SafetySetting_BLOCK_LOW_AND_ABOVE SafetySetting_HarmBlockThreshold = 1
// Content with NEGLIGIBLE and LOW will be allowed.
SafetySetting_BLOCK_MEDIUM_AND_ABOVE SafetySetting_HarmBlockThreshold = 2
// Content with NEGLIGIBLE, LOW, and MEDIUM will be allowed.
SafetySetting_BLOCK_ONLY_HIGH SafetySetting_HarmBlockThreshold = 3
// All content will be allowed.
SafetySetting_BLOCK_NONE SafetySetting_HarmBlockThreshold = 4
// Turn off the safety filter.
SafetySetting_OFF SafetySetting_HarmBlockThreshold = 5
)func (SafetySetting_HarmBlockThreshold) Descriptor
func (SafetySetting_HarmBlockThreshold) Descriptor() protoreflect.EnumDescriptorfunc (SafetySetting_HarmBlockThreshold) Enum
func (x SafetySetting_HarmBlockThreshold) Enum() *SafetySetting_HarmBlockThresholdfunc (SafetySetting_HarmBlockThreshold) EnumDescriptor
func (SafetySetting_HarmBlockThreshold) EnumDescriptor() ([]byte, []int)Deprecated: Use SafetySetting_HarmBlockThreshold.Descriptor instead.
func (SafetySetting_HarmBlockThreshold) Number
func (x SafetySetting_HarmBlockThreshold) Number() protoreflect.EnumNumberfunc (SafetySetting_HarmBlockThreshold) String
func (x SafetySetting_HarmBlockThreshold) String() stringfunc (SafetySetting_HarmBlockThreshold) Type
func (SafetySetting_HarmBlockThreshold) Type() protoreflect.EnumTypeSearchEntryPoint
type SearchEntryPoint struct {
// Optional. Web content snippet that can be embedded in a web page or an app
// webview.
RenderedContent string `protobuf:"bytes,1,opt,name=rendered_content,json=renderedContent,proto3" json:"rendered_content,omitempty"`
// Optional. Base64 encoded JSON representing array of Google search entry point.
func (*SearchEntryPoint) Descriptor
func (*SearchEntryPoint) Descriptor() ([]byte, []int)Deprecated: Use SearchEntryPoint.ProtoReflect.Descriptor instead.
func (*SearchEntryPoint) GetRenderedContent
func (x *SearchEntryPoint) GetRenderedContent() stringfunc (*SearchEntryPoint) GetSdkBlob
func (x *SearchEntryPoint) GetSdkBlob() []bytefunc (*SearchEntryPoint) ProtoMessage
func (*SearchEntryPoint) ProtoMessage()func (*SearchEntryPoint) ProtoReflect
func (x *SearchEntryPoint) ProtoReflect() protoreflect.Messagefunc (*SearchEntryPoint) Reset
func (x *SearchEntryPoint) Reset()func (*SearchEntryPoint) String
func (x *SearchEntryPoint) String() stringSegment
type Segment struct {
// Output only. The index of a Part object within its parent Content object.
PartIndex int32 `protobuf:"varint,1,opt,name=part_index,json=partIndex,proto3" json:"part_index,omitempty"`
// Output only. Start index in the given Part, measured in bytes. Offset from
// the start of the Part, inclusive, starting at zero.
StartIndex int32 `protobuf:"varint,2,opt,name=start_index,json=startIndex,proto3" json:"start_index,omitempty"`
// Output only. End index in the given Part, measured in bytes. Offset from
// the start of the Part, exclusive, starting at zero.
EndIndex int32 `protobuf:"varint,3,opt,name=end_index,json=endIndex,proto3" json:"end_index,omitempty"`
// Output only. The text corresponding to the segment from the response.
Text string `protobuf:"bytes,4,opt,name=text,proto3" json:"text,omitempty"`
// contains filtered or unexported fields
}Segment of the content.
func (*Segment) Descriptor
Deprecated: Use Segment.ProtoReflect.Descriptor instead.
func (*Segment) GetEndIndex
func (*Segment) GetPartIndex
func (*Segment) GetStartIndex
func (*Segment) GetText
func (*Segment) ProtoMessage
func (*Segment) ProtoMessage()func (*Segment) ProtoReflect
func (x *Segment) ProtoReflect() protoreflect.Messagefunc (*Segment) Reset
func (x *Segment) Reset()func (*Segment) String
TaskType
type TaskType int32Type of task for which the embedding will be used.
TaskType_TASK_TYPE_UNSPECIFIED, TaskType_RETRIEVAL_QUERY, TaskType_RETRIEVAL_DOCUMENT, TaskType_SEMANTIC_SIMILARITY, TaskType_CLASSIFICATION, TaskType_CLUSTERING, TaskType_QUESTION_ANSWERING, TaskType_FACT_VERIFICATION, TaskType_CODE_RETRIEVAL_QUERY
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
// Specifies that the given text will be used for question answering.
TaskType_QUESTION_ANSWERING TaskType = 6
// Specifies that the given text will be used for fact verification.
TaskType_FACT_VERIFICATION TaskType = 7
// Specifies that the given text will be used for code retrieval.
TaskType_CODE_RETRIEVAL_QUERY TaskType = 8
)func (TaskType) Descriptor
func (TaskType) Descriptor() protoreflect.EnumDescriptorfunc (TaskType) Enum
func (TaskType) EnumDescriptor
Deprecated: Use TaskType.Descriptor instead.
func (TaskType) Number
func (x TaskType) Number() protoreflect.EnumNumberfunc (TaskType) String
func (TaskType) Type
func (TaskType) Type() protoreflect.EnumTypeUnimplementedGenerativeServiceServer
type UnimplementedGenerativeServiceServer struct {
}UnimplementedGenerativeServiceServer should be embedded to have forward compatible implementations.
func (UnimplementedGenerativeServiceServer) BatchEmbedContents
func (UnimplementedGenerativeServiceServer) BatchEmbedContents(context.Context, *BatchEmbedContentsRequest) (*BatchEmbedContentsResponse, error)func (UnimplementedGenerativeServiceServer) CountTokens
func (UnimplementedGenerativeServiceServer) CountTokens(context.Context, *CountTokensRequest) (*CountTokensResponse, error)func (UnimplementedGenerativeServiceServer) EmbedContent
func (UnimplementedGenerativeServiceServer) EmbedContent(context.Context, *EmbedContentRequest) (*EmbedContentResponse, error)func (UnimplementedGenerativeServiceServer) GenerateContent
func (UnimplementedGenerativeServiceServer) GenerateContent(context.Context, *GenerateContentRequest) (*GenerateContentResponse, error)func (UnimplementedGenerativeServiceServer) StreamGenerateContent
func (UnimplementedGenerativeServiceServer) StreamGenerateContent(*GenerateContentRequest, GenerativeService_StreamGenerateContentServer) errorUnimplementedModelServiceServer
type UnimplementedModelServiceServer struct {
}UnimplementedModelServiceServer should be embedded to have forward compatible implementations.
func (UnimplementedModelServiceServer) GetModel
func (UnimplementedModelServiceServer) GetModel(context.Context, *GetModelRequest) (*Model, error)func (UnimplementedModelServiceServer) ListModels
func (UnimplementedModelServiceServer) ListModels(context.Context, *ListModelsRequest) (*ListModelsResponse, error)UnsafeGenerativeServiceServer
type UnsafeGenerativeServiceServer interface {
// contains filtered or unexported methods
}UnsafeGenerativeServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to GenerativeServiceServer will result in compilation errors.
UnsafeModelServiceServer
type UnsafeModelServiceServer interface {
// contains filtered or unexported methods
}UnsafeModelServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to ModelServiceServer will result in compilation errors.
UrlContextMetadata
type UrlContextMetadata struct {
// List of url context.
UrlMetadata []*UrlMetadata `protobuf:"bytes,1,rep,name=url_metadata,json=urlMetadata,proto3" json:"url_metadata,omitempty"`
// contains filtered or unexported fields
}Metadata related to url context retrieval tool.
func (*UrlContextMetadata) Descriptor
func (*UrlContextMetadata) Descriptor() ([]byte, []int)Deprecated: Use UrlContextMetadata.ProtoReflect.Descriptor instead.
func (*UrlContextMetadata) GetUrlMetadata
func (x *UrlContextMetadata) GetUrlMetadata() []*UrlMetadatafunc (*UrlContextMetadata) ProtoMessage
func (*UrlContextMetadata) ProtoMessage()func (*UrlContextMetadata) ProtoReflect
func (x *UrlContextMetadata) ProtoReflect() protoreflect.Messagefunc (*UrlContextMetadata) Reset
func (x *UrlContextMetadata) Reset()func (*UrlContextMetadata) String
func (x *UrlContextMetadata) String() stringUrlMetadata
type UrlMetadata struct {
// Retrieved url by the tool.
RetrievedUrl string `protobuf:"bytes,1,opt,name=retrieved_url,json=retrievedUrl,proto3" json:"retrieved_url,omitempty"`
// Status of the url retrieval.
UrlRetrievalStatus UrlMetadata_UrlRetrievalStatus `protobuf:"varint,2,opt,name=url_retrieval_status,json=urlRetrievalStatus,proto3,enum=google.ai.generativelanguage.v1.UrlMetadata_UrlRetrievalStatus" json:"url_retrieval_status,omitempty"`
// contains filtered or unexported fields
}Context of the a single url retrieval.
func (*UrlMetadata) Descriptor
func (*UrlMetadata) Descriptor() ([]byte, []int)Deprecated: Use UrlMetadata.ProtoReflect.Descriptor instead.
func (*UrlMetadata) GetRetrievedUrl
func (x *UrlMetadata) GetRetrievedUrl() stringfunc (*UrlMetadata) GetUrlRetrievalStatus
func (x *UrlMetadata) GetUrlRetrievalStatus() UrlMetadata_UrlRetrievalStatusfunc (*UrlMetadata) ProtoMessage
func (*UrlMetadata) ProtoMessage()func (*UrlMetadata) ProtoReflect
func (x *UrlMetadata) ProtoReflect() protoreflect.Messagefunc (*UrlMetadata) Reset
func (x *UrlMetadata) Reset()func (*UrlMetadata) String
func (x *UrlMetadata) String() stringUrlMetadata_UrlRetrievalStatus
type UrlMetadata_UrlRetrievalStatus int32Status of the url retrieval.
UrlMetadata_URL_RETRIEVAL_STATUS_UNSPECIFIED, UrlMetadata_URL_RETRIEVAL_STATUS_SUCCESS, UrlMetadata_URL_RETRIEVAL_STATUS_ERROR, UrlMetadata_URL_RETRIEVAL_STATUS_PAYWALL, UrlMetadata_URL_RETRIEVAL_STATUS_UNSAFE
const (
// Default value. This value is unused.
UrlMetadata_URL_RETRIEVAL_STATUS_UNSPECIFIED UrlMetadata_UrlRetrievalStatus = 0
// Url retrieval is successful.
UrlMetadata_URL_RETRIEVAL_STATUS_SUCCESS UrlMetadata_UrlRetrievalStatus = 1
// Url retrieval is failed due to error.
UrlMetadata_URL_RETRIEVAL_STATUS_ERROR UrlMetadata_UrlRetrievalStatus = 2
// Url retrieval is failed because the content is behind paywall.
UrlMetadata_URL_RETRIEVAL_STATUS_PAYWALL UrlMetadata_UrlRetrievalStatus = 3
// Url retrieval is failed because the content is unsafe.
UrlMetadata_URL_RETRIEVAL_STATUS_UNSAFE UrlMetadata_UrlRetrievalStatus = 4
)func (UrlMetadata_UrlRetrievalStatus) Descriptor
func (UrlMetadata_UrlRetrievalStatus) Descriptor() protoreflect.EnumDescriptorfunc (UrlMetadata_UrlRetrievalStatus) Enum
func (x UrlMetadata_UrlRetrievalStatus) Enum() *UrlMetadata_UrlRetrievalStatusfunc (UrlMetadata_UrlRetrievalStatus) EnumDescriptor
func (UrlMetadata_UrlRetrievalStatus) EnumDescriptor() ([]byte, []int)Deprecated: Use UrlMetadata_UrlRetrievalStatus.Descriptor instead.
func (UrlMetadata_UrlRetrievalStatus) Number
func (x UrlMetadata_UrlRetrievalStatus) Number() protoreflect.EnumNumberfunc (UrlMetadata_UrlRetrievalStatus) String
func (x UrlMetadata_UrlRetrievalStatus) String() stringfunc (UrlMetadata_UrlRetrievalStatus) Type
func (UrlMetadata_UrlRetrievalStatus) Type() protoreflect.EnumTypeVideoMetadata
type VideoMetadata struct {
// Optional. The start offset of the video.
StartOffset *durationpb.Duration `protobuf:"bytes,1,opt,name=start_offset,json=startOffset,proto3" json:"start_offset,omitempty"`
// Optional. The end offset of the video.
EndOffset *durationpb.Duration `protobuf:"bytes,2,opt,name=end_offset,json=endOffset,proto3" json:"end_offset,omitempty"`
// Optional. The frame rate of the video sent to the model. If not specified,
// the default value will be 1.0. The fps range is (0.0, 24.0].
Fps float64 `protobuf:"fixed64,3,opt,name=fps,proto3" json:"fps,omitempty"`
// contains filtered or unexported fields
}Metadata describes the input video content.
func (*VideoMetadata) Descriptor
func (*VideoMetadata) Descriptor() ([]byte, []int)Deprecated: Use VideoMetadata.ProtoReflect.Descriptor instead.
func (*VideoMetadata) GetEndOffset
func (x *VideoMetadata) GetEndOffset() *durationpb.Durationfunc (*VideoMetadata) GetFps
func (x *VideoMetadata) GetFps() float64func (*VideoMetadata) GetStartOffset
func (x *VideoMetadata) GetStartOffset() *durationpb.Durationfunc (*VideoMetadata) ProtoMessage
func (*VideoMetadata) ProtoMessage()func (*VideoMetadata) ProtoReflect
func (x *VideoMetadata) ProtoReflect() protoreflect.Messagefunc (*VideoMetadata) Reset
func (x *VideoMetadata) Reset()func (*VideoMetadata) String
func (x *VideoMetadata) String() string