Skip to content

Commit 1ab556a

Browse files
committed
Switch to latest stable Gemini 1.5 Flash model
1 parent 5478400 commit 1ab556a

File tree

8 files changed

+15
-23
lines changed

8 files changed

+15
-23
lines changed

Examples/GenerativeAICLI/Sources/GenerateContent.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ struct GenerateContent: AsyncParsableCommand {
102102
if let modelName {
103103
return modelName
104104
} else {
105-
return "gemini-1.5-flash-latest"
105+
return "gemini-1.5-flash"
106106
}
107107
}
108108
}

Examples/GenerativeAISample/ChatSample/ViewModels/ConversationViewModel.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class ConversationViewModel: ObservableObject {
3636
private var chatTask: Task<Void, Never>?
3737

3838
init() {
39-
model = GenerativeModel(name: "gemini-1.5-flash-latest", apiKey: APIKey.default)
39+
model = GenerativeModel(name: "gemini-1.5-flash", apiKey: APIKey.default)
4040
chat = model.startChat()
4141
}
4242

Examples/GenerativeAISample/FunctionCallingSample/ViewModels/FunctionCallingViewModel.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class FunctionCallingViewModel: ObservableObject {
3939

4040
init() {
4141
model = GenerativeModel(
42-
name: "gemini-1.5-flash-latest",
42+
name: "gemini-1.5-flash",
4343
apiKey: APIKey.default,
4444
tools: [Tool(functionDeclarations: [
4545
FunctionDeclaration(

Examples/GenerativeAISample/GenerativeAIMultimodalSample/ViewModels/PhotoReasoningViewModel.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class PhotoReasoningViewModel: ObservableObject {
4444
private var model: GenerativeModel?
4545

4646
init() {
47-
model = GenerativeModel(name: "gemini-1.5-flash-latest", apiKey: APIKey.default)
47+
model = GenerativeModel(name: "gemini-1.5-flash", apiKey: APIKey.default)
4848
}
4949

5050
func reason() async {

Examples/GenerativeAISample/GenerativeAITextSample/ViewModels/SummarizeViewModel.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class SummarizeViewModel: ObservableObject {
3232
private var model: GenerativeModel?
3333

3434
init() {
35-
model = GenerativeModel(name: "gemini-1.5-flash-latest", apiKey: APIKey.default)
35+
model = GenerativeModel(name: "gemini-1.5-flash", apiKey: APIKey.default)
3636
}
3737

3838
func summarize(inputText: String) async {

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ For example, with just a few lines of code, you can access Gemini's multimodal c
1919
generate text from text-and-image input:
2020

2121
```swift
22-
let model = GenerativeModel(name: "gemini-1.5-flash-latest", apiKey: "YOUR_API_KEY")
22+
let model = GenerativeModel(name: "gemini-1.5-flash", apiKey: "YOUR_API_KEY")
2323
let cookieImage = UIImage(...)
2424
let prompt = "Do these look store-bought or homemade?"
2525

Sources/GoogleAI/GenerativeModel.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public final class GenerativeModel {
4848
/// Initializes a new remote model with the given parameters.
4949
///
5050
/// - Parameters:
51-
/// - name: The name of the model to use, for example `"gemini-1.5-pro-latest"`; see
51+
/// - name: The name of the model to use, for example `"gemini-1.5-flash"`; see
5252
/// [Gemini models](https://ai.google.dev/models/gemini) for a list of supported model names.
5353
/// - apiKey: The API key for your project.
5454
/// - generationConfig: The content generation parameters your model should use.
@@ -83,7 +83,7 @@ public final class GenerativeModel {
8383
/// Initializes a new remote model with the given parameters.
8484
///
8585
/// - Parameters:
86-
/// - name: The name of the model to use, e.g., `"gemini-1.5-pro-latest"`; see
86+
/// - name: The name of the model to use, e.g., `"gemini-1.5-flash"`; see
8787
/// [Gemini models](https://ai.google.dev/models/gemini) for a list of supported model names.
8888
/// - apiKey: The API key for your project.
8989
/// - generationConfig: The content generation parameters your model should use.

Tests/GoogleAITests/GoogleAITests.swift

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -34,37 +34,29 @@ final class GoogleGenerativeAITests: XCTestCase {
3434
let systemInstruction = ModelContent(role: "system", parts: [.text("Talk like a pirate.")])
3535

3636
// Permutations without optional arguments.
37-
let _ = GenerativeModel(name: "gemini-1.5-pro-latest", apiKey: "API_KEY")
37+
let _ = GenerativeModel(name: "gemini-1.5-flash", apiKey: "API_KEY")
38+
let _ = GenerativeModel(name: "gemini-1.5-flash", apiKey: "API_KEY", safetySettings: filters)
39+
let _ = GenerativeModel(name: "gemini-1.5-flash", apiKey: "API_KEY", generationConfig: config)
3840
let _ = GenerativeModel(
39-
name: "gemini-1.5-pro-latest",
40-
apiKey: "API_KEY",
41-
safetySettings: filters
42-
)
43-
let _ = GenerativeModel(
44-
name: "gemini-1.5-pro-latest",
45-
apiKey: "API_KEY",
46-
generationConfig: config
47-
)
48-
let _ = GenerativeModel(
49-
name: "gemini-1.5-pro-latest",
41+
name: "gemini-1.5-flash",
5042
apiKey: "API_KEY",
5143
systemInstruction: systemInstruction
5244
)
5345

5446
let _ = GenerativeModel(
55-
name: "gemini-1.5-pro-latest",
47+
name: "gemini-1.5-flash",
5648
apiKey: "API_KEY",
5749
systemInstruction: "Talk like a pirate."
5850
)
5951

6052
let _ = GenerativeModel(
61-
name: "gemini-1.5-pro-latest",
53+
name: "gemini-1.5-flash",
6254
apiKey: "API_KEY",
6355
systemInstruction: "Talk like a pirate.", "Your name is Francis Drake."
6456
)
6557

6658
// All arguments passed.
67-
let genAI = GenerativeModel(name: "gemini-1.5-pro-latest",
59+
let genAI = GenerativeModel(name: "gemini-1.5-flash",
6860
apiKey: "API_KEY",
6961
generationConfig: config, // Optional
7062
safetySettings: filters, // Optional

0 commit comments

Comments
 (0)