autogen icon indicating copy to clipboard operation
autogen copied to clipboard

Make usage of `name` field in OpenAI messages optional in `OpenAIChatCompletionClient`

Open ekzhu opened this issue 9 months ago • 9 comments

Confirmation

  • [x] I confirm that I am a maintainer and so can use this template. If I am not, I understand this issue will be closed and I will be asked to use a different template.

Issue body

Many "openai-compatible" model providers don't support the name field in message.

e.g, https://console.groq.com/docs/openai

Add include_name_in_message parameter to BaseOpenAIChatCompletionClient, and add to BaseOpenAIClientConfiguration. Default should be True.

Then, in user_message_to_oai and assistant_message_to_oai, we decide whether to use the name field based on the option set.

https://github.com/microsoft/autogen/blob/483532180a109d12c639160cb6a40e678a56e6ed/python/packages/autogen-ext/src/autogen_ext/models/openai/_openai_client.py#L182-L183

https://github.com/microsoft/autogen/blob/483532180a109d12c639160cb6a40e678a56e6ed/python/packages/autogen-ext/src/autogen_ext/models/openai/_openai_client.py#L222

For model APIs that don't support this field, we document in the usage guide about this option.

ekzhu avatar Mar 20 '25 06:03 ekzhu

Can I work on this issue?

tongyu0924 avatar Mar 20 '25 17:03 tongyu0924

Sure.

ekzhu avatar Mar 20 '25 17:03 ekzhu

@ekzhu Is this issue assigned? If not , I would be glad to implement this

gmivan avatar Apr 06 '25 23:04 gmivan

@gmivan thanks! Though I think @tongyu0924 already has a PR for it, which needs to be updated to work with the new transformation code.

@SongChiYoung can provide some guidance in how to make changes to the model client.

ekzhu avatar Apr 15 '25 05:04 ekzhu

@gmivan thanks! Though I think @tongyu0924 already has a PR for it, which needs to be updated to work with the new transformation code.

@SongChiYoung can provide some guidance in how to make changes to the model client.

Thanks for the note! I initially opened a PR for this, but I won’t be able to follow up with the required updates due to time constraints. Feel free to let someone else take over.

tongyu0924 avatar Apr 15 '25 05:04 tongyu0924

I can take over if you don't mind. Thank you

gmivan avatar Apr 15 '25 16:04 gmivan

Please do

ekzhu avatar Apr 15 '25 23:04 ekzhu

@gmivan I hope everything is going well. Please feel free to tag me if I can assist in any way.

SongChiYoung avatar Apr 18 '25 11:04 SongChiYoung

@SongChiYoung working on it. Prepared commit. How should I push: make a new branch with issue name and push into it? I think I have no rights for this

gmivan avatar Apr 21 '25 22:04 gmivan

@ekzhu Is this issue solved

ashutoshsom1 avatar Jul 21 '25 10:07 ashutoshsom1

@ashutoshsom1 no it has not been resolved.

ekzhu avatar Jul 23 '25 22:07 ekzhu