Exercises / llm
Validate chat roles
valid_roles(msgs) is True only if every role is system, user, assistant, or tool. Print the flag for a 3-message list that includes a bad role.
Live Pythonpython
Output
Run to execute this in your browser. Nothing is sent to a server.