Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue #5609: Use litellm's modify_params with default True #5611

Merged
merged 10 commits into from
Dec 16, 2024
4 changes: 2 additions & 2 deletions docs/modules/usage/micro-agents.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Micro-agents are defined in markdown files under the `openhands/agenthub/codeact
## Available Micro-Agents

### GitHub Agent
**File**: `github.md`
**File**: `github.md`
**Triggers**: `github`, `git`

The GitHub agent specializes in GitHub API interactions and repository management. It:
Expand All @@ -30,7 +30,7 @@ Key features:
- API-first approach for GitHub operations

### NPM Agent
**File**: `npm.md`
**File**: `npm.md`
**Triggers**: `npm`

Specializes in handling npm package management with specific focus on:
Expand Down
2 changes: 1 addition & 1 deletion docs/modules/usage/prompting-best-practices.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ When working with a customized repository:

Example customized prompt:
```
Add a new task completion feature to src/components/TaskList.tsx following our existing component patterns.
Add a new task completion feature to src/components/TaskList.tsx following our existing component patterns.
Include unit tests in tests/components/ and update the documentation in docs/features/.
The component should use our shared styling from src/styles/components.
```
Expand Down
3 changes: 3 additions & 0 deletions evaluation/benchmarks/EDA/run_infer.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
AppConfig,
SandboxConfig,
get_llm_config_arg,
get_llm_config_for_eval,
get_parser,
)
from openhands.core.logger import openhands_logger as logger
Expand Down Expand Up @@ -202,6 +203,8 @@ def process_instance(
llm_config = None
if args.llm_config:
llm_config = get_llm_config_arg(args.llm_config)
if llm_config is not None:
llm_config = get_llm_config_for_eval(llm_config)
if llm_config is None:
raise ValueError(f'Could not find LLM config: --llm_config {args.llm_config}')

Expand Down
3 changes: 3 additions & 0 deletions evaluation/benchmarks/agent_bench/run_infer.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
AppConfig,
SandboxConfig,
get_llm_config_arg,
get_llm_config_for_eval,
parse_arguments,
)
from openhands.core.logger import openhands_logger as logger
Expand Down Expand Up @@ -307,6 +308,8 @@ def process_instance(
llm_config = None
if args.llm_config:
llm_config = get_llm_config_arg(args.llm_config)
if llm_config is not None:
llm_config = get_llm_config_for_eval(llm_config)

if llm_config is None:
raise ValueError(f'Could not find LLM config: --llm_config {args.llm_config}')
Expand Down
3 changes: 3 additions & 0 deletions evaluation/benchmarks/aider_bench/run_infer.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
AppConfig,
SandboxConfig,
get_llm_config_arg,
get_llm_config_for_eval,
load_from_toml,
parse_arguments,
)
Expand Down Expand Up @@ -279,6 +280,8 @@ def process_instance(
llm_config = None
if args.llm_config:
llm_config = get_llm_config_arg(args.llm_config)
if llm_config is not None:
llm_config = get_llm_config_for_eval(llm_config)

if llm_config is None:
raise ValueError(f'Could not find LLM config: --llm_config {args.llm_config}')
Expand Down
3 changes: 3 additions & 0 deletions evaluation/benchmarks/biocoder/run_infer.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
AppConfig,
SandboxConfig,
get_llm_config_arg,
get_llm_config_for_eval,
parse_arguments,
)
from openhands.core.logger import openhands_logger as logger
Expand Down Expand Up @@ -328,6 +329,8 @@ def process_instance(
llm_config = None
if args.llm_config:
llm_config = get_llm_config_arg(args.llm_config)
if llm_config is not None:
llm_config = get_llm_config_for_eval(llm_config)

if llm_config is None:
raise ValueError(f'Could not find LLM config: --llm_config {args.llm_config}')
Expand Down
3 changes: 3 additions & 0 deletions evaluation/benchmarks/bird/run_infer.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
AppConfig,
SandboxConfig,
get_llm_config_arg,
get_llm_config_for_eval,
parse_arguments,
)
from openhands.core.logger import openhands_logger as logger
Expand Down Expand Up @@ -456,6 +457,8 @@ def execute_sql(db_path, sql):
llm_config = None
if args.llm_config:
llm_config = get_llm_config_arg(args.llm_config)
if llm_config is not None:
llm_config = get_llm_config_for_eval(llm_config)
if llm_config is None:
raise ValueError(f'Could not find LLM config: --llm_config {args.llm_config}')

Expand Down
3 changes: 3 additions & 0 deletions evaluation/benchmarks/browsing_delegation/run_infer.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
AppConfig,
SandboxConfig,
get_llm_config_arg,
get_llm_config_for_eval,
parse_arguments,
)
from openhands.core.logger import openhands_logger as logger
Expand Down Expand Up @@ -142,6 +143,8 @@ def process_instance(
llm_config = None
if args.llm_config:
llm_config = get_llm_config_arg(args.llm_config)
if llm_config is not None:
llm_config = get_llm_config_for_eval(llm_config)

if llm_config is None:
raise ValueError(f'Could not find LLM config: --llm_config {args.llm_config}')
Expand Down
3 changes: 3 additions & 0 deletions evaluation/benchmarks/commit0_bench/run_infer.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
AppConfig,
SandboxConfig,
get_llm_config_arg,
get_llm_config_for_eval,
get_parser,
)
from openhands.core.logger import openhands_logger as logger
Expand Down Expand Up @@ -571,6 +572,8 @@ def commit0_setup(dataset: pd.DataFrame, repo_split: str) -> pd.DataFrame:
llm_config = None
if args.llm_config:
llm_config = get_llm_config_arg(args.llm_config)
if llm_config is not None:
llm_config = get_llm_config_for_eval(llm_config)
llm_config.log_completions = True

if llm_config is None:
Expand Down
3 changes: 3 additions & 0 deletions evaluation/benchmarks/discoverybench/run_infer.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
AppConfig,
SandboxConfig,
get_llm_config_arg,
get_llm_config_for_eval,
parse_arguments,
)
from openhands.core.logger import openhands_logger as logger
Expand Down Expand Up @@ -466,6 +467,8 @@ def create_dataset(repo_location: str, split: str = 'test'):
llm_config = None
if args.llm_config:
llm_config = get_llm_config_arg(args.llm_config)
if llm_config is not None:
llm_config = get_llm_config_for_eval(llm_config)
if llm_config is None:
raise ValueError(f'Could not find LLM config: --llm_config {args.llm_config}')

Expand Down
3 changes: 3 additions & 0 deletions evaluation/benchmarks/gaia/run_infer.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
AppConfig,
SandboxConfig,
get_llm_config_arg,
get_llm_config_for_eval,
get_parser,
)
from openhands.core.logger import openhands_logger as logger
Expand Down Expand Up @@ -238,6 +239,8 @@ def process_instance(
llm_config = None
if args.llm_config:
llm_config = get_llm_config_arg(args.llm_config)
if llm_config is not None:
llm_config = get_llm_config_for_eval(llm_config)
if llm_config is None:
raise ValueError(f'Could not find LLM config: --llm_config {args.llm_config}')

Expand Down
3 changes: 3 additions & 0 deletions evaluation/benchmarks/gorilla/run_infer.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
AppConfig,
SandboxConfig,
get_llm_config_arg,
get_llm_config_for_eval,
get_parser,
)
from openhands.core.logger import openhands_logger as logger
Expand Down Expand Up @@ -146,6 +147,8 @@ def process_instance(
llm_config = None
if args.llm_config:
llm_config = get_llm_config_arg(args.llm_config)
if llm_config is not None:
llm_config = get_llm_config_for_eval(llm_config)
if llm_config is None:
raise ValueError(f'Could not find LLM config: --llm_config {args.llm_config}')

Expand Down
3 changes: 3 additions & 0 deletions evaluation/benchmarks/gpqa/run_infer.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
AppConfig,
SandboxConfig,
get_llm_config_arg,
get_llm_config_for_eval,
get_parser,
)
from openhands.core.logger import openhands_logger as logger
Expand Down Expand Up @@ -326,6 +327,8 @@ def process_instance(
llm_config = None
if args.llm_config:
llm_config = get_llm_config_arg(args.llm_config)
if llm_config is not None:
llm_config = get_llm_config_for_eval(llm_config)
if llm_config is None:
raise ValueError(f'Could not find LLM config: --llm_config {args.llm_config}')

Expand Down
3 changes: 3 additions & 0 deletions evaluation/benchmarks/humanevalfix/run_infer.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
AppConfig,
SandboxConfig,
get_llm_config_arg,
get_llm_config_for_eval,
parse_arguments,
)
from openhands.core.logger import openhands_logger as logger
Expand Down Expand Up @@ -285,6 +286,8 @@ def process_instance(
llm_config = None
if args.llm_config:
llm_config = get_llm_config_arg(args.llm_config)
if llm_config is not None:
llm_config = get_llm_config_for_eval(llm_config)
if llm_config is None:
raise ValueError(f'Could not find LLM config: --llm_config {args.llm_config}')

Expand Down
3 changes: 3 additions & 0 deletions evaluation/benchmarks/logic_reasoning/run_infer.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
AppConfig,
SandboxConfig,
get_llm_config_arg,
get_llm_config_for_eval,
get_parser,
)
from openhands.core.logger import openhands_logger as logger
Expand Down Expand Up @@ -288,6 +289,8 @@ def process_instance(
llm_config = None
if args.llm_config:
llm_config = get_llm_config_arg(args.llm_config)
if llm_config is not None:
llm_config = get_llm_config_for_eval(llm_config)
if llm_config is None:
raise ValueError(f'Could not find LLM config: --llm_config {args.llm_config}')

Expand Down
3 changes: 3 additions & 0 deletions evaluation/benchmarks/miniwob/run_infer.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
AppConfig,
SandboxConfig,
get_llm_config_arg,
get_llm_config_for_eval,
parse_arguments,
)
from openhands.core.logger import openhands_logger as logger
Expand Down Expand Up @@ -231,6 +232,8 @@ def process_instance(
llm_config = None
if args.llm_config:
llm_config = get_llm_config_arg(args.llm_config)
if llm_config is not None:
llm_config = get_llm_config_for_eval(llm_config)
if llm_config is None:
raise ValueError(f'Could not find LLM config: --llm_config {args.llm_config}')

Expand Down
3 changes: 3 additions & 0 deletions evaluation/benchmarks/mint/run_infer.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
AppConfig,
SandboxConfig,
get_llm_config_arg,
get_llm_config_for_eval,
get_parser,
)
from openhands.core.logger import openhands_logger as logger
Expand Down Expand Up @@ -279,6 +280,8 @@ def process_instance(
llm_config = None
if args.llm_config:
llm_config = get_llm_config_arg(args.llm_config)
if llm_config is not None:
llm_config = get_llm_config_for_eval(llm_config)
if llm_config is None:
raise ValueError(f'Could not find LLM config: --llm_config {args.llm_config}')

Expand Down
3 changes: 3 additions & 0 deletions evaluation/benchmarks/ml_bench/run_infer.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
AppConfig,
SandboxConfig,
get_llm_config_arg,
get_llm_config_for_eval,
get_parser,
load_app_config,
)
Expand Down Expand Up @@ -292,6 +293,8 @@ def process_instance(instance: Any, metadata: EvalMetadata, reset_logger: bool =
llm_config = None
if args.llm_config:
llm_config = get_llm_config_arg(args.llm_config)
if llm_config is not None:
llm_config = get_llm_config_for_eval(llm_config)
if llm_config is None:
raise ValueError(f'Could not find LLM config: --llm_config {args.llm_config}')

Expand Down
3 changes: 3 additions & 0 deletions evaluation/benchmarks/scienceagentbench/run_infer.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
AppConfig,
SandboxConfig,
get_llm_config_arg,
get_llm_config_for_eval,
get_parser,
)
from openhands.core.logger import openhands_logger as logger
Expand Down Expand Up @@ -272,6 +273,8 @@ def process_instance(
llm_config = None
if args.llm_config:
llm_config = get_llm_config_arg(args.llm_config)
if llm_config is not None:
llm_config = get_llm_config_for_eval(llm_config)
if llm_config is None:
raise ValueError(f'Could not find LLM config: --llm_config {args.llm_config}')

Expand Down
6 changes: 4 additions & 2 deletions evaluation/benchmarks/swe_bench/run_infer.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from datasets import load_dataset

import openhands.agenthub

from evaluation.utils.shared import (
EvalException,
EvalMetadata,
Expand All @@ -28,6 +27,7 @@
AppConfig,
SandboxConfig,
get_llm_config_arg,
get_llm_config_for_eval,
get_parser,
)
from openhands.core.logger import openhands_logger as logger
Expand Down Expand Up @@ -76,7 +76,7 @@ def get_instruction(instance: pd.Series, metadata: EvalMetadata):
'4. Rerun your reproduce script and confirm that the error is fixed!\n'
'5. Think about edgecases and make sure your fix handles them as well\n'
"Your thinking should be thorough and so it's fine if it's very long.\n"
)
)

if RUN_WITH_BROWSING:
instruction += (
Expand Down Expand Up @@ -490,6 +490,8 @@ def filter_dataset(dataset: pd.DataFrame, filter_column: str) -> pd.DataFrame:
llm_config = None
if args.llm_config:
llm_config = get_llm_config_arg(args.llm_config)
if llm_config is not None:
llm_config = get_llm_config_for_eval(llm_config)
llm_config.log_completions = True

if llm_config is None:
Expand Down
3 changes: 3 additions & 0 deletions evaluation/benchmarks/toolqa/run_infer.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
AppConfig,
SandboxConfig,
get_llm_config_arg,
get_llm_config_for_eval,
get_parser,
)
from openhands.core.logger import openhands_logger as logger
Expand Down Expand Up @@ -181,6 +182,8 @@ def process_instance(instance: Any, metadata: EvalMetadata, reset_logger: bool =
llm_config = None
if args.llm_config:
llm_config = get_llm_config_arg(args.llm_config)
if llm_config is not None:
llm_config = get_llm_config_for_eval(llm_config)
if llm_config is None:
raise ValueError(f'Could not find LLM config: --llm_config {args.llm_config}')

Expand Down
3 changes: 3 additions & 0 deletions evaluation/benchmarks/webarena/run_infer.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
AppConfig,
SandboxConfig,
get_llm_config_arg,
get_llm_config_for_eval,
parse_arguments,
)
from openhands.core.logger import openhands_logger as logger
Expand Down Expand Up @@ -212,6 +213,8 @@ def process_instance(
llm_config = None
if args.llm_config:
llm_config = get_llm_config_arg(args.llm_config)
if llm_config is not None:
llm_config = get_llm_config_for_eval(llm_config)
if llm_config is None:
raise ValueError(f'Could not find LLM config: --llm_config {args.llm_config}')

Expand Down
4 changes: 3 additions & 1 deletion openhands/agenthub/codeact_agent/codeact_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,9 @@ def get_action_message(

# Add the LLM message (assistant) that initiated the tool calls
# (overwrites any previous message with the same response_id)
logger.debug(f'Tool calls type: {type(assistant_msg.tool_calls)}, value: {assistant_msg.tool_calls}')
logger.debug(
f'Tool calls type: {type(assistant_msg.tool_calls)}, value: {assistant_msg.tool_calls}'
)
pending_tool_call_action_messages[llm_response.id] = Message(
role=assistant_msg.role,
# tool call content SHOULD BE a string
Expand Down
Loading
Loading