diff --git a/docs/docs/integrations/tools/steam.ipynb b/docs/docs/integrations/tools/steam.ipynb index d6af64660c6..16390622c48 100644 --- a/docs/docs/integrations/tools/steam.ipynb +++ b/docs/docs/integrations/tools/steam.ipynb @@ -30,11 +30,19 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Note: you may need to restart the kernel to use updated packages.\n" + ] + } + ], "source": [ - "%pip install --upgrade --quiet python-steam-api python-decouple" + "%pip install --upgrade --quiet python-steam-api python-decouple steamspypi" ] }, { @@ -48,15 +56,15 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "import os\n", "\n", - "os.environ[\"STEAM_KEY\"] = \"xyz\"\n", - "os.environ[\"STEAM_ID\"] = \"123\"\n", - "os.environ[\"OPENAI_API_KEY\"] = \"abc\"" + "os.environ[\"STEAM_KEY\"] = \"\"\n", + "os.environ[\"STEAM_ID\"] = \"\"\n", + "os.environ[\"OPENAI_API_KEY\"] = \"\"" ] }, { @@ -70,63 +78,83 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 3, "metadata": {}, "outputs": [], "source": [ - "from langchain.agents import AgentType, initialize_agent\n", "from langchain_community.agent_toolkits.steam.toolkit import SteamToolkit\n", "from langchain_community.utilities.steam import SteamWebAPIWrapper\n", - "from langchain_openai import OpenAI" + "\n", + "steam = SteamWebAPIWrapper()\n", + "tools = [steam.run]" ] }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 4, "metadata": {}, "outputs": [], "source": [ - "llm = OpenAI(temperature=0)\n", - "Steam = SteamWebAPIWrapper()\n", - "toolkit = SteamToolkit.from_steam_api_wrapper(Steam)\n", - "agent = initialize_agent(\n", - " toolkit.get_tools(), llm, agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION, verbose=True\n", - ")" + "from langgraph.prebuilt import create_react_agent\n", + "\n", + "agent = create_react_agent(\"openai:gpt-4.1-mini\", tools)" ] }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ + "================================\u001b[1m Human Message \u001b[0m=================================\n", "\n", + "can you give the information about the game Terraria?\n", + "==================================\u001b[1m Ai Message \u001b[0m==================================\n", + "Tool Calls:\n", + " run (call_6vHAXSIL2MPugXxlv5uyf9Xk)\n", + " Call ID: call_6vHAXSIL2MPugXxlv5uyf9Xk\n", + " Args:\n", + " mode: get_games_details\n", + " game: Terraria\n", + "=================================\u001b[1m Tool Message \u001b[0m=================================\n", + "Name: run\n", "\n", - "\u001b[1m> Entering new AgentExecutor chain...\u001b[0m\n", - "\u001b[32;1m\u001b[1;3m I need to find the game details\n", - "Action: Get Games Details\n", - "Action Input: Terraria\u001b[0m\n", - "Observation: \u001b[36;1m\u001b[1;3mThe id is: 105600\n", + "The id is: [105600]\n", "The link is: https://store.steampowered.com/app/105600/Terraria/?snr=1_7_15__13\n", "The price is: $9.99\n", "The summary of the game is: Dig, Fight, Explore, Build: The very world is at your fingertips as you fight for survival, fortune, and glory. Will you delve deep into cavernous expanses in search of treasure and raw materials with which to craft ever-evolving gear, machinery, and aesthetics? Perhaps you will choose instead to seek out ever-greater foes to test your mettle in combat? Maybe you will decide to construct your own city to house the host of mysterious allies you may encounter along your travels? In the World of Terraria, the choice is yours!Blending elements of classic action games with the freedom of sandbox-style creativity, Terraria is a unique gaming experience where both the journey and the destination are completely in the player’s control. The Terraria adventure is truly as unique as the players themselves! Are you up for the monumental task of exploring, creating, and defending a world of your own? Key features: Sandbox Play Randomly generated worlds Free Content Updates \n", "The supported languages of the game are: English, French, Italian, German, Spanish - Spain, Polish, Portuguese - Brazil, Russian, Simplified Chinese\n", - "\u001b[0m\n", - "Thought:\u001b[32;1m\u001b[1;3m I now know the final answer\n", - "Final Answer: Terraria is a game with an id of 105600, a link of https://store.steampowered.com/app/105600/Terraria/?snr=1_7_15__13, a price of $9.99, a summary of \"Dig, Fight, Explore, Build: The very world is at your fingertips as you fight for survival, fortune, and glory. Will you delve deep into cavernous expanses in search of treasure and raw materials with which to craft ever-evolving gear, machinery, and aesthetics? Perhaps you will choose instead to seek out ever-greater foes to test your mettle in combat? Maybe you will decide to construct your own city to house the host of mysterious allies you may encounter along your travels? In the World of Terraria, the choice is yours!Blending elements of classic action games with the freedom of sandbox-style creativity, Terraria is a unique gaming experience where both the journey and the destination are completely in the player’s control. The Terraria adventure is truly as unique as the players themselves! Are you up for the monumental task of exploring, creating, and defending a\u001b[0m\n", "\n", - "\u001b[1m> Finished chain.\u001b[0m\n", - "{'input': 'can you give the information about the game Terraria', 'output': 'Terraria is a game with an id of 105600, a link of https://store.steampowered.com/app/105600/Terraria/?snr=1_7_15__13, a price of $9.99, a summary of \"Dig, Fight, Explore, Build: The very world is at your fingertips as you fight for survival, fortune, and glory. Will you delve deep into cavernous expanses in search of treasure and raw materials with which to craft ever-evolving gear, machinery, and aesthetics? Perhaps you will choose instead to seek out ever-greater foes to test your mettle in combat? Maybe you will decide to construct your own city to house the host of mysterious allies you may encounter along your travels? In the World of Terraria, the choice is yours!Blending elements of classic action games with the freedom of sandbox-style creativity, Terraria is a unique gaming experience where both the journey and the destination are completely in the player’s control. The Terraria adventure is truly as unique as the players themselves! Are you up for the monumental task of exploring, creating, and defending a'}\n" + "==================================\u001b[1m Ai Message \u001b[0m==================================\n", + "\n", + "Terraria is a game where you can dig, fight, explore, and build in a world that is totally at your fingertips. The game gives you the freedom to survive, seek fortune, and achieve glory. You can explore cavernous expanses in search of treasure and materials to craft various gear, machinery, and aesthetic items. Alternatively, you can challenge powerful foes or construct your own city to house mysterious allies you may encounter. The game blends classic action elements with sandbox-style creativity, offering a unique experience where your journey and destination are controlled by you.\n", + "\n", + "Key features of Terraria include sandbox play, randomly generated worlds, and free content updates.\n", + "\n", + "The game is priced at $9.99 and supports multiple languages including English, French, Italian, German, Spanish (Spain), Polish, Portuguese (Brazil), Russian, and Simplified Chinese.\n", + "\n", + "You can find more information and purchase it here: [Terraria on Steam](https://store.steampowered.com/app/105600/Terraria/?snr=1_7_15__13).\n" ] } ], "source": [ - "out = agent(\"can you give the information about the game Terraria\")\n", - "print(out)" + "events = agent.stream(\n", + " {\"messages\": [(\"user\", \"can you give the information about the game Terraria?\")]},\n", + " stream_mode=\"values\",\n", + ")\n", + "for event in events:\n", + " event[\"messages\"][-1].pretty_print()" ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": { @@ -145,7 +173,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.12" + "version": "3.12.4" } }, "nbformat": 4,