MCPcopy Create free account
hub / github.com/ChrisFeldmeier/OpenCodeRust / small_options

Function small_options

crates/opencode-provider/src/transform.rs:1321–1372  ·  view source on GitHub ↗

Generate small model options (reduced reasoning effort).

(model: &models::ModelInfo)

Source from the content-addressed store, hash-verified

1319
1320/// Generate small model options (reduced reasoning effort).
1321pub fn small_options(model: &models::ModelInfo) -> HashMap<String, serde_json::Value> {
1322 use serde_json::json;
1323 let mut result = HashMap::new();
1324
1325 let npm = model
1326 .provider
1327 .as_ref()
1328 .and_then(|p| p.npm.as_deref())
1329 .unwrap_or("");
1330 let api_id = model
1331 .provider
1332 .as_ref()
1333 .and_then(|p| p.api.as_deref())
1334 .unwrap_or("");
1335 let provider_id = model.id.to_lowercase();
1336
1337 if provider_id == "openai" || npm == "@ai-sdk/openai" || npm == "@ai-sdk/github-copilot" {
1338 result.insert("store".to_string(), json!(false));
1339 if api_id.contains("gpt-5") {
1340 if api_id.contains("5.") {
1341 result.insert("reasoningEffort".to_string(), json!("low"));
1342 } else {
1343 result.insert("reasoningEffort".to_string(), json!("minimal"));
1344 }
1345 }
1346 return result;
1347 }
1348
1349 if provider_id == "google" {
1350 // gemini-3 uses thinkingLevel, gemini-2.5 uses thinkingBudget
1351 if api_id.contains("gemini-3") {
1352 result.insert(
1353 "thinkingConfig".to_string(),
1354 json!({"thinkingLevel": "minimal"}),
1355 );
1356 } else {
1357 result.insert("thinkingConfig".to_string(), json!({"thinkingBudget": 0}));
1358 }
1359 return result;
1360 }
1361
1362 if provider_id == "openrouter" {
1363 if api_id.contains("google") {
1364 result.insert("reasoning".to_string(), json!({"enabled": false}));
1365 } else {
1366 result.insert("reasoningEffort".to_string(), json!("minimal"));
1367 }
1368 return result;
1369 }
1370
1371 result
1372}
1373
1374// ---------------------------------------------------------------------------
1375// schema (Gemini schema sanitization)

Callers

nothing calls this directly

Calls 2

newFunction · 0.85
containsMethod · 0.80

Tested by

no test coverage detected