Conversation
- Removed Message.to_llm_dict() alias (deprecated in favor of to_chat_dict()) - Removed Message.from_litellm_message() alias (deprecated in favor of from_llm_chat_message()) - Renamed internal BaseContent.to_llm_dict() to _to_content_dicts() to clarify it's internal - Updated all production code to use to_chat_dict() instead of to_llm_dict() - Updated all tests to use new API methods - Updated test function names to reflect new method names - Updated docstrings and comments to reference new method names - All 334 tests in tests/sdk/llm/ pass Co-authored-by: openhands <openhands@all-hands.dev>
|
@OpenHands review diff from main and revert changes we did to |
|
I'm on it! xingyaoww can track my progress at all-hands.dev |
The previous commit renamed BaseContent.to_llm_dict() to _to_content_dicts() as part of removing deprecated methods. However, this method is an internal implementation detail of the content classes, not a deprecated public API. Changes: - Reverted BaseContent.to_llm_dict() name (from _to_content_dicts) - Reverted TextContent.to_llm_dict() name (from _to_content_dicts) - Reverted ImageContent.to_llm_dict() name (from _to_content_dicts) - Updated call site in Message._list_serializer() - Updated test references in tests/sdk/llm/test_message.py The deprecated Message.to_llm_dict() and Message.from_litellm_message() methods remain removed as intended by the PR. Co-authored-by: openhands <openhands@all-hands.dev>
SummaryI've successfully reviewed the diff from main and reverted the changes to What Was RevertedThe PR originally made two types of changes to
I reverted only the rename (#2), keeping the removal of the deprecated method (#1) as intended by the PR. Changes MadeReverted in
Updated in
Rationale
Verification✅ All 334 tests in The PR now correctly removes only the deprecated public API methods while keeping the internal content class methods unchanged. |
Yes, IMHO On a side note, I find that a great way to use the agent is like:
That may sound totally normal, but idk, what I mean... I'm not sure how to say this. Let's say this way: we're in October 2025.
Old OpenHands-Gemini-2.0-FT could do exploratory conversations better than 3.7. On the other hand, OpenHands-GPT-5 feels like... the real deal. I bump into some usability issues. But it's so good. I don't understand how people still use the LLM providers apps, when they're hamstrung by the inability to (insert here: "explore the other repo", "make a md file on this, on a new branch, push it out and come back to me", "with this in mind, review that PR and fix it", "map this execution path and give me concise pseudocode, now change it to include x"). Anyway, sorry. I'm so excited about this. What relation does it have with |
Yeah my primary concern is that if we keep this, we will have three different ways to convert Messages to dict with two of those be the same 😓 So i think it is better for us to keep things more explicit |
Summary
This PR removes the deprecated
to_llm_dict()andfrom_litellm_message()methods that were kept for backward compatibility after the native responses API implementation (PR #622).Fixes #639
Changes
Method Removals
Message.to_llm_dict()- deprecated alias forto_chat_dict()Message.from_litellm_message()- deprecated alias forfrom_llm_chat_message()Internal Refactoring
BaseContent.to_llm_dict()→_to_content_dicts()- clarified this is an internal methodTextContentandImageContentMessage._list_serializer()Production Code Updates
openhands/sdk/llm/llm.py- changedmessage.to_llm_dict()tomessage.to_chat_dict()Test Updates
to_llm_dict()→to_chat_dict()for Message serializationfrom_litellm_message()→from_llm_chat_message()for Message deserializationto_llm_dict()→_to_content_dicts()for content unit testsFiles Modified
openhands/sdk/llm/message.py- removed deprecated methods, renamed internal methodsopenhands/sdk/llm/llm.py- updated to useto_chat_dict()tests/sdk/llm/test_message.py- migrated to new APItests/sdk/llm/test_message_serialization.py- migrated to new APItests/sdk/llm/test_thinking_blocks.py- migrated to new APItests/sdk/llm/test_reasoning_content.py- migrated to new APItests/fixtures/llm_data/data_generator.py- migrated to new APITesting
All 334 tests in
tests/sdk/llm/pass successfully:Pre-commit hooks pass (ruff format, ruff lint, pycodestyle, pyright).
Motivation
The new API provides:
This cleanup eliminates technical debt early in the responses API rollout.
@xingyaoww can click here to continue refining the PR
Agent Server images for this PR
• GHCR package: https://github.com/All-Hands-AI/agent-sdk/pkgs/container/agent-server
Variants & Base Images
golang:1.21-bookwormeclipse-temurin:17-jdknikolaik/python-nodejs:python3.12-nodejs22Pull (multi-arch manifest)
Run
All tags pushed for this build
The
705eb2atag is a multi-arch manifest (amd64/arm64); your client pulls the right arch automatically.