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

Improve auto reply registration #1170

Merged
merged 6 commits into from
Aug 4, 2023
Merged

Improve auto reply registration #1170

merged 6 commits into from
Aug 4, 2023

Conversation

sonichi
Copy link
Collaborator

@sonichi sonichi commented Aug 3, 2023

Why are these changes needed?

  1. Make _check_termination_and_human_reply a registered method so that other functions can be registered before it.
  2. Make registration position configurable.
  3. Allow registered functions to be excluded in generate_reply.
  4. Remove the need for overriding generate_reply completely.
  5. Update the chess and groupchat notebooks.
  6. Use object as key.
  7. Add link to the groupchat notebook.
  8. Fix bug in mathchat.
  9. Allow send/receive without reply and simplify the groupchat implementation.

Related issue number

Checks

@sonichi sonichi temporarily deployed to openai August 3, 2023 16:39 — with GitHub Actions Inactive
@sonichi sonichi temporarily deployed to openai August 3, 2023 16:39 — with GitHub Actions Inactive
@sonichi sonichi temporarily deployed to openai August 3, 2023 16:39 — with GitHub Actions Inactive
Copy link
Collaborator

@BeibinLi BeibinLi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sonichi sonichi requested a review from yiranwu0 August 3, 2023 21:06
Copy link
Collaborator

@thinkall thinkall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would a function unregister_auto_reply be useful? Just a random thought, no actual use case from my side.

@thinkall
Copy link
Collaborator

thinkall commented Aug 4, 2023

https://github.com/microsoft/FLAML/actions/runs/5756114523/job/15604943615?pr=1170#step:12:105

____________________________ test_responsive_agent _____________________________

monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7f95c06de1c0>

    def test_responsive_agent(monkeypatch):
        dummy_agent_1 = ResponsiveAgent(name="dummy_agent_1", human_input_mode="ALWAYS")
        dummy_agent_2 = ResponsiveAgent(name="dummy_agent_2", human_input_mode="TERMINATE")
    
        monkeypatch.setattr(sys, "stdin", StringIO("exit"))
        dummy_agent_1.receive("hello", dummy_agent_2)  # receive a str
        monkeypatch.setattr(sys, "stdin", StringIO("TERMINATE\n\n"))
        dummy_agent_1.receive(
            {
                "content": "hello {name}",
                "context": {
                    "name": "dummy_agent_2",
                },
            },
            dummy_agent_2,
        )  # receive a dict
>       assert "context" in dummy_agent_1.chat_messages["dummy_agent_2"][-2]
E       IndexError: list index out of range

test/autogen/agentchat/test_responsive_agent.py:[84](https://github.com/microsoft/FLAML/actions/runs/5756114523/job/15604943615?pr=1170#step:12:85): IndexError
----------------------------- Captured stdout call -----------------------------
dummy_agent_2 (to dummy_agent_1):

hello

--------------------------------------------------------------------------------
Provide feedback to dummy_agent_2. Press enter to skip and use auto-reply, or type 'exit' to end the conversation: dummy_agent_2 (to dummy_agent_1):

hello {name}

--------------------------------------------------------------------------------
Provide feedback to dummy_agent_2. Press enter to skip and use auto-reply, or type 'exit' to end the conversation: dummy_agent_1 (to dummy_agent_2):

TERMINATE

--------------------------------------------------------------------------------
Please give feedback to dummy_agent_1. Press enter or type 'exit' to stop the conversation: 
>>>>>>>> NO HUMAN INPUT RECEIVED.

@sonichi sonichi temporarily deployed to openai August 4, 2023 02:12 — with GitHub Actions Inactive
@sonichi sonichi temporarily deployed to openai August 4, 2023 02:12 — with GitHub Actions Inactive
@sonichi sonichi enabled auto-merge August 4, 2023 02:12
@sonichi
Copy link
Collaborator Author

sonichi commented Aug 4, 2023

Would a function unregister_auto_reply be useful? Just a random thought, no actual use case from my side.

I guess it'll be useful. We can add it when needed.

@sonichi sonichi added this pull request to the merge queue Aug 4, 2023
@sonichi sonichi removed this pull request from the merge queue due to a manual request Aug 4, 2023
@sonichi sonichi temporarily deployed to openai August 4, 2023 03:27 — with GitHub Actions Inactive
@sonichi sonichi temporarily deployed to openai August 4, 2023 03:27 — with GitHub Actions Inactive
@sonichi sonichi temporarily deployed to openai August 4, 2023 03:27 — with GitHub Actions Inactive
@sonichi sonichi enabled auto-merge August 4, 2023 03:27
@sonichi sonichi added this pull request to the merge queue Aug 4, 2023
@sonichi sonichi removed this pull request from the merge queue due to a manual request Aug 4, 2023
@sonichi sonichi temporarily deployed to openai August 4, 2023 07:24 — with GitHub Actions Inactive
@sonichi sonichi temporarily deployed to openai August 4, 2023 07:24 — with GitHub Actions Inactive
@sonichi sonichi temporarily deployed to openai August 4, 2023 07:24 — with GitHub Actions Inactive
@sonichi sonichi enabled auto-merge August 4, 2023 07:51
@sonichi sonichi temporarily deployed to openai August 4, 2023 07:58 — with GitHub Actions Inactive
@sonichi sonichi temporarily deployed to openai August 4, 2023 07:58 — with GitHub Actions Inactive
@sonichi sonichi temporarily deployed to openai August 4, 2023 07:58 — with GitHub Actions Inactive
@sonichi sonichi added this pull request to the merge queue Aug 4, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Aug 4, 2023
@sonichi sonichi added this pull request to the merge queue Aug 4, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Aug 4, 2023
@sonichi sonichi added this pull request to the merge queue Aug 4, 2023
Merged via the queue into main with commit 2208dfb Aug 4, 2023
16 checks passed
@sonichi sonichi deleted the register branch August 4, 2023 16:09
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.

None yet

3 participants