microsoft / autogen

A programming framework for agentic AI 🤖
https://microsoft.github.io/autogen/
Creative Commons Attribution 4.0 International
32.55k stars 4.74k forks source link

[Bug]: GPTAssistantAgent doesn't update instructions if openai_assistant_id is None and retrieve_assistants_by_name is invoked #952

Closed lc0rp closed 9 months ago

lc0rp commented 10 months ago

Describe the bug

autogen/agentchat/contrib/gpt_assistant_agent.py lines 94+ which updates the instructions only gets run if an openai_assistant_id was passed in, but the changes in #718 introduce the ability to retrieve an assistant by name, if openai_assistant_id is None.

The agent retrieved_by_name will not get instructions updated even if overwrite_instructions=True.

@IANTHEREAL - possible fix is to outdent lines 89 to 105

Steps to reproduce

  1. Create an assistant with a known name and instructions via the playground or API.
    • name=Test
    • instructions=Old instructions
  2. Call GPTAssistantAgent(name="Test", instructions="New instructions", overwrite_instructions=True)
  3. The instructions will still be "Old instructions

Expected Behavior

One expects overwrite_instructions to be respected even if the agent is retrieved by name.

Screenshots and logs

No response

Additional Information

No response

IANTHEREAL commented 10 months ago

We shouldn't update assistant attributions while the assistant name is not unique in OpenAI. PR https://github.com/microsoft/autogen/pull/925 is the first step to mitigate this issue

afourney commented 10 months ago

@gagb for visibility

gagb commented 10 months ago

@lc0rp, I agree with @IANTHEREAL -- the name field is not unique, and if you see @IANTHEREAL's PR he added a clarification for overwrite_instructions saying "This parameter is in effect only when assistant_id is specified in llm_config."

gagb commented 9 months ago

This was addressed.