Skip to content

Commit 0ca33d4

Browse files
committed
Add developer API integration testing and update docs
1 parent 12a7bef commit 0ca33d4

File tree

4 files changed

+45
-9
lines changed

4 files changed

+45
-9
lines changed

FirebaseVertexAI/CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
# Unreleased
2+
- [added] **Public Preview**: Added support for specifying response modalities
3+
in `GenerationConfig`. This includes **public experimental** support for image
4+
generation using Gemini 2.0 Flash (`gemini-2.0-flash-exp`). (#14658)
5+
<br /><br />
6+
Note: This feature is in Public Preview (and relies on experimental models),
7+
which means that it is not subject to any SLA or deprecation policy and could
8+
change in backwards-incompatible ways.
9+
110
# 11.11.0
211
- [added] Emits a warning when attempting to use an incompatible model with
312
`GenerativeModel` or `ImagenModel`. (#14610)

FirebaseVertexAI/Sources/GenerationConfig.swift

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,15 @@ public struct GenerationConfig: Sendable {
143143
/// [Generate structured
144144
/// output](https://firebase.google.com/docs/vertex-ai/structured-output?platform=ios) guide
145145
/// for more details.
146-
/// - responseModalities: Supported modalities of the response.
146+
/// - responseModalities: The data types (modalities) that may be returned in model responses.
147+
///
148+
/// See the [multimodal
149+
/// responses](https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal-response-generation)
150+
/// documentation for more details.
151+
///
152+
/// > Warning: Specifying response modalities is a **Public Preview** feature, which means
153+
/// > that it is not subject to any SLA or deprecation policy and could change in
154+
/// > backwards-incompatible ways.
147155
public init(temperature: Float? = nil, topP: Float? = nil, topK: Int? = nil,
148156
candidateCount: Int? = nil, maxOutputTokens: Int? = nil,
149157
presencePenalty: Float? = nil, frequencyPenalty: Float? = nil,

FirebaseVertexAI/Sources/Types/Public/ResponseModality.swift

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,39 @@
1414

1515
import Foundation
1616

17-
/// Represents the available response modalities.
17+
/// Represents the different types, or modalities, of data that a model can produce as output.
18+
///
19+
/// To configure the desired output modalities for model requests, set the `responseModalities`
20+
/// parameter when initializing a ``GenerationConfig``. See the [multimodal
21+
/// responses](https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal-response-generation)
22+
/// documentation for more details.
23+
///
24+
/// > Important: Support for each response modality, or combination of modalities, depends on the
25+
/// > model.
1826
@available(iOS 15.0, macOS 12.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *)
1927
public struct ResponseModality: EncodableProtoEnum, Sendable {
2028
enum Kind: String {
2129
case text = "TEXT"
2230
case image = "IMAGE"
23-
case audio = "AUDIO"
2431
}
2532

26-
/// Text response modality.
33+
/// Specifies that the model should generate textual content.
34+
///
35+
/// Use this modality when you need the model to produce written language, such as answers to
36+
/// questions, summaries, creative writing, code snippets, or structured data formats like JSON.
2737
public static let text = ResponseModality(kind: .text)
2838

29-
/// Image response modality.
39+
/// **Public Experimental**: Specifies that the model should generate image data.
40+
///
41+
/// Use this modality when you want the model to create visual content based on the provided input
42+
/// or prompts. The response might contain one or more generated images. See the [image
43+
/// generation](https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal-response-generation#image-generation)
44+
/// documentation for more details.
45+
///
46+
/// > Warning: Image generation using Gemini 2.0 Flash is a **Public Experimental** feature, which
47+
/// > means that it is not subject to any SLA or deprecation policy and could change in
48+
/// > backwards-incompatible ways.
3049
public static let image = ResponseModality(kind: .image)
3150

32-
/// Audio response modality.
33-
public static let audio = ResponseModality(kind: .audio)
34-
3551
let rawValue: String
3652
}

FirebaseVertexAI/Tests/TestApp/Tests/Integration/GenerateContentIntegrationTests.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,10 @@ struct GenerateContentIntegrationTests {
122122
#expect(candidatesTokensDetails.tokenCount == usageMetadata.candidatesTokenCount)
123123
}
124124

125-
@Test(arguments: [InstanceConfig.vertexV1Beta])
125+
@Test(arguments: [
126+
InstanceConfig.vertexV1Beta,
127+
InstanceConfig.developerV1Beta,
128+
])
126129
func generateImage(_ config: InstanceConfig) async throws {
127130
let generationConfig = GenerationConfig(
128131
temperature: 0.0,

0 commit comments

Comments
 (0)