cleanup: remove model name string matching

model_context_window() now reads from config.api_context_window
instead of guessing from model name strings. is_anthropic_model()
replaced with backend == "anthropic" checks. Dead model field
removed from AgentDef/AgentHeader.

Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
Kent Overstreet 2026-04-02 14:09:54 -04:00
parent 47c6694b10
commit 078dcf22d0
5 changed files with 15 additions and 32 deletions

View file

@ -11,15 +11,8 @@ use chrono::{DateTime, Utc};
use tiktoken_rs::CoreBPE;
/// Look up a model's context window size in tokens.
pub fn model_context_window(model: &str) -> usize {
let m = model.to_lowercase();
if m.contains("opus") || m.contains("sonnet") {
200_000
} else if m.contains("qwen") {
131_072
} else {
128_000
}
pub fn model_context_window(_model: &str) -> usize {
crate::config::get().api_context_window
}
/// Context budget in tokens: 60% of the model's context window.