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

[Feature Request]: Enable easy replacement of registered functions #1233

Closed
krlng opened this issue Jan 13, 2024 · 1 comment
Closed

[Feature Request]: Enable easy replacement of registered functions #1233

krlng opened this issue Jan 13, 2024 · 1 comment
Assignees

Comments

@krlng
Copy link

krlng commented Jan 13, 2024

Is your feature request related to a problem? Please describe.

If a user wants to change the behavior of any of the functions that got registered for a reply, it is not enough to overwrite this function in a child-class, as the register_reply function registers class-methods.

Instead a user has to replace the function with something similar as:

  ind = [i for i, x in enumerate(self._reply_func_list) if hasattr(x["reply_func"],"__name__") and x["reply_func"].__name__ == "generate_oai_reply"]
  assert len(ind) == 1
  for i in ind:
      self._reply_func_list.pop(i)
      self.register_reply([Agent, None], self.generate_oai_reply, position=i)

after calling the constructor of the parent class.

Describe the solution you'd like

Make it somehow more easy for users to use custom reply functions. On idea is not using class-functions, as sketched here:
#1209

Another would be an easy replacement of existing functions.

Additional context

No response

@ekzhu
Copy link
Collaborator

ekzhu commented Jan 14, 2024

I like this issue. This is touching the heart of what we are currently working on in #1215 and #1240. In short, we want to make it really easy for developers to compose agent. So you can customize your own agent by declaratively specify a list of components, without modifying the defaults like today.

What you are doing is a fine shortcut for the issue right now as you can go directly modify the _reply_func_list of the agent by adding or remove reply functions.

@davorrunje davorrunje self-assigned this Jan 14, 2024
@gagb gagb closed this as completed Aug 27, 2024
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

No branches or pull requests

4 participants