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

Autogen Retrieval User Proxy generate_init_message bug #859

Closed
Tracked by #1657
mknio opened this issue Dec 4, 2023 · 8 comments
Closed
Tracked by #1657

Autogen Retrieval User Proxy generate_init_message bug #859

mknio opened this issue Dec 4, 2023 · 8 comments
Assignees
Labels
0.2 Issues which are related to the pre 0.4 codebase rag retrieve-augmented generative agents

Comments

@mknio
Copy link
Collaborator

mknio commented Dec 4, 2023

I am trying to use the Autogen's RetrievalUserProxy and after i created a userpoxyagent and an assistant agent i wanted to initiate a message by saying user.initiate_chat(assistant, message = passed_prompt). it gave me a TypeError that it is not expecting it because it should have been passed as "problem" not "message" in the retrieval_user_proxy_agent.py at line 414. It is passed as a "problem" not a "message".

def generate_init_message(self, problem: str, n_results: int = 20, search_string: str = ""):
    """Generate an initial message with the given problem and prompt.

    Args:
        problem (str): the problem to be solved.
        n_results (int): the number of results to be retrieved.
        search_string (str): only docs containing this string will be retrieved.

    Returns:
        str: the generated prompt ready to be sent to the assistant agent.
    """
    self._reset()
    self.retrieve_docs(problem, n_results, search_string)
    self.problem = problem
    self.n_results = n_results
    doc_contents = self._get_context(self._results)
    message = self._generate_message(doc_contents, self._task)
    return message

However, in the class ConversableAgent the initiate_chat function is expecting a message argument at the line 529.

def initiate_chat(
    self,
    recipient: "ConversableAgent",
    clear_history: Optional[bool] = True,
    silent: Optional[bool] = False,
    **context,
):
    """Initiate a chat with the recipient agent.

    Reset the consecutive auto reply counter.
    If `clear_history` is True, the chat history with the recipient agent will be cleared.
    `generate_init_message` is called to generate the initial message for the agent.

    Args:
        recipient: the recipient agent.
        clear_history (bool): whether to clear the chat history with the agent.
        silent (bool or None): (Experimental) whether to print the messages for this conversation.
        **context: any context information.
            "message" needs to be provided if the `generate_init_message` method is not overridden.
    """

I believe that the generate_init_message should be also overridden as message and not as problem.

Please clarify this issue.

@sonichi sonichi added the rag retrieve-augmented generative agents label Dec 4, 2023
@sonichi
Copy link
Contributor

sonichi commented Dec 4, 2023

@thinkall would you like to make RetrievalUserProxyAgent more general? If the agent is intended for general use, "problem" is probably too narrow a concept.
Another question I've been thinking is how to consolidate TeachableAgent, RetrievalUserProxyAgent, EcoAssistant, MemGPT etc.
I believe there is value to generalize the lessons learned from these and build a good systems component.
cc @rickyloynd-microsoft @JieyuZ2 @cpacker

@mknio
Copy link
Collaborator Author

mknio commented Dec 4, 2023

I have seen some other codes where it uses message and somewhere else it uses "problem" and "message". So the question rises. When do we use "message" and when do we use "problem". the code is from the examples that autogen provided in the agentchat_groupchat_RAG.ipynb. Thank you

@JieyuZ2
Copy link
Collaborator

JieyuZ2 commented Dec 4, 2023

@thinkall would you like to make RetrievalUserProxyAgent more general? If the agent is intended for general use, "problem" is probably too narrow a concept. Another question I've been thinking is how to consolidate TeachableAgent, RetrievalUserProxyAgent, EcoAssistant, MemGPT etc. I believe there is value to generalize the lessons learned from these and build a good systems component. cc @rickyloynd-microsoft @JieyuZ2 @cpacker

it may require a modularized way to build retrieval-based agents, define store and retrieve function like we define reply function.

@thinkall
Copy link
Collaborator

thinkall commented Dec 6, 2023

@thinkall would you like to make RetrievalUserProxyAgent more general? If the agent is intended for general use, "problem" is probably too narrow a concept. Another question I've been thinking is how to consolidate TeachableAgent, RetrievalUserProxyAgent, EcoAssistant, MemGPT etc. I believe there is value to generalize the lessons learned from these and build a good systems component. cc @rickyloynd-microsoft @JieyuZ2 @cpacker

it may require a modularized way to build retrieval-based agents, define store and retrieve function like we define reply function.

Yes, looks like it's time to start working on that.

@thinkall
Copy link
Collaborator

thinkall commented Dec 6, 2023

I have seen some other codes where it uses message and somewhere else it uses "problem" and "message". So the question rises. When do we use "message" and when do we use "problem". the code is from the examples that autogen provided in the agentchat_groupchat_RAG.ipynb. Thank you

Hi @mknio , before we update the code, you'll need to initiate the chat with problem when using a RetrieveUserProxyAgent.

@mknio
Copy link
Collaborator Author

mknio commented Dec 7, 2023

Isnt "message" the better word to use in this instance as it is also dependent on many other factors like the generate_init_message and initiate_chat are all expecting message. Anyways, I will change the code to "problem" once it is updated if that is the most suitable thing to do. Thank you!

@thinkall
Copy link
Collaborator

thinkall commented Dec 7, 2023

Isnt "message" the better word to use in this instance as it is also dependent on many other factors like the generate_init_message and initiate_chat are all expecting message. Anyways, I will change the code to "problem" once it is updated if that is the most suitable thing to do. Thank you!

Right, we'll unify the interface. Before that, please use "problem" as a workaround. Just to clarify, you need "problem" for the current version of RetrieveUserProxyAgent.

@thinkall thinkall mentioned this issue Apr 6, 2024
11 tasks
@thinkall thinkall self-assigned this Jun 18, 2024
@rysweet rysweet added 0.2 Issues which are related to the pre 0.4 codebase needs-triage labels Oct 2, 2024
@rysweet
Copy link
Collaborator

rysweet commented Oct 18, 2024

seems to be resolved.

@rysweet rysweet closed this as completed Oct 18, 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 rag retrieve-augmented generative agents
Projects
None yet
Development

No branches or pull requests

5 participants