fix(agent): include max_tokens in _resolve_runtime_agent_kwargs_for_provider return dict (#59763) - #59792
Open
webtecnica wants to merge 1 commit into
Open
Conversation
…rovider return dict (NousResearch#59763)
3 tasks
Contributor
|
Thanks for tracing the pinned-provider path. The reported channel-override defect is present on current main: Problems
Suggested changes
Automated hermes-sweeper review. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Descrição
_resolve_runtime_agent_kwargs_for_provider()não incluíamax_tokensem seu dict de retorno, fazendo com quemodel.max_tokensdoconfig.yaml,HERMES_MAX_TOKENSenv var, e per-providermax_output_tokensfossem ignorados em qualquer rota com provider fixo (channel overrides, etc.).A função irmã
_resolve_runtime_agent_kwargs()já implementava essa resolução corretamente —_resolve_runtime_agent_kwargs_for_provider()simplesmente não tinha o bloco equivalente.O que foi feito
Adicionada a mesma lógica de resolução de
max_tokensque existe em_resolve_runtime_agent_kwargs()para_resolve_runtime_agent_kwargs_for_provider():HERMES_MAX_TOKENSenv var — lida primeiro (priority mais alta)model.max_tokensdoconfig.yaml— via_get_model_config()max_output_tokens— fallback decustom_providersno runtime, apenas quando os anteriores não estão definidosmax_tokensincluído no dict retornadoArquivos alterados
gateway/run.py— +22 linhas em_resolve_runtime_agent_kwargs_for_provider()Contexto adicional
O issue também mencionava
_build_call_kwargs()emagent/auxiliary_client.pydropandomax_tokenspara OpenRouter no caminho auxiliar. Analisando o código, a omissão demax_tokensem_build_call_kwargspara providers não-Anthropic/NVIDIA é intencional (documentado no comentário das linhas 5870-5902) — omitir o parâmetro permite que a maioria dos providers use o limite máximo do modelo, que é o desejado para calls auxiliares (sumarização, títulos, etc.). Portanto o fix se concentra exclusivamente em_resolve_runtime_agent_kwargs_for_provider.Closes #59763