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

Method for_model

crates/opencode-session/src/system.rs:52–72  ·  view source on GitHub ↗

Select the appropriate system prompt based on model API ID. TS: `SystemPrompt.provider(model)` in session/system.ts Matching rules (in priority order): - gpt-5 → PROMPT_CODEX - gpt-* / o1 / o3 → PROMPT_BEAST - gemini-* → PROMPT_GEMINI - claude* → PROMPT_ANTHROPIC - trinity → PROMPT_TRINITY - fallback → PROMPT_QWEN (anthropic without todo)

(model_api_id: &str)

Source from the content-addressed store, hash-verified

50 /// - trinity → PROMPT_TRINITY
51 /// - fallback → PROMPT_QWEN (anthropic without todo)
52 pub fn for_model(model_api_id: &str) -> &'static str {
53 let id = model_api_id.to_lowercase();
54
55 if id.contains("gpt-5") {
56 return PROMPT_CODEX;
57 }
58 if id.contains("gpt-") || id.contains("o1") || id.contains("o3") {
59 return PROMPT_BEAST;
60 }
61 if id.contains("gemini-") {
62 return PROMPT_GEMINI;
63 }
64 if id.contains("claude") {
65 return PROMPT_ANTHROPIC;
66 }
67 if id.contains("trinity") {
68 return PROMPT_TRINITY;
69 }
70 // Default fallback — same as TS (qwen.txt = anthropic without todo)
71 PROMPT_QWEN
72 }
73
74 /// Build the environment context block.
75 /// TS: `SystemPrompt.environment(model)` in session/system.ts

Callers

nothing calls this directly

Calls 1

containsMethod · 0.80

Tested by

no test coverage detected