package
0.19.0
Repository: https://github.com/google/generative-ai-go.git
Documentation: pkg.go.dev

# Functions

ImageData is a convenience function for creating an image Blob for input to a model.
NewClient creates a new Google generative AI client.
NewUserContent returns a *Content with a "user" role set and one or more parts.
Ptr returns a pointer to its argument.
WithClientInfo sets request information identifying the product that is calling this client.

# Constants

BlockReasonOther means prompt was blocked due to unknown reasons.
BlockReasonSafety means prompt was blocked due to safety reasons.
BlockReasonUnspecified means default value.
CodeExecutionResultOutcomeDeadlineExceeded means code execution ran for too long, and was cancelled.
CodeExecutionResultOutcomeFailed means code execution finished but with a failure.
CodeExecutionResultOutcomeOK means code execution completed successfully.
CodeExecutionResultOutcomeUnspecified means unspecified status.
ExecutableCodeLanguageUnspecified means unspecified language.
ExecutableCodePython means python >= 3.10, with numpy and simpy available.
FileStateActive means file is processed and available for inference.
FileStateFailed means file failed processing.
FileStateProcessing means file is being processed and cannot be used for inference yet.
FileStateUnspecified means the default value.
FinishReasonMaxTokens means the maximum number of tokens as specified in the request was reached.
FinishReasonOther means unknown reason.
FinishReasonRecitation means the candidate content was flagged for recitation reasons.
FinishReasonSafety means the candidate content was flagged for safety reasons.
FinishReasonStop means natural stop point of the model or provided stop sequence.
FinishReasonUnspecified means default value.
FunctionCallingAny means model is constrained to always predicting a function call only.
FunctionCallingAuto means default model behavior, model decides to predict either a function call or a natural language response.
FunctionCallingNone means model will not predict any function call.
FunctionCallingUnspecified means unspecified function calling mode.
HarmBlockLowAndAbove means content with NEGLIGIBLE will be allowed.
HarmBlockMediumAndAbove means content with NEGLIGIBLE and LOW will be allowed.
HarmBlockNone means all content will be allowed.
HarmBlockOnlyHigh means content with NEGLIGIBLE, LOW, and MEDIUM will be allowed.
HarmBlockUnspecified means threshold is unspecified.
HarmCategoryDangerous means dangerous content that promotes, facilitates, or encourages harmful acts.
HarmCategoryDangerousContent means dangerous content.
HarmCategoryDerogatory means negative or harmful comments targeting identity and/or protected attribute.
HarmCategoryHarassment means harasment content.
HarmCategoryHateSpeech means hate speech and content.
HarmCategoryMedical means promotes unchecked medical advice.
HarmCategorySexual means contains references to sexual acts or other lewd content.
HarmCategorySexuallyExplicit means sexually explicit content.
HarmCategoryToxicity means content that is rude, disrespectful, or profane.
HarmCategoryUnspecified means category is unspecified.
HarmCategoryViolence means describes scenarios depicting violence against an individual or group, or general descriptions of gore.
HarmProbabilityHigh means content has a high chance of being unsafe.
HarmProbabilityLow means content has a low chance of being unsafe.
HarmProbabilityMedium means content has a medium chance of being unsafe.
HarmProbabilityNegligible means content has a negligible chance of being unsafe.
HarmProbabilityUnspecified means probability is unspecified.
TaskTypeClassification means specifies that the given text will be classified.
TaskTypeClustering means specifies that the embeddings will be used for clustering.
TaskTypeFactVerification means specifies that the given text will be used for fact verification.
TaskTypeQuestionAnswering means specifies that the given text will be used for question answering.
TaskTypeRetrievalDocument means specifies the given text is a document from the corpus being searched.
TaskTypeRetrievalQuery means specifies the given text is a query in a search/retrieval setting.
TaskTypeSemanticSimilarity means specifies the given text will be used for STS.
TaskTypeUnspecified means unset value, which will default to one of the other enum values.
TypeArray means array type.
TypeBoolean means boolean type.
TypeInteger means integer type.
TypeNumber means number type.
TypeObject means object type.
TypeString means string type.
TypeUnspecified means not specified, should not be used.

# Structs

BatchEmbedContentsResponse is the response to a `BatchEmbedContentsRequest`.
Blob contains raw media bytes.
A BlockedError indicates that the model's response was blocked.
CachedContent is content that has been preprocessed and can be used in subsequent request to GenerativeService.
A CachedContentIterator iterates over CachedContents.
CachedContentToUpdate specifies which fields of a CachedContent to modify in a call to [Client.UpdateCachedContent].
CachedContentUsageMetadata is metadata on the usage of the cached content.
Candidate is a response candidate generated from the model.
A ChatSession provides interactive chat.
CitationMetadata is a collection of source attributions for a piece of content.
CitationSource contains a citation to a source for a portion of a specific response.
A Client is a Google generative AI client.
CodeExecution is tool that executes code generated by the model, and automatically returns the result to the model.
CodeExecutionResult is result of executing the `ExecutableCode`.
Content is the base structured datatype containing multi-part content of a message.
ContentEmbedding is a list of floats representing an embedding.
CountTokensResponse is a response from `CountTokens`.
EmbedContentResponse is the response to an `EmbedContentRequest`.
An EmbeddingBatch holds a collection of embedding requests.
EmbeddingModel is a model that computes embeddings.
ExecutableCode is code generated by the model that is meant to be executed, and the result returned to the model.
ExpireTimeOrTTL describes the time when a resource expires.
File is a file uploaded to the API.
FileData is URI based data.
A FileIterator iterates over Files.
FileMetadata holds metadata about a file.
FunctionCall is a predicted `FunctionCall` returned from the model that contains a string representing the `FunctionDeclaration.name` with the arguments and their values.
FunctionCallingConfig holds configuration for function calling.
FunctionDeclaration is structured representation of a function declaration as defined by the [OpenAPI 3.03 specification](https://spec.openapis.org/oas/v3.0.3).
FunctionResponse is the result output from a `FunctionCall` that contains a string representing the `FunctionDeclaration.name` and a structured JSON object containing any output from the function is used as context to the model.
GenerateContentResponse is the response from a GenerateContent or GenerateContentStream call.
GenerateContentResponseIterator is an iterator over GnerateContentResponse.
GenerationConfig is configuration options for model generation and outputs.
GenerativeModel is a model that can generate text.
ModelInfo is information about a language model.
A ModelInfoIterator iterates over Models.
PromptFeedback contains a set of the feedback metadata the prompt specified in `GenerateContentRequest.content`.
SafetyRating is the safety rating for a piece of content.
SafetySetting is safety setting, affecting the safety-blocking behavior.
Schema is the `Schema` object allows the definition of input and output data types.
Tool details that the model may use to generate response.
ToolConfig is the Tool configuration containing parameters for specifying `Tool` use in the request.
UploadFileOptions are options for [Client.UploadFile].
UsageMetadata is metadata on the generation request's token usage.
VideoMetadata is metadata for a video `File`.

# Interfaces

A Part is a piece of model content.

# Type aliases

BlockReason is specifies what was the reason why prompt was blocked.
CodeExecutionResultOutcome is enumeration of possible outcomes of the code execution.
ExecutableCodeLanguage is supported programming languages for the generated code.
FileState represents states for the lifecycle of a File.
FinishReason is defines the reason why the model stopped generating tokens.
FunctionCallingMode is defines the execution behavior for function calling by defining the execution mode.
HarmBlockThreshold specifies block at and beyond a specified harm probability.
HarmCategory specifies the category of a rating.
HarmProbability specifies the probability that a piece of content is harmful.
TaskType is type of task for which the embedding will be used.
A Text is a piece of text, like a question or phrase.
Type contains the list of OpenAPI data types as defined by https://spec.openapis.org/oas/v3.0.3#data-types.