autogen icon indicating copy to clipboard operation
autogen copied to clipboard

源码里的非致命小问题

Open ColorCode-39c5bb opened this issue 2 months ago • 1 comments

https://github.com/microsoft/autogen/blob/027ecf0a379bcc1d09956d46d12d44a3ad9cee14/python/packages/autogen-ext/src/autogen_ext/models/openai/_message_transform.py#L523-L540 其中的:

__unknown_models = list(
    set(total_models) - set(__openai_models) - set(__claude_models) - set(__gemini_models) - set(__llama_models)
)
__mistral_models = [model for model in total_models if ModelFamily.is_mistral(model)]

__unknown_models = list(
    set(total_models) - set(__openai_models) - set(__claude_models) - set(__gemini_models) - set(__mistral_models)
)

应该是:

to delete here

__mistral_models = [model for model in total_models if ModelFamily.is_mistral(model)]

__unknown_models = list(
    set(total_models) - set(__openai_models) - set(__claude_models) - set(__gemini_models) - set(__llama_models) - set(__mistral_models)
)

还是该文件 https://github.com/microsoft/autogen/blob/027ecf0a379bcc1d09956d46d12d44a3ad9cee14/python/packages/autogen-ext/src/autogen_ext/models/openai/_message_transform.py#L43-L53 其中的:

transformer = get_transformer("openai", "gpt-4", type(llm_message))
sdk_message = transformer(llm_message, context={})

这个示例没有随源码更新。源码中的get_transformer返回的是一个Mapping,当前版本应该需要对transformer再执行get()才能拿到真正的transformer函数。并且get_transformer函数实际上是registry.py模块里的。

另一个文件registry.py https://github.com/microsoft/autogen/blob/027ecf0a379bcc1d09956d46d12d44a3ad9cee14/python/packages/autogen-ext/src/autogen_ext/models/openai/_transformation/registry.py#L72-L88 形参有3个,但示例只传了2个参数

ColorCode-39c5bb avatar Sep 16 '26 05:09 ColorCode-39c5bb

Hi @maintainers! I'd like to work on this issue. I can fix the __unknown_models set difference in _message_transform.py so __llama_models and __mistral_models are properly excluded without overwriting, and update the get_transformer docstring example. Could you please assign this to me? Starting on the PR now.

itzzdev09 avatar Sep 16 '26 05:09 itzzdev09