Skip to content

Commit f2b9add

Browse files
Add Mistral Medium 3.5 model option and reasoning hint
1 parent f43520e commit f2b9add

4 files changed

Lines changed: 16 additions & 5 deletions

File tree

app/src/main/kotlin/com/google/ai/sample/GenerativeAiViewModelFactory.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ enum class ModelOption(
4444
CLOUDFLARE_KIMI_K2_6("Kimi K2.6 (Cloudflare)", "@cf/moonshotai/kimi-k2.6", ApiProvider.CLOUDFLARE, supportsScreenshot = true),
4545
MISTRAL_LARGE_3("Mistral Large 3", "mistral-large-latest", ApiProvider.MISTRAL),
4646
MISTRAL_MEDIUM_3_1("Mistral Medium 3.1", "mistral-medium-latest", ApiProvider.MISTRAL),
47+
MISTRAL_MEDIUM_3_5("Mistral Medium 3.5", "mistral-medium-3-5", ApiProvider.MISTRAL),
4748
GPT_5_1_CODEX_MAX("GPT-5.1 Codex Max (Vercel)", "openai/gpt-5.1-codex-max", ApiProvider.VERCEL),
4849
GPT_5_1_CODEX_MINI("GPT-5.1 Codex Mini (Vercel)", "openai/gpt-5.1-codex-mini", ApiProvider.VERCEL),
4950
GPT_5_NANO("GPT-5 Nano (Vercel)", "openai/gpt-5-nano", ApiProvider.VERCEL),

app/src/main/kotlin/com/google/ai/sample/MenuScreen.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,13 +215,15 @@ fun MenuScreen(
215215
}
216216
val normalModels = allModels.filter {
217217
it != ModelOption.MISTRAL_MEDIUM_3_1 &&
218+
it != ModelOption.MISTRAL_MEDIUM_3_5 &&
218219
it != ModelOption.PUTER_GPT_5_4_NANO &&
219220
it.apiProvider != ApiProvider.VERCEL &&
220221
!STRIKETHROUGH_MODELS.contains(it)
221222
}
222223
val orderedModels = listOf(
223224
ModelOption.PUTER_GPT_5_4_NANO,
224-
ModelOption.MISTRAL_MEDIUM_3_1
225+
ModelOption.MISTRAL_MEDIUM_3_1,
226+
ModelOption.MISTRAL_MEDIUM_3_5
225227
) +
226228
normalModels +
227229
vercelModels +
@@ -290,6 +292,8 @@ fun MenuScreen(
290292
val modelHint = when (selectedModel) {
291293
ModelOption.GEMMA_3_27B_IT -> "Google doesn't support screenshots in the API for this model."
292294
ModelOption.GPT_OSS_120B -> "This is a pure text model\nCerebras sometimes discontinues free access in the Free Tier, displaying an \"Error 404: gpt-oss-120b does not exist or you do not have access to it\" message, or changes the rate limits."
295+
ModelOption.MISTRAL_MEDIUM_3_1,
296+
ModelOption.MISTRAL_MEDIUM_3_5 -> "This is a reasoning model"
293297
ModelOption.MISTRAL_LARGE_3 -> "Mistral AI rejects requests containing non-black images with a 429 Error: Rate limit exceeded response"
294298
ModelOption.GEMINI_3_FLASH -> "Google often rejects requests to this model with a 503 Model is exhausted error"
295299
ModelOption.PUTER_GLM5 -> "This model is expensive and uses up the free quota quickly. Consider GPT-5.4 Nano."

app/src/main/kotlin/com/google/ai/sample/ScreenCaptureApiClients.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,14 @@ internal suspend fun callMistralApi(
134134
.build()
135135

136136
val keysForCoordinator = availableApiKeys.filter { it.isNotBlank() }.distinct().ifEmpty { listOf(apiKey) }
137-
val minIntervalMs = if (modelName == com.google.ai.sample.ModelOption.MISTRAL_MEDIUM_3_1.modelName) 420L else 1500L
137+
val minIntervalMs = if (
138+
modelName == com.google.ai.sample.ModelOption.MISTRAL_MEDIUM_3_1.modelName ||
139+
modelName == com.google.ai.sample.ModelOption.MISTRAL_MEDIUM_3_5.modelName
140+
) 420L else 1500L
138141
val maxAttempts = if (
139142
modelName == com.google.ai.sample.ModelOption.MISTRAL_LARGE_3.modelName ||
140-
modelName == com.google.ai.sample.ModelOption.MISTRAL_MEDIUM_3_1.modelName
143+
modelName == com.google.ai.sample.ModelOption.MISTRAL_MEDIUM_3_1.modelName ||
144+
modelName == com.google.ai.sample.ModelOption.MISTRAL_MEDIUM_3_5.modelName
141145
) {
142146
3
143147
} else {

app/src/main/kotlin/com/google/ai/sample/feature/multimodal/PhotoReasoningViewModel.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1377,12 +1377,14 @@ class PhotoReasoningViewModel(
13771377
// Validate that we have at least one key before proceeding
13781378
require(availableKeys.isNotEmpty()) { "No valid Mistral API keys available after filtering" }
13791379
val mistralMinIntervalMs = when (currentModel) {
1380-
ModelOption.MISTRAL_MEDIUM_3_1 -> 420L
1380+
ModelOption.MISTRAL_MEDIUM_3_1,
1381+
ModelOption.MISTRAL_MEDIUM_3_5 -> 420L
13811382
else -> 1500L
13821383
}
13831384
val maxAttempts = when (currentModel) {
13841385
ModelOption.MISTRAL_LARGE_3,
1385-
ModelOption.MISTRAL_MEDIUM_3_1 -> 3
1386+
ModelOption.MISTRAL_MEDIUM_3_1,
1387+
ModelOption.MISTRAL_MEDIUM_3_5 -> 3
13861388
else -> availableKeys.size * 4 + 8
13871389
}
13881390
val coordinated = MistralRequestCoordinator.execute(

0 commit comments

Comments
 (0)