diff --git a/Examples/GenerativeAICLI/Sources/GenerateContent.swift b/Examples/GenerativeAICLI/Sources/GenerateContent.swift index 669dfe4..e9c285d 100644 --- a/Examples/GenerativeAICLI/Sources/GenerateContent.swift +++ b/Examples/GenerativeAICLI/Sources/GenerateContent.swift @@ -102,7 +102,7 @@ struct GenerateContent: AsyncParsableCommand { if let modelName { return modelName } else { - return "gemini-1.5-flash-latest" + return "gemini-1.5-flash" } } } diff --git a/Examples/GenerativeAISample/ChatSample/ViewModels/ConversationViewModel.swift b/Examples/GenerativeAISample/ChatSample/ViewModels/ConversationViewModel.swift index 9508c3f..82dcb2e 100644 --- a/Examples/GenerativeAISample/ChatSample/ViewModels/ConversationViewModel.swift +++ b/Examples/GenerativeAISample/ChatSample/ViewModels/ConversationViewModel.swift @@ -36,7 +36,7 @@ class ConversationViewModel: ObservableObject { private var chatTask: Task? init() { - model = GenerativeModel(name: "gemini-1.5-flash-latest", apiKey: APIKey.default) + model = GenerativeModel(name: "gemini-1.5-flash", apiKey: APIKey.default) chat = model.startChat() } diff --git a/Examples/GenerativeAISample/FunctionCallingSample/ViewModels/FunctionCallingViewModel.swift b/Examples/GenerativeAISample/FunctionCallingSample/ViewModels/FunctionCallingViewModel.swift index 7ebb821..220d5fe 100644 --- a/Examples/GenerativeAISample/FunctionCallingSample/ViewModels/FunctionCallingViewModel.swift +++ b/Examples/GenerativeAISample/FunctionCallingSample/ViewModels/FunctionCallingViewModel.swift @@ -39,7 +39,7 @@ class FunctionCallingViewModel: ObservableObject { init() { model = GenerativeModel( - name: "gemini-1.5-flash-latest", + name: "gemini-1.5-flash", apiKey: APIKey.default, tools: [Tool(functionDeclarations: [ FunctionDeclaration( diff --git a/Examples/GenerativeAISample/GenerativeAIMultimodalSample/ViewModels/PhotoReasoningViewModel.swift b/Examples/GenerativeAISample/GenerativeAIMultimodalSample/ViewModels/PhotoReasoningViewModel.swift index 3e3fd19..39d3d5d 100644 --- a/Examples/GenerativeAISample/GenerativeAIMultimodalSample/ViewModels/PhotoReasoningViewModel.swift +++ b/Examples/GenerativeAISample/GenerativeAIMultimodalSample/ViewModels/PhotoReasoningViewModel.swift @@ -44,7 +44,7 @@ class PhotoReasoningViewModel: ObservableObject { private var model: GenerativeModel? init() { - model = GenerativeModel(name: "gemini-1.5-flash-latest", apiKey: APIKey.default) + model = GenerativeModel(name: "gemini-1.5-flash", apiKey: APIKey.default) } func reason() async { diff --git a/Examples/GenerativeAISample/GenerativeAITextSample/ViewModels/SummarizeViewModel.swift b/Examples/GenerativeAISample/GenerativeAITextSample/ViewModels/SummarizeViewModel.swift index 08aab40..3533dd8 100644 --- a/Examples/GenerativeAISample/GenerativeAITextSample/ViewModels/SummarizeViewModel.swift +++ b/Examples/GenerativeAISample/GenerativeAITextSample/ViewModels/SummarizeViewModel.swift @@ -32,7 +32,7 @@ class SummarizeViewModel: ObservableObject { private var model: GenerativeModel? init() { - model = GenerativeModel(name: "gemini-1.5-flash-latest", apiKey: APIKey.default) + model = GenerativeModel(name: "gemini-1.5-flash", apiKey: APIKey.default) } func summarize(inputText: String) async { diff --git a/README.md b/README.md index 7de87dd..900ed97 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ For example, with just a few lines of code, you can access Gemini's multimodal c generate text from text-and-image input: ```swift -let model = GenerativeModel(name: "gemini-1.5-flash-latest", apiKey: "YOUR_API_KEY") +let model = GenerativeModel(name: "gemini-1.5-flash", apiKey: "YOUR_API_KEY") let cookieImage = UIImage(...) let prompt = "Do these look store-bought or homemade?" diff --git a/Sources/GoogleAI/GenerativeModel.swift b/Sources/GoogleAI/GenerativeModel.swift index fc9c985..a1a021d 100644 --- a/Sources/GoogleAI/GenerativeModel.swift +++ b/Sources/GoogleAI/GenerativeModel.swift @@ -48,7 +48,7 @@ public final class GenerativeModel { /// Initializes a new remote model with the given parameters. /// /// - Parameters: - /// - name: The name of the model to use, for example `"gemini-1.5-pro-latest"`; see + /// - name: The name of the model to use, for example `"gemini-1.5-flash"`; see /// [Gemini models](https://ai.google.dev/models/gemini) for a list of supported model names. /// - apiKey: The API key for your project. /// - generationConfig: The content generation parameters your model should use. @@ -83,7 +83,7 @@ public final class GenerativeModel { /// Initializes a new remote model with the given parameters. /// /// - Parameters: - /// - name: The name of the model to use, e.g., `"gemini-1.5-pro-latest"`; see + /// - name: The name of the model to use, e.g., `"gemini-1.5-flash"`; see /// [Gemini models](https://ai.google.dev/models/gemini) for a list of supported model names. /// - apiKey: The API key for your project. /// - generationConfig: The content generation parameters your model should use. diff --git a/Tests/GoogleAITests/GoogleAITests.swift b/Tests/GoogleAITests/GoogleAITests.swift index 151e35d..e2e7203 100644 --- a/Tests/GoogleAITests/GoogleAITests.swift +++ b/Tests/GoogleAITests/GoogleAITests.swift @@ -34,37 +34,29 @@ final class GoogleGenerativeAITests: XCTestCase { let systemInstruction = ModelContent(role: "system", parts: [.text("Talk like a pirate.")]) // Permutations without optional arguments. - let _ = GenerativeModel(name: "gemini-1.5-pro-latest", apiKey: "API_KEY") + let _ = GenerativeModel(name: "gemini-1.5-flash", apiKey: "API_KEY") + let _ = GenerativeModel(name: "gemini-1.5-flash", apiKey: "API_KEY", safetySettings: filters) + let _ = GenerativeModel(name: "gemini-1.5-flash", apiKey: "API_KEY", generationConfig: config) let _ = GenerativeModel( - name: "gemini-1.5-pro-latest", - apiKey: "API_KEY", - safetySettings: filters - ) - let _ = GenerativeModel( - name: "gemini-1.5-pro-latest", - apiKey: "API_KEY", - generationConfig: config - ) - let _ = GenerativeModel( - name: "gemini-1.5-pro-latest", + name: "gemini-1.5-flash", apiKey: "API_KEY", systemInstruction: systemInstruction ) let _ = GenerativeModel( - name: "gemini-1.5-pro-latest", + name: "gemini-1.5-flash", apiKey: "API_KEY", systemInstruction: "Talk like a pirate." ) let _ = GenerativeModel( - name: "gemini-1.5-pro-latest", + name: "gemini-1.5-flash", apiKey: "API_KEY", systemInstruction: "Talk like a pirate.", "Your name is Francis Drake." ) // All arguments passed. - let genAI = GenerativeModel(name: "gemini-1.5-pro-latest", + let genAI = GenerativeModel(name: "gemini-1.5-flash", apiKey: "API_KEY", generationConfig: config, // Optional safetySettings: filters, // Optional