Skip to content

Commit fe6bbec

Browse files
authored
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
1 parent b2cfe57 commit fe6bbec

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/art/preprocessing/tokenize.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,9 @@ def tokenize_trajectory(
192192
end = start + 1
193193
if isinstance(message, dict):
194194
content = message.get("content")
195-
assert isinstance(content, str)
195+
assert isinstance(content, str), (
196+
"Trajectories must have a 'content' field of type str"
197+
)
196198
content_token_ids = tokenizer.encode(
197199
content,
198200
add_special_tokens=False,

0 commit comments

Comments
 (0)