Learn LangChain.js - Build LLM apps with JavaScript and OpenAI

2024 ж. 20 Мам.
72 199 Рет қаралды

LangChain.js is a framework for building AI apps. Click here to get to the course's interactive challenges: scrimba.com/links/langchain
At the end of this course, you will be able use LangChain's Expression Language to build GPT-powered chatbots that have specific knowledge about an underlying dataset. You will use text embeddings and a vector database to perform retrieval-augmented generation (RAG).
The course requires an understanding of JavaScript. Here is a free JS course if you need a refresher:
scrimba.com/learn/learnjavasc...
✏️ If you have any feedback to the teacher Tom Chant, please reach out to him on X here:
/ tpchant
Also, feel free to follow Scrimba on KZhead: / scrimba
⭐️ Code ⭐️
🔗 Download via Scrimba: scrimba.com/links/langchain
⭐️ Chapters ⭐️
⌨️ (0:00:00) Introduction
⌨️ (0:02:01) What you'll learn and build
⌨️ (0:04:08) Introduction to LangChain from Jacob Lee (Lead Maintainer of LangChain.js)
⌨️ (0:05:36) App Flow Diagrams
⌨️ (0:09:04) What are embeddings
⌨️ (0:15:20) Supabase Setup
⌨️ (0:19:27) Split the text
⌨️ (0:21:28) Split the text II
⌨️ (0:27:47) Upload to supabase
⌨️ (0:31:53) Starter code
⌨️ (0:33:19) Explainer The Standalone Question
⌨️ (0:35:31) Aside Prompt Templates
⌨️ (0:38:59) Aside Prompt Templates II
⌨️ (0:42:08) Adding the first chain
⌨️ (0:46:11) Retrieval
⌨️ (0:52:45) Add StringOutputParser
⌨️ (0:55:15) Fetching the answer the template
⌨️ (1:00:39) Serialize the docs
⌨️ (1:02:53) Aside RunnableSequence
⌨️ (1:07:54) Aside RunnableSequence 2
⌨️ (1:10:57) Aside RunnableSequence 3 RunnablePassthrough
⌨️ (1:14:47) Super Challenge - add the RunnableSequence
⌨️ (1:17:10) Super Challenge - solution
⌨️ (1:21:47) Wire up the UI
⌨️ (1:24:34) Setting up the memory
⌨️ (1:27:27) Super Challenge Wire up the memory
⌨️ (1:33:51) Performance Issues Check-list
⌨️ (1:37:44) Outro
🎉 Thanks to our Champion and Sponsor supporters:
👾 davthecoder
👾 jedi-or-sith
👾 南宮千影
👾 Agustín Kussrow
👾 Nattira Maneerat
👾 Heather Wcislo
👾 Serhiy Kalinets
👾 Justin Hual
👾 Otis Morgan
👾 Oscar Rahnama
--
Learn to code for free and get a developer job: www.freecodecamp.org
Read hundreds of articles on programming: freecodecamp.org/news

Пікірлер
  • Scrimba teachers have mastered the art of teaching. Thank you for this video.

    @kasper369@kasper3696 ай бұрын
  • I was just teaching myself this, you guys always seem to know what we need

    @jessecasey8295@jessecasey82956 ай бұрын
  • I'm a few lessons into the free Js course above and it's really good. Without a doubt I'm following both of these to the end. Thanks really!

    @paul-olof@paul-olof6 ай бұрын
  • Awesome! Exactly what I needed

    @legobuildingsrewiew7538@legobuildingsrewiew75386 ай бұрын
  • You exactly know what we need. Awesome

    @FatemehDamarchilou@FatemehDamarchilou6 ай бұрын
  • This channel is so amazing

    @noneofyourbusiness8625@noneofyourbusiness86256 ай бұрын
  • 📝 Summary of Key Points: 📌 The video discusses the use of Lang chain, a tool for building AI applications, specifically focusing on the concept of output passers and the use of runnable sequences. 🧐 Lang chain offers various output passes for different situations, such as outputting in JSON or binary data. The video demonstrates the use of the string output passer, which passes the output as a string. 🚀 The video introduces the concept of a runnable sequence, which allows for more complex chains of prompts and models. The video provides examples of how to use the pipe method and the runnable sequence to chain together prompts, models, and output passers. 🚀 The importance of formatting the output and using input variables effectively is discussed. 🚀 Performance can be improved by adjusting parameters such as chunk size, overlap size, and OpenAI settings. 💡 Additional Insights and Observations: 💬 "Lang chain offers a powerful and flexible way to build AI applications by chaining together prompts, models, and output passers." 📊 No specific data or statistics were mentioned in the video. 🌐 Lang chain is a tool provided by OpenAI, a reputable source in the field of artificial intelligence. 📣 Concluding Remarks: The video provides a comprehensive overview of using Lang chain to build AI applications. It explains the concept of output passers and demonstrates the use of the string output passer. The video also introduces the concept of a runnable sequence and provides examples of how to chain together prompts, models, and output passers. It emphasizes the importance of formatting the output and using input variables effectively. Overall, Lang chain offers a powerful and flexible way to build AI applications, and performance can be optimized by adjusting various parameters. Made with Talkbud

    @abdelhaibouaicha3293@abdelhaibouaicha32936 ай бұрын
    • Did you use llm to summarise this?

      @MelvinPaulbrains@MelvinPaulbrains4 ай бұрын
    • @@MelvinPaulbrains yes, I have used Talkbud chrome extension, it’s free.

      @abdelhaibouaicha3293@abdelhaibouaicha32934 ай бұрын
    • Apparently AI can't tell "passers" from "parsers "

      @carpanojr@carpanojr3 ай бұрын
  • That's a great tutorial ⭐ Thank you

    @girishanker3796@girishanker37963 ай бұрын
  • Thanks for the video !

    @noob_616chess@noob_616chess6 ай бұрын
  • Perfect, thanks. How does that works with data bases with more than one parameters retrieval?

    @inaamullah7192@inaamullah71926 ай бұрын
  • Ty very much for this course

    @p-a8230@p-a82304 ай бұрын
  • Oh good tech never slows down

    @isaiahbaah515@isaiahbaah5156 ай бұрын
  • can we push new data embeddings in same document / table which we already have embeddings? or should we have new table for each new docuemnt?

    @neerosity@neerosity3 ай бұрын
  • Amazing - Job Done

    @fhbthenorthstar@fhbthenorthstar3 ай бұрын
  • great tutorial indeed. Thanks a bunch. Just one question, can this technique be used with another LLM downloaded on one's computer? like llama for example. So doing the same thing without having to pay for tokens and such. Thanks,

    @samshosho@samshosho5 ай бұрын
    • Probably, yes. I haven't done it myself and I would think the performance would be bound to suffer to some extent, at least at the moment. If you get it working, come back and share your repo - would be really interested to see and hear about it!

      @thomaschant@thomaschant5 ай бұрын
    • I think everything you have explained would be done the same. Only the way you talk to the LLM will differ. In the terms of ready made API when it comes to OpenAI and no set methods to talk to the downloaded LLM. Any idea how something like that could be done? like any service out there or ready code from GitHub or so that would facilitate such thing? you know it's not a good idea to reinvent the wheel.@@thomaschant

      @samshosho@samshosho5 ай бұрын
  • I think they have updated. When we do the punctuation Prompt it is corrected the grammar also, so no need to run the grammarPrompt

    @vedicmusings@vedicmusings2 ай бұрын
  • if some one like me (noob) encountering error while document load add the just 3 columns in supabase metadata jsonb,content text,embedding and disable database->edit (RLS) if im wrong please correct me

    @ItsMe-ry7mk@ItsMe-ry7mk12 күн бұрын
  • Hello, I really like your videos and I'm able to learn a lot from the courses you have here. As a Brazilian, I only wonder if there is a way to translate some videos, in addition to the Brazilian language into other languages. KZhead's own translation is not that good and some words often make no sense at all.

    @MSs_.@MSs_.6 ай бұрын
    • Hey! We are really hoping to bring high quality subtitles to Scrimba lessons in the near future - it's something we are making progress on as we speak.

      @thomaschant@thomaschant6 ай бұрын
  • Thanks but when I tried your example on my webpage, I ran into all sorts of problems, don't know how it works on your end. For me, it required to have "" above the script, that did it but now i am stuck at dotenv and fs as it seems they cannot be used inside webpage. How did you run in your demo please ?

    @BuyCarsTVPakistan@BuyCarsTVPakistan2 ай бұрын
  • I got a quota failure when I tried to upload to supabase, is the free tier not sufficient to complete this tutorial? BTW, great course.

    @stephenjames2951@stephenjames29515 ай бұрын
    • Should be able to do it on the free tier. Are you using a very large document?

      @thomaschant@thomaschant5 ай бұрын
    • @@thomaschant I was using your document from the tutorial. Following along locally.

      @stephenjames2951@stephenjames29515 ай бұрын
    • @@stephenjames2951 that's really strange. Nothing's changed as far as I can see. You should have 500mb of database space. Have you been a really heavy supabase user for another project?

      @thomaschant@thomaschant5 ай бұрын
    • I had this same error. Did you eventually resolve it?@@stephenjames2951

      @fieworjohn5697@fieworjohn56974 ай бұрын
  • Does it works with image also

    @gagsy17@gagsy172 ай бұрын
  • What I feel is lacking is lang chain updated their site and all the references are moved

    @sa34w@sa34w6 ай бұрын
  • Cool ✨✨

    @clerov@clerov6 ай бұрын
  • 👍

    @caiyu538@caiyu5385 ай бұрын
  • Is it the RAG architecture?

    @chinmayjoshi6984@chinmayjoshi6984Ай бұрын
  • Hello, is anybody getting this error? Error: Error searching for documents: 57014 canceling statement due to statement timeout null when using the retriever?

    @diegogonzalezcruz6952@diegogonzalezcruz695229 күн бұрын
  • 👍💯

    @rishiraj2548@rishiraj25486 ай бұрын
  • what is the openAIApiKey ? please anyone give me response.

    @sushantabhowmick1031@sushantabhowmick10313 ай бұрын
  • how about for python?

    @user-wr4yl7tx3w@user-wr4yl7tx3w3 ай бұрын
  • The scrimba ui with the video on the code editor is dreadful. Improve it if you want it to thrive

    @AB-kq9xm@AB-kq9xm3 ай бұрын
  • Who was flying? My father trained in Stearman before becoming a Corsair pilot.

    @hope42@hope422 ай бұрын
  • why in my application node can't load the file with fetch

    @lucasfrutig4945@lucasfrutig49453 ай бұрын
  • The database has a large number of records of about 16666 records and has error 57014 canceling statement due to statement timeout null. Is there any way to fix it?

    @quanxom840@quanxom840Ай бұрын
  • 🖐️🌐 👍

    @Shriramkrishnhari@Shriramkrishnhari6 ай бұрын
  • Movie review rating web app with Laravel pls 🙏

    @qaw392@qaw3926 ай бұрын
  • this video is flashing a lot (full white screen for split second) when changing screens inside the app that the author is showcasing us. Really painful. Although the content seems good.

    @piotrzaborszczyk483@piotrzaborszczyk4834 ай бұрын
  • Make video about pos

    @mrjoe64-dz4pr@mrjoe64-dz4pr6 ай бұрын
  • At time span 31:29 I am not getting the table data it's empty. I have pasted the API keys properly. Can anybody help

    @sagarsingh2601@sagarsingh26016 ай бұрын
    • are you writing your code in scrimba or in your local machine?

      @_sahildahat_@_sahildahat_6 ай бұрын
    • Is there an error showing? Can you type the error message here.

      @reginaldosano6593@reginaldosano65936 ай бұрын
    • same , did u sloved

      @roshannayak5982@roshannayak59825 ай бұрын
    • ​@@_sahildahat_ In scrimba, but it shows

      @roshannayak5982@roshannayak59825 ай бұрын
    • @@reginaldosano6593 I receive an error and can't collect data on supabase since the env key isn't supplied in the video.

      @roshannayak5982@roshannayak59825 ай бұрын
  • How to run this in the local machine? When I tried to run this, It throws error about the type of module etc but even after fixing this error, it doesnt run. Can someone please help me out here! Thank you!

    @_sahildahat_@_sahildahat_6 ай бұрын
    • Hey how far did you get? Did you download the zipped file from the scrim and do NPM install and NPM start?

      @thomaschant@thomaschant6 ай бұрын
    • @@thomaschant yes, earlier there was some issue but now it's running. So basically the zip file code is vite? And the scrimba-info.txt should always have questions & answers format like the one used?

      @_sahildahat_@_sahildahat_6 ай бұрын
    • @@_sahildahat_ Yes the zip is vite and you just have to follow the instructions in the readme file. The text can be any format you like but I guess in a customer service/support bot/info bot environment it is likely to be question and answer. But the same technique would work on, for example, an academic paper.

      @thomaschant@thomaschant6 ай бұрын
    • @@thomaschant Thank you so much! I will continue the video. This comment thread would be of great help to me! Please continue to reply to me here! And thanks for making this awesome video!

      @_sahildahat_@_sahildahat_6 ай бұрын
    • @@_sahildahat_ my pleasure! Good luck 🍀

      @thomaschant@thomaschant6 ай бұрын
  • you use openai key so its not free ? and if openai changes its term of service, this code doesnt work anymore ?

    @jeremyh9841@jeremyh98416 ай бұрын
    • An openai key is free, you just have to make an account then make a key :)

      @duck3y27@duck3y276 ай бұрын
    • but i had to put my credit card and they take 1 cent for each request@@duck3y27

      @jeremyh9841@jeremyh98416 ай бұрын
    • ...and it's gone. OpenAI is going to implode soon. Hundreds of staffers are going over to Microsoft.

      @SacWebDeveloper@SacWebDeveloper6 ай бұрын
    • almost all of them. which is the same.@@SacWebDeveloper

      @Huru_@Huru_6 ай бұрын
    • The key is free, you get some free credits, and you can use the code to work with any other LLM.

      @pedrogorilla483@pedrogorilla4836 ай бұрын
  • Someone do that on Visual Studio Code ? I got some error ...

    @wilonweb@wilonweb6 ай бұрын
    • Yup I was able to code it in VS Code. What is your error?

      @reginaldosano6593@reginaldosano65936 ай бұрын
    • @@reginaldosano6593 import { RecursiveCharacterTextSplitter } from "langchain/text_splitter"; ^^^^^^ SyntaxError: Cannot use import statement outside a module at internalCompileFunction (node:internal/vm:73:18) at wrapSafe (node:internal/modules/cjs/loader:1176:20) at Module._compile (node:internal/modules/cjs/loader:1218:27) at Module._extensions..js (node:internal/modules/cjs/loader:1308:10) at Module.load (node:internal/modules/cjs/loader:1117:32) at Module._load (node:internal/modules/cjs/loader:958:12) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) at node:internal/main/run_main_module:23:47 Node.js v18.14.2

      @wilonweb@wilonweb5 ай бұрын
    • where is the zip file?

      @lucianoperez2454@lucianoperez24545 ай бұрын
    • @@lucianoperez2454 wich zip file ?

      @wilonweb@wilonweb5 ай бұрын
    • @@wilonweb I was trying to work on my local machine, never worked on scrimba before, i didn't know how to download the project, now i know... idk if it's on the video , maybe i missed it.

      @lucianoperez2454@lucianoperez24545 ай бұрын
  • Is there a source code

    @mohammedseid810@mohammedseid8105 ай бұрын
    • Yes, if you click the first link in the description, in the Scrim (interactive code editor) click the settings ⚙ and select "download as zip". That will give you all the files to run locally :)

      @thomaschant@thomaschant5 ай бұрын
  • 🧐

    @soumadip_skyy_banerjee@soumadip_skyy_banerjee6 ай бұрын
    • ?

      @Anonymous____________A721@Anonymous____________A7216 ай бұрын
  • Finally a Freecodecamp tut whose lecturer speaks English natively 😂😂😂

    @guillermohinostroza1016@guillermohinostroza10165 ай бұрын
  • Like 503º

    @victorpinasarnault9135@victorpinasarnault91356 ай бұрын
  • 🫡❤️‍🔥

    @faruk_@faruk_6 ай бұрын
  • Second viewer 😊

    @abimbolasalawu299@abimbolasalawu2996 ай бұрын
  • First

    @originalpne1060@originalpne10606 ай бұрын
  • Not worth learning programming for jobs anymore. You can learn it for fun

    @sivaprasad905@sivaprasad9055 ай бұрын
    • Bruh chat gpt can't build a full scale software for u which has to be used by millions of users lmao. We still need software engineers and programmers

      @manan-543@manan-5435 ай бұрын
  • i dont like scrimba

    @4399lol@4399lol6 ай бұрын
    • What do you like?

      @paul-olof@paul-olof5 ай бұрын
  • After the Sam Altman fallout over the weekend, this did not age well. What's more surprising is that you still released this after everyone is dumping OpenAI. Did you guys even know about it? RIP OpenAI.

    @SacWebDeveloper@SacWebDeveloper6 ай бұрын
    • I’m still using ChatGPT. Although do have to agree that the idea of Prompt Engineering is kinda meh

      @theencryptedpartition4633@theencryptedpartition46336 ай бұрын
    • My thoughts exactly. That board just killed (or at least hurt it seriously) an entire nascent industry. There's literally no point learning anything that relies on openAI API right now. I don't see them keeping the service open with no workers.

      @Huru_@Huru_6 ай бұрын
    • Prompt Engineering has got nothing to do with chatGPT. It's like, prompt engineering is the technique and chatGPT is the product. It's here to stay.@@theencryptedpartition4633

      @Huru_@Huru_6 ай бұрын
    • Langchain works just fine with other AI models, including locally hosted ones.

      @kevingage4157@kevingage41576 ай бұрын
    • That’s just your opinion. Just don’t watch it.

      @pedrogorilla483@pedrogorilla4836 ай бұрын
  • is the source code available on scrimba.? i am not finding the download option

    @nasimreja7312@nasimreja73125 ай бұрын
  • What are the prerequisite?? @freecodecamp

    @bullyversal5313@bullyversal53136 ай бұрын
KZhead