Skip to content

Commit edc9de3

Browse files
authored
Update models in samples and README to gemini-1.5-flash-latest (#173)
1 parent e8bbb72 commit edc9de3

File tree

6 files changed

+8
-26
lines changed

6 files changed

+8
-26
lines changed

Examples/GenerativeAICLI/Sources/GenerateContent.swift

+3-21
Original file line numberDiff line numberDiff line change
@@ -55,23 +55,7 @@ struct GenerateContent: AsyncParsableCommand {
5555

5656
mutating func run() async throws {
5757
do {
58-
let safetySettings = [SafetySetting(harmCategory: .dangerousContent, threshold: .blockNone)]
59-
// Let the server pick the default config.
60-
let config = GenerationConfig(
61-
temperature: 0.2,
62-
topP: 0.1,
63-
topK: 16,
64-
candidateCount: 1,
65-
maxOutputTokens: isStreaming ? nil : 256,
66-
stopSequences: nil
67-
)
68-
69-
let model = GenerativeModel(
70-
name: modelNameOrDefault(),
71-
apiKey: apiKey,
72-
generationConfig: config,
73-
safetySettings: safetySettings
74-
)
58+
let model = GenerativeModel(name: modelNameOrDefault(), apiKey: apiKey)
7559

7660
var parts = [ModelContent.Part]()
7761

@@ -115,12 +99,10 @@ struct GenerateContent: AsyncParsableCommand {
11599
}
116100

117101
func modelNameOrDefault() -> String {
118-
if let modelName = modelName {
102+
if let modelName {
119103
return modelName
120-
} else if imageURL != nil {
121-
return "gemini-1.0-pro-vision-latest"
122104
} else {
123-
return "gemini-1.0-pro"
105+
return "gemini-1.5-flash-latest"
124106
}
125107
}
126108
}

Examples/GenerativeAISample/ChatSample/ViewModels/ConversationViewModel.swift

+1-1
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.0-pro", apiKey: APIKey.default)
39+
model = GenerativeModel(name: "gemini-1.5-flash-latest", apiKey: APIKey.default)
4040
chat = model.startChat()
4141
}
4242

Examples/GenerativeAISample/FunctionCallingSample/ViewModels/FunctionCallingViewModel.swift

+1-1
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.0-pro",
42+
name: "gemini-1.5-flash-latest",
4343
apiKey: APIKey.default,
4444
tools: [Tool(functionDeclarations: [
4545
FunctionDeclaration(

Examples/GenerativeAISample/GenerativeAIMultimodalSample/ViewModels/PhotoReasoningViewModel.swift

+1-1
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.0-pro-vision-latest", apiKey: APIKey.default)
47+
model = GenerativeModel(name: "gemini-1.5-flash-latest", apiKey: APIKey.default)
4848
}
4949

5050
func reason() async {

Examples/GenerativeAISample/GenerativeAITextSample/ViewModels/SummarizeViewModel.swift

+1-1
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.0-pro", apiKey: APIKey.default)
35+
model = GenerativeModel(name: "gemini-1.5-flash-latest", apiKey: APIKey.default)
3636
}
3737

3838
func summarize(inputText: String) async {

README.md

+1-1
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-pro-latest", apiKey: "YOUR_API_KEY")
22+
let model = GenerativeModel(name: "gemini-1.5-flash-latest", apiKey: "YOUR_API_KEY")
2323
let cookieImage = UIImage(...)
2424
let prompt = "Do these look store-bought or homemade?"
2525

0 commit comments

Comments
 (0)