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.
This pull request refactors how runtime generation parameters (such as temperature, max_tokens, and tool_choice) are passed to and handled by LLM (Large Language Model) instances. The main improvement is to make the LLM instantiation more flexible by supporting arbitrary generation arguments via a unified mechanism, and to clarify the default tool usage behavior in HuggingFace and OpenAI LLMs. Additional tests are included to ensure the new instantiation logic works as expected.
LLM Instantiation and Generation Argument Handling:
LLM.instantiateindebug_gym/llms/base.pyto accept arbitrary runtime generation keyword arguments via**runtime_generate_kwargs, removing the explicittemperatureandmax_tokensparameters and allowing more flexible configuration. [1] [2]scripts/replay.pyandscripts/run.pyto passgenerate_kwargsfrom the config intoLLM.instantiateusing the newruntime_generate_kwargsmechanism. [1] [2]tests/llms/test_base.pyto cover the new instantiation logic, including passing both config and runtime generation kwargs.LLM Generation Behavior:
tool_choiceparameter inOpenAILLM.generateto"auto"and ensured it is passed through to the underlying API call, making tool usage more configurable. [1] [2]generatemethod inHuggingFaceLLMto defaulttool_choiceto"required"for tool usage, clarifying its intended behavior.Minor Cleanups:
debug_gym/agents/utils.pyand added a missing import indebug_gym/llms/huggingface.py. [1] [2]