Structures
The following structures are available globally.
-
The model’s response to a count tokens request.
Declaration
Swift
@available(iOS 15.0, macOS 11.0, *) public struct CountTokensResponse
extension CountTokensResponse: Decodable
-
A predicted function call returned from the model.
Declaration
Swift
public struct FunctionCall : Equatable
extension FunctionCall: Decodable
extension FunctionCall: Encodable
-
Structured representation of a function declaration.
This
FunctionDeclaration
is a representation of a block of code that can be used as aTool
by the model and executed by the client.Declaration
Swift
public struct FunctionDeclaration
extension FunctionDeclaration: Encodable
-
Helper tools that the model may use to generate response.
A
Tool
is a piece of code that enables the system to interact with external systems to perform an action, or set of actions, outside of knowledge and scope of the model.Declaration
Swift
public struct Tool
extension Tool: Encodable
-
Configuration for specifying function calling behavior.
Declaration
Swift
public struct FunctionCallingConfig
extension FunctionCallingConfig: Encodable
-
Tool configuration for any
Tool
specified in the request.Declaration
Swift
public struct ToolConfig
extension ToolConfig: Encodable
-
Result output from a
FunctionCall
.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. This should contain the result of aFunctionCall
made based on model prediction.Declaration
Swift
public struct FunctionResponse : Equatable
extension FunctionResponse: Encodable
-
The model’s response to a generate content request.
Declaration
Swift
@available(iOS 15.0, macOS 11.0, *) public struct GenerateContentResponse
extension GenerateContentResponse: Decodable
-
A struct representing a possible reply to a content generation prompt. Each content generation prompt may produce multiple candidate responses.
Declaration
Swift
@available(iOS 15.0, macOS 11.0, *) public struct CandidateResponse
extension CandidateResponse: Decodable
-
A collection of source attributions for a piece of content.
Declaration
Swift
@available(iOS 15.0, macOS 11.0, *) public struct CitationMetadata
extension CitationMetadata: Decodable
-
A struct describing a source attribution.
Declaration
Swift
@available(iOS 15.0, macOS 11.0, *) public struct Citation
extension Citation: Decodable
-
A metadata struct containing any feedback the model had on the prompt it was provided.
Declaration
Swift
@available(iOS 15.0, macOS 11.0, *) public struct PromptFeedback
extension PromptFeedback: Decodable
-
A struct defining model parameters to be used when sending generative AI requests to the backend model.
Declaration
Swift
@available(iOS 15.0, macOS 11.0, *) public struct GenerationConfig
extension GenerationConfig: Encodable
-
Configuration parameters for sending requests to the backend.
Declaration
Swift
@available(iOS 15.0, macOS 11.0, *) public struct RequestOptions
-
A type describing data in media formats interpretable by an AI model. Each generative AI request or response contains an
Array
ofModelContent
s, and eachModelContent
value may comprise multiple heterogeneousPart
s.Declaration
Swift
@available(iOS 15.0, macOS 11.0, *) public struct ModelContent : Equatable
extension ModelContent: Codable
-
A type defining potentially harmful media categories and their model-assigned ratings. A value of this type may be assigned to a category for every model-generated response, not just responses that exceed a certain threshold.
Declaration
Swift
@available(iOS 15.0, macOS 11.0, *) public struct SafetyRating : Equatable, Hashable
extension SafetyRating: Decodable
-
Safety feedback for an entire request.
Declaration
Swift
@available(iOS 15.0, macOS 11.0, *) public struct SafetyFeedback
extension SafetyFeedback: Decodable
-
A type used to specify a threshold for harmful content, beyond which the model will return a fallback response instead of generated content.
Declaration
Swift
@available(iOS 15.0, macOS 11.0, *) public struct SafetySetting
extension SafetySetting: Codable