MCPcopy Create free account
hub / github.com/diillson/chatcli / getMaxTokensForCurrentLLM

Method getMaxTokensForCurrentLLM

cli/cli_llm.go:613–619  ·  view source on GitHub ↗

getMaxTokensForCurrentLLM picks the per-turn `max_tokens` for the active LLM by walking the precedence chain: 1. session override set by `/switch --max-tokens` (cli.UserMaxTokens), 2. provider-specific env var (see providerMaxTokensEnv) — operational escape hatch when an operator needs to force a v

()

Source from the content-addressed store, hash-verified

611// Returns the catalog default whenever none of the override sources resolve
612// to a positive integer.
613func (cli *ChatCLI) getMaxTokensForCurrentLLM() int {
614 if cli.UserMaxTokens > 0 {
615 return cli.UserMaxTokens
616 }
617 override := providerMaxTokensOverride(cli.Provider)
618 return catalog.GetMaxTokens(cli.Provider, cli.Model, override)
619}
620
621// providerMaxTokensOverride reads the configured env var for the provider
622// and returns its positive-integer value, or 0 when the env is unset,

Callers 6

RunOnceMethod · 0.95
showConfigPanoramaMethod · 0.95
showConfigProvidersMethod · 0.95
processLLMRequestMethod · 0.95
processFileCommandMethod · 0.95
handleMetricsCommandMethod · 0.80

Calls 2

GetMaxTokensFunction · 0.92

Tested by

no test coverage detected