File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed
crates/goose/src/providers Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -72,10 +72,19 @@ fn resolve_ollama_stream_usage() -> bool {
7272 let config = crate :: config:: Config :: global ( ) ;
7373 match config. get_param :: < bool > ( "OLLAMA_STREAM_USAGE" ) {
7474 Ok ( val) => val,
75- // Default to true: Ollama supports stream_options since mid-2025 and
76- // most installs will benefit from token usage tracking. Users on older
77- // Ollama builds that hang can set OLLAMA_STREAM_USAGE=false to opt out.
78- Err ( _) => true ,
75+ // Key not set: default to true. Ollama supports stream_options since
76+ // mid-2025 and most installs benefit from token usage tracking.
77+ Err ( crate :: config:: ConfigError :: NotFound ( _) ) => true ,
78+ // Invalid value (e.g. "0", "yes", typo): warn and disable stream_options
79+ // so users who intended to opt out aren't silently left hanging.
80+ Err ( e) => {
81+ tracing:: warn!(
82+ "Invalid OLLAMA_STREAM_USAGE value ({}); disabling stream_options. \
83+ Use true or false.",
84+ e
85+ ) ;
86+ false
87+ }
7988 }
8089}
8190
You can’t perform that action at this time.
0 commit comments