generativelanguagepb

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 15, 2024 License: Apache-2.0 Imports: 9 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

View Source
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",
	}
	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,
	}
)

Enum value maps for TaskType.

View Source
var (
	GenerateContentResponse_PromptFeedback_BlockReason_name = map[int32]string{
		0: "BLOCK_REASON_UNSPECIFIED",
		1: "SAFETY",
		2: "OTHER",
	}
	GenerateContentResponse_PromptFeedback_BlockReason_value = map[string]int32{
		"BLOCK_REASON_UNSPECIFIED": 0,
		"SAFETY":                   1,
		"OTHER":                    2,
	}
)

Enum value maps for GenerateContentResponse_PromptFeedback_BlockReason.

View Source
var (
	Candidate_FinishReason_name = map[int32]string{
		0: "FINISH_REASON_UNSPECIFIED",
		1: "STOP",
		2: "MAX_TOKENS",
		3: "SAFETY",
		4: "RECITATION",
		5: "OTHER",
	}
	Candidate_FinishReason_value = map[string]int32{
		"FINISH_REASON_UNSPECIFIED": 0,
		"STOP":                      1,
		"MAX_TOKENS":                2,
		"SAFETY":                    3,
		"RECITATION":                4,
		"OTHER":                     5,
	}
)

Enum value maps for Candidate_FinishReason.

View Source
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",
	}
	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,
	}
)

Enum value maps for HarmCategory.

View Source
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.

View Source
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",
	}
	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,
	}
)

Enum value maps for SafetySetting_HarmBlockThreshold.

View Source
var File_google_ai_generativelanguage_v1_citation_proto protoreflect.FileDescriptor
View Source
var File_google_ai_generativelanguage_v1_content_proto protoreflect.FileDescriptor
View Source
var File_google_ai_generativelanguage_v1_generative_service_proto protoreflect.FileDescriptor
View Source
var File_google_ai_generativelanguage_v1_model_proto protoreflect.FileDescriptor
View Source
var File_google_ai_generativelanguage_v1_model_service_proto protoreflect.FileDescriptor
View Source
var File_google_ai_generativelanguage_v1_safety_proto protoreflect.FileDescriptor

Functions

func RegisterGenerativeServiceServer

func RegisterGenerativeServiceServer(s *grpc.Server, srv GenerativeServiceServer)

func RegisterModelServiceServer

func RegisterModelServiceServer(s *grpc.Server, srv ModelServiceServer)

Types

type 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 deprecated

func (*BatchEmbedContentsRequest) Descriptor() ([]byte, []int)

Deprecated: Use BatchEmbedContentsRequest.ProtoReflect.Descriptor instead.

func (*BatchEmbedContentsRequest) GetModel

func (x *BatchEmbedContentsRequest) GetModel() string

func (*BatchEmbedContentsRequest) GetRequests

func (x *BatchEmbedContentsRequest) GetRequests() []*EmbedContentRequest

func (*BatchEmbedContentsRequest) ProtoMessage

func (*BatchEmbedContentsRequest) ProtoMessage()

func (*BatchEmbedContentsRequest) ProtoReflect

func (*BatchEmbedContentsRequest) Reset

func (x *BatchEmbedContentsRequest) Reset()

func (*BatchEmbedContentsRequest) String

func (x *BatchEmbedContentsRequest) String() string

type BatchEmbedContentsResponse

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 deprecated

func (*BatchEmbedContentsResponse) Descriptor() ([]byte, []int)

Deprecated: Use BatchEmbedContentsResponse.ProtoReflect.Descriptor instead.

func (*BatchEmbedContentsResponse) GetEmbeddings

func (x *BatchEmbedContentsResponse) GetEmbeddings() []*ContentEmbedding

func (*BatchEmbedContentsResponse) ProtoMessage

func (*BatchEmbedContentsResponse) ProtoMessage()

func (*BatchEmbedContentsResponse) ProtoReflect

func (*BatchEmbedContentsResponse) Reset

func (x *BatchEmbedContentsResponse) Reset()

func (*BatchEmbedContentsResponse) String

func (x *BatchEmbedContentsResponse) String() string

type Blob

type Blob struct {

	// The IANA standard MIME type of the source data.
	// Accepted types include: "image/png", "image/jpeg", "image/heic",
	// "image/heif", "image/webp".
	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

func (*Blob) Descriptor() ([]byte, []int)

Deprecated: Use Blob.ProtoReflect.Descriptor instead.

func (*Blob) GetData

func (x *Blob) GetData() []byte

func (*Blob) GetMimeType

func (x *Blob) GetMimeType() string

func (*Blob) ProtoMessage

func (*Blob) ProtoMessage()

func (*Blob) ProtoReflect

func (x *Blob) ProtoReflect() protoreflect.Message

func (*Blob) Reset

func (x *Blob) Reset()

func (*Blob) String

func (x *Blob) String() string

type Candidate

type Candidate struct {

	// Output only. Index of the candidate in the list of candidates.
	Index *int32 `protobuf:"varint,3,opt,name=index,proto3,oneof" json:"index,omitempty"`
	// Output only. Generated content returned from the model.
	Content *Content `protobuf:"bytes,1,opt,name=content,proto3" json:"content,omitempty"`
	// Optional. Output only. The reason why the model stopped generating tokens.
	//
	// If empty, the model has not stopped generating the tokens.
	FinishReason Candidate_FinishReason `` /* 158-byte string literal not displayed */
	// 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"`
	// contains filtered or unexported fields
}

A response candidate generated from the model.

func (*Candidate) Descriptor deprecated

func (*Candidate) Descriptor() ([]byte, []int)

Deprecated: Use Candidate.ProtoReflect.Descriptor instead.

func (*Candidate) GetCitationMetadata

func (x *Candidate) GetCitationMetadata() *CitationMetadata

func (*Candidate) GetContent

func (x *Candidate) GetContent() *Content

func (*Candidate) GetFinishReason

func (x *Candidate) GetFinishReason() Candidate_FinishReason

func (*Candidate) GetIndex

func (x *Candidate) GetIndex() int32

func (*Candidate) GetSafetyRatings

func (x *Candidate) GetSafetyRatings() []*SafetyRating

func (*Candidate) GetTokenCount

func (x *Candidate) GetTokenCount() int32

func (*Candidate) ProtoMessage

func (*Candidate) ProtoMessage()

func (*Candidate) ProtoReflect

func (x *Candidate) ProtoReflect() protoreflect.Message

func (*Candidate) Reset

func (x *Candidate) Reset()

func (*Candidate) String

func (x *Candidate) String() string

type Candidate_FinishReason

type Candidate_FinishReason int32

Defines the reason why the model stopped generating tokens.

const (
	// Default value. This value is unused.
	Candidate_FINISH_REASON_UNSPECIFIED Candidate_FinishReason = 0
	// Natural stop point of the model or provided stop sequence.
	Candidate_STOP Candidate_FinishReason = 1
	// The maximum number of tokens as specified in the request was reached.
	Candidate_MAX_TOKENS Candidate_FinishReason = 2
	// The candidate content was flagged for safety reasons.
	Candidate_SAFETY Candidate_FinishReason = 3
	// The candidate content was flagged for recitation reasons.
	Candidate_RECITATION Candidate_FinishReason = 4
	// Unknown reason.
	Candidate_OTHER Candidate_FinishReason = 5
)

func (Candidate_FinishReason) Descriptor

func (Candidate_FinishReason) Enum

func (Candidate_FinishReason) EnumDescriptor deprecated

func (Candidate_FinishReason) EnumDescriptor() ([]byte, []int)

Deprecated: Use Candidate_FinishReason.Descriptor instead.

func (Candidate_FinishReason) Number

func (Candidate_FinishReason) String

func (x Candidate_FinishReason) String() string

func (Candidate_FinishReason) Type

type CitationMetadata

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 deprecated

func (*CitationMetadata) Descriptor() ([]byte, []int)

Deprecated: Use CitationMetadata.ProtoReflect.Descriptor instead.

func (*CitationMetadata) GetCitationSources

func (x *CitationMetadata) GetCitationSources() []*CitationSource

func (*CitationMetadata) ProtoMessage

func (*CitationMetadata) ProtoMessage()

func (*CitationMetadata) ProtoReflect

func (x *CitationMetadata) ProtoReflect() protoreflect.Message

func (*CitationMetadata) Reset

func (x *CitationMetadata) Reset()

func (*CitationMetadata) String

func (x *CitationMetadata) String() string

type CitationSource

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 deprecated

func (*CitationSource) Descriptor() ([]byte, []int)

Deprecated: Use CitationSource.ProtoReflect.Descriptor instead.

func (*CitationSource) GetEndIndex

func (x *CitationSource) GetEndIndex() int32

func (*CitationSource) GetLicense

func (x *CitationSource) GetLicense() string

func (*CitationSource) GetStartIndex

func (x *CitationSource) GetStartIndex() int32

func (*CitationSource) GetUri

func (x *CitationSource) GetUri() string

func (*CitationSource) ProtoMessage

func (*CitationSource) ProtoMessage()

func (*CitationSource) ProtoReflect

func (x *CitationSource) ProtoReflect() protoreflect.Message

func (*CitationSource) Reset

func (x *CitationSource) Reset()

func (*CitationSource) String

func (x *CitationSource) String() string

type Content

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

func (*Content) Descriptor() ([]byte, []int)

Deprecated: Use Content.ProtoReflect.Descriptor instead.

func (*Content) GetParts

func (x *Content) GetParts() []*Part

func (*Content) GetRole

func (x *Content) GetRole() string

func (*Content) ProtoMessage

func (*Content) ProtoMessage()

func (*Content) ProtoReflect

func (x *Content) ProtoReflect() protoreflect.Message

func (*Content) Reset

func (x *Content) Reset()

func (*Content) String

func (x *Content) String() string

type 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 deprecated

func (*ContentEmbedding) Descriptor() ([]byte, []int)

Deprecated: Use ContentEmbedding.ProtoReflect.Descriptor instead.

func (*ContentEmbedding) GetValues

func (x *ContentEmbedding) GetValues() []float32

func (*ContentEmbedding) ProtoMessage

func (*ContentEmbedding) ProtoMessage()

func (*ContentEmbedding) ProtoReflect

func (x *ContentEmbedding) ProtoReflect() protoreflect.Message

func (*ContentEmbedding) Reset

func (x *ContentEmbedding) Reset()

func (*ContentEmbedding) String

func (x *ContentEmbedding) String() string

type CountTokensRequest

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"`
	// Required. The input given to the model as a prompt.
	Contents []*Content `protobuf:"bytes,2,rep,name=contents,proto3" json:"contents,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 deprecated

func (*CountTokensRequest) Descriptor() ([]byte, []int)

Deprecated: Use CountTokensRequest.ProtoReflect.Descriptor instead.

func (*CountTokensRequest) GetContents

func (x *CountTokensRequest) GetContents() []*Content

func (*CountTokensRequest) GetModel

func (x *CountTokensRequest) GetModel() string

func (*CountTokensRequest) ProtoMessage

func (*CountTokensRequest) ProtoMessage()

func (*CountTokensRequest) ProtoReflect

func (x *CountTokensRequest) ProtoReflect() protoreflect.Message

func (*CountTokensRequest) Reset

func (x *CountTokensRequest) Reset()

func (*CountTokensRequest) String

func (x *CountTokensRequest) String() string

type CountTokensResponse

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"`
	// contains filtered or unexported fields
}

A response from `CountTokens`.

It returns the model's `token_count` for the `prompt`.

func (*CountTokensResponse) Descriptor deprecated

func (*CountTokensResponse) Descriptor() ([]byte, []int)

Deprecated: Use CountTokensResponse.ProtoReflect.Descriptor instead.

func (*CountTokensResponse) GetTotalTokens

func (x *CountTokensResponse) GetTotalTokens() int32

func (*CountTokensResponse) ProtoMessage

func (*CountTokensResponse) ProtoMessage()

func (*CountTokensResponse) ProtoReflect

func (x *CountTokensResponse) ProtoReflect() protoreflect.Message

func (*CountTokensResponse) Reset

func (x *CountTokensResponse) Reset()

func (*CountTokensResponse) String

func (x *CountTokensResponse) String() string

type EmbedContentRequest

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. Can
	// only be set for `models/embedding-001`.
	TaskType *TaskType `` /* 138-byte string literal not displayed */
	// 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 `models/text-embedding-latest`.
	OutputDimensionality *int32 `` /* 128-byte string literal not displayed */
	// contains filtered or unexported fields
}

Request containing the `Content` for the model to embed.

func (*EmbedContentRequest) Descriptor deprecated

func (*EmbedContentRequest) Descriptor() ([]byte, []int)

Deprecated: Use EmbedContentRequest.ProtoReflect.Descriptor instead.

func (*EmbedContentRequest) GetContent

func (x *EmbedContentRequest) GetContent() *Content

func (*EmbedContentRequest) GetModel

func (x *EmbedContentRequest) GetModel() string

func (*EmbedContentRequest) GetOutputDimensionality added in v0.4.0

func (x *EmbedContentRequest) GetOutputDimensionality() int32

func (*EmbedContentRequest) GetTaskType

func (x *EmbedContentRequest) GetTaskType() TaskType

func (*EmbedContentRequest) GetTitle

func (x *EmbedContentRequest) GetTitle() string

func (*EmbedContentRequest) ProtoMessage

func (*EmbedContentRequest) ProtoMessage()

func (*EmbedContentRequest) ProtoReflect

func (x *EmbedContentRequest) ProtoReflect() protoreflect.Message

func (*EmbedContentRequest) Reset

func (x *EmbedContentRequest) Reset()

func (*EmbedContentRequest) String

func (x *EmbedContentRequest) String() string

type EmbedContentResponse

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 deprecated

func (*EmbedContentResponse) Descriptor() ([]byte, []int)

Deprecated: Use EmbedContentResponse.ProtoReflect.Descriptor instead.

func (*EmbedContentResponse) GetEmbedding

func (x *EmbedContentResponse) GetEmbedding() *ContentEmbedding

func (*EmbedContentResponse) ProtoMessage

func (*EmbedContentResponse) ProtoMessage()

func (*EmbedContentResponse) ProtoReflect

func (x *EmbedContentResponse) ProtoReflect() protoreflect.Message

func (*EmbedContentResponse) Reset

func (x *EmbedContentResponse) Reset()

func (*EmbedContentResponse) String

func (x *EmbedContentResponse) String() string

type GenerateContentRequest

type GenerateContentRequest struct {

	// Required. The name of the `Model` to use for generating the completion.
	//
	// Format: `name=models/{model}`.
	Model string `protobuf:"bytes,1,opt,name=model,proto3" json:"model,omitempty"`
	// Required. The content of the current conversation with the model.
	//
	// For single-turn queries, this is a single instance. For multi-turn queries,
	// this is a repeated field that contains conversation history + latest
	// request.
	Contents []*Content `protobuf:"bytes,2,rep,name=contents,proto3" json:"contents,omitempty"`
	// Optional. A list of unique `SafetySetting` instances for blocking unsafe
	// content.
	//
	// This will be enforced on the `GenerateContentRequest.contents` and
	// `GenerateContentResponse.candidates`. There should not be more than one
	// setting for each `SafetyCategory` type. The API will block any contents and
	// responses that fail to meet the thresholds set by these settings. This list
	// overrides the default settings for each `SafetyCategory` specified in the
	// safety_settings. If there is no `SafetySetting` for a given
	// `SafetyCategory` provided in the list, the API will use the default safety
	// setting for that category. Harm categories HARM_CATEGORY_HATE_SPEECH,
	// HARM_CATEGORY_SEXUALLY_EXPLICIT, HARM_CATEGORY_DANGEROUS_CONTENT,
	// HARM_CATEGORY_HARASSMENT are supported.
	SafetySettings []*SafetySetting `protobuf:"bytes,3,rep,name=safety_settings,json=safetySettings,proto3" json:"safety_settings,omitempty"`
	// Optional. Configuration options for model generation and outputs.
	GenerationConfig *GenerationConfig `protobuf:"bytes,4,opt,name=generation_config,json=generationConfig,proto3,oneof" json:"generation_config,omitempty"`
	// contains filtered or unexported fields
}

Request to generate a completion from the model.

func (*GenerateContentRequest) Descriptor deprecated

func (*GenerateContentRequest) Descriptor() ([]byte, []int)

Deprecated: Use GenerateContentRequest.ProtoReflect.Descriptor instead.

func (*GenerateContentRequest) GetContents

func (x *GenerateContentRequest) GetContents() []*Content

func (*GenerateContentRequest) GetGenerationConfig

func (x *GenerateContentRequest) GetGenerationConfig() *GenerationConfig

func (*GenerateContentRequest) GetModel

func (x *GenerateContentRequest) GetModel() string

func (*GenerateContentRequest) GetSafetySettings

func (x *GenerateContentRequest) GetSafetySettings() []*SafetySetting

func (*GenerateContentRequest) ProtoMessage

func (*GenerateContentRequest) ProtoMessage()

func (*GenerateContentRequest) ProtoReflect

func (x *GenerateContentRequest) ProtoReflect() protoreflect.Message

func (*GenerateContentRequest) Reset

func (x *GenerateContentRequest) Reset()

func (*GenerateContentRequest) String

func (x *GenerateContentRequest) String() string

type GenerateContentResponse

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"`
	// contains filtered or unexported fields
}

Response from the model supporting multiple candidates.

Note on safety ratings and content filtering. They are reported for both prompt in `GenerateContentResponse.prompt_feedback` and for each candidate in `finish_reason` and in `safety_ratings`. The API contract is that:

  • either all requested candidates are returned or no candidates at all
  • no candidates are returned only if there was something wrong with the prompt (see `prompt_feedback`)
  • feedback on each candidate is reported on `finish_reason` and `safety_ratings`.

func (*GenerateContentResponse) Descriptor deprecated

func (*GenerateContentResponse) Descriptor() ([]byte, []int)

Deprecated: Use GenerateContentResponse.ProtoReflect.Descriptor instead.

func (*GenerateContentResponse) GetCandidates

func (x *GenerateContentResponse) GetCandidates() []*Candidate

func (*GenerateContentResponse) GetPromptFeedback

func (*GenerateContentResponse) ProtoMessage

func (*GenerateContentResponse) ProtoMessage()

func (*GenerateContentResponse) ProtoReflect

func (x *GenerateContentResponse) ProtoReflect() protoreflect.Message

func (*GenerateContentResponse) Reset

func (x *GenerateContentResponse) Reset()

func (*GenerateContentResponse) String

func (x *GenerateContentResponse) String() string

type GenerateContentResponse_PromptFeedback

type GenerateContentResponse_PromptFeedback struct {

	// Optional. If set, the prompt was blocked and no candidates are returned.
	// Rephrase your prompt.
	BlockReason GenerateContentResponse_PromptFeedback_BlockReason `` /* 183-byte string literal not displayed */
	// 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 deprecated

func (*GenerateContentResponse_PromptFeedback) Descriptor() ([]byte, []int)

Deprecated: Use GenerateContentResponse_PromptFeedback.ProtoReflect.Descriptor instead.

func (*GenerateContentResponse_PromptFeedback) GetBlockReason

func (*GenerateContentResponse_PromptFeedback) GetSafetyRatings

func (x *GenerateContentResponse_PromptFeedback) GetSafetyRatings() []*SafetyRating

func (*GenerateContentResponse_PromptFeedback) ProtoMessage

func (*GenerateContentResponse_PromptFeedback) ProtoReflect

func (*GenerateContentResponse_PromptFeedback) Reset

func (*GenerateContentResponse_PromptFeedback) String

type GenerateContentResponse_PromptFeedback_BlockReason

type GenerateContentResponse_PromptFeedback_BlockReason int32

Specifies what was the reason why prompt was blocked.

const (
	// Default value. This value is unused.
	GenerateContentResponse_PromptFeedback_BLOCK_REASON_UNSPECIFIED GenerateContentResponse_PromptFeedback_BlockReason = 0
	// Prompt was blocked due to safety reasons. You can inspect
	// `safety_ratings` to understand which safety category blocked it.
	GenerateContentResponse_PromptFeedback_SAFETY GenerateContentResponse_PromptFeedback_BlockReason = 1
	// Prompt was blocked due to unknown reaasons.
	GenerateContentResponse_PromptFeedback_OTHER GenerateContentResponse_PromptFeedback_BlockReason = 2
)

func (GenerateContentResponse_PromptFeedback_BlockReason) Descriptor

func (GenerateContentResponse_PromptFeedback_BlockReason) Enum

func (GenerateContentResponse_PromptFeedback_BlockReason) EnumDescriptor deprecated

Deprecated: Use GenerateContentResponse_PromptFeedback_BlockReason.Descriptor instead.

func (GenerateContentResponse_PromptFeedback_BlockReason) Number

func (GenerateContentResponse_PromptFeedback_BlockReason) String

func (GenerateContentResponse_PromptFeedback_BlockReason) Type

type GenerationConfig

type GenerationConfig struct {

	// Optional. Number of generated responses to return.
	//
	// Currently, this value can only be set to 1. If unset, this will default
	// to 1.
	CandidateCount *int32 `protobuf:"varint,1,opt,name=candidate_count,json=candidateCount,proto3,oneof" json:"candidate_count,omitempty"`
	// Optional. The set of character sequences (up to 5) that will stop output
	// generation. If specified, the API will stop at the first appearance of a
	// stop sequence. The stop sequence will not be included as part of the
	// response.
	StopSequences []string `protobuf:"bytes,2,rep,name=stop_sequences,json=stopSequences,proto3" json:"stop_sequences,omitempty"`
	// Optional. The maximum number of tokens to include in a candidate.
	//
	// 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 nucleus sampling.
	//
	// Tokens are sorted based on their assigned probabilities so that only the
	// most likely tokens are considered. Top-k sampling directly limits the
	// maximum number of tokens to consider, while Nucleus sampling limits number
	// of tokens based on the cumulative probability.
	//
	// Note: The default value varies by model, see the `Model.top_p`
	// attribute of the `Model` returned from the `getModel` function.
	TopP *float32 `protobuf:"fixed32,6,opt,name=top_p,json=topP,proto3,oneof" json:"top_p,omitempty"`
	// Optional. The maximum number of tokens to consider when sampling.
	//
	// Models use nucleus sampling or combined 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, see the `Model.top_k`
	// attribute of the `Model` returned from the `getModel` function. Empty
	// `top_k` field in `Model` indicates 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"`
	// contains filtered or unexported fields
}

Configuration options for model generation and outputs. Not all parameters may be configurable for every model.

func (*GenerationConfig) Descriptor deprecated

func (*GenerationConfig) Descriptor() ([]byte, []int)

Deprecated: Use GenerationConfig.ProtoReflect.Descriptor instead.

func (*GenerationConfig) GetCandidateCount

func (x *GenerationConfig) GetCandidateCount() int32

func (*GenerationConfig) GetMaxOutputTokens

func (x *GenerationConfig) GetMaxOutputTokens() int32

func (*GenerationConfig) GetStopSequences

func (x *GenerationConfig) GetStopSequences() []string

func (*GenerationConfig) GetTemperature

func (x *GenerationConfig) GetTemperature() float32

func (*GenerationConfig) GetTopK

func (x *GenerationConfig) GetTopK() int32

func (*GenerationConfig) GetTopP

func (x *GenerationConfig) GetTopP() float32

func (*GenerationConfig) ProtoMessage

func (*GenerationConfig) ProtoMessage()

func (*GenerationConfig) ProtoReflect

func (x *GenerationConfig) ProtoReflect() protoreflect.Message

func (*GenerationConfig) Reset

func (x *GenerationConfig) Reset()

func (*GenerationConfig) String

func (x *GenerationConfig) String() string

type GenerativeServiceClient

type GenerativeServiceClient interface {
	// Generates a response from the model given an input
	// `GenerateContentRequest`.
	GenerateContent(ctx context.Context, in *GenerateContentRequest, opts ...grpc.CallOption) (*GenerateContentResponse, error)
	// Generates a streamed response from the model given an input
	// `GenerateContentRequest`.
	StreamGenerateContent(ctx context.Context, in *GenerateContentRequest, opts ...grpc.CallOption) (GenerativeService_StreamGenerateContentClient, error)
	// Generates an embedding from the model given an input `Content`.
	EmbedContent(ctx context.Context, in *EmbedContentRequest, opts ...grpc.CallOption) (*EmbedContentResponse, error)
	// Generates multiple embeddings from the model given input text in a
	// synchronous call.
	BatchEmbedContents(ctx context.Context, in *BatchEmbedContentsRequest, opts ...grpc.CallOption) (*BatchEmbedContentsResponse, error)
	// Runs a model's tokenizer on input content and returns the token count.
	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://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

type GenerativeServiceServer

type GenerativeServiceServer interface {
	// Generates a response from the model given an input
	// `GenerateContentRequest`.
	GenerateContent(context.Context, *GenerateContentRequest) (*GenerateContentResponse, error)
	// Generates a streamed response from the model given an input
	// `GenerateContentRequest`.
	StreamGenerateContent(*GenerateContentRequest, GenerativeService_StreamGenerateContentServer) error
	// Generates an embedding from the model given an input `Content`.
	EmbedContent(context.Context, *EmbedContentRequest) (*EmbedContentResponse, error)
	// Generates multiple embeddings from the model given input text in a
	// synchronous call.
	BatchEmbedContents(context.Context, *BatchEmbedContentsRequest) (*BatchEmbedContentsResponse, error)
	// Runs a model's tokenizer on input content and returns the token count.
	CountTokens(context.Context, *CountTokensRequest) (*CountTokensResponse, error)
}

GenerativeServiceServer is the server API for GenerativeService service.

type GenerativeService_StreamGenerateContentClient

type GenerativeService_StreamGenerateContentClient interface {
	Recv() (*GenerateContentResponse, error)
	grpc.ClientStream
}

type GenerativeService_StreamGenerateContentServer

type GenerativeService_StreamGenerateContentServer interface {
	Send(*GenerateContentResponse) error
	grpc.ServerStream
}

type 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 deprecated

func (*GetModelRequest) Descriptor() ([]byte, []int)

Deprecated: Use GetModelRequest.ProtoReflect.Descriptor instead.

func (*GetModelRequest) GetName

func (x *GetModelRequest) GetName() string

func (*GetModelRequest) ProtoMessage

func (*GetModelRequest) ProtoMessage()

func (*GetModelRequest) ProtoReflect

func (x *GetModelRequest) ProtoReflect() protoreflect.Message

func (*GetModelRequest) Reset

func (x *GetModelRequest) Reset()

func (*GetModelRequest) String

func (x *GetModelRequest) String() string

type HarmCategory

type HarmCategory int32

The category of a rating.

These categories cover various kinds of harms that developers may wish to adjust.

const (
	// Category is unspecified.
	HarmCategory_HARM_CATEGORY_UNSPECIFIED HarmCategory = 0
	// Negative or harmful comments targeting identity and/or protected attribute.
	HarmCategory_HARM_CATEGORY_DEROGATORY HarmCategory = 1
	// Content that is rude, disrespectful, or profane.
	HarmCategory_HARM_CATEGORY_TOXICITY HarmCategory = 2
	// Describes scenarios depicting violence against an individual or group, or
	// general descriptions of gore.
	HarmCategory_HARM_CATEGORY_VIOLENCE HarmCategory = 3
	// Contains references to sexual acts or other lewd content.
	HarmCategory_HARM_CATEGORY_SEXUAL HarmCategory = 4
	// Promotes unchecked medical advice.
	HarmCategory_HARM_CATEGORY_MEDICAL HarmCategory = 5
	// Dangerous content that promotes, facilitates, or encourages harmful acts.
	HarmCategory_HARM_CATEGORY_DANGEROUS HarmCategory = 6
	// Harasment content.
	HarmCategory_HARM_CATEGORY_HARASSMENT HarmCategory = 7
	// Hate speech and content.
	HarmCategory_HARM_CATEGORY_HATE_SPEECH HarmCategory = 8
	// Sexually explicit content.
	HarmCategory_HARM_CATEGORY_SEXUALLY_EXPLICIT HarmCategory = 9
	// Dangerous content.
	HarmCategory_HARM_CATEGORY_DANGEROUS_CONTENT HarmCategory = 10
)

func (HarmCategory) Descriptor

func (HarmCategory) Enum

func (x HarmCategory) Enum() *HarmCategory

func (HarmCategory) EnumDescriptor deprecated

func (HarmCategory) EnumDescriptor() ([]byte, []int)

Deprecated: Use HarmCategory.Descriptor instead.

func (HarmCategory) Number

func (HarmCategory) String

func (x HarmCategory) String() string

func (HarmCategory) Type

type ListModelsRequest

type ListModelsRequest struct {

	// The maximum number of `Models` to return (per page).
	//
	// The service may return fewer models.
	// If unspecified, at most 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 deprecated

func (*ListModelsRequest) Descriptor() ([]byte, []int)

Deprecated: Use ListModelsRequest.ProtoReflect.Descriptor instead.

func (*ListModelsRequest) GetPageSize

func (x *ListModelsRequest) GetPageSize() int32

func (*ListModelsRequest) GetPageToken

func (x *ListModelsRequest) GetPageToken() string

func (*ListModelsRequest) ProtoMessage

func (*ListModelsRequest) ProtoMessage()

func (*ListModelsRequest) ProtoReflect

func (x *ListModelsRequest) ProtoReflect() protoreflect.Message

func (*ListModelsRequest) Reset

func (x *ListModelsRequest) Reset()

func (*ListModelsRequest) String

func (x *ListModelsRequest) String() string

type ListModelsResponse

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 deprecated

func (*ListModelsResponse) Descriptor() ([]byte, []int)

Deprecated: Use ListModelsResponse.ProtoReflect.Descriptor instead.

func (*ListModelsResponse) GetModels

func (x *ListModelsResponse) GetModels() []*Model

func (*ListModelsResponse) GetNextPageToken

func (x *ListModelsResponse) GetNextPageToken() string

func (*ListModelsResponse) ProtoMessage

func (*ListModelsResponse) ProtoMessage()

func (*ListModelsResponse) ProtoReflect

func (x *ListModelsResponse) ProtoReflect() protoreflect.Message

func (*ListModelsResponse) Reset

func (x *ListModelsResponse) Reset()

func (*ListModelsResponse) String

func (x *ListModelsResponse) String() string

type Model

type Model struct {

	// Required. The resource name of the `Model`.
	//
	// Format: `models/{model}` with a `{model}` naming convention of:
	//
	// * "{base_model_id}-{version}"
	//
	// Examples:
	//
	// * `models/chat-bison-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:
	//
	// * `chat-bison`
	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
	Version string `protobuf:"bytes,3,opt,name=version,proto3" json:"version,omitempty"`
	// The human-readable name of the model. E.g. "Chat Bison".
	//
	// 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 method names are defined as Pascal case
	// strings, such as `generateMessage` which correspond to API methods.
	SupportedGenerationMethods []string `` /* 141-byte string literal not displayed */
	// Controls the randomness of the output.
	//
	// Values can range over `[0.0,1.0]`, inclusive. A value closer to `1.0` 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"`
	// For Nucleus sampling.
	//
	// 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"`
	// contains filtered or unexported fields
}

Information about a Generative Language Model.

func (*Model) Descriptor deprecated

func (*Model) Descriptor() ([]byte, []int)

Deprecated: Use Model.ProtoReflect.Descriptor instead.

func (*Model) GetBaseModelId

func (x *Model) GetBaseModelId() string

func (*Model) GetDescription

func (x *Model) GetDescription() string

func (*Model) GetDisplayName

func (x *Model) GetDisplayName() string

func (*Model) GetInputTokenLimit

func (x *Model) GetInputTokenLimit() int32

func (*Model) GetName

func (x *Model) GetName() string

func (*Model) GetOutputTokenLimit

func (x *Model) GetOutputTokenLimit() int32

func (*Model) GetSupportedGenerationMethods

func (x *Model) GetSupportedGenerationMethods() []string

func (*Model) GetTemperature

func (x *Model) GetTemperature() float32

func (*Model) GetTopK

func (x *Model) GetTopK() int32

func (*Model) GetTopP

func (x *Model) GetTopP() float32

func (*Model) GetVersion

func (x *Model) GetVersion() string

func (*Model) ProtoMessage

func (*Model) ProtoMessage()

func (*Model) ProtoReflect

func (x *Model) ProtoReflect() protoreflect.Message

func (*Model) Reset

func (x *Model) Reset()

func (*Model) String

func (x *Model) String() string

type ModelServiceClient

type ModelServiceClient interface {
	// Gets information about a specific Model.
	GetModel(ctx context.Context, in *GetModelRequest, opts ...grpc.CallOption) (*Model, error)
	// Lists models available through the 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://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

type ModelServiceServer

type ModelServiceServer interface {
	// Gets information about a specific Model.
	GetModel(context.Context, *GetModelRequest) (*Model, error)
	// Lists models available through the API.
	ListModels(context.Context, *ListModelsRequest) (*ListModelsResponse, error)
}

ModelServiceServer is the server API for ModelService service.

type Part

type Part struct {

	// Types that are assignable to Data:
	//
	//	*Part_Text
	//	*Part_InlineData
	Data isPart_Data `protobuf_oneof:"data"`
	// 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

func (*Part) Descriptor() ([]byte, []int)

Deprecated: Use Part.ProtoReflect.Descriptor instead.

func (*Part) GetData

func (m *Part) GetData() isPart_Data

func (*Part) GetInlineData

func (x *Part) GetInlineData() *Blob

func (*Part) GetText

func (x *Part) GetText() string

func (*Part) ProtoMessage

func (*Part) ProtoMessage()

func (*Part) ProtoReflect

func (x *Part) ProtoReflect() protoreflect.Message

func (*Part) Reset

func (x *Part) Reset()

func (*Part) String

func (x *Part) String() string

type Part_InlineData

type Part_InlineData struct {
	// Inline media bytes.
	InlineData *Blob `protobuf:"bytes,3,opt,name=inline_data,json=inlineData,proto3,oneof"`
}

type Part_Text

type Part_Text struct {
	// Inline text.
	Text string `protobuf:"bytes,2,opt,name=text,proto3,oneof"`
}

type SafetyRating

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 `` /* 142-byte string literal not displayed */
	// 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 deprecated

func (*SafetyRating) Descriptor() ([]byte, []int)

Deprecated: Use SafetyRating.ProtoReflect.Descriptor instead.

func (*SafetyRating) GetBlocked

func (x *SafetyRating) GetBlocked() bool

func (*SafetyRating) GetCategory

func (x *SafetyRating) GetCategory() HarmCategory

func (*SafetyRating) GetProbability

func (x *SafetyRating) GetProbability() SafetyRating_HarmProbability

func (*SafetyRating) ProtoMessage

func (*SafetyRating) ProtoMessage()

func (*SafetyRating) ProtoReflect

func (x *SafetyRating) ProtoReflect() protoreflect.Message

func (*SafetyRating) Reset

func (x *SafetyRating) Reset()

func (*SafetyRating) String

func (x *SafetyRating) String() string

type SafetyRating_HarmProbability

type SafetyRating_HarmProbability int32

The 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.

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) Enum

func (SafetyRating_HarmProbability) EnumDescriptor deprecated

func (SafetyRating_HarmProbability) EnumDescriptor() ([]byte, []int)

Deprecated: Use SafetyRating_HarmProbability.Descriptor instead.

func (SafetyRating_HarmProbability) Number

func (SafetyRating_HarmProbability) String

func (SafetyRating_HarmProbability) Type

type SafetySetting

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 `` /* 142-byte string literal not displayed */
	// contains filtered or unexported fields
}

Safety setting, affecting the safety-blocking behavior.

Passing a safety setting for a category changes the allowed proability that content is blocked.

func (*SafetySetting) Descriptor deprecated

func (*SafetySetting) Descriptor() ([]byte, []int)

Deprecated: Use SafetySetting.ProtoReflect.Descriptor instead.

func (*SafetySetting) GetCategory

func (x *SafetySetting) GetCategory() HarmCategory

func (*SafetySetting) GetThreshold

func (*SafetySetting) ProtoMessage

func (*SafetySetting) ProtoMessage()

func (*SafetySetting) ProtoReflect

func (x *SafetySetting) ProtoReflect() protoreflect.Message

func (*SafetySetting) Reset

func (x *SafetySetting) Reset()

func (*SafetySetting) String

func (x *SafetySetting) String() string

type SafetySetting_HarmBlockThreshold

type SafetySetting_HarmBlockThreshold int32

Block at and beyond a specified harm probability.

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
)

func (SafetySetting_HarmBlockThreshold) Descriptor

func (SafetySetting_HarmBlockThreshold) Enum

func (SafetySetting_HarmBlockThreshold) EnumDescriptor deprecated

func (SafetySetting_HarmBlockThreshold) EnumDescriptor() ([]byte, []int)

Deprecated: Use SafetySetting_HarmBlockThreshold.Descriptor instead.

func (SafetySetting_HarmBlockThreshold) Number

func (SafetySetting_HarmBlockThreshold) String

func (SafetySetting_HarmBlockThreshold) Type

type TaskType

type TaskType int32

Type of task for which the embedding will be used.

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
)

func (TaskType) Descriptor

func (TaskType) Descriptor() protoreflect.EnumDescriptor

func (TaskType) Enum

func (x TaskType) Enum() *TaskType

func (TaskType) EnumDescriptor deprecated

func (TaskType) EnumDescriptor() ([]byte, []int)

Deprecated: Use TaskType.Descriptor instead.

func (TaskType) Number

func (x TaskType) Number() protoreflect.EnumNumber

func (TaskType) String

func (x TaskType) String() string

func (TaskType) Type

type UnimplementedGenerativeServiceServer

type UnimplementedGenerativeServiceServer struct {
}

UnimplementedGenerativeServiceServer can be embedded to have forward compatible implementations.

func (*UnimplementedGenerativeServiceServer) BatchEmbedContents

func (*UnimplementedGenerativeServiceServer) CountTokens

func (*UnimplementedGenerativeServiceServer) EmbedContent

func (*UnimplementedGenerativeServiceServer) GenerateContent

type UnimplementedModelServiceServer

type UnimplementedModelServiceServer struct {
}

UnimplementedModelServiceServer can be embedded to have forward compatible implementations.

func (*UnimplementedModelServiceServer) GetModel

func (*UnimplementedModelServiceServer) ListModels

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL