|
1 | 1 | { |
2 | 2 | "cells": [ |
| 3 | + { |
| 4 | + "metadata": {}, |
| 5 | + "cell_type": "markdown", |
| 6 | + "source": "### Building an Agentic RAG Workflow using Elasticsearch and LangChain", |
| 7 | + "id": "4f931c74dd212130" |
| 8 | + }, |
3 | 9 | { |
4 | 10 | "metadata": {}, |
5 | 11 | "cell_type": "markdown", |
6 | 12 | "source": "This notebook demonstrates a simple Agentic RAG workflow that uses Elasticsearch as the vector store and LangChain for orchestration. It accompanies the article \"Developing Adaptive Retrieval Workflows Using Elasticsearch and LangChain\" and showcases the core ideas discussed there. For a deeper explanation, please refer to the article.", |
7 | | - "id": "6652455987a6d84d" |
| 13 | + "id": "a01126d74984e99d" |
8 | 14 | }, |
9 | 15 | { |
10 | 16 | "metadata": {}, |
|
197 | 203 | "name": "stderr", |
198 | 204 | "output_type": "stream", |
199 | 205 | "text": [ |
200 | | - "\u001b[32m2025-11-06 10:05:52.472\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36m__main__\u001b[0m:\u001b[36minstall_elser\u001b[0m:\u001b[36m22\u001b[0m - \u001b[1m\".elser_model_2\" model is ready\u001b[0m\n" |
| 206 | + "\u001B[32m2025-11-06 10:05:52.472\u001B[0m | \u001B[1mINFO \u001B[0m | \u001B[36m__main__\u001B[0m:\u001B[36minstall_elser\u001B[0m:\u001B[36m22\u001B[0m - \u001B[1m\".elser_model_2\" model is ready\u001B[0m\n" |
201 | 207 | ] |
202 | 208 | } |
203 | 209 | ], |
|
672 | 678 | "name": "stderr", |
673 | 679 | "output_type": "stream", |
674 | 680 | "text": [ |
675 | | - "\u001b[32m2025-11-06 10:30:53.873\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36m__main__\u001b[0m:\u001b[36mrouter\u001b[0m:\u001b[36m11\u001b[0m - \u001b[1mRouter selected the datasource: websearch\u001b[0m\n", |
676 | | - "\u001b[32m2025-11-06 10:30:53.874\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36m__main__\u001b[0m:\u001b[36mrouter\u001b[0m:\u001b[36m12\u001b[0m - \u001b[1mUser query: What are the latest AI models released this month?\u001b[0m\n" |
| 681 | + "\u001B[32m2025-11-06 10:30:53.873\u001B[0m | \u001B[1mINFO \u001B[0m | \u001B[36m__main__\u001B[0m:\u001B[36mrouter\u001B[0m:\u001B[36m11\u001B[0m - \u001B[1mRouter selected the datasource: websearch\u001B[0m\n", |
| 682 | + "\u001B[32m2025-11-06 10:30:53.874\u001B[0m | \u001B[1mINFO \u001B[0m | \u001B[36m__main__\u001B[0m:\u001B[36mrouter\u001B[0m:\u001B[36m12\u001B[0m - \u001B[1mUser query: What are the latest AI models released this month?\u001B[0m\n" |
677 | 683 | ] |
678 | 684 | }, |
679 | 685 | { |
680 | 686 | "name": "stdout", |
681 | 687 | "output_type": "stream", |
682 | 688 | "text": [ |
683 | | - "\u001b[32;1m\u001b[1;3mWhat Is The Best AI Model In September 2025? Ultimate Comparison The five most powerful AI companies have now unveiled their flagship models , creating what might be the most intense competition we've seen in artificial intelligence development. OpenAI dropped GPT-5 in early August 2025, while Anthropic released Claude Opus 4.1 just days earlier. Here's what I've learned after testing every major AI release this month : The real question isn't about keeping up with every shiny new model . It's about how to use AI tools responsibly while they rapidly evolve around us. Missed the latest AI news? From ChatGPT upgrades to Google's new tools, here are 7 big AI updates you need to know about this week. To fully meet our goals, MAI requires purpose-built models . Today, we're excited to preview the first steps to making this a reality. First, we're releasing MAI-Voice-1, our first highly expressive and natural speech generation model , which is available in Copilot Daily and Podcasts, and as a brand new Copilot Labs experience to try out here. Anthropic has unveiled its latest AI models , Claude Opus 4 and Claude Sonnet 4, marking a significant advancement in the field of artificial intelligence. Claude Opus 4 stands out as Anthropic's most powerful model to date, excelling in complex coding tasks and long-duration problem-solving.\u001b[0m" |
| 689 | + "\u001B[32;1m\u001B[1;3mWhat Is The Best AI Model In September 2025? Ultimate Comparison The five most powerful AI companies have now unveiled their flagship models , creating what might be the most intense competition we've seen in artificial intelligence development. OpenAI dropped GPT-5 in early August 2025, while Anthropic released Claude Opus 4.1 just days earlier. Here's what I've learned after testing every major AI release this month : The real question isn't about keeping up with every shiny new model . It's about how to use AI tools responsibly while they rapidly evolve around us. Missed the latest AI news? From ChatGPT upgrades to Google's new tools, here are 7 big AI updates you need to know about this week. To fully meet our goals, MAI requires purpose-built models . Today, we're excited to preview the first steps to making this a reality. First, we're releasing MAI-Voice-1, our first highly expressive and natural speech generation model , which is available in Copilot Daily and Podcasts, and as a brand new Copilot Labs experience to try out here. Anthropic has unveiled its latest AI models , Claude Opus 4 and Claude Sonnet 4, marking a significant advancement in the field of artificial intelligence. Claude Opus 4 stands out as Anthropic's most powerful model to date, excelling in complex coding tasks and long-duration problem-solving.\u001B[0m" |
684 | 690 | ] |
685 | 691 | }, |
686 | 692 | { |
687 | 693 | "name": "stderr", |
688 | 694 | "output_type": "stream", |
689 | 695 | "text": [ |
690 | | - "\u001b[32m2025-11-06 10:30:58.545\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36m__main__\u001b[0m:\u001b[36mself_reflection\u001b[0m:\u001b[36m29\u001b[0m - \u001b[1mSelf-reflection passed — binary_score=True\u001b[0m\n", |
691 | | - "\u001b[32m2025-11-06 10:31:00.390\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36m__main__\u001b[0m:\u001b[36m<module>\u001b[0m:\u001b[36m2\u001b[0m - \u001b[1m\n", |
| 696 | + "\u001B[32m2025-11-06 10:30:58.545\u001B[0m | \u001B[1mINFO \u001B[0m | \u001B[36m__main__\u001B[0m:\u001B[36mself_reflection\u001B[0m:\u001B[36m29\u001B[0m - \u001B[1mSelf-reflection passed — binary_score=True\u001B[0m\n", |
| 697 | + "\u001B[32m2025-11-06 10:31:00.390\u001B[0m | \u001B[1mINFO \u001B[0m | \u001B[36m__main__\u001B[0m:\u001B[36m<module>\u001B[0m:\u001B[36m2\u001B[0m - \u001B[1m\n", |
692 | 698 | "Final Summary:\n", |
693 | | - ": The latest AI models released this month include OpenAI's GPT-5, launched in early August 2025, and Anthropic's Claude Opus 4.1, alongside Claude Opus 4 and Claude Sonnet 4, which feature advanced capabilities in coding and long-duration problem-solving. Additionally, MAI unveiled MAI-Voice-1, a highly expressive speech generation model, now available in Copilot applications. These releases mark significant advancements from leading AI companies.\u001b[0m\n" |
| 699 | + ": The latest AI models released this month include OpenAI's GPT-5, launched in early August 2025, and Anthropic's Claude Opus 4.1, alongside Claude Opus 4 and Claude Sonnet 4, which feature advanced capabilities in coding and long-duration problem-solving. Additionally, MAI unveiled MAI-Voice-1, a highly expressive speech generation model, now available in Copilot applications. These releases mark significant advancements from leading AI companies.\u001B[0m\n" |
694 | 700 | ] |
695 | 701 | } |
696 | 702 | ], |
|
714 | 720 | "name": "stderr", |
715 | 721 | "output_type": "stream", |
716 | 722 | "text": [ |
717 | | - "\u001b[32m2025-11-06 10:29:14.260\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36m__main__\u001b[0m:\u001b[36mrouter\u001b[0m:\u001b[36m11\u001b[0m - \u001b[1mRouter selected the datasource: vectorstore\u001b[0m\n", |
718 | | - "\u001b[32m2025-11-06 10:29:14.261\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36m__main__\u001b[0m:\u001b[36mrouter\u001b[0m:\u001b[36m12\u001b[0m - \u001b[1mUser query: What technological innovations are discussed in Sci/Tech news?\u001b[0m\n", |
| 723 | + "\u001B[32m2025-11-06 10:29:14.260\u001B[0m | \u001B[1mINFO \u001B[0m | \u001B[36m__main__\u001B[0m:\u001B[36mrouter\u001B[0m:\u001B[36m11\u001B[0m - \u001B[1mRouter selected the datasource: vectorstore\u001B[0m\n", |
| 724 | + "\u001B[32m2025-11-06 10:29:14.261\u001B[0m | \u001B[1mINFO \u001B[0m | \u001B[36m__main__\u001B[0m:\u001B[36mrouter\u001B[0m:\u001B[36m12\u001B[0m - \u001B[1mUser query: What technological innovations are discussed in Sci/Tech news?\u001B[0m\n", |
719 | 725 | "/Users/kirtisodhi/Library/Python/3.9/lib/python/site-packages/langchain_elasticsearch/_sync/vectorstores.py:530: ElasticsearchWarning: text_expansion is deprecated. Use sparse_vector instead.\n", |
720 | 726 | " hits = self._store.search(\n", |
721 | | - "\u001b[32m2025-11-06 10:29:14.771\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36m__main__\u001b[0m:\u001b[36mself_reflection\u001b[0m:\u001b[36m29\u001b[0m - \u001b[1mSelf-reflection passed — binary_score=True\u001b[0m\n", |
722 | | - "\u001b[32m2025-11-06 10:29:16.247\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36m__main__\u001b[0m:\u001b[36m<module>\u001b[0m:\u001b[36m2\u001b[0m - \u001b[1m\n", |
| 727 | + "\u001B[32m2025-11-06 10:29:14.771\u001B[0m | \u001B[1mINFO \u001B[0m | \u001B[36m__main__\u001B[0m:\u001B[36mself_reflection\u001B[0m:\u001B[36m29\u001B[0m - \u001B[1mSelf-reflection passed — binary_score=True\u001B[0m\n", |
| 728 | + "\u001B[32m2025-11-06 10:29:16.247\u001B[0m | \u001B[1mINFO \u001B[0m | \u001B[36m__main__\u001B[0m:\u001B[36m<module>\u001B[0m:\u001B[36m2\u001B[0m - \u001B[1m\n", |
723 | 729 | "Final Summary:\n", |
724 | | - ": Recent Sci/Tech news highlights several technological innovations: NASA is developing a cutting-edge Linux-based supercomputer to support researchers and shuttle engineers; a company has achieved cat cloning through chromatin transfer technology; Princeton University scientists report that current technologies can be implemented immediately to stabilize global warming for the next 50 years; and a set of innovative GameBoy mini-games has won a prize for game design.\u001b[0m\n" |
| 730 | + ": Recent Sci/Tech news highlights several technological innovations: NASA is developing a cutting-edge Linux-based supercomputer to support researchers and shuttle engineers; a company has achieved cat cloning through chromatin transfer technology; Princeton University scientists report that current technologies can be implemented immediately to stabilize global warming for the next 50 years; and a set of innovative GameBoy mini-games has won a prize for game design.\u001B[0m\n" |
725 | 731 | ] |
726 | 732 | } |
727 | 733 | ], |
|
745 | 751 | "name": "stderr", |
746 | 752 | "output_type": "stream", |
747 | 753 | "text": [ |
748 | | - "\u001b[32m2025-11-06 10:29:38.534\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36m__main__\u001b[0m:\u001b[36mrouter\u001b[0m:\u001b[36m11\u001b[0m - \u001b[1mRouter selected the datasource: composite\u001b[0m\n", |
749 | | - "\u001b[32m2025-11-06 10:29:38.535\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36m__main__\u001b[0m:\u001b[36mrouter\u001b[0m:\u001b[36m12\u001b[0m - \u001b[1mUser query: Compare a Sci/Tech article from the dataset with a current web article about AI trends.\u001b[0m\n", |
| 754 | + "\u001B[32m2025-11-06 10:29:38.534\u001B[0m | \u001B[1mINFO \u001B[0m | \u001B[36m__main__\u001B[0m:\u001B[36mrouter\u001B[0m:\u001B[36m11\u001B[0m - \u001B[1mRouter selected the datasource: composite\u001B[0m\n", |
| 755 | + "\u001B[32m2025-11-06 10:29:38.535\u001B[0m | \u001B[1mINFO \u001B[0m | \u001B[36m__main__\u001B[0m:\u001B[36mrouter\u001B[0m:\u001B[36m12\u001B[0m - \u001B[1mUser query: Compare a Sci/Tech article from the dataset with a current web article about AI trends.\u001B[0m\n", |
750 | 756 | "/Users/kirtisodhi/Library/Python/3.9/lib/python/site-packages/langchain_elasticsearch/_sync/vectorstores.py:530: ElasticsearchWarning: text_expansion is deprecated. Use sparse_vector instead.\n", |
751 | 757 | " hits = self._store.search(\n" |
752 | 758 | ] |
|
755 | 761 | "name": "stdout", |
756 | 762 | "output_type": "stream", |
757 | 763 | "text": [ |
758 | | - "\u001b[32;1m\u001b[1;3m3 days ago - In the late 2010s, graphics processing ... large-scale (commercial and academic) machine learning models' training. Specialized programming languages such as Prolog were used in early AI research, but general-purpose programming languages like Python have become predominant. The transistor density in integrated circuits has been observed to roughly double every 18 months—a trend known as Moore's ... May 1, 2025 - Models with advanced reasoning capabilities, like OpenAI o1, can already solve complex problems with logical steps that are similar to how humans think before responding to difficult questions. These capabilities will continue to be useful in fields like science, coding, math, law and medicine, allowing models to compare contracts, generate code and execute multistep workflows. 2 days ago - In any given business function, no more than 10 percent of respondents say their organizations are scaling AI agents (Exhibit 2). Looking at individual business functions, agent use is most commonly reported in IT and knowledge management, where agentic use cases such as service-desk management in IT and deep research in knowledge management have quickly developed. By industry, the use of AI agents is most widely reported in the technology, media and telecommunications, and healthcare sectors (Exhibit 3). 1 month ago - North America, which includes the U.S. and Canada, is the market leader . In 2023, it captured 38.9% of the global AI market, which was about $97.25 billion in revenue. ... China has a much higher active adoption rate. March 4, 2025 - AI Statistics explores the latest trends in artificial intelligence (AI). Gain insights into adoption rates, AI jobs, and applications.\u001b[0m" |
| 764 | + "\u001B[32;1m\u001B[1;3m3 days ago - In the late 2010s, graphics processing ... large-scale (commercial and academic) machine learning models' training. Specialized programming languages such as Prolog were used in early AI research, but general-purpose programming languages like Python have become predominant. The transistor density in integrated circuits has been observed to roughly double every 18 months—a trend known as Moore's ... May 1, 2025 - Models with advanced reasoning capabilities, like OpenAI o1, can already solve complex problems with logical steps that are similar to how humans think before responding to difficult questions. These capabilities will continue to be useful in fields like science, coding, math, law and medicine, allowing models to compare contracts, generate code and execute multistep workflows. 2 days ago - In any given business function, no more than 10 percent of respondents say their organizations are scaling AI agents (Exhibit 2). Looking at individual business functions, agent use is most commonly reported in IT and knowledge management, where agentic use cases such as service-desk management in IT and deep research in knowledge management have quickly developed. By industry, the use of AI agents is most widely reported in the technology, media and telecommunications, and healthcare sectors (Exhibit 3). 1 month ago - North America, which includes the U.S. and Canada, is the market leader . In 2023, it captured 38.9% of the global AI market, which was about $97.25 billion in revenue. ... China has a much higher active adoption rate. March 4, 2025 - AI Statistics explores the latest trends in artificial intelligence (AI). Gain insights into adoption rates, AI jobs, and applications.\u001B[0m" |
759 | 765 | ] |
760 | 766 | }, |
761 | 767 | { |
762 | 768 | "name": "stderr", |
763 | 769 | "output_type": "stream", |
764 | 770 | "text": [ |
765 | | - "\u001b[32m2025-11-06 10:29:40.618\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36m__main__\u001b[0m:\u001b[36mself_reflection\u001b[0m:\u001b[36m29\u001b[0m - \u001b[1mSelf-reflection passed — binary_score=True\u001b[0m\n", |
766 | | - "\u001b[32m2025-11-06 10:29:42.894\u001b[0m | \u001b[1mINFO \u001b[0m | \u001b[36m__main__\u001b[0m:\u001b[36m<module>\u001b[0m:\u001b[36m2\u001b[0m - \u001b[1m\n", |
| 771 | + "\u001B[32m2025-11-06 10:29:40.618\u001B[0m | \u001B[1mINFO \u001B[0m | \u001B[36m__main__\u001B[0m:\u001B[36mself_reflection\u001B[0m:\u001B[36m29\u001B[0m - \u001B[1mSelf-reflection passed — binary_score=True\u001B[0m\n", |
| 772 | + "\u001B[32m2025-11-06 10:29:42.894\u001B[0m | \u001B[1mINFO \u001B[0m | \u001B[36m__main__\u001B[0m:\u001B[36m<module>\u001B[0m:\u001B[36m2\u001B[0m - \u001B[1m\n", |
767 | 773 | "Final Summary:\n", |
768 | 774 | ": The Sci/Tech article from the dataset highlights NASA's development of advanced AI for planetary rovers, aiming to make them more autonomous and capable of making mission-critical decisions independently. This reflects a trend towards specialized AI applications in science and exploration.\n", |
769 | 775 | "\n", |
770 | 776 | "Compared to current web articles on AI trends, the broader industry focus is on scaling AI models and agents across various sectors, especially in IT, healthcare, and knowledge management. Recent models like OpenAI o1 showcase advanced reasoning, supporting complex tasks in coding, law, and medicine. While organizations are experimenting with AI agents, widespread deployment is still limited. The global AI market continues to grow, with North America as a leader and China rapidly adopting AI solutions.\n", |
771 | 777 | "\n", |
772 | | - "In summary, while NASA’s AI efforts demonstrate specialized, mission-focused intelligence in robotics, current AI trends emphasize the expansion of advanced, general-purpose AI agents across industries to boost productivity and handle complex workflows. Both reflect ongoing technical progress and increasing real-world impact of artificial intelligence.\u001b[0m\n" |
| 778 | + "In summary, while NASA’s AI efforts demonstrate specialized, mission-focused intelligence in robotics, current AI trends emphasize the expansion of advanced, general-purpose AI agents across industries to boost productivity and handle complex workflows. Both reflect ongoing technical progress and increasing real-world impact of artificial intelligence.\u001B[0m\n" |
773 | 779 | ] |
774 | 780 | } |
775 | 781 | ], |
|
0 commit comments