Conversation
|
Someone is attempting to deploy a commit to the deepset Team on Vercel. A member of the Team first needs to authorize it. |
|
Hi @Taranum01, thanks for your interest in contributing to Haystack! 🙏 This is an automated message to help us keep the review queue healthy. |
Add a DEVELOPER entry to the ChatRole enum and a ChatMessage.from_developer classmethod. from_openai_dict_format now maps 'developer' to ChatRole.DEVELOPER (via from_developer) instead of silently collapsing it into ChatRole.SYSTEM, so to_openai_dict_format round-trips the role correctly. system messages continue to round-trip unchanged.
e163a78 to
3f939c0
Compare
|
Thanks for the PR! However, we don't want a new ChatRole here. Adding the role would mean updating every place that special-cases |
Summary
Fixes #12604.
OpenAI exposes a
'developer'chat role that was silently downgraded toChatRole.SYSTEMbyChatMessage.from_openai_dict_format._validate_openai_messageandto_openai_dict_formatalready accepted'developer', so the value was preserved on the wire but lost its identity on the client. This PR adds first-classChatRole.DEVELOPERsupport so the role survives a round-trip.Changes
haystack/dataclasses/chat_message.pyChatRole.DEVELOPER = "developer".ChatMessage.from_developer(content, meta, name)classmethod, mirroringfrom_system.from_openai_dict_format:"developer"->from_developer;"system"->from_system."user"/"assistant"/"tool"unchanged.Tests
test/dataclasses/test_chat_message.pytest_chat_role_developer_valuetest_from_developer_basictest_from_developer_with_meta_and_nametest_from_openai_dict_format_developer_roletest_to_openai_dict_format_developer_roletest_round_trip_developer_role_preservedtest_round_trip_system_role_unchanged