From fe6bbec690f88c620a2a64ac3d75503b87d1164e Mon Sep 17 00:00:00 2001 From: Freddie Vargus Date: Tue, 28 Oct 2025 13:50:47 -0400 Subject: [PATCH] Improve assertion error message for content type Enhance assertion for content type in message dictionary. Came across this when testing this out with a tool-call and the assertion / why it was failing was not obvious --- src/art/preprocessing/tokenize.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/art/preprocessing/tokenize.py b/src/art/preprocessing/tokenize.py index 70dbd766..a9a6a072 100644 --- a/src/art/preprocessing/tokenize.py +++ b/src/art/preprocessing/tokenize.py @@ -192,7 +192,9 @@ def tokenize_trajectory( end = start + 1 if isinstance(message, dict): content = message.get("content") - assert isinstance(content, str) + assert isinstance(content, str), ( + "Trajectories must have a 'content' field of type str" + ) content_token_ids = tokenizer.encode( content, add_special_tokens=False,