Skip to content

A programming framework for agentic AI

Update Microsoft Fabric notebook (#3243)

Li Jiangf8663e358152
diff --git a/notebook/agentchat_microsoft_fabric.ipynb b/notebook/agentchat_microsoft_fabric.ipynb
index e4c2a7119..97cab73b4 100644
--- a/notebook/agentchat_microsoft_fabric.ipynb
+++ b/notebook/agentchat_microsoft_fabric.ipynb
@@ -113,32 +113,36 @@
}
],
"source": [
- "import types\n",
+ "from synapse.ml.mlflow import get_mlflow_env_config\n",
"\n",
- "import httpx\n",
- "from synapse.ml.fabric.credentials import get_openai_httpx_sync_client\n",
"\n",
- "import autogen\n",
+ "def get_config_list():\n",
+ " mlflow_env_configs = get_mlflow_env_config()\n",
+ " access_token = mlflow_env_configs.driver_aad_token\n",
+ " prebuilt_AI_base_url = mlflow_env_configs.workload_endpoint + \"cognitive/openai/\"\n",
"\n",
- "http_client = get_openai_httpx_sync_client()\n",
- "http_client.__deepcopy__ = types.MethodType(\n",
- " lambda self, memo: self, http_client\n",
- ") # https://microsoft.github.io/autogen/docs/topics/llm_configuration#adding-http-client-in-llm_config-for-proxy\n",
+ " config_list = [\n",
+ " {\n",
+ " \"model\": \"gpt-4o\",\n",
+ " \"api_key\": access_token,\n",
+ " \"base_url\": prebuilt_AI_base_url,\n",
+ " \"api_type\": \"azure\",\n",
+ " \"api_version\": \"2024-02-01\",\n",
+ " },\n",
+ " ]\n",
"\n",
- "config_list = [\n",
- " {\n",
- " \"model\": \"gpt-4o\",\n",
- " \"http_client\": http_client,\n",
- " \"api_type\": \"azure\",\n",
- " \"api_version\": \"2024-02-01\",\n",
- " },\n",
- "]\n",
+ " # Set temperature, timeout and other LLM configurations\n",
+ " llm_config = {\n",
+ " \"config_list\": config_list,\n",
+ " \"temperature\": 0,\n",
+ " \"timeout\": 600,\n",
+ " }\n",
+ " return config_list, llm_config\n",
+ "\n",
+ "config_list, llm_config = get_config_list()\n",
"\n",
- "# Set temperature, timeout and other LLM configurations\n",
- "llm_config = {\n",
- " \"config_list\": config_list,\n",
- " \"temperature\": 0,\n",
- "}"
+ "assert len(config_list) > 0\n",
+ "print(\"models to use: \", [config_list[i][\"model\"] for i in range(len(config_list))])"
]
},
{
@@ -300,6 +304,8 @@
}
],
"source": [
+ "import autogen\n",
+ "\n",
"# create an AssistantAgent instance named \"assistant\"\n",
"assistant = autogen.AssistantAgent(\n",
" name=\"assistant\",\n",