Skip to content

Commit b239f04

Browse files
committed
feat(google): add gemini 3 flash + tool calling
1 parent cd396a8 commit b239f04

File tree

5 files changed

+276
-34
lines changed

5 files changed

+276
-34
lines changed

Sources/Tachikoma/Models/Model.swift

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,11 +238,24 @@ public enum LanguageModel: Sendable, CustomStringConvertible, Hashable {
238238
}
239239

240240
public enum Google: String, Sendable, Hashable, CaseIterable {
241-
case gemini3Flash = "gemini-3-flash"
241+
// NOTE: As of 2025-12-17, ListModels exposes Gemini 3 Flash as `gemini-3-flash-preview` on v1beta.
242+
// We keep the user-facing identifier as `gemini-3-flash` and map it to the preview model id for API calls.
243+
case gemini3Flash = "gemini-3-flash-preview"
242244
case gemini25Pro = "gemini-2.5-pro"
243245
case gemini25Flash = "gemini-2.5-flash"
244246
case gemini25FlashLite = "gemini-2.5-flash-lite"
245247

248+
public var apiModelId: String { self.rawValue }
249+
250+
public var userFacingModelId: String {
251+
switch self {
252+
case .gemini3Flash:
253+
"gemini-3-flash"
254+
default:
255+
self.rawValue
256+
}
257+
}
258+
246259
public var supportsVision: Bool { true }
247260
public var supportsTools: Bool { true }
248261

@@ -659,7 +672,7 @@ public enum LanguageModel: Sendable, CustomStringConvertible, Hashable {
659672
case let .anthropic(model):
660673
return "Anthropic/\(model.modelId)"
661674
case let .google(model):
662-
return "Google/\(model.rawValue)"
675+
return "Google/\(model.userFacingModelId)"
663676
case let .mistral(model):
664677
return "Mistral/\(model.rawValue)"
665678
case let .groq(model):
@@ -696,7 +709,7 @@ public enum LanguageModel: Sendable, CustomStringConvertible, Hashable {
696709
case let .anthropic(model):
697710
model.modelId
698711
case let .google(model):
699-
model.rawValue
712+
model.userFacingModelId
700713
case let .mistral(model):
701714
model.rawValue
702715
case let .groq(model):

Sources/Tachikoma/Models/ModelSelection.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ public struct ModelSelector {
152152

153153
private static func parseGoogleModel(_ input: String) -> Model.Google? {
154154
switch input {
155-
case "gemini-3-flash", "gemini3flash", "gemini-3flash":
155+
case "gemini-3-flash", "gemini-3-flash-preview", "gemini3flash", "gemini-3flash":
156156
.gemini3Flash
157157
case "gemini-2.5-pro", "gemini25pro", "gemini2.5pro":
158158
.gemini25Pro
@@ -292,7 +292,7 @@ public struct ModelSelector {
292292
return $0.modelId
293293
}
294294
case "google", "gemini":
295-
return Model.Google.allCases.map(\.rawValue)
295+
return Model.Google.allCases.map(\.userFacingModelId)
296296
case "ollama":
297297
return Model.Ollama.allCases.compactMap {
298298
if case .custom = $0 { return nil }

0 commit comments

Comments
 (0)