Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Suggestion]: Change behavior of config cloning in register_reply #2487

Open
PyroGenesis opened this issue Apr 23, 2024 · 1 comment
Open
Labels
0.2 Issues which are related to the pre 0.4 codebase help wanted Extra attention is needed needs-triage

Comments

@PyroGenesis
Copy link
Contributor

PyroGenesis commented Apr 23, 2024

Describe the issue

When you register a reply to a ConversableAgent, you have the option of providing a config parameter which could be used for LLM generation or other extra variables.

This is then assigned to the "private" _reply_func_list in this way:

self._reply_func_list.insert(
    position,
    {
        "trigger": trigger,
        "reply_func": reply_func,
        "config": copy.copy(config),
        "init_config": config,
        "reset_config": reset_config,
        "ignore_async_in_sync_chat": ignore_async_in_sync_chat and inspect.iscoroutinefunction(reply_func),
    },
)

My focus is specifically on config and init_config. This works well when the config is modified over time by the reply function, and reset() resets the config as expected. However, this approach leaves no way to modify the config from outside the reply function, which is a useful functionality.

If the user really wants to modify the config, they will need to access _reply_func_list. What if we invert the cloning behavior so that config is the original object and init_config is the clone? That way, the user can keep a reference to the config object and update it if needed accordingly,

Let me know if I've missed something important or there is a better way to give reply functions additional mutable data. My current workaround is to use functools.partial() to pass in a mutable dict.

Steps to reproduce

No response

Screenshots and logs

No response

Additional Information

No response

@ekzhu
Copy link
Collaborator

ekzhu commented Apr 23, 2024

I think it makes sense to allow config to be modified externally from the agent. You might want to take a look at experimental branch as we are working toward more extensible API. cc @jackgerrits

@qingyun-wu qingyun-wu added enhancement help wanted Extra attention is needed labels Jun 18, 2024
@rysweet rysweet added 0.2 Issues which are related to the pre 0.4 codebase needs-triage labels Oct 2, 2024
@fniedtner fniedtner removed the feature label Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.2 Issues which are related to the pre 0.4 codebase help wanted Extra attention is needed needs-triage
Projects
None yet
Development

No branches or pull requests

5 participants