|
121 | 121 | }, |
122 | 122 | { |
123 | 123 | "cell_type": "code", |
124 | | - "execution_count": 5, |
| 124 | + "execution_count": null, |
125 | 125 | "metadata": { |
126 | 126 | "colab": { |
127 | 127 | "base_uri": "https://localhost:8080/" |
|
163 | 163 | }, |
164 | 164 | { |
165 | 165 | "cell_type": "code", |
166 | | - "execution_count": 6, |
| 166 | + "execution_count": null, |
167 | 167 | "metadata": { |
168 | 168 | "colab": { |
169 | 169 | "base_uri": "https://localhost:8080/" |
|
227 | 227 | }, |
228 | 228 | { |
229 | 229 | "cell_type": "code", |
230 | | - "execution_count": 7, |
| 230 | + "execution_count": null, |
231 | 231 | "metadata": { |
232 | 232 | "colab": { |
233 | 233 | "base_uri": "https://localhost:8080/" |
|
300 | 300 | }, |
301 | 301 | { |
302 | 302 | "cell_type": "code", |
303 | | - "execution_count": 9, |
| 303 | + "execution_count": null, |
304 | 304 | "metadata": { |
305 | 305 | "colab": { |
306 | 306 | "base_uri": "https://localhost:8080/" |
|
375 | 375 | }, |
376 | 376 | { |
377 | 377 | "cell_type": "code", |
378 | | - "execution_count": 11, |
| 378 | + "execution_count": null, |
379 | 379 | "metadata": { |
380 | 380 | "colab": { |
381 | 381 | "base_uri": "https://localhost:8080/" |
|
481 | 481 | }, |
482 | 482 | { |
483 | 483 | "cell_type": "code", |
484 | | - "execution_count": 12, |
| 484 | + "execution_count": null, |
485 | 485 | "metadata": { |
486 | 486 | "colab": { |
487 | 487 | "base_uri": "https://localhost:8080/" |
|
555 | 555 | }, |
556 | 556 | { |
557 | 557 | "cell_type": "code", |
558 | | - "execution_count": 37, |
| 558 | + "execution_count": null, |
559 | 559 | "metadata": { |
560 | 560 | "colab": { |
561 | 561 | "base_uri": "https://localhost:8080/" |
|
746 | 746 | }, |
747 | 747 | { |
748 | 748 | "cell_type": "code", |
749 | | - "execution_count": 47, |
| 749 | + "execution_count": null, |
750 | 750 | "metadata": { |
751 | 751 | "id": "3QJbO5JqixP6" |
752 | 752 | }, |
|
794 | 794 | }, |
795 | 795 | { |
796 | 796 | "cell_type": "code", |
797 | | - "execution_count": 48, |
| 797 | + "execution_count": null, |
798 | 798 | "metadata": { |
799 | 799 | "colab": { |
800 | 800 | "base_uri": "https://localhost:8080/" |
|
884 | 884 | }, |
885 | 885 | { |
886 | 886 | "cell_type": "code", |
887 | | - "execution_count": 5, |
| 887 | + "execution_count": null, |
888 | 888 | "metadata": { |
889 | 889 | "colab": { |
890 | 890 | "base_uri": "https://localhost:8080/" |
|
919 | 919 | }, |
920 | 920 | { |
921 | 921 | "cell_type": "code", |
922 | | - "execution_count": 6, |
| 922 | + "execution_count": null, |
923 | 923 | "metadata": { |
924 | 924 | "colab": { |
925 | 925 | "base_uri": "https://localhost:8080/" |
|
997 | 997 | }, |
998 | 998 | { |
999 | 999 | "cell_type": "code", |
1000 | | - "execution_count": 4, |
| 1000 | + "execution_count": null, |
1001 | 1001 | "metadata": { |
1002 | 1002 | "colab": { |
1003 | 1003 | "base_uri": "https://localhost:8080/" |
|
1060 | 1060 | }, |
1061 | 1061 | { |
1062 | 1062 | "cell_type": "code", |
1063 | | - "execution_count": 6, |
| 1063 | + "execution_count": null, |
1064 | 1064 | "metadata": { |
1065 | 1065 | "colab": { |
1066 | 1066 | "base_uri": "https://localhost:8080/" |
|
1161 | 1161 | }, |
1162 | 1162 | { |
1163 | 1163 | "cell_type": "code", |
1164 | | - "execution_count": 17, |
| 1164 | + "execution_count": null, |
1165 | 1165 | "metadata": { |
1166 | 1166 | "colab": { |
1167 | 1167 | "base_uri": "https://localhost:8080/" |
|
1301 | 1301 | }, |
1302 | 1302 | { |
1303 | 1303 | "cell_type": "code", |
1304 | | - "execution_count": 18, |
| 1304 | + "execution_count": null, |
1305 | 1305 | "metadata": { |
1306 | 1306 | "colab": { |
1307 | 1307 | "base_uri": "https://localhost:8080/" |
|
1528 | 1528 | }, |
1529 | 1529 | { |
1530 | 1530 | "cell_type": "code", |
1531 | | - "execution_count": 22, |
| 1531 | + "execution_count": null, |
1532 | 1532 | "metadata": { |
1533 | 1533 | "colab": { |
1534 | 1534 | "base_uri": "https://localhost:8080/" |
|
1641 | 1641 | }, |
1642 | 1642 | { |
1643 | 1643 | "cell_type": "code", |
1644 | | - "execution_count": 25, |
| 1644 | + "execution_count": null, |
1645 | 1645 | "metadata": { |
1646 | 1646 | "id": "U1r9txhY4TRz" |
1647 | 1647 | }, |
|
1664 | 1664 | }, |
1665 | 1665 | { |
1666 | 1666 | "cell_type": "code", |
1667 | | - "execution_count": 26, |
| 1667 | + "execution_count": null, |
1668 | 1668 | "metadata": { |
1669 | 1669 | "colab": { |
1670 | 1670 | "base_uri": "https://localhost:8080/" |
|
1771 | 1771 | }, |
1772 | 1772 | { |
1773 | 1773 | "cell_type": "code", |
1774 | | - "execution_count": 29, |
| 1774 | + "execution_count": null, |
1775 | 1775 | "metadata": { |
1776 | 1776 | "id": "AncPEwMz4HDX" |
1777 | 1777 | }, |
|
1780 | 1780 | "name": "stdout", |
1781 | 1781 | "output_type": "stream", |
1782 | 1782 | "text": [ |
1783 | | - "VeFaaS 应用 ID: \n", |
1784 | | - "返回的消息内容: 您好呀!作为 Agent 开发者,您是不是有关于如何调用功能获取天气信息之类的问题呢?要是想获取特定城市天气,您只要提出需求,我会通过合适的函数调用为您提供准确天气情况。 \n" |
| 1783 | + "返回的消息内容: 您好呀!作为Agent开发者,或许您对如何更高效精准地使用函数获取天气数据感兴趣?要是您想测试关于天气查询的功能,不妨给我一个城市名,我调用`get_city_weather`函数来为您获取相应的天气报告,方便您做进一步研究。 \n" |
1785 | 1784 | ] |
1786 | 1785 | } |
1787 | 1786 | ], |
|
1794 | 1793 | "\n", |
1795 | 1794 | "cloud_app = CloudApp(vefaas_application_name=vefaas_application_name, vefaas_endpoint=vefaas_endpoint)\n", |
1796 | 1795 | "\n", |
1797 | | - "print(f\"VeFaaS 应用 ID: {cloud_app.vefaas_application_id}\")\n", |
1798 | | - "\n", |
1799 | 1796 | "# 发送消息\n", |
1800 | 1797 | "response_message = await cloud_app.message_send(\n", |
1801 | 1798 | " message=\"你好,我是一名 Agent 开发者。\", user_id=user_id, session_id=session_id\n", |
|
1848 | 1845 | }, |
1849 | 1846 | { |
1850 | 1847 | "cell_type": "code", |
1851 | | - "execution_count": 34, |
| 1848 | + "execution_count": null, |
1852 | 1849 | "metadata": { |
1853 | 1850 | "id": "SiszeafO6Iav" |
1854 | 1851 | }, |
|
1857 | 1854 | "name": "stdout", |
1858 | 1855 | "output_type": "stream", |
1859 | 1856 | "text": [ |
1860 | | - "VeFaaS 应用 Endpoint: https://sd3n10st049upp79s7nb0.apigateway-cn-beijing.volceapi.com\n", |
1861 | 1857 | "云部署的 MCP 工具: [Tool(name='run_agent', title=None, description='A reporter for weather updates\\nArgs:\\n user_input: User\\'s input message (required).\\n user_id: User identifier. Defaults to \"mcp_user\".\\n session_id: Session identifier. Defaults to \"mcp_session\".\\nReturns:\\n Final agent response as a string.\\n\\n\\n**Query Parameters:**\\n\\n- **user_input** (Required): No description.\\n\\n- **user_id**: No description.\\n\\n- **session_id**: No description.\\n\\n\\n**Responses:**\\n\\n- **200** (Success): Successful Response\\n - Content-Type: `application/json`\\n\\n - **Example:**\\n```json\\n\"string\"\\n```\\n\\n- **422**: Validation Error\\n - Content-Type: `application/json`\\n\\n - **Response Properties:**\\n\\n - **Example:**\\n```json\\n{\\n \"detail\": [\\n \"unknown_type\"\\n ]\\n}\\n```', inputSchema={'type': 'object', 'properties': {'user_input': {'type': 'string', 'title': 'User Input'}, 'user_id': {'type': 'string', 'title': 'User Id', 'default': 'mcp_user'}, 'session_id': {'type': 'string', 'title': 'Session Id', 'default': 'mcp_session'}}, 'required': ['user_input']}, outputSchema={'type': 'object', 'properties': {'result': {'type': 'string', 'title': 'Response Run Agent'}}, 'required': ['result'], 'x-fastmcp-wrap-result': True}, annotations=None, meta={'_fastmcp': {'tags': ['mcp']}}), Tool(name='agent_card', title=None, description='Agent Card\\n\\n\\n**Responses:**\\n\\n- **200** (Success): Successful Response\\n - Content-Type: `application/json`\\n\\n - **Example:**\\n```json\\n{\\n \"key\": \"value\"\\n}\\n```', inputSchema={'type': 'object', 'properties': {}, 'required': []}, outputSchema={'additionalProperties': True, 'type': 'object', 'title': 'Response Agent Card'}, annotations=None, meta={'_fastmcp': {'tags': ['mcp']}}), Tool(name='get_cozeloop_space_id', title=None, description='Get Cozeloop Space Id\\n\\n\\n**Responses:**\\n\\n- **200** (Success): Successful Response\\n - Content-Type: `application/json`\\n\\n - **Example:**\\n```json\\n{\\n \"key\": \"value\"\\n}\\n```', inputSchema={'type': 'object', 'properties': {}, 'required': []}, outputSchema={'additionalProperties': True, 'type': 'object', 'title': 'Response Get Cozeloop Space Id'}, annotations=None, meta={'_fastmcp': {'tags': ['mcp']}})]\n", |
1862 | | - "返回的消息内容: CallToolResult(content=[TextContent(type='text', text='{\"result\":\"您好呀!作为Agent开发者,想必您对各种功能调用很熟悉啦。要是您对我获取天气信息的流程感兴趣,或是想了解如何优化相关调用,咱们都可以交流探讨。要是您想获取某个城市的天气,我随时可以通过 `get_city_weather` 函数为您查询。 \"}', annotations=None, meta=None)], structured_content={'result': '您好呀!作为Agent开发者,想必您对各种功能调用很熟悉啦。要是您对我获取天气信息的流程感兴趣,或是想了解如何优化相关调用,咱们都可以交流探讨。要是您想获取某个城市的天气,我随时可以通过 `get_city_weather` 函数为您查询。 '}, data='您好呀!作为Agent开发者,想必您对各种功能调用很熟悉啦。要是您对我获取天气信息的流程感兴趣,或是想了解如何优化相关调用,咱们都可以交流探讨。要是您想获取某个城市的天气,我随时可以通过 `get_city_weather` 函数为您查询。 ', is_error=False)\n" |
| 1858 | + "返回的消息内容: CallToolResult(content=[TextContent(type='text', text='{\"result\":\"您好呀!作为Agent开发者,想必您对于功能集成与调用有独到见解。若您想了解天气相关功能在实际应用中的开发要点,比如怎样更好结合`get_city_weather`函数优化您的项目,都能和我说说,咱们一起探讨。要是您想测试天气查询功能,告诉我城市名称,我就调用函数给出天气信息。 \"}', annotations=None, meta=None)], structured_content={'result': '您好呀!作为Agent开发者,想必您对于功能集成与调用有独到见解。若您想了解天气相关功能在实际应用中的开发要点,比如怎样更好结合`get_city_weather`函数优化您的项目,都能和我说说,咱们一起探讨。要是您想测试天气查询功能,告诉我城市名称,我就调用函数给出天气信息。 '}, data='您好呀!作为Agent开发者,想必您对于功能集成与调用有独到见解。若您想了解天气相关功能在实际应用中的开发要点,比如怎样更好结合`get_city_weather`函数优化您的项目,都能和我说说,咱们一起探讨。要是您想测试天气查询功能,告诉我城市名称,我就调用函数给出天气信息。 ', is_error=False)\n" |
1863 | 1859 | ] |
1864 | 1860 | } |
1865 | 1861 | ], |
|
1874 | 1870 | "cloud_app = CloudApp(vefaas_application_name=vefaas_application_name)\n", |
1875 | 1871 | "\n", |
1876 | 1872 | "endpoint = cloud_app._get_vefaas_endpoint()\n", |
1877 | | - "print(f\"VeFaaS 应用 Endpoint: {endpoint}\")\n", |
1878 | 1873 | "\n", |
1879 | 1874 | "client = Client(f\"{endpoint}/mcp?token={vefaas_application_token}\")\n", |
1880 | 1875 | "\n", |
|
0 commit comments