Repository: microsoft/autogen
Pull request: support azure assistant api
## Why are these changes needed?

while using azure gpt assistant api, `model` in `config_list` would cause error:  `NotFoundError: Error code: 404 - {'error': {'code': '404', 'message': 'Resource not found'}}`. 

Following the azure tutorial - https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/assistant#create-an-assistant, we should remove `model`  from `config_list` 

<!-- Please give a short summary of the change and the problem this solves. -->

## Related issue number

<!-- For example: "Closes #1234" -->

## Checks

- [ ] I've included any doc changes needed for https://microsoft.github.io/autogen/. See https://microsoft.github.io/autogen/docs/Contribute#documentation to build and test documentation locally.
- [ ] I've added tests (if relevant) corresponding to the changes introduced in this PR.
- [ ] I've made sure all auto checks have passed.


Problem statement:
[Feature Request]: Microsoft Azure OpenAI Service Assistant API Support
### Is your feature request related to a problem? Please describe.

When I use Microsoft Azure OpenAI Service Assistant API , it cause error , not supported

### Describe the solution you'd like

please support

### Additional context

_No response_

Hints from issue discussion:

Commit message: try to add azure testing

Patch to review:
diff --git a/autogen/agentchat/contrib/gpt_assistant_agent.py b/autogen/agentchat/contrib/gpt_assistant_agent.py
index b588b2b59f5a..72bbcebe03e6 100644
--- a/autogen/agentchat/contrib/gpt_assistant_agent.py
+++ b/autogen/agentchat/contrib/gpt_assistant_agent.py
@@ -53,9 +53,14 @@ def __init__(
                 - Other kwargs: Except verbose, others are passed directly to ConversableAgent.
         """
         # Use AutoGen OpenAIWrapper to create a client
-        oai_wrapper = OpenAIWrapper(**llm_config)
+        openai_client_cfg = None
+        if llm_config and llm_config.get("config_list") is not None and len(llm_config["config_list"]) > 0:
+            openai_client_cfg = llm_config["config_list"][0].copy()
+
+        oai_wrapper = OpenAIWrapper(base_config=openai_client_cfg)
         if len(oai_wrapper._clients) > 1:
             logger.warning("GPT Assistant only supports one OpenAI client. Using the first client in the list.")
+
         self._openai_client = oai_wrapper._clients[0]._oai_client
         openai_assistant_id = llm_config.get("assistant_id", None)
         if openai_assistant_id is None:
diff --git a/test/agentchat/contrib/test_gpt_assistant.py b/test/agentchat/contrib/test_gpt_assistant.py
index 92e12558afc7..ebf04a4ad281 100644
--- a/test/agentchat/contrib/test_gpt_assistant.py
+++ b/test/agentchat/contrib/test_gpt_assistant.py
@@ -24,7 +24,7 @@
 
 if not skip:
     config_list = autogen.config_list_from_json(
-        OAI_CONFIG_LIST, file_location=KEY_LOC, filter_dict={"api_type": ["openai"]}
+        OAI_CONFIG_LIST, file_location=KEY_LOC, filter_dict={"api_type": ["openai", "azure"]}
     )
 
 
@@ -41,6 +41,12 @@ def test_config_list() -> None:
     reason="do not run on MacOS or windows OR dependency is not installed OR requested to skip",
 )
 def test_gpt_assistant_chat() -> None:
+    for gpt_config in config_list:
+        _test_gpt_assistant_chat([gpt_config])
+    _test_gpt_assistant_chat(None)
+
+
+def _test_gpt_assistant_chat(gpt_config) -> None:
     ossinsight_api_schema = {
         "name": "ossinsight_data_api",
         "parameters": {
@@ -64,7 +70,7 @@ def ask_ossinsight(question: str) -> str:
     name = f"For test_gpt_assistant_chat {uuid.uuid4()}"
     analyst = GPTAssistantAgent(
         name=name,
-        llm_config={"tools": [{"type": "function", "function": ossinsight_api_schema}], "config_list": config_list},
+        llm_config={"tools": [{"type": "function", "function": ossinsight_api_schema}], "config_list": gpt_config},
         instructions="Hello, Open Source Project Analyst. You'll conduct comprehensive evaluations of open source projects or organizations on the GitHub platform",
     )
     try:
@@ -90,7 +96,7 @@ def ask_ossinsight(question: str) -> str:
     # check the question asked
     ask_ossinsight_mock.assert_called_once()
     question_asked = ask_ossinsight_mock.call_args[0][0].lower()
-    for word in "microsoft autogen stars github".split(" "):
+    for word in "microsoft autogen star github".split(" "):
         assert word in question_asked
 
     # check the answer
@@ -108,6 +114,12 @@ def ask_ossinsight(question: str) -> str:
     reason="do not run on MacOS or windows OR dependency is not installed OR requested to skip",
 )
 def test_get_assistant_instructions() -> None:
+    for config in config_list:
+        _test_get_assistant_instructions([config])
+    _test_get_assistant_instructions(None)
+
+
+def _test_get_assistant_instructions(gpt_config) -> None:
     """
     Test function to create a new GPTAssistantAgent, set its instructions, retrieve the instructions,
     and assert that the retrieved instructions match the set instructions.
@@ -117,7 +129,7 @@ def test_get_assistant_instructions() -> None:
         name,
         instructions="This is a test",
         llm_config={
-            "config_list": config_list,
+            "config_list": gpt_config,
         },
     )
 
@@ -132,6 +144,12 @@ def test_get_assistant_instructions() -> None:
     reason="do not run on MacOS or windows OR dependency is not installed OR requested to skip",
 )
 def test_gpt_assistant_instructions_overwrite() -> None:
+    for config in config_list:
+        _test_gpt_assistant_instructions_overwrite([config])
+    _test_gpt_assistant_instructions_overwrite(None)
+
+
+def _test_gpt_assistant_instructions_overwrite(gpt_config) -> None:
     """
     Test that the instructions of a GPTAssistantAgent can be overwritten or not depending on the value of the
     `overwrite_instructions` parameter when creating a new assistant with the same ID.
@@ -151,7 +169,7 @@ def test_gpt_assistant_instructions_overwrite() -> None:
         name,
         instructions=instructions1,
         llm_config={
-            "config_list": config_list,
+            "config_list": gpt_config,
         },
     )
 
@@ -161,7 +179,7 @@ def test_gpt_assistant_instructions_overwrite() -> None:
             name,
             instructions=instructions2,
             llm_config={
-                "config_list": config_list,
+                "config_list": gpt_config,
                 "assistant_id": assistant_id,
             },
             overwrite_instructions=True,


Code review comments:
diff_hunk: @@ -24,7 +24,7 @@
 
 if not skip:
     config_list = autogen.config_list_from_json(
-        OAI_CONFIG_LIST, file_location=KEY_LOC, filter_dict={"api_type": ["openai"]}
+        OAI_CONFIG_LIST, file_location=KEY_LOC, filter_dict={"api_type": ["openai", "azure"]}
     )
path: test/agentchat/contrib/test_gpt_assistant.py
text: @user1:
Keep the original config_list as openai_config_list
Add an aoai_config_list with filter_dict={"api_version": ["2024-02-15-preview"]}
Then test these two config_lists separately