Skip to content

solve the problem when speaker is "ai"#86

Merged
ultmaster merged 3 commits intomicrosoft:mainfrom
icelinks:main
Aug 14, 2025
Merged

solve the problem when speaker is "ai"#86
ultmaster merged 3 commits intomicrosoft:mainfrom
icelinks:main

Conversation

@icelinks
Copy link
Contributor

when use poml() function there is a problem that PomlMessage doesn't support speaker "ai"

@ultmaster
Copy link
Contributor

Thanks for pushing the fix.

I think it should be fixed the other way around.

Speaker = Literal["human", "assistant", "system"] should be human, ai, system.

@icelinks
Copy link
Contributor Author

Thanks for pushing the fix.

I think it should be fixed the other way around.

Speaker = Literal["human", "assistant", "system"] should be human, ai, system.

yeah,that's right. I'll make some changes, thanks.

@ultmaster
Copy link
Contributor

Emmm.. The openai_chat is unrelated to the pydantic here.

For the pydantic, changing Speaker = Literal["human", "assistant", "system"] to Speaker = Literal["human", "ai", "system"] is enough. No other changes required.

@icelinks
Copy link
Contributor Author

Emmm.. The openai_chat is unrelated to the pydantic here.

For the pydantic, changing Speaker = Literal["human", "assistant", "system"] to Speaker = Literal["human", "ai", "system"] is enough. No other changes required.

When 'format = "openai_chat"', only changing Speaker = Literal["human", "assistant", "system"] to Speaker = Literal["human", "ai", "system"] will causing problem. _poml_response_to_openai_chat function needs change.

@ultmaster
Copy link
Contributor

I don't think the original speaker returned by POML will ever be assistant? The speakers in the input of _poml_response_to_openai_chat must belong to human, ai and system, if I understand correctly.

@icelinks
Copy link
Contributor Author

icelinks commented Aug 14, 2025

I don't think the original speaker returned by POML will ever be assistant? The speakers in the input of _poml_response_to_openai_chat must belong to human, ai and system, if I understand correctly.

If that _poml_response_to_openai_chat still needs to change, now this function only support human, assistant and system. No matter what it will eventually be converted into user, assistant, and system.

If it's ok i'll remove assistant finally.

@ultmaster
Copy link
Contributor

Sorry I mistakenly see "assistant": "assistant" as the change. I apologize for the confusion.

Seems that your change is correct. Please remove ""assistant": "assistant", from speaker_to_role and "assistant" from Speaker.

@icelinks
Copy link
Contributor Author

Sorry I mistakenly see "assistant": "assistant" as the change. I apologize for the confusion.

Seems that your change is correct. Please remove ""assistant": "assistant", from speaker_to_role and "assistant" from Speaker.

Ok, I have already removed it, thanks for review.

@ultmaster ultmaster enabled auto-merge (squash) August 14, 2025 07:08
@ultmaster ultmaster merged commit 7b41c95 into microsoft:main Aug 14, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants