Skip to content

Commit

Permalink
Update model name strings in README, docs and samples (#109)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewheard authored Feb 15, 2024
1 parent dbc9cd5 commit e2cebcd
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions Examples/GenerativeAICLI/Sources/GenerateContent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@ struct GenerateContent: AsyncParsableCommand {
if let modelName = modelName {
return modelName
} else if imageURL != nil {
return "gemini-pro-vision"
return "gemini-1.0-pro-vision-latest"
} else {
return "gemini-pro"
return "gemini-1.0-pro"
}
}
}
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-pro", apiKey: APIKey.default)
model = GenerativeModel(name: "gemini-1.0-pro", apiKey: APIKey.default)
chat = model.startChat()
}

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-pro-vision", apiKey: APIKey.default)
model = GenerativeModel(name: "gemini-1.0-pro-vision-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-pro", apiKey: APIKey.default)
model = GenerativeModel(name: "gemini-1.0-pro", 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-pro-vision", apiKey: "YOUR_API_KEY")
let model = GenerativeModel(name: "gemini-1.0-pro-vision-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 @@ -42,7 +42,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-pro"`; see
/// - name: The name of the model to use, e.g., `"gemini-1.0-pro"`; 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
8 changes: 4 additions & 4 deletions Tests/GoogleAITests/GoogleAITests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ final class GoogleGenerativeAITests: XCTestCase {
let filters = [SafetySetting(harmCategory: .dangerousContent, threshold: .blockOnlyHigh)]

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

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

0 comments on commit e2cebcd

Please sign in to comment.