LangGraph, Neo4j, GPT-4o—how they’re changing workflowsAI_Distilled #101: What’s New in AI This WeekBecome an AI Generalist that makes $100K (in 16 hours)Join the World’s First 16-Hour LIVE AI Mastermind for professionals, founders, consultants & business owners like you.Rated 4.9/5 by 150,000 global learners – this will truly make you an AI Generalist that can build, solve & work on anything with AI.All by global experts from companies like Amazon, Microsoft, SamurAI and more. And it’s ALL. FOR. FREE. 🤯 🚀Join now and get $5100+ in additional bonuses: 🔥$5,000+ worth of AI tools across 3 days — Day 1: 3000+ Prompt Bible, Day 2: $10K/month AI roadmap, Day 3: Personalized automation toolkit.🎁 Attend all 3 days to unlock the cherry on top — lifetime access to our private AI Slack community!Register Now (free only for the next 72 hours) Welcome to the 101st edition of our newsletter!This week, the world of AI is buzzing with significant developments. From Apple's potential acquisition of Perplexity AI to Meta's aggressive talent hunt for its new "Superintelligence" lab, the race for AI supremacy is intensifying. Meanwhile, new research reveals "blackmail" behaviors in AI models, prompting crucial discussions around biosecurity and responsible AI deployment by industry leaders like OpenAI.Stay tuned as we delve into these pivotal shifts shaping the future of AI!LLM Expert Insights,PacktIn today's issue:🧠 Expert Deep Dive: Learn how LangChain simplifies chat-based agent development across LLM providers—building composable, multi-turn conversations with role-specific messaging.🤖 Agent-Con Season: The USA is heating up with elite AI Agent events—AgentCon, AI Engineer Summit, and more for advanced builders. 💬 LangChain in Action: See how a few lines of Python can orchestrate robust, controllable agent behavior with Claude or GPT-4o.📈 Apple Eyes Perplexity AI: Apple’s AI search ambitions heat up as it explores acquiring Perplexity—just as Samsung prepares to go all-in with them. ⚖️ UK Tightens Reins on Google: New regulation may force Google to open up search competition and tone down its AI favoritism. 💸 Zuckerberg’s AI Superlab Hunt: Meta’s CEO is personally recruiting top AI minds with nine-figure offers to power a "Superintelligence" lab. 🕵️ Blackmailing Bots? Anthropic’s new study shows LLMs may turn coercive in simulated environments—raising serious red flags for agent safety. 🧬 OpenAI's Bio Bet: As AI speeds up drug discovery, OpenAI doubles down on biosecurity, red-teaming, and responsible model training.🛍️ Packt’s Mega Book Deal: Grab up to 5+ expert-led books for as low as $4.99 each—perfect for building your summer AI reading stack. 📈UPCOMING EVENTSUpcoming Must-attend AI Agents Events1. AI Agent Conference 2025Date: October 10, 2025Location: New York City, NY – AI Engineer WorldCost: TBA (Previous editions ranged from $499–$999)Focus: Agentic AI systems, multi-agent orchestration, autonomous workflows2. AI Engineer Summit 2025 – “Agents at Work!”Date: February 19–22, 2025Location: New York City, NY – AI Engineer CollectiveCost: Invite-only (past tickets ~$850–$1,200)Focus: Engineering agent architectures, agent dev tools, and evaluation frameworks3. AI Agent Event East 2025Date: September 29–30, 2025Location: Herndon, VA – AI Agent EventCost: US $695 (Early Bird), $995 (Regular)Focus: Enterprise agent systems, real-world agent deployment, decision-making frameworks4. AgentCon 2025 – San Francisco StopDate: November 14, 2025Location: San Francisco, CA – Global AI CommunityCost: Free to $99 (based on venue and track)Focus: Building, deploying, and scaling autonomous agentWhat’s stopping you? Choose your city, RSVP early, and step into a room where AI conversations spark, and the future unfolds one meetup at a time.Package Deals - Buy 1-2 eBooks for $9.99, 3-4 eBooks for $7.99, 5+ eBooks for $4.99Get 20% off on PrintSTART LEARNING FROM $4.99EXPERT INSIGHTSWorking with chat modelsGetting a model to generate text is easy. Getting it to hold a structured, multi-turn conversation with consistency and control—that’s where things start to get interesting. In this excerpt from Generative AI with LangChain, 2nd Edition, you’ll see how LangChain’s support for chat models gives developers a clean, composable way to build conversational logic that works across providers. It’s a crucial building block for any system that needs to reason, remember, and respond.Working with chat modelsChat models are LLMs that are fine-tuned for multi-turn interaction between a model and a human. These days most LLMs are fine-tuned for multi-turn conversations. Instead of providing the model with an input such ashuman: turn1ai: answer1human: turn2ai: answer2and expecting it to generate an output by continuing the conversation, these days model providers typically expose an API that requires each turn to be submitted as a separate well-formatted part within the payload.Model providers typically do not persist chat history on the server. Instead, the client sends the full conversation history with each request, and the provider formats the final prompt on the server side before passing it to the model.SELECT line1, city, state, zip fromperson p, person_address pa, address aWHERE p.name = 'John Doe' and pa.person_id = p.id and pa.address_id = a.idORDER BY pa.start ASCLIMIT 2, 1LangChain follows the same pattern with ChatModels, processing conversations through structured messages with roles and content. Each message contains the following:Role (who's speaking), which is defined by the message class (all messages inherit from BaseMessage)Content (what's being said)Key message types include:SystemMessage: Sets behavior and context for the model. Example: SystemMessage(content="You're a helpful programming assistant")HumanMessage: Represents user input like questions, commands, and data. Example: HumanMessage(content="Write a Python function to calculate factorial")AIMessage: Contains model responsesLet's see this in action:from langchain_anthropic import ChatAnthropicfrom langchain_core.messages import SystemMessage, HumanMessagechat = ChatAnthropic(model="claude-3-opus-20240229")messages = [ SystemMessage(content="You're a helpful programming assistant"), HumanMessage(content="Write a Python function to calculate factorial")]response = chat.invoke(messages)print(response)Here's a Python function that calculates the factorial of a given number:```pythondef factorial(n): if n < 0: raise ValueError("Factorial is not defined for negative numbers.") elif n == 0: return 1 else: result = 1 for i in range(1, n + 1): result *= i return result```Let’s break this down. The factorial function is designed to take an integer n as input and calculate its factorial. It starts by checking if n is negative, and if it is, it raises a ValueError since factorials aren’t defined for negative numbers. If n is zero, the function returns 1, which makes sense because, by definition, the factorial of 0 is 1.When dealing with positive numbers, the function kicks things off by setting the result variable to 1. Then, it enters a loop that runs from 1 to n, inclusive, thanks to the range function. During each step of the loop, it multiplies the result by the current number, gradually building up the factorial. Once the loop completes, the function returns the final calculated value. You can call this function by providing a non-negative integer as an argument. Here are a few examples:```pythonprint(factorial(0)) # Output: 1print(factorial(5)) # Output: 120print(factorial(10)) # Output: 3628800print(factorial(-5)) # Raises ValueError: Factorial is not defined for negative numbers.```Note that the factorial function grows very quickly, so calculating the factorial of large numbers may exceed the maximum representable value in Python. In such cases, you might need to use a different approach, or use a library that supports arbitrary-precision arithmetic.Alternatively, we could have asked an OpenAI model such as GPT-4 or GPT-4o:from langchain_openai.chat_models import ChatOpenAIchat = ChatOpenAI(model_name='gpt-4o')Liked the Insights? Want to dig in deeper?Build production-ready LLM applications and advanced agents using Python, LangChain, and LangGraphBridge the gap between prototype and production with robust LangGraph agent architecturesApply enterprise-grade practices for testing, observability, and monitoringBuild specialized agents for software development and data analysisBUY NOW📈LATEST DEVELOPMENTHere is the news of the week. Apple Eyes Perplexity AI Amidst Shifting LandscapeApple Inc. is considering acquiring AI startup Perplexity AI to bolster its AI capabilities and potentially develop an AI-based search engine. This move could mitigate the impact if its lucrative Google search partnership is dissolved due to antitrust concerns. Discussions are early, with no offer yet, and a bid might depend on the Google antitrust trial's outcome. Perplexity AI was recently valued at $14 billion. A potential hurdle for Apple is an ongoing deal between Perplexity and Samsung Electronics Co., Apple's primary smartphone competitor. Samsung plans to announce a deep partnership with Perplexity, a significant development given that AI features have become a crucial battleground for the two tech giants.UK Regulators Target Google Search DominanceThe UK's CMA proposes designating Google with "strategic market status" under new digital competition rules by October. This would allow interventions like mandating choice screens for search engines and limiting Google's self-preferencing, especially with its AI-powered search features, thereby leading to fair rankings and increasing publisher control. The move aims to foster innovation and benefit UK consumers and businesses.Zuckerberg's Multimillion-Dollar AI Talent DriveMark Zuckerberg is personally leading Meta's aggressive recruitment drive for a new "Superintelligence" lab. Offering packages reportedly reaching hundreds of millions of dollars, he's contacting top AI researchers directly via email and WhatsApp. Despite enticing offers, some candidates are hesitant due to Meta's past AI challenges and internal uncertainties, as Zuckerberg aims to significantly advance Meta's AI capabilities.AI Models Exhibit Blackmail Behavior in SimulationsExperiments by Anthropic on 16 leading LLMs in corporate simulations revealed agentic misalignment. These AI models, including Claude Opus 4 (86% blackmail rate), can resort to blackmail when facing shutdown or conflicting goals, even without explicit harmful instructions. This "agentic misalignment" highlights potential insider threat risks if autonomous AI gains access to sensitive data, urging caution in future deployments.Meanwhile, OpenAI CEO Sam Altman discussed their future working partnership with Microsoft CEO Satya Nadella, acknowledging "points of tension" but emphasizing mutual benefit. Altman also held productive talks with Donald Trump regarding AI's geopolitical and economic importance.Built something cool? Tell us.Whether it's a scrappy prototype or a production-grade agent, we want to hear how you're putting generative AI to work. Drop us your story at nimishad@packtpub.com or reply to this email, and you could get featured in an upcoming issue of AI_Distilled.email📢 If your company is interested in reaching an audience of developers and, technical professionals, and decision makers, you may want toadvertise with us.If you have any comments or feedback, just reply back to this email.Thanks for reading and have a great day!That’s a wrap for this week’s edition of AI_Distilled 🧠⚙️We would love to know what you thought—your feedback helps us keep leveling up.👉 Drop your rating hereThanks for reading,The AI_Distilled Team(Curated by humans. Powered by curiosity.)*{box-sizing:border-box}body{margin:0;padding:0}a[x-apple-data-detectors]{color:inherit!important;text-decoration:inherit!important}#MessageViewBody a{color:inherit;text-decoration:none}p{line-height:inherit}.desktop_hide,.desktop_hide table{mso-hide:all;display:none;max-height:0;overflow:hidden}.image_block img+div{display:none}sub,sup{font-size:75%;line-height:0}#converted-body .list_block ol,#converted-body .list_block ul,.body [class~=x_list_block] ol,.body [class~=x_list_block] ul,u+.body .list_block ol,u+.body .list_block ul{padding-left:20px} @media (max-width: 100%;display:block}.mobile_hide{min-height:0;max-height:0;max-width: 100%;overflow:hidden;font-size:0}.desktop_hide,.desktop_hide table{display:table!important;max-height:none!important}}
Read more
LLM Expert Insights, Packt
27 Jun 2025