feat: Add environment variables to override model context limits (#3260)

Co-authored-by: dianed-square <73617011+dianed-square@users.noreply.github.com>
Co-authored-by: Angie Jones <jones.angie@gmail.com>
This commit is contained in:
dcieslak19973
2025-07-07 17:27:23 -05:00
committed by GitHub
parent 79e7a82cde
commit a3601341ca
4 changed files with 206 additions and 8 deletions
+3 -2
View File
@@ -1303,7 +1303,7 @@ impl Session {
pub async fn display_context_usage(&self) -> Result<()> {
let provider = self.agent.provider().await?;
let model_config = provider.get_model_config();
let context_limit = model_config.context_limit.unwrap_or(32000);
let context_limit = model_config.context_limit();
match self.get_metadata() {
Ok(metadata) => {
@@ -1450,7 +1450,8 @@ fn get_reasoner() -> Result<Arc<dyn Provider>, anyhow::Error> {
.expect("No model configured. Run 'goose configure' first")
};
let model_config = ModelConfig::new(model);
let model_config =
ModelConfig::new_with_context_env(model, Some("GOOSE_PLANNER_CONTEXT_LIMIT"));
let reasoner = create(&provider, model_config)?;
Ok(reasoner)