LangGraph 101: it's better than LangChain

2024 ж. 10 Мам.
31 064 Рет қаралды

LangGraph is a special LangChain-built library that builds intelligent AI Agents using graphs. Ie, agentic state machines. It allows us to build more powerful and flexible AI agents than what we can build using just the core library, LangChain.
In this video, we'll see how to build agents with LangGraph and OpenAI.
📌 Code:
github.com/pinecone-io/exampl...
🌲 Subscribe for Latest Articles and Videos:
www.pinecone.io/newsletter-si...
👋🏼 AI Consulting:
aurelio.ai
👾 Discord:
/ discord
Twitter: / jamescalam
LinkedIn: / jamescalam
#ai #langchain #artificialintelligence #nlp #chatbot #openai
00:00 Intro to LangGraph
00:52 Graphs in LangGraph
03:00 More Complex LangGraph Agent
08:12 LangGraph Graph State
14:00 LangGraph Agent Node
17:08 Forcing a Specific LLM Output
20:00 Building the Graph
23:23 Using our Agent Graph
28:32 LangGraph vs LangChain

Пікірлер
  • Hi James, thanks for the great content. I’m curious about why you went down the road of having the graph playing with the agent state and tools rather than just doing things directly in the langgraph nodes ? I’m seeing less and less examples from langchain using so called « agent » with langgraph and also tools, they only use it for Tavily because they have a langchain prebuilt tool, and i wonder what is your opinion on agents being soon obsolete ? And tools just used for built-in tools wrappers from langchain rather than custom tools

    @nelsonatp8957@nelsonatp895717 күн бұрын
  • Thank you for being thorough with very simple and less simple examples. It made it easy to understand and allowed me to run with the knowledge. 💜

    @irkedoff@irkedoff16 күн бұрын
  • We have this on 2x watchlist. Thanks for making this. Still getting our heads around graph vs chain.

    @getcoai@getcoai3 күн бұрын
  • Hi James, thanks for the content. I'm trying to use langgraph with Vertex AI with the Gemini-pro model. Do you have any suggestions on how to tackle this task? I'm trying to adapt the code you made.

    @victorsilva-jb2sf@victorsilva-jb2sf11 күн бұрын
  • I have been patiently waiting for your video on langgaraph James. Thanks😊

    @kubasmide223@kubasmide22318 күн бұрын
    • sorry for making you wait so long 😅

      @jamesbriggs@jamesbriggs18 күн бұрын
  • Great video James! Motivates me to learn more about langgraph now after hearing about it's release a few months back.

    @law_wu@law_wu15 күн бұрын
  • Thank you for the video. I have a question about how "query_agent_runnable" decide is an error message or not? What's the criteria of the decision?

    @stevechiou5760@stevechiou576011 күн бұрын
  • God bless your soul for doing this tutorial in Colab!! I'm using Crew AI in colab and my only hardware atm is a Ipad pro 2020 and a Samsung s23 ultra. Seriously: this is a boon for finding a solution for my...solution 💀

    @AndreiSheard@AndreiSheard3 күн бұрын
  • I agree Graphs are excellent choice for Agents and also good for the cost reduction policy. Langgraph is quite complex though. If you want to play with easier solution you can check autogen graph, it is (for now) more generic in use, at least for a fast prototyping.Thanks for this video.

    @maciejzieniewicz4301@maciejzieniewicz430116 күн бұрын
  • Question: If I have a data preprocessing agent that has access to around 20 preprocessing tools, what is the best way to go about executing them on a pandas data frame? Do I have the data frame in the State and then pass that input in the function? Does the agent need to have access to that data frame or can we abstract that?

    @lavamonkeymc@lavamonkeymc4 күн бұрын
  • i am really struggling to find a single example that doesn't use open ai function calling (llm.bind, convert_to_openai_ helper functions). can you PLEASE help me out. I specifically am looking for a single agent and multi agent architecture with detailed explanation on the state, interactions with runnables like chat history, geared towards RAG

    @imposternaruto@imposternaruto11 күн бұрын
  • Great content, as always. Very random note: ive been to bali so many times (i work in tech in Singapore) and id recognise a bali villa door handle anywhere! 😂😂😂 Enjoy!

    @justinhall4855@justinhall485517 күн бұрын
    • haha I am impressed

      @jamesbriggs@jamesbriggs16 күн бұрын
  • Does llama3 support these functional calling in LangGraph?

    @justdavebz@justdavebz9 күн бұрын
  • Can you use the OpenAI() API in LangGraph to specify Ollama models?

    @diegocalderon3221@diegocalderon3221Күн бұрын
  • my q now is: does it still make sense to learn (theory, modify existing apps, experiment with, write new apps with) langchain? or rather just ignore and just start w/ langgraph? from a beginner's perspective (no prior langchain exp). what's the recommendation and its justification?

    @themax2go@themax2go14 күн бұрын
  • This is very interesting. Is there a tool to reverse engineer this Agent solution ? Can Nodes and Edges be mathematically defined like a enforced index for a DB? Appreciate any feedback and Thank you for sharing.

    @SolidBuildersInc@SolidBuildersInc12 күн бұрын
  • Thanks for the video! As a noob, I’m lost between whether I should learn langgraph or autogen or agency swarm. I learned to use autogen but it seems to lack the minimum control I need to build something reliable. To learn everything…takes to much time for me as I’m totally new to the computer language, and want to build something that I need rather than learning the basics for multiple libraries. Will langgraph the go-to library for the time being? What would you recommend for people like me?

    @lLvupKitchen@lLvupKitchen9 күн бұрын
    • Don't forget CrewAI

      @RevMan001@RevMan0012 күн бұрын
  • thanks for this video ! not related to this but while using langchain agent where it is invoking a function which makes openai call as an api in django application getting timeout error in production env . any inputs on how this can be fixed

    @Windchimesandrain@Windchimesandrain18 күн бұрын
    • if you're streaming maybe you are not closing the stream correctly? Otherwise I'm not sure to be honest - it does sounds like a codebase-specific issue rather than any particular behavior exclusive to using django+openai api together

      @jamesbriggs@jamesbriggs18 күн бұрын
  • Someone may correct me but I think LangGraph's potential resides mainly in the cyclical graphs. For instance for making, self-reflective agent. When making Directed acyclic graph (DAG) pipelines (like you did), it's better to use chains (Langchain).

    @WhylerGame@WhylerGame11 күн бұрын
  • Nice video!" What do you think about DSPy? Do you think it makes langchain and similar obsolete?

    @andrewandreas5795@andrewandreas579518 күн бұрын
    • No they don't serve the same purpose

      @stephanembatchou5300@stephanembatchou530013 күн бұрын
  • Does ```@tool("final_answer") def final_answer_tool( answer: str, source: str ): """Returns a natural language response to the user in `answer`, and a `source` which provides citations for where this information came from. """ return ""``` help in parse my answer?. What if the client wants in some other format, how to use within LangGraph?

    @andy111007@andy11100714 күн бұрын
  • I like the additional flexibility of langchart. This is just crying out for a gui builder using Graphviz or tikzit - or more even node red. I can see an ecosystem growing around something like that with people submitting nodes and structures.

    @74Gee@74Gee17 күн бұрын
  • What do you think about Microsoft's Semantic Kernel and PromptFlow?

    @alivecoding4995@alivecoding499510 күн бұрын
  • James, have you already put any projects using LangChain into production in your consultancy? If so, was the experience positive?

    @matheusdonato6694@matheusdonato669417 күн бұрын
    • yes we've done a few - all good so far earlier langchain was troublesome, but most of the issues we had back then have been resolved (primarily stability + excessive dependencies)

      @jamesbriggs@jamesbriggs16 күн бұрын
  • Awesome! Also, what do you mean when you say that agents are the short-term future? What about the long term?

    @danielschoenbohm@danielschoenbohm18 күн бұрын
    • long term: en.wikipedia.org/wiki/The_Terminator

      @jamesbriggs@jamesbriggs18 күн бұрын
    • but fr, I have no idea on long term - I don't think it's possible to predict where things are going, so anything beyond the next 1-2 years (or even earlier) would be pure guesswork from me

      @jamesbriggs@jamesbriggs18 күн бұрын
    • AI is moving so fast, it's become impossible to follow

      @coinspeednews4703@coinspeednews470318 күн бұрын
    • @@jamesbriggs 🤣

      @danielschoenbohm@danielschoenbohm17 күн бұрын
    • ​@@jamesbriggs Yes I agree. I have no idea where things are headed, but one thing is certain: agents enable intelligence to act. What that will look like, I don't know. I'm also not sure if we'll call them "agents" in the future. My dad probably won't. :)

      @danielschoenbohm@danielschoenbohm17 күн бұрын
  • Have not finished but this dude is legit

    @gabrielnieves4912@gabrielnieves491214 күн бұрын
  • Is this similar to dspy?

    @matthewwalker7063@matthewwalker706317 күн бұрын
  • Why did you say agents are short-term leaders of AI? What is your definition of an agent? Is an agent a thing or is agentic workflow an approach to building intelligent systems?

    @generationgap416@generationgap4163 күн бұрын
  • What do you prefer between Llamaindex and Lagchain? I'm beginning in this topic and I want some advice

    @user-um2kn6mn1j@user-um2kn6mn1j18 күн бұрын
    • I've never had any need to go beyond the langchain ecosystem, but I also haven't used llama-index enough to know if I'm missing out on anything big there

      @jamesbriggs@jamesbriggs18 күн бұрын
  • Thank you James :)

    @user-ie9co7ex6s@user-ie9co7ex6s18 күн бұрын
    • thanks to you :)

      @jamesbriggs@jamesbriggs18 күн бұрын
  • I found this mixture of langchain (agents & tools) and langgraph quite confusing. The documentation is more straightforward.

    @alivecoding4995@alivecoding499510 күн бұрын
  • off topic - but have you noticed you write ESE than add an "l" -> ELSE SEARH, then add a "c" -> SEARCH how's your brain working to do that? I analyze human language production as if it were ML.. so I'm curious how this is happening...

    @ChrizzeeB@ChrizzeeB2 күн бұрын
  • Can I go straight to learning Langgraph than learning Langchain first?

    @lezgoverci@lezgoverci14 күн бұрын
  • Semantic router for conditional edges is OP

    @abdullahsiddique6393@abdullahsiddique639318 күн бұрын
    • 💯

      @jamesbriggs@jamesbriggs17 күн бұрын
  • The volume of your videos is way lower than standard youtube videos, would be good if you could up the levels some more next time.

    @USBEN.@USBEN.16 күн бұрын
  • did you have a good night out yesterday?

    @arcfired3615@arcfired361518 күн бұрын
    • yes, night out, socializing, getting plenty of sleep and not trying to keep up with ai - all things I do frequently

      @jamesbriggs@jamesbriggs17 күн бұрын
  • similar to agent pilot

    @jbexta@jbexta16 күн бұрын
  • There is no such thing as a graph with a conditional edge. What you are describing is normal conditional programming. Maybe a state machine if all the transitions are rigorously set.

    @viorelteodorescu@viorelteodorescu16 күн бұрын
    • yeah that syntax is probably my least favorite part of langgraph, and it feels overly complex, ie you must define tools + router + "conditional edge" (using LangChain syntax)

      @jamesbriggs@jamesbriggs16 күн бұрын
  • Bro, please imcrease your audio. I have to use chrome extensions for your videos to improve audio amplitude

    @rohanchoudhary672@rohanchoudhary67215 күн бұрын
  • This video is proof that developers dont get half.

    @natekryn9840@natekryn984017 күн бұрын
  • im sorry but this is unnecessarily complicated, i've used the graphs on haystack, and their api looks way cleaner

    @azero79@azero7918 күн бұрын
    • I’m very open to jumping back into the haystack ecosystem

      @jamesbriggs@jamesbriggs17 күн бұрын
    • @@jamesbriggs check haystack pipelines

      @azero79@azero796 күн бұрын
  • damn their APIs are so bad

    @frazuppi4897@frazuppi48972 күн бұрын
  • Stop saying it's pretty simple. It's not simple for those people who are seeing this for the first time. I Like your content but be mindful of newbies because you will discourage them.

    @generationgap416@generationgap41618 күн бұрын
    • Hey not simple at all i try to understand but i couldn't

      @user-en4ek6xt6w@user-en4ek6xt6w18 күн бұрын
    • It’s all relative. He can’t explain every concept at every level in every video. Sometimes you need to assume some level of audience understanding or you’ll never discuss anything. What’s simple for you won’t be for someone else, and that’s ok.

      @endlessvoid7952@endlessvoid795218 күн бұрын
    • It is simple if someone already knows langchain.

      @robertmazurowski5974@robertmazurowski597417 күн бұрын
    • Ask a programmer what hes able to do, he will say: not much, a little here, a little there. In reality that programmer learned so much that he forgot how much he learned and how complicated it was. When that programmer learns something new it funds on that gigantic, mostly unconciouse base, built before, which is expressed by "thats pretty simple".

      @samyio4256@samyio425617 күн бұрын
    • Good point, I have been using langchain and related libraries for well over a year now. For anyone reading who doesn’t find it simple, it’s not (my bad) and it takes some time to learn. However, don’t be discouraged - after using the tools for a while, you’ll end up looking back at this eventually and thinking of it as “simple” too, but to get there it requires time and practice, my advice would be to try building with it, the more you build the more you will learn and understand If anyone has feedback on what they find most confusing I’d love to hear it and I’d be happy to put together some more content to focus on what you all struggle with most

      @jamesbriggs@jamesbriggs17 күн бұрын
  • LangGraph is not better than LangChain, it extends LangChain...

    @8eck@8eck17 күн бұрын
  • Watch at 1.25 speed. This guy speaks too slow.

    @deeplearningpartnership@deeplearningpartnership9 күн бұрын
    • 1.5 for me 😂

      @gambaweb@gambaweb5 күн бұрын
KZhead