|
46 | 46 | "\n", |
47 | 47 | "from metorial import Metorial\n", |
48 | 48 | "from metorial.integrations.autogen import (\n", |
49 | | - " create_autogen_tools,\n", |
50 | | - " get_autogen_tool_executor,\n", |
| 49 | + " create_autogen_tools,\n", |
| 50 | + " get_autogen_tool_executor,\n", |
51 | 51 | ")" |
52 | 52 | ] |
53 | 53 | }, |
|
67 | 67 | "outputs": [], |
68 | 68 | "source": [ |
69 | 69 | "async def run_agents(query: str):\n", |
70 | | - " async with metorial.provider_session(\n", |
71 | | - " provider=\"openai\",\n", |
72 | | - " server_deployments=[os.getenv(\"EXA_DEPLOYMENT_ID\")],\n", |
73 | | - " ) as session:\n", |
74 | | - " tools = create_autogen_tools(session)\n", |
75 | | - " tool_executor = get_autogen_tool_executor(session)\n", |
| 70 | + " async with metorial.provider_session(\n", |
| 71 | + " provider=\"openai\",\n", |
| 72 | + " server_deployments=[os.getenv(\"EXA_DEPLOYMENT_ID\")],\n", |
| 73 | + " ) as session:\n", |
| 74 | + " tools = create_autogen_tools(session)\n", |
| 75 | + " tool_executor = get_autogen_tool_executor(session)\n", |
76 | 76 | "\n", |
77 | | - " print(f\"Available tools: {[t['function']['name'] for t in tools]}\")\n", |
| 77 | + " print(f\"Available tools: {[t['function']['name'] for t in tools]}\")\n", |
78 | 78 | "\n", |
79 | | - " llm_config = {\n", |
80 | | - " \"config_list\": [{\"model\": \"gpt-4o\", \"api_key\": os.getenv(\"OPENAI_API_KEY\")}],\n", |
81 | | - " \"tools\": tools,\n", |
82 | | - " }\n", |
| 79 | + " llm_config = {\n", |
| 80 | + " \"config_list\": [{\"model\": \"gpt-4o\", \"api_key\": os.getenv(\"OPENAI_API_KEY\")}],\n", |
| 81 | + " \"tools\": tools,\n", |
| 82 | + " }\n", |
83 | 83 | "\n", |
84 | | - " assistant = AssistantAgent(\n", |
85 | | - " name=\"research_assistant\",\n", |
86 | | - " system_message=\"You are a helpful research assistant.\",\n", |
87 | | - " llm_config=llm_config,\n", |
88 | | - " )\n", |
| 84 | + " assistant = AssistantAgent(\n", |
| 85 | + " name=\"research_assistant\",\n", |
| 86 | + " system_message=\"You are a helpful research assistant.\",\n", |
| 87 | + " llm_config=llm_config,\n", |
| 88 | + " )\n", |
89 | 89 | "\n", |
90 | | - " user_proxy = UserProxyAgent(\n", |
91 | | - " name=\"user\",\n", |
92 | | - " human_input_mode=\"NEVER\",\n", |
93 | | - " max_consecutive_auto_reply=5,\n", |
94 | | - " function_map=tool_executor,\n", |
95 | | - " )\n", |
| 90 | + " user_proxy = UserProxyAgent(\n", |
| 91 | + " name=\"user\",\n", |
| 92 | + " human_input_mode=\"NEVER\",\n", |
| 93 | + " max_consecutive_auto_reply=5,\n", |
| 94 | + " function_map=tool_executor,\n", |
| 95 | + " )\n", |
96 | 96 | "\n", |
97 | | - " await user_proxy.a_initiate_chat(assistant, message=query)" |
| 97 | + " await user_proxy.a_initiate_chat(assistant, message=query)" |
98 | 98 | ] |
99 | 99 | }, |
100 | 100 | { |
|
0 commit comments