File tree Expand file tree Collapse file tree 2 files changed +20
-3
lines changed
openhands-sdk/openhands/sdk/llm/utils Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -89,10 +89,13 @@ class ModelFeatures:
8989# Models that require string serializer for tool messages
9090# These models don't support structured content format [{"type":"text","text":"..."}]
9191# and need plain strings instead
92+ # NOTE: model_matches uses case-insensitive substring matching, not globbing.
93+ # Keep these entries as bare substrings without wildcards.
9294FORCE_STRING_SERIALIZER_PATTERNS : list [str ] = [
93- "deepseek" ,
94- "glm" ,
95- "groq/kimi-k2-instruct" ,
95+ "deepseek" , # e.g., DeepSeek-V3.2-Exp
96+ "glm" , # e.g., GLM-4.5 / GLM-4.6
97+ # Kimi K2-Instruct requires string serialization only on Groq
98+ "groq/kimi-k2-instruct" , # explicit provider-prefixed IDs
9699]
97100
98101
Original file line number Diff line number Diff line change @@ -226,3 +226,17 @@ def test_supports_stop_words_false_models(model):
226226def test_responses_api_support (model , expected_responses ):
227227 features = get_features (model )
228228 assert features .supports_responses_api is expected_responses
229+
230+
231+ def test_force_string_serializer_full_model_names ():
232+ """Ensure full model names match substring patterns for string serializer.
233+
234+ Regression coverage for patterns like deepseek/glm without wildcards; Kimi
235+ should only match when provider-prefixed with groq/.
236+ """
237+ assert get_features ("DeepSeek-V3.2-Exp" ).force_string_serializer is True
238+ assert get_features ("GLM-4.5" ).force_string_serializer is True
239+ # Provider-agnostic Kimi should not force string serializer
240+ assert get_features ("Kimi K2-Instruct-0905" ).force_string_serializer is False
241+ # Groq-prefixed Kimi should force string serializer
242+ assert get_features ("groq/kimi-k2-instruct-0905" ).force_string_serializer is True
You can’t perform that action at this time.
0 commit comments