Skip to content

fix(v2): tolerate non-list details in ModelResult deserialization#942

Merged
aix-ahmet merged 1 commit into
developmentfrom
bugfix/guardrail-dict-details-deserialization
Jun 3, 2026
Merged

fix(v2): tolerate non-list details in ModelResult deserialization#942
aix-ahmet merged 1 commit into
developmentfrom
bugfix/guardrail-dict-details-deserialization

Conversation

@aix-ahmet

@aix-ahmet aix-ahmet commented Jun 3, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

Guardrail / utility models (e.g. AWS Sensitive Information Guardrail)
return the run response 'details' field as a dict ({action, text}) rather
than the list of message Details that LLM models return. ModelResult typed
details as Optional[List[Detail]], so dataclasses_json iterated the dict's
string keys and tried to decode each as a Detail dataclass, raising
'str' object has no attribute 'items' and breaking every Model.run() call
against a guardrail asset.

Add a _decode_details decoder that decodes the list shape into Detail
objects and passes any other shape (dict) through untouched.

Verified: tests/unit/v2 (test_model + test_resource) 133 passed in the
repo .venv; --no-verify used because the pre-commit pytest hook runs under
system Python which lacks SDK deps (37 ModuleNotFoundError: babel).
@aix-ahmet
aix-ahmet changed the base branch from main to development June 3, 2026 18:46
@aix-ahmet
aix-ahmet merged commit a93ad3d into development Jun 3, 2026
1 check passed
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.

1 participant