Skip to content

Switch to gemini-1.5-pro-latest in docs and tests #138

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions Examples/GenerativeAICLI/Sources/GenerateContent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,8 @@ struct GenerateContent: AsyncParsableCommand {
func modelNameOrDefault() -> String {
if let modelName = modelName {
return modelName
} else if imageURL != nil {
return "gemini-1.0-pro-vision-latest"
} else {
return "gemini-1.0-pro"
return "gemini-1.5-pro-latest"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class ConversationViewModel: ObservableObject {
private var chatTask: Task<Void, Never>?

init() {
model = GenerativeModel(name: "gemini-1.0-pro", apiKey: APIKey.default)
model = GenerativeModel(name: "gemini-1.5-pro-latest", apiKey: APIKey.default)
chat = model.startChat()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class FunctionCallingViewModel: ObservableObject {

init() {
model = GenerativeModel(
name: "gemini-1.0-pro",
name: "gemini-1.5-pro-latest",
apiKey: APIKey.default,
tools: [Tool(functionDeclarations: [
FunctionDeclaration(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class PhotoReasoningViewModel: ObservableObject {
private var model: GenerativeModel?

init() {
model = GenerativeModel(name: "gemini-1.0-pro-vision-latest", apiKey: APIKey.default)
model = GenerativeModel(name: "gemini-1.5-pro-latest", apiKey: APIKey.default)
}

func reason() async {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class SummarizeViewModel: ObservableObject {
private var model: GenerativeModel?

init() {
model = GenerativeModel(name: "gemini-1.0-pro", apiKey: APIKey.default)
model = GenerativeModel(name: "gemini-1.5-pro-latest", apiKey: APIKey.default)
}

func summarize(inputText: String) async {
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,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.0-pro-vision-latest", apiKey: "YOUR_API_KEY")
let model = GenerativeModel(name: "gemini-1.5-pro-latest", apiKey: "YOUR_API_KEY")
let cookieImage = UIImage(...)
let prompt = "Do these look store-bought or homemade?"

Expand Down
2 changes: 1 addition & 1 deletion Sources/GoogleAI/GenerativeModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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, e.g., `"gemini-1.0-pro"`; see
/// - name: The name of the model to use, e.g., `"gemini-1.5-pro-latest"`; 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.
Expand Down
18 changes: 13 additions & 5 deletions Tests/GoogleAITests/GoogleAITests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,25 @@ final class GoogleGenerativeAITests: XCTestCase {
let systemInstruction = ModelContent(role: "system", parts: [.text("Talk like a pirate.")])

// Permutations without optional arguments.
let _ = GenerativeModel(name: "gemini-1.0-pro", apiKey: "API_KEY")
let _ = GenerativeModel(name: "gemini-1.0-pro", apiKey: "API_KEY", safetySettings: filters)
let _ = GenerativeModel(name: "gemini-1.0-pro", apiKey: "API_KEY", generationConfig: config)
let _ = GenerativeModel(name: "gemini-1.5-pro-latest", apiKey: "API_KEY")
let _ = GenerativeModel(
name: "gemini-1.0-pro",
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",
apiKey: "API_KEY",
systemInstruction: systemInstruction
)

// All arguments passed.
let genAI = GenerativeModel(name: "gemini-1.0-pro",
let genAI = GenerativeModel(name: "gemini-1.5-pro-latest",
apiKey: "API_KEY",
generationConfig: config, // Optional
safetySettings: filters, // Optional
Expand Down