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

Update Microsoft Fabric notebook #3243

Merged
merged 2 commits into from
Jul 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 27 additions & 21 deletions notebook/agentchat_microsoft_fabric.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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))])"
]
},
{
Expand Down Expand Up @@ -300,6 +304,8 @@
}
],
"source": [
"import autogen\n",
"\n",
"# create an AssistantAgent instance named \"assistant\"\n",
"assistant = autogen.AssistantAgent(\n",
" name=\"assistant\",\n",
Expand Down
Loading