Skip to content

Conversation

@enyst
Copy link
Collaborator

@enyst enyst commented Oct 31, 2025

Summary

Add a unit test that validates all relevant LLM attributes are forwarded to LiteLLM when invoking completion(). The test patches openhands.sdk.llm.llm.litellm_completion and inspects the kwargs it receives.

What it tests

  • Transport-level options: model, api_key, base_url, api_version, timeout, drop_params, seed, custom_llm_provider
  • Sampling options (via select_chat_options): temperature, top_p, top_k, and normalization of max_output_tokens -> max_completion_tokens for non-Azure OpenAI-compatible requests

Expected outcome
This test is expected to fail on current main due to custom_llm_provider not being forwarded to LiteLLM (see discussion in PR #963). The failure is intentional to surface the gap.

Why this is useful
This ensures regression coverage so any attributes defined on LLM that should be visible to LiteLLM are actually passed through, not only the ones handled specially in select_chat_options().

Notes

  • The test uses a non-reasoning model (gpt-4o) to keep temperature/top_p/top_k in play
  • LiteLLM response is mocked via tests.conftest.create_mock_litellm_response

Co-authored-by: openhands [email protected]

@enyst can click here to continue refining the PR

…ssing custom_llm_provider)

Adds a unit test that patches litellm.completion and asserts both sampling options (temperature/top_p/top_k, max tokens) and transport-level options (base_url, api_version, timeout, drop_params, seed, custom_llm_provider) are forwarded from LLM to LiteLLM. The test currently fails on main due to custom_llm_provider not being passed through.

Co-authored-by: openhands <[email protected]>
@blacksmith-sh
Copy link
Contributor

blacksmith-sh bot commented Oct 31, 2025

Found 2 test failures on Blacksmith runners:

Test View Logs
test_llm_attr_forwarding/test_all_config_attrs_are_forwarded_to_litellm_completion View Logs
test_llm_responses_attr_forwarding/test_responses_api_forwards_all_relevant_attrs View Logs


Fix in Cursor

enyst and others added 3 commits October 31, 2025 18:20
…last

Adds tests/sdk/llm/test_llm_responses_attr_forwarding.py which patches litellm.responses and verifies forwarding of transport-level params and responses options. The check for custom_llm_provider (known missing) is placed at the end so earlier regressions are visible first.

Co-authored-by: openhands <[email protected]>
…est; make Responses API patch return minimal typed response

This reorders the known failing assertion in the chat-completions test and fixes the Responses test to return a minimal ResponsesAPIResponse so other kwargs assertions can execute.

Co-authored-by: openhands <[email protected]>
…ures; keep custom_llm_provider assertion last

- Use gpt-5-mini to ensure uses_responses_api=True
- Include a system message so instructions is non-empty
- Leave known failing custom_llm_provider assertion last

Co-authored-by: openhands <[email protected]>
@openhands-ai
Copy link

openhands-ai bot commented Oct 31, 2025

Looks like there are a few issues preventing this PR from being merged!

  • GitHub Actions are failing:
    • Run tests
    • Agent Server

If you'd like me to help, just leave a comment, like

@OpenHands please fix the failing actions on PR #981 at branch `test/llm-attrs-forwarding`

Feel free to include any additional details that might help me get this PR into a better state.

You can manage your notification settings

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants