{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "a2502a91", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[HumanMessage(content='Tell me the recent movies list in 2025', id='f421141e-8db1-4db4-9ebc-de1a46019386'), AIMessage(content='', additional_kwargs={'tool_calls': [{'id': 'call_lpcEZ355VWZjzZOOLsAF2zuA', 'function': {'arguments': '{\"query\":\"recent movies list 2025\"}', 'name': 'tavily_search_results_json'}, 'type': 'function'}]}, response_metadata={'token_usage': {'completion_tokens': 23, 'prompt_tokens': 91, 'total_tokens': 114, 'completion_tokens_details': {'accepted_prediction_tokens': 0, 'audio_tokens': 0, 'reasoning_tokens': 0, 'rejected_prediction_tokens': 0}, 'prompt_tokens_details': {'audio_tokens': 0, 'cached_tokens': 0}}, 'model_name': 'gpt-3.5-turbo-0125', 'system_fingerprint': None, 'finish_reason': 'tool_calls', 'logprobs': None}, id='run-ef6c1818-38b5-4fd4-9a25-ef82fbe61c05-0', tool_calls=[{'name': 'tavily_search_results_json', 'args': {'query': 'recent movies list 2025'}, 'id': 'call_lpcEZ355VWZjzZOOLsAF2zuA', 'type': 'tool_call'}], usage_metadata={'input_tokens': 91, 'output_tokens': 23, 'total_tokens': 114}), ToolMessage(content='[{\"url\": \"https://editorial.rottentomatoes.com/article/the-most-anticipated-movies-of-2025/\", \"content\": \"The Conjuring: Last Rites\\\\n(2025)\\\\n\\\\nRelease Date: September 5, 2025 \\\\nDirector: Michael Chaves \\\\nStarring: Vera Farmiga, Patrick Wilson, Ben Hardy\\\\n\\\\nThe Conjuring: Last Rites, will be the final chapter that centers paranormal experts Ed and Lorraine Warren. Both Patrick Wilson and Vera Farmiga are set to reprise their roles as the married couple, and they will be joined by a host of new cast members including X Men: Apocalypse’s Ben Hardy and Mia Tomlinson whose roles remain unknown. [...] The Lonely Island’s Akiva Schaffer brings back the bumbling detective Frank Drebin, originally played by Leslie Nielsen in the classic TV comedy Police Squad! and a trio of Naked Gun films from the late 1980s to mid-1990s. The man attempting to fill Nielsen’s shoes in the role? None other than Liam Neeson.\\\\n\\\\nFreakier Friday\\\\n(2025)\\\\n\\\\nFreakier Friday\\\\n(2025)\\\\n\\\\nRelease Date: August 8, 2025 \\\\nDirectors: Nisha Ganatra \\\\nStarring: Jamie Lee Curtis, Julia Butler, Chad Michael Murray [...] Good Fortune\\\\n(2025)\\\\n\\\\nGood Fortune\\\\n(2025)\\\\n\\\\nRelease Date: October 17, 2025 \\\\nDirectors: Aziz Ansari \\\\nStarring: Keanu Reeves, Keke Palmer, Seth Rogen\\\\n\\\\nAziz Ansari, known for Parks and Recreation and Master of None, has a new comedy on the horizon. The latest film follows the story of an angel who inhabits the body of a man’s boss to teach him a lesson. Cast members include Sandra Oh, Seth Rogen, Keanu Reeves as Ansari himself who will also serve as a producer on the film.\"}, {\"url\": \"https://variety.com/lists/best-movies-of-2025-so-far/\", \"content\": \"may all sound a bit overloaded, but “Bring Her Back” lurches forward with the warped psychedelic logic of a wounded dream. In their second feature, the Australian YouTube-horror-comedy-pranksters-turned-filmmakers Danny and Michael Philippou (“Talk to Me”) find terrifying ways to get under your skin, pushing everything to the brink of transgression, using domestic trauma to create a symphonic projection of Munchausen syndrome by proxy, all sealed by Hawkins’ gargoyle grin of evil. \\xad—OG [...] ## Mission: Impossible — The Final Reckoning\\\\n\\\\nMISSION: IMPOSSIBLE – THE FINAL RECKONING, (aka MISSION: IMPOSSIBLE 8), Tom Cruise, 2025. © Paramount Pictures / Courtesy Everett Collection\\\\nMISSION: IMPOSSIBLE – THE FINAL RECKONING, (aka MISSION: IMPOSSIBLE 8), Tom Cruise, 2025. © Paramount Pictures / Courtesy Everett Collection [...] intelligent and ruthlessly efficient thriller. Speaking of Bond, Pierce Brosnan pops up as the couple’s boss in a movie that delivers all the intrigue you’d expect from the genre, in addition to a perceptive case study on how successful marriages work: A little secrecy keeps things spicy, so long as both parties can fully trust one another. Violate that, and you stand to destroy not just the union, but the entire Western World. —Peter Debruge\"}, {\"url\": \"https://deadline.com/lists/2025-movies/\", \"content\": \"On the heels of a packed holiday box office at the end of 2024 that saw Wicked: Part One versus Gladiator II followed by Moana 2 ahead of Thanksgiving and then A Complete Unknown and Babygirl leading the Christmas Day releases, 2025 has its own stacked roster of big film titles. [...] The latest Disney live-action remake of a princess film, starring Rachel Zegler (The Ballad of Songbirds and Snakes, West Side Story), arrives in theaters March 21, 2025. Gal Gadot co-stars as the Evil Queen, and of course the seven dwarves Grumpy, Sneezy, Dopey, Sleepy, Happy, Bashful and Doc will be present as well.\\\\n\\\\nRELATED: ‘Snow White’ Trailer Features Gal Gadot’s Evil Queen, Rachel Zegler, The Seven Dwarfs & More [...] Starring Chris Pratt, Millie Bobby Brown and more, the latest film from the Russo brothers arrives on Netflix March 14, 2025. The film, written by Avengersscribes Christopher Markus & Stephen McFeely, is adapted from Simon Stålenhag’s illustrated novel, set in the 1990s where sentient robots live in exile after a failed uprising.\\\\n\\\\nRELATED: ‘The Electric State’ Trailer: Millie Bobby Brown, Chris Pratt, The Russos And Robots\"}]', name='tavily_search_results_json', id='5f046ab3-63fe-4fc0-bc31-50dc91b7eacc', tool_call_id='call_lpcEZ355VWZjzZOOLsAF2zuA'), AIMessage(content='Here are some of the recent movies in 2025:\\n\\n1. **The Conjuring: Last Rites**\\n - **Release Date:** September 5, 2025\\n - **Director:** Michael Chaves\\n - **Starring:** Vera Farmiga, Patrick Wilson, Ben Hardy\\n - **Description:** The final chapter in the series focusing on paranormal experts Ed and Lorraine Warren.\\n\\n2. **Freakier Friday**\\n - **Release Date:** August 8, 2025\\n - **Director:** Nisha Ganatra\\n - **Starring:** Jamie Lee Curtis, Julia Butler, Chad Michael Murray\\n - **Description:** A new twist on the classic \"Freaky Friday\" story.\\n\\n3. **Good Fortune**\\n - **Release Date:** October 17, 2025\\n - **Director:** Aziz Ansari\\n - **Starring:** Keanu Reeves, Keke Palmer, Seth Rogen\\n - **Description:** A comedy about an angel inhabiting a man\\'s boss to teach him a lesson.\\n\\n4. **Mission: Impossible — The Final Reckoning**\\n - **Description:** The eighth installment in the Mission: Impossible series.\\n\\n5. **Snow White**\\n - **Release Date:** March 21, 2025\\n - **Starring:** Rachel Zegler, Gal Gadot\\n - **Description:** A Disney live-action remake of the classic Snow White story.\\n\\n6. **The Electric State**\\n - **Release Date:** March 14, 2025\\n - **Starring:** Chris Pratt, Millie Bobby Brown\\n - **Description:** A film about sentient robots living in exile after a failed uprising.\\n\\nYou can find more details about these movies in the following links:\\n1. [Rotten Tomatoes - Most Anticipated Movies of 2025](https://editorial.rottentomatoes.com/article/the-most-anticipated-movies-of-2025/)\\n2. [Variety - Best Movies of 2025 So Far](https://variety.com/lists/best-movies-of-2025-so-far/)\\n3. [Deadline - 2025 Movies](https://deadline.com/lists/2025-movies/)', response_metadata={'token_usage': {'completion_tokens': 463, 'prompt_tokens': 1172, 'total_tokens': 1635, 'completion_tokens_details': {'accepted_prediction_tokens': 0, 'audio_tokens': 0, 'reasoning_tokens': 0, 'rejected_prediction_tokens': 0}, 'prompt_tokens_details': {'audio_tokens': 0, 'cached_tokens': 0}}, 'model_name': 'gpt-3.5-turbo-0125', 'system_fingerprint': None, 'finish_reason': 'stop', 'logprobs': None}, id='run-fc16df9c-a29e-4599-a1ad-463f749cc6ff-0', usage_metadata={'input_tokens': 1172, 'output_tokens': 463, 'total_tokens': 1635})]\n" ] } ], "source": [ "import os\n", "from dotenv import load_dotenv, find_dotenv\n", "_ = load_dotenv(find_dotenv())\n", "from langchain_openai import ChatOpenAI\n", "from langchain_community.tools.tavily_search import TavilySearchResults\n", "from langgraph.prebuilt import create_react_agent\n", "from langchain_core.messages import HumanMessage\n", "\n", "\n", "\n", "# Access the variables\n", "OPENAI_API_KEY = os.getenv('OPENAI_API_KEY')\n", "TAVILY_API_KEY = os.getenv('TAVILY_API_KEY')\n", "\n", "os.environ[\"OPENAI_API_KEY\"] = OPENAI_API_KEY\n", "os.environ[\"TAVILY_API_KEY\"] = TAVILY_API_KEY\n", "\n", "\n", "chatModel = ChatOpenAI(model=\"gpt-3.5-turbo-0125\")\n", "search = TavilySearchResults(max_results=3)\n", "\n", "# res = search.invoke(\"Tell me the recent movies list in 2025\")\n", "# print(res)\n", "\n", "tool = [search]\n", "\n", "agent_executor = create_react_agent(chatModel, tool)\n", "\n", "\n", "response = agent_executor.invoke({\"messages\": [HumanMessage(content=\"Tell me the recent movies list in 2025\")]})\n", "\n", "print(response['messages'])" ] }, { "cell_type": "code", "execution_count": null, "id": "c254fccd", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "eaa961c4", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "llmapp", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.13" } }, "nbformat": 4, "nbformat_minor": 5 }