Skip to content

Commit e57ab66

Browse files
authored
Improve assertion error message for content type (#446)
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 32d7ed9 commit e57ab66

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
@@ -255,7 +255,9 @@ def tokenize_trajectory(
255255
"via tokenizer.encode(content). This path ignores tool calls."
256256
)
257257
content = message.get("content")
258-
assert isinstance(content, str)
258+
assert isinstance(content, str), (
259+
"Trajectories must have a 'content' field of type str"
260+
)
259261
content_token_ids = tokenizer.encode(
260262
content,
261263
add_special_tokens=False,

0 commit comments

Comments
 (0)