# Structures

The following structures are available globally.
- `


  ### [GenerateContentResponse](https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/GenerateContentResponse)


  ` The model's response to a generate content request.

  #### Declaration

  Swift

      public struct GenerateContentResponse : Sendable

      extension GenerateContentResponse: Decodable

- `


  ### [Candidate](https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/Candidate)


  ` A struct representing a possible reply to a content generation prompt. Each content generation
  prompt may produce multiple candidate responses.

  #### Declaration

  Swift

      public struct Candidate : Sendable

      extension Candidate: Decodable

- `


  ### [CitationMetadata](https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/CitationMetadata)


  ` A collection of source attributions for a piece of content.

  #### Declaration

  Swift

      public struct CitationMetadata : Sendable

      extension CitationMetadata: Decodable

- `


  ### [Citation](https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/Citation)


  ` A struct describing a source attribution.

  #### Declaration

  Swift

      public struct Citation : Sendable, Equatable

      extension Citation: Decodable

- `


  ### [FinishReason](https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/FinishReason)


  ` A value enumerating possible reasons for a model to terminate a content generation request.

  #### Declaration

  Swift

      public struct FinishReason : DecodableProtoEnum, Hashable, Sendable

- `


  ### [PromptFeedback](https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/PromptFeedback)


  ` A metadata struct containing any feedback the model had on the prompt it was provided.

  #### Declaration

  Swift

      public struct PromptFeedback : Sendable

      extension PromptFeedback: Decodable

- `


  ### [GroundingMetadata](https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/GroundingMetadata)


  ` Metadata returned to the client when grounding is enabled.

  > [!CAUTION]
  > Important
  >
  > If using Grounding with Google Search, you are required to comply with the
  > "Grounding with Google Search" usage requirements for your chosen API provider:
  > [Gemini Developer API](https://ai.google.dev/gemini-api/terms#grounding-with-google-search)
  > or the Agent Platform Gemini API (see
  > [Service Terms](https://cloud.google.com/terms/service-terms)
  > section within the Service Specific Terms).

  #### Declaration

  Swift

      public struct GroundingMetadata : Sendable, Equatable, Hashable

      extension GroundingMetadata: Decodable

- `


  ### [Segment](https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/Segment)


  ` Represents a specific segment within a `https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/ModelContent` struct, often used to pinpoint the
  exact location of text or data that grounding information refers to.

  #### Declaration

  Swift

      public struct Segment : Sendable, Equatable, Hashable

      extension Segment: Decodable

- `


  ### [GenerationConfig](https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/GenerationConfig)


  ` A struct defining model parameters to be used when sending generative AI
  requests to the backend model.

  #### Declaration

  Swift

      public struct GenerationConfig : Sendable, Equatable

      extension GenerationConfig: Encodable

- `


  ### [RequestOptions](https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/RequestOptions)


  ` Configuration parameters for sending requests to the backend.

  #### Declaration

  Swift

      public struct RequestOptions : Sendable, Hashable

      extension RequestOptions: Equatable

- `


  ### [ModalityTokenCount](https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/ModalityTokenCount)


  ` Represents token counting info for a single modality.

  #### Declaration

  Swift

      public struct ModalityTokenCount : Sendable

      extension ModalityTokenCount: Decodable

- `


  ### [ContentModality](https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/ContentModality)


  ` Content part modality.

  #### Declaration

  Swift

      public struct ContentModality : DecodableProtoEnum, Hashable, Sendable

- `


  ### [ModelContent](https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/ModelContent)


  ` A type describing data in media formats interpretable by an AI model. Each generative AI
  request or response contains an `Array` of `ModelContent`s, and each `ModelContent` value
  may comprise multiple heterogeneous `https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Protocols/Part`s.

  #### Declaration

  Swift

      public struct ModelContent : Equatable, Sendable

      extension ModelContent: Codable

- `


  ### [SafetyRating](https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/SafetyRating)


  ` 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

      public struct SafetyRating : Equatable, Hashable, Sendable

      extension SafetyRating: Decodable

- `


  ### [SafetySetting](https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/SafetySetting)


  ` A type used to specify a threshold for harmful content, beyond which the model will return a
  fallback response instead of generated content.

  See [safety settings for Gemini
  models](https://firebase.google.com/docs/ai-logic/safety-settings) for
  more details.

  #### Declaration

  Swift

      public struct SafetySetting : Sendable, Hashable

      extension SafetySetting: Encodable

- `


  ### [HarmCategory](https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/HarmCategory)


  ` Categories describing the potential harm a piece of content may pose.

  #### Declaration

  Swift

      public struct HarmCategory : CodableProtoEnum, Hashable, Sendable

- `


  ### [FunctionDeclaration](https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/FunctionDeclaration)


  ` Structured representation of a function declaration.

  This `FunctionDeclaration` is a representation of a block of code that can be used as a
  `https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Classes/GenerativeModel/Tool` by the model and executed by the client.

  #### Declaration

  Swift

      public struct FunctionDeclaration : Sendable

      extension FunctionDeclaration: Encodable

- `


  ### [GoogleSearch](https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/GoogleSearch)


  ` A tool that allows the generative model to connect to Google Search to access and incorporate
  up-to-date information from the web into its responses.

  > [!CAUTION]
  > Important
  >
  > When using this feature, you are required to comply with the
  > "Grounding with Google Search" usage requirements for your chosen API provider:
  > [Gemini Developer API](https://ai.google.dev/gemini-api/terms#grounding-with-google-search)
  > or the Agent Platform Gemini API (see
  > [Service Terms](https://cloud.google.com/terms/service-terms)
  > section within the Service Specific Terms).

  #### Declaration

  Swift

      public struct GoogleSearch : Sendable

      extension GoogleSearch: Encodable

- `


  ### [FunctionCallingConfig](https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/FunctionCallingConfig)


  ` Configuration for specifying function calling behavior.

  #### Declaration

  Swift

      public struct FunctionCallingConfig : Sendable

      extension FunctionCallingConfig: Encodable

- `


  ### [ToolConfig](https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/ToolConfig)


  ` Tool configuration for any `https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Classes/GenerativeModel/Tool` specified in the request.

  #### Declaration

  Swift

      public struct ToolConfig : Sendable

      extension ToolConfig: Encodable

- `


  ### [RetrievalConfig](https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/RetrievalConfig)


  ` Configuration for grounding retrieval tools, such as Grounding with Google Maps.

  Use `RetrievalConfig` inside `https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/ToolConfig` or `https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/TemplateToolConfig` to provide optional
  location coordinates and language preferences to bias and localize search results.

  #### Declaration

  Swift

      public struct RetrievalConfig : Sendable, Encodable

- `


  ### [CountTokensResponse](https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/CountTokensResponse)


  ` The model's response to a count tokens request.

  #### Declaration

  Swift

      public struct CountTokensResponse : Sendable

      extension CountTokensResponse: Decodable

- `


  ### [TemplateTool](https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/TemplateTool)


  ` **\[Public Preview\]** A tool that a model may use when generating responses with server prompt
  templates.
  Warning

  This API is a public preview and may be subject to change.

  In Server Prompt Templates, tools available to the model must be listed in the `tools` object of
  the template's frontmatter. Server-side tools like Grounding with Google Search
  (`googleSearch`), Python code execution (`codeExecution`), and URL context (`urlContext`) are
  configured directly in the template and do not require client-side tool objects.

  `TemplateTool` is used to configure client-involved tools:
  - `functionDeclarations(_:)`: Provides client-side schemas or declarations for functions listed in the template.
  - `googleMaps()`: Configures Grounding with Google Maps.

  For more details, see
  [Tool use in server prompt templates](https://firebase.google.com/docs/ai-logic/server-prompt-templates/syntax-and-examples#tools)
  and [Function calling with server prompt templates](https://firebase.google.com/docs/ai-logic/server-prompt-templates/multi-turn-interactions#function-calling).

  #### Declaration

  Swift

      public struct TemplateTool : Sendable

- `


  ### [Backend](https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/Backend)


  ` Represents available backend APIs for the Firebase AI SDK.

  #### Declaration

  Swift

      public struct Backend

- `


  ### [ImageConfig](https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/ImageConfig)


  ` Configuration options for generating images with Gemini models.

  See the [documentation](https://ai.google.dev/gemini-api/docs/image-generation#aspect_ratios_and_image_size)
  to learn about parameters available for use with Gemini image models.

  #### Declaration

  Swift

      public struct ImageConfig : Sendable, Equatable

      extension ImageConfig: Encodable

- `


  ### [ActivityDetectionConfig](https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/ActivityDetectionConfig)


  ` Configures the model's automatic detection of user activity.

  **Public Preview**: This API is a public preview and may be subject to change.
  Seealso
  `https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/RealtimeInputConfig`

  #### Declaration

  Swift

      public struct ActivityDetectionConfig : Sendable

- `


  ### [AudioTranscriptionConfig](https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/AudioTranscriptionConfig)


  ` Configuration options for audio transcriptions when communicating with a model that supports the
  Gemini Live API.

  While there are not currently any options, this will likely change in the future. For now, just
  providing an instance of this struct will enable audio transcriptions for the corresponding
  input or output fields.

  #### Declaration

  Swift

      @available(watchOS, unavailable)
      public struct AudioTranscriptionConfig : Sendable

- `


  ### [SlidingWindow](https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/SlidingWindow)


  ` Configures the sliding window context compression mechanism.

  The SlidingWindow method operates by discarding content at the beginning of the context window.
  The resulting context will always begin at the start of a USER role turn. System instructions
  will always remain at the start of the result.

  #### Declaration

  Swift

      @available(watchOS, unavailable)
      public struct SlidingWindow : Sendable

- `


  ### [ContextWindowCompressionConfig](https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/ContextWindowCompressionConfig)


  ` Enables context window compression to manage the model's context window.

  This mechanism prevents the context from exceeding a given length.

  #### Declaration

  Swift

      @available(watchOS, unavailable)
      public struct ContextWindowCompressionConfig : Sendable

- `


  ### [LiveAudioTranscription](https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/LiveAudioTranscription)


  ` Text transcription of some audio form during a live interaction with the model.

  #### Declaration

  Swift

      @available(watchOS, unavailable)
      public struct LiveAudioTranscription : Sendable

- `


  ### [LiveGenerationConfig](https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/LiveGenerationConfig)


  ` Configuration options for live content generation.

  #### Declaration

  Swift

      @available(watchOS, unavailable)
      public struct LiveGenerationConfig : Sendable

- `


  ### [LiveServerContent](https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/LiveServerContent)


  ` Incremental server update generated by the model in response to client
  messages.

  Content is generated as quickly as possible, and not in realtime. Clients
  may choose to buffer and play it out in realtime.

  #### Declaration

  Swift

      @available(watchOS, unavailable)
      public struct LiveServerContent : Sendable

- `


  ### [LiveServerGoingAwayNotice](https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/LiveServerGoingAwayNotice)


  ` Server will not be able to service client soon.

  To learn more about session limits, see the
  [sessions](https://firebase.google.com/docs/ai-logic/live-api/sessions) documentation.

  #### Declaration

  Swift

      @available(watchOS, unavailable)
      public struct LiveServerGoingAwayNotice : Sendable

- `


  ### [LiveServerMessage](https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/LiveServerMessage)


  ` Update from the server, generated from the model in response to client messages.

  #### Declaration

  Swift

      @available(watchOS, unavailable)
      public struct LiveServerMessage : Sendable

- `


  ### [LiveServerToolCall](https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/LiveServerToolCall)


  ` Request for the client to execute the provided `functionCalls`.

  The client should return matching `https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/FunctionResponsePart`, where the
  `https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/FunctionResponsePart#/s:15FirebaseAILogic20FunctionResponsePartV10functionIdSSSgvp` fields correspond to individual `https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/FunctionCallPart`s.

  #### Declaration

  Swift

      @available(watchOS, unavailable)
      public struct LiveServerToolCall : Sendable

- `


  ### [LiveServerToolCallCancellation](https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/LiveServerToolCallCancellation)


  ` Notification for the client to cancel a previous function call from `https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/LiveServerToolCall`.

  The client does not need to send `https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/FunctionResponsePart`s for the cancelled
  `https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/FunctionCallPart`s.

  #### Declaration

  Swift

      @available(watchOS, unavailable)
      public struct LiveServerToolCallCancellation : Sendable

- `


  ### [VoiceActivityType](https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/VoiceActivityType)


  ` Represents the type of server-detected voice activity signal.
  Seealso
  `https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/LiveServerVoiceActivity`

  #### Declaration

  Swift

      @available(watchOS, unavailable)
      public struct VoiceActivityType : DecodableProtoEnum, Hashable, Sendable

- `


  ### [LiveServerVoiceActivity](https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/LiveServerVoiceActivity)


  ` Server notification indicating voice activity was detected in the input audio stream.

  Voice activity is detected by the server's automatic activity detection (enabled by default,
  see `https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/ActivityDetectionConfig`) when the user starts or stops speaking, and is delivered
  through `https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/LiveServerContent#/s:15FirebaseAILogic17LiveServerContentV13voiceActivityAA0cd5VoiceG0VSgvp`. For example, it can be used to drive a voice
  activity indicator, or to handle the user interrupting the model (barge-in) on the client.

  #### Declaration

  Swift

      @available(watchOS, unavailable)
      public struct LiveServerVoiceActivity : Sendable

- `


  ### [LiveSessionUnsupportedMessageError](https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/LiveSessionUnsupportedMessageError)


  ` The model sent a message that the SDK failed to parse.

  This may indicate that the SDK version needs updating, a model is too old for the current SDK
  version, or that the model is just
  not supported.

  Check the `NSUnderlyingErrorKey` entry in `https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/LiveSessionUnsupportedMessageError#/s:10Foundation13CustomNSErrorP13errorUserInfoSDySSypGvp`
  for the error that caused this.

  #### Declaration

  Swift

      @available(watchOS, unavailable)
      public struct LiveSessionUnsupportedMessageError : Error, Sendable, CustomNSError

- `


  ### [LiveSessionLostConnectionError](https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/LiveSessionLostConnectionError)


  ` The live session was closed, because the network connection was lost.

  Check the `NSUnderlyingErrorKey` entry in `https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/LiveSessionLostConnectionError#/s:10Foundation13CustomNSErrorP13errorUserInfoSDySSypGvp` for
  the error that caused this.

  #### Declaration

  Swift

      @available(watchOS, unavailable)
      public struct LiveSessionLostConnectionError : Error, Sendable, CustomNSError

- `


  ### [LiveSessionUnexpectedClosureError](https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/LiveSessionUnexpectedClosureError)


  ` The live session was closed, but not for a reason the SDK expected.

  Check the `NSUnderlyingErrorKey` entry in `https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/LiveSessionUnexpectedClosureError#/s:10Foundation13CustomNSErrorP13errorUserInfoSDySSypGvp`
  for the error that caused this.

  #### Declaration

  Swift

      @available(watchOS, unavailable)
      public struct LiveSessionUnexpectedClosureError : Error, Sendable, CustomNSError

- `


  ### [LiveSessionSetupError](https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/LiveSessionSetupError)


  ` The model refused our request to setup a live session.

  This can occur due to the model not supporting the requested response modalities, the project
  not having access to the model, the model being invalid, or some internal error.

  Check the `NSUnderlyingErrorKey` entry in `https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/LiveSessionSetupError#/s:10Foundation13CustomNSErrorP13errorUserInfoSDySSypGvp` for the error
  that caused this.

  #### Declaration

  Swift

      @available(watchOS, unavailable)
      public struct LiveSessionSetupError : Error, Sendable, CustomNSError

- `


  ### [LiveSessionResumptionUpdate](https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/LiveSessionResumptionUpdate)


  ` An update of the session resumption state.

  This message is only sent if `https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/SessionResumptionConfig` was set in the
  session setup.

  #### Declaration

  Swift

      @available(watchOS, unavailable)
      public struct LiveSessionResumptionUpdate : Sendable

- `


  ### [RealtimeInputConfig](https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/RealtimeInputConfig)


  ` Configures model input behavior when generating content in the Live API via the realtime
  supported methods

  **Public Preview**: This API is a public preview and may be subject to change.

  #### Declaration

  Swift

      public struct RealtimeInputConfig : Sendable

- `


  ### [SessionResumptionConfig](https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/SessionResumptionConfig)


  ` Configuration for the session resumption mechanism.

  When included in the session setup, the server will send
  `https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/LiveSessionResumptionUpdate` messages in the response stream.

  #### Declaration

  Swift

      @available(watchOS, unavailable)
      public struct SessionResumptionConfig : Sendable

- `


  ### [MultiSpeakerVoiceConfig](https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/MultiSpeakerVoiceConfig)


  ` **\[Public Preview\]** Configuration for a multi-speaker audio generation setup.
  Warning

  This API is a public preview and may be subject to change.

  Enables the model to generate audio containing multiple distinct speakers, alternating voices
  dynamically based on the `speaker` specified in each turn's `https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/SpeechMetadata`.

  > [!CAUTION]
  > Important
  >
  > When using a multi-speaker configuration, every `https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/TextPart` in the request prompt
  > must include `https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/SpeechMetadata` with a `speaker` matching one of the configured speakers.
  > Omitting `speaker` in a multi-speaker request causes the request to fail.
  >
  > Warning: Multi-speaker configurations are not currently supported by the Live API, such as
  > `https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/LiveGenerationConfig`.

  For more details, see the
  [multi-speaker guide](https://firebase.google.com/docs/ai-logic/generate-speech#multi-speaker).

  #### Declaration

  Swift

      public struct MultiSpeakerVoiceConfig : Sendable

- `


  ### [TextPart](https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/TextPart)


  ` A text part containing a string value.

  #### Declaration

  Swift

      public struct TextPart : https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Protocols/Part

- `


  ### [InlineDataPart](https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/InlineDataPart)


  ` A data part that is provided inline in requests.

  Data provided as an inline data part is encoded as base64 and included directly (inline) in the
  request. For large files, see `https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/FileDataPart` which references content by URI instead of
  including the data in the request.

  > [!CAUTION]
  > Important
  >
  > Only small files can be sent as inline data because of limits on total request
  > sizes;
  > see [input files and requirements](https://firebase.google.com/docs/ai-logic/input-file-requirements#provide-file-as-inline-data)
  > for more details and size limits.

  #### Declaration

  Swift

      public struct InlineDataPart : https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Protocols/Part

- `


  ### [FileDataPart](https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/FileDataPart)


  ` File data stored in Cloud Storage for Firebase, referenced by URI.

  #### Declaration

  Swift

      public struct FileDataPart : https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Protocols/Part

- `


  ### [FunctionCallPart](https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/FunctionCallPart)


  ` A predicted function call returned from the model.

  #### Declaration

  Swift

      public struct FunctionCallPart : https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Protocols/Part

- `


  ### [FunctionResponsePart](https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/FunctionResponsePart)


  ` Result output from a function call.

  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 a `https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/FunctionCallPart` made based on model prediction.

  #### Declaration

  Swift

      public struct FunctionResponsePart : https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Protocols/Part

- `


  ### [ExecutableCodePart](https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/ExecutableCodePart)


  ` A part containing code that was executed by the model.

  #### Declaration

  Swift

      public struct ExecutableCodePart : https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Protocols/Part

- `


  ### [CodeExecutionResultPart](https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/CodeExecutionResultPart)


  ` The result of executing code.

  #### Declaration

  Swift

      public struct CodeExecutionResultPart : https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Protocols/Part

- `


  ### [ResponseModality](https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/ResponseModality)


  ` Represents the different types, or modalities, of data that a model can produce as output.

  To configure the desired output modalities for model requests, set the `responseModalities`
  parameter when initializing a `https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/GenerationConfig`. See the [configure model parameters
  documentation](https://firebase.google.com/docs/ai-logic/model-parameters#parameters-descriptions-gemini)
  for more details.

  > [!CAUTION]
  > Important
  >
  > Support for each response modality, or combination of modalities, depends on the
  > model.

  #### Declaration

  Swift

      public struct ResponseModality : EncodableProtoEnum, Sendable, Equatable

- `


  ### [SpeakerVoiceConfig](https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/SpeakerVoiceConfig)


  ` **\[Public Preview\]** Configuration pairing a speaker name or identifier with a preset voice.
  Warning

  This API is a public preview and may be subject to change.

  This configuration pairs a speaker name (such as `"Alice"` or `"Joe"`) with a preset voice name.
  The `speaker` name defined here must match the `speaker` string specified in `https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/SpeechMetadata`
  on each dialogue turn's `https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/TextPart` in a multi-speaker request.

  #### Declaration

  Swift

      public struct SpeakerVoiceConfig : Sendable

- `


  ### [SpeechConfig](https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/SpeechConfig)


  ` **\[Public Preview\]** Configuration for model speech and audio generation behaviors.
  Warning

  This API is a public preview and may be subject to change.

  Configures voice properties (single-speaker or multi-speaker setup) and language preferences
  when requesting the model to generate spoken responses.

  For turn-level speech delivery control (such as emotion, pacing, and whispering), attach
  `https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/SpeechMetadata` to individual `https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/TextPart` instances in your request prompt.

  For more details on speech generation, see the
  [Text-to-speech guide](https://firebase.google.com/docs/ai-logic/generate-speech).

  #### Declaration

  Swift

      public struct SpeechConfig : Sendable

- `


  ### [SpeechMetadata](https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/SpeechMetadata)


  ` **\[Public Preview\]** Turn-level speech synthesis metadata for text content in a model request.
  Warning

  This API is a public preview and may be subject to change.

  When generating audio, Gemini text-to-speech (TTS) models treat the input text in a
  `https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/TextPart` strictly as a verbatim transcript. `SpeechMetadata` attaches structured
  turn-level instructions to control speaker assignment and speech delivery.

  For more details on speech generation, see the
  [Text-to-speech guide](https://firebase.google.com/docs/ai-logic/generate-speech).

  #### Declaration

  Swift

      public struct SpeechMetadata : Sendable, Equatable, Hashable

      extension SpeechMetadata: Codable

- `


  ### [ThinkingConfig](https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/ThinkingConfig)


  ` Configuration for controlling the "thinking" behavior of compatible Gemini models.

  Gemini 2.5 series models and newer utilize a thinking process before generating a response. This
  allows them to reason through complex problems and plan a more coherent and accurate answer.
  See the [thinking documentation](https://firebase.google.com/docs/ai-logic/thinking) for more
  details.

  #### Declaration

  Swift

      public struct ThinkingConfig : Sendable, Equatable

      extension ThinkingConfig: Encodable

- `


  ### [CodeExecution](https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs#/s:15FirebaseAILogic13CodeExecutionV)


  ` A tool that allows the model to execute code.

  This tool can be used to solve complex problems, for example, by generating and executing Python
  code to solve a math problem.

  #### Declaration

  Swift

      public struct CodeExecution : Sendable, Encodable

- `


  ### [GoogleMaps](https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs#/s:15FirebaseAILogic10GoogleMapsV)


  ` A tool that allows the model to ground its responses in data from Google Maps.

  > [!CAUTION]
  > Important
  >
  > When using this feature, you are required to comply with the
  > "Grounding with Google Maps" usage requirements for your chosen API provider.

  #### Declaration

  Swift

      public struct GoogleMaps : Sendable, Encodable

- `


  ### [GoogleMapsGroundingChunk](https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/GoogleMapsGroundingChunk)


  ` A grounding chunk sourced from Google Maps.

  #### Declaration

  Swift

      public struct GoogleMapsGroundingChunk : Sendable, Equatable, Hashable, Decodable

- `


  ### [TemplateToolConfig](https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/TemplateToolConfig)


  ` **\[Public Preview\]** Tool configuration options for tools used with server prompt templates.
  Warning

  This API is a public preview and may be subject to change.

  In Server Prompt Templates, `TemplateToolConfig` allows the client application to supply
  runtime configuration parameters for tools declared in the template's frontmatter.

  For more details, see
  [Grounding with Google Maps in server prompt templates](https://firebase.google.com/docs/ai-logic/server-prompt-templates/syntax-and-examples#grounding-with-google-maps).

  #### Declaration

  Swift

      public struct TemplateToolConfig : Sendable, Encodable

- `


  ### [URLContextMetadata](https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/URLContextMetadata)


  ` Metadata related to the `https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Classes/GenerativeModel/Tool#/s:15FirebaseAILogic15GenerativeModelC4ToolV10urlContextAEyFZ` tool.

  #### Declaration

  Swift

      public struct URLContextMetadata : Sendable, Hashable

      extension URLContextMetadata: Decodable

- `


  ### [URLMetadata](https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Structs/URLMetadata)


  ` Metadata for a single URL retrieved by the `https://firebase.google.com/docs/reference/swift/firebaseailogic/api/reference/Classes/GenerativeModel/Tool#/s:15FirebaseAILogic15GenerativeModelC4ToolV10urlContextAEyFZ` tool.

  #### Declaration

  Swift

      public struct URLMetadata : Sendable, Hashable

      extension URLMetadata: Decodable