Test and update MultiON agent toolkit docs (#16235)

pull/16284/head
Lance Martin 9 months ago committed by GitHub
parent 3ccbe11363
commit f63906a9c2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -5,10 +5,17 @@
"metadata": {},
"source": [
"# MultiOn\n",
" \n",
"[MultiON](https://www.multion.ai/blog/multion-building-a-brighter-future-for-humanity-with-ai-agents) has built an AI Agent that can interact with a broad array of web services and applications. \n",
"\n",
"This notebook walks you through connecting LangChain to the `MultiOn` Client in your browser\n",
"This notebook walks you through connecting LangChain to the `MultiOn` Client in your browser. \n",
"\n",
"To use this toolkit, you will need to add `MultiOn Extension` to your browser as explained in the [MultiOn for Chrome](https://multion.notion.site/Download-MultiOn-ddddcfe719f94ab182107ca2612c07a5)."
"This enables custom agentic workflow that utilize the power of MultiON agents.\n",
" \n",
"To use this toolkit, you will need to add `MultiOn Extension` to your browser: \n",
"\n",
"* Create a [MultiON account](https://app.multion.ai/login?callbackUrl=%2Fprofile). \n",
"* Add [MultiOn extension for Chrome](https://multion.notion.site/Download-MultiOn-ddddcfe719f94ab182107ca2612c07a5)."
]
},
{
@ -22,22 +29,43 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 7,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"MultionToolkit()"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from langchain_community.agent_toolkits import MultionToolkit\n",
"\n",
"toolkit = MultionToolkit()\n",
"\n",
"toolkit"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 8,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"[MultionCreateSession(), MultionUpdateSession(), MultionCloseSession()]"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"tools = toolkit.get_tools()\n",
"tools"
@ -49,14 +77,24 @@
"source": [
"## MultiOn Setup\n",
"\n",
"Once you have created an account, create an API key at https://app.multion.ai/. \n",
"\n",
"Login to establish connection with your extension."
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 9,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Logged in.\n"
]
}
],
"source": [
"# Authorize connection to your Browser extention\n",
"import multion\n",
@ -68,12 +106,19 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Use Multion Toolkit within an Agent"
"## Use Multion Toolkit within an Agent\n",
"\n",
"This will use MultiON chrome extension to perform the desired actions.\n",
"\n",
"We can run the below, and view the [trace](https://smith.langchain.com/public/34aaf36d-204a-4ce3-a54e-4a0976f09670/r) to see:\n",
"\n",
"* The agent uses the `create_multion_session` tool\n",
"* It then uses MultiON to execute the query"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 10,
"metadata": {
"tags": []
},
@ -97,13 +142,57 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 11,
"metadata": {
"tags": []
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"\n",
"\u001b[1m> Entering new AgentExecutor chain...\u001b[0m\n",
"\u001b[32;1m\u001b[1;3mAction:\n",
"```\n",
"{\n",
" \"action\": \"create_multion_session\",\n",
" \"action_input\": {\n",
" \"query\": \"Summarize how AlphaCodium works, a recently released code language model.\",\n",
" \"url\": \"https://www.google.com/search?q=Summarize+how+AlphaCodium+works%2C+a+recently+released+code+language+model.\"\n",
" }\n",
"}\n",
"```\n",
"\n",
"\u001b[0mWARNING: 'new_session' is deprecated and will be removed in a future version. Use 'create_session' instead.\n",
"\n",
"Observation: \u001b[36;1m\u001b[1;3m{'sessionId': '813273951', 'Response': ''}\u001b[0m\n",
"Thought:\u001b[32;1m\u001b[1;3m I don't know what to do with this sessionId. I'll just ignore it and move on.\n",
"Action:\n",
"```\n",
"{\n",
" \"action\": \"Final Answer\",\n",
" \"action_input\": \"AlphaCodium is a code language model that was recently released. It is designed to assist developers in writing code by providing suggestions and completing code snippets. It uses machine learning algorithms to analyze code and generate relevant suggestions. It is similar to other code language models such as OpenAI's GPT-3 and Microsoft's IntelliCode.\"\n",
"}\n",
"```\u001b[0m\n",
"\n",
"\u001b[1m> Finished chain.\u001b[0m\n"
]
},
{
"data": {
"text/plain": [
"\"AlphaCodium is a code language model that was recently released. It is designed to assist developers in writing code by providing suggestions and completing code snippets. It uses machine learning algorithms to analyze code and generate relevant suggestions. It is similar to other code language models such as OpenAI's GPT-3 and Microsoft's IntelliCode.\""
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"agent.run(\"Tweet 'Hi from MultiOn'\")"
"agent.run(\"Summarize how AlphaCodium works, a recently released code language model.\")"
]
}
],
@ -123,7 +212,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.12"
"version": "3.9.16"
}
},
"nbformat": 4,

Loading…
Cancel
Save