Stream LLMs with LangChain + Streamlit | Tutorial

Поділитися
Вставка
  • Опубліковано 30 вер 2024

КОМЕНТАРІ • 94

  • @ronikh4n
    @ronikh4n 7 місяців тому +5

    Fantastic walkthrough! I was wondering if you could create a tutorial on how to build a custom Knowledge Retrieval service using Langchain. The idea behind this service is to allow users (multi tenancy) to chat with their uploaded documents in different formats like PDF, CSV, and Text, while ensuring that the data remains accessible only to the user/owner who uploaded the file.

  • @saqibullah-sm9pw
    @saqibullah-sm9pw 8 днів тому

    I think passing chat history like that is not optimized way ..what if we use langchainMeomryBuffer wo summarize previous chat and give back to llm so that I doesn't increase input token size as every llm has fixed input token size , moving beyond that token size can produce not desirable output because it will miss some parts from input

  • @davidtindell950
    @davidtindell950 Місяць тому +1

    Another very useful "AO" vid that I must have missed somehow ! TUVM !!!

  • @DavidChoqueluqueRoman
    @DavidChoqueluqueRoman 3 дні тому

    Your video es great, but very basic. What about stream for tool calling agents?

  • @TheEverydayAnalyst
    @TheEverydayAnalyst Місяць тому

    Many users end up clicking enter while they are still typing the query. In the chat GPT we have the stop button to cancel the request. How can this be achieved in langChain or Streamlit?

  • @shobhitagnihotri416
    @shobhitagnihotri416 7 місяців тому +2

    How can we generate an assistant that can provide code after uploading documentation of frame work . Please make something related to this . Thank in advance

    • @alejandro_ao
      @alejandro_ao  7 місяців тому +1

      that's a bit more tricky since we usually need a lot of context to write good code. gemini 1.5 is capable of doing this afaik. i'll make some videos about this!

  • @divyagarh
    @divyagarh 2 місяці тому

    Is there a way to do streaming with CustomLLM class with Custom Finetuned model or SageMaker Endpoint (not chat gpt) and using langchain?

  • @gabrieljauregui654
    @gabrieljauregui654 7 місяців тому +4

    Great tutorial to keep us practicing both LangChain and Streamlit! Greetings from Argentina 😊😊

  • @hakikitosunpasa335
    @hakikitosunpasa335 7 місяців тому +1

    Amazing tutorial, I wonder how to use LCEL with RAG and streaming output in conversational setting...

  • @amorotto
    @amorotto 7 місяців тому +1

    Great video! would be great to create a similar one for conversational agents with tools using LCEL as well!

    • @alejandro_ao
      @alejandro_ao  7 місяців тому +2

      i'm working on something like that :)

  • @cindywu3265
    @cindywu3265 7 місяців тому +1

    Very clear and great content to follow along! I am able to build a chat app with multiple pdfs with ConversationalRetrievalChain, but not sure how to implement streaming with that. Hope I will see one soon!

    • @alejandro_ao
      @alejandro_ao  7 місяців тому +1

      hey there. yeah, you can totally implement streaming with conversational retrieval chain. but you would probably need to use the latest version of it. i think that the class-based chains (like the one you mentioned) are not compatible with LCEL but I am not certain. try creating your chain like this: python.langchain.com/docs/expression_language/cookbook/retrieval

    • @cindywu3265
      @cindywu3265 6 місяців тому

      @@alejandro_ao Awesome, thank you Alejandro! Look forward to your next video

  • @jamessebastian8912
    @jamessebastian8912 7 місяців тому +2

    Thanks! Great Tutorial.

  • @user-yh1qt9tf4u
    @user-yh1qt9tf4u 5 місяців тому

    I like your so helpful videos so much. Recently, with the help of your videos, I created a customized Rag chatbot with nice avatars and customized HTML. So with the langchain chat message function and the chat history.
    Text streaming using chat message instead simple langchain message as add on is not possible, is it?

  • @ajay.kartheek
    @ajay.kartheek 7 місяців тому

    Great Tutorials...... Can you tell me what I need to know to build an RAG application like webpage query bot without using streamlit (python based web developemnt will be very useful for me)... I am trying to build an project for my Placement drives. Plz help me through this!! Thank you!!

  • @anuvratshukla7061
    @anuvratshukla7061 6 місяців тому

    How can we do the same streaming with Mixtral LLM? I'm using Mixtral (huggining face inferecing) + Langchain + Streamlit. LLM is used as pandas agent and I want to stream the response.

  • @limjuroy7078
    @limjuroy7078 6 місяців тому

    After watching this video, I am thinking of updating the code for your Multiple PDF Chat Tutorial that I have followed fw months ago. I am considering replacing the existing ConversationalRetrievalChain and BufferMemory with LCEL as demonstrated in the video.

    • @alejandro_ao
      @alejandro_ao  6 місяців тому +1

      yes! i really need to update that video. the core remains relevant, but the code might need some brushing up

    • @limjuroy7078
      @limjuroy7078 6 місяців тому

      @@alejandro_ao Hope you will do that and come out with a video asap.

  • @Reality_Check_1984
    @Reality_Check_1984 5 місяців тому

    This is an amazing video. Extremely helpful. How would you go about sequential chains with this? I have been picking up errors and not sure where to read into this more.

  • @Emmanuel-xe5bc
    @Emmanuel-xe5bc 5 місяців тому

    great job. I hope i can use part of your code for school assignments?

    • @alejandro_ao
      @alejandro_ao  4 місяці тому +1

      absolutely! and tell your friends about the channel in case they want to learn more about LLM apps :)

  • @srikanthverpula6271
    @srikanthverpula6271 6 місяців тому

    its good but if possible can you work on function calling (Realtime API multiple) in conversational way?

  • @ramkipalle6612
    @ramkipalle6612 7 місяців тому

    How can we do the streaming if the backend chain logic is exposed as REST API? In this example, both backend and frontend logic is there in the same file.

  • @softwareideology2033
    @softwareideology2033 6 місяців тому

    Hi ! I impressed with your chat with MySQL solution Can you make a video about chat with api which has swagger docs ?

  • @ersaaatmeh9273
    @ersaaatmeh9273 6 місяців тому

    Hi , could I ask you how I can do the same step if I try LLM from Hugging Face?

  • @AIdevel
    @AIdevel 7 місяців тому

    Thanks for this great video I wonder how to integrate the streaming method in my RAG application, how to stream the response in RAG based app that uses Qdrant database would you explain it for me ❤❤

  • @mikachiche
    @mikachiche 6 місяців тому

    Thanks you very useful tuto, you should explain a little more what and why you're doing something

  • @jamalnuh8565
    @jamalnuh8565 7 місяців тому

    We I reimplement your code I got errors I wonder, I almost clone three of your repo and fails although I try to use free API such as hugging face

  • @KumR
    @KumR 3 місяці тому

    Sorry but how is this different from doing same thing in chatgpt

    • @alejandro_ao
      @alejandro_ao  3 місяці тому

      not very different. this tutorial is mostly for creating your own version of chatgpt or your own implementation of a LLM-chatbot for a "chat over your data" kind of application. arguably, you could also use this app instead of chatgpt if you wanted to have access to GPT-4 at a fraction of the price, but chatgpt has more features (like storing your conversations, voice-to-text, multimodal input) that you would have to code yourself. on the other hand, coding those features yourself might be a great learning experience!

  • @cheybrown2076
    @cheybrown2076 2 місяці тому

    Hey! Really awesome tutorial! Just a bit confused with how the template and the invoke method work together. The user question: {user question} in the template and then {user question: query} in the invoke method. How do they correlate please. Thanks

    • @alejandro_ao
      @alejandro_ao  2 місяці тому +1

      hey there, great question.
      the variables in the template are in between curly braces, like {user_question}. these values will be replaced later, when you "invoke" it.
      and when you run the invoke method on a prompt (or a chain that starts with a prompt), you pass an object that looks like this:
      {
      variable_to_replace: "my value"
      }
      this will replace all the {variable_to_replace} in your prompt with "my value".
      so if your prompt looks like this:
      prompt = PromptTemplate.from_template("this is the user question: {user_question}")
      and
      query = "what is love?"
      then when you run
      prompt.inovoke({
      user_question: query
      })
      will return this: "this is the user question: what is love?"

    • @cheybrown2076
      @cheybrown2076 2 місяці тому

      @@alejandro_ao thank you! So helpful. Can’t wait to start playing with langchain and crewai. Just finishing off a deep learning (tensorflow) course and some projects then I’ll get into it.
      I’m a data analyst trying to transition into data science/ML engineering btw 😊

    • @alejandro_ao
      @alejandro_ao  2 місяці тому +1

      ​@@cheybrown2076 you are on the right path! actually, i am opening a cohort in a couple of weeks precisely about building AI apps. if you would like to join: course.alejandro-ao.com
      let me know if you're interested or have any questions!

  • @chibuzoemelike6403
    @chibuzoemelike6403 7 місяців тому +1

    This is very helpful, will be great to see something on Langraph and Agents. Thank you for all your support

    • @alejandro_ao
      @alejandro_ao  5 місяців тому

      i have been planing to bring langgraph for a while. so many things to cover. i have started covering agents a bit more, though!

  • @julienduchesneau9747
    @julienduchesneau9747 5 місяців тому

    yeah good video thank you, I will try to had a sidebar to ajust temp and token lenght with previous videos and see how it goes.

  • @dhmkkk
    @dhmkkk 7 місяців тому

    is there any way to incorporate streamlit button inputs and llm to answer from that like i ask give menu options and it shows options as buttons and when i click one the llm knows what i selected

  • @AageSundvor
    @AageSundvor 4 місяці тому

    Is it possible to add tools to this chatbot or must an agent be used?
    Maybe you could show how the best way to add search tool for the bot?

  • @fatiga2426
    @fatiga2426 4 місяці тому

    Great video! I was wondering, why is it necessary to use a Str output parser? Why not getting the content string from de answer directly?
    Thanks!

    • @alejandro_ao
      @alejandro_ao  4 місяці тому +1

      hey! you can do that too. that was mostly to show how to use the output parsers. but usually you would use the output parser within a chain rather than at the end. inside a chain, if your next step in the chain requires a string input, using an output parser will make sure that it works regardless of what the intermediate step returns 👍

  • @geekyprogrammer4831
    @geekyprogrammer4831 6 місяців тому

    Can you create a tutorial on Langgraph?

  • @ScottSummerill
    @ScottSummerill 7 місяців тому

    Just stumbled across your channel. Looks pretty decent. Curious what the AO means.

    • @alejandro_ao
      @alejandro_ao  7 місяців тому

      thanks! welcome to the community :) AO is just my initials btw

  • @duanxn
    @duanxn 6 місяців тому +1

    great tutorial, step by step and crystal clear

  • @parkeatshark4364
    @parkeatshark4364 6 місяців тому

    Could it possible to do this with free account of openai

    • @alejandro_ao
      @alejandro_ao  6 місяців тому

      hey there, if you don't want to use openai, you can always use a free model. Groq has a free API (for now) and they allow you to try out Mistral, Gema and Llama2 for free. check them out and the just implement them like this: python.langchain.com/docs/integrations/chat/groq
      (it should be about a couple lines of code!)

    • @parkeatshark4364
      @parkeatshark4364 6 місяців тому

      Thanks you, I will try this one btw your content is very helpful and easily understood@@alejandro_ao

  • @OwaisBinMushtaq
    @OwaisBinMushtaq 7 місяців тому

    Can you please make a chatbot on an open source model.
    And Great Tutorial as always 🎉

    • @alejandro_ao
      @alejandro_ao  6 місяців тому +1

      hey there! sure, i will be including more open source models in the demos fron now on :)

  • @ErwinWientjes
    @ErwinWientjes 6 місяців тому

    where has your site gone

    • @alejandro_ao
      @alejandro_ao  6 місяців тому

      hey can you please check again? i think the dns is taking too long to propagate :S

  • @abhijitubale
    @abhijitubale 6 місяців тому

    Hey Alejandro, Please do let us know which code completion extension/plugin are you using…it seems really “ahead” of you in the video…

    • @abhijitubale
      @abhijitubale 6 місяців тому

      Does anyone know ??

    • @alejandro_ao
      @alejandro_ao  6 місяців тому +1

      hey there! i am using github copilot. it's great :)

  • @edsonrodas3954
    @edsonrodas3954 6 місяців тому

    I'm recently learning python and for me this is amazing. You make it look so easy, thanks for share your knowledge

    • @alejandro_ao
      @alejandro_ao  6 місяців тому

      this is beautiful to hear. thank you 😊 keep it up, you're on the right path!

  • @mirzatouqirbaig3920
    @mirzatouqirbaig3920 7 місяців тому

    Great video. Can you make a video on LangGraph?

    • @alejandro_ao
      @alejandro_ao  7 місяців тому

      hey there, sure! coming soon!

  • @tojitojira858
    @tojitojira858 6 місяців тому

    Thank, how should be process to add this functionality on your example "chat wit a website" ?

    • @alejandro_ao
      @alejandro_ao  6 місяців тому

      hey there! all you got to do is use `stream` instead of `invoke` and yield the results using `st.write_stream`. did you manage to make it work?

    • @tojitojira858
      @tojitojira858 6 місяців тому

      @@alejandro_ao I applied the changes mentioned in your video, but I didn't manage to get the same result as you.

    • @tojitojira858
      @tojitojira858 6 місяців тому

      @@alejandro_ao the message is displayed but a very long json variable

  • @zeelthumar
    @zeelthumar 7 місяців тому

    That write_stream function is cool.. thanks for sharing this buddy.

    • @alejandro_ao
      @alejandro_ao  7 місяців тому +1

      i know, they released it a few days ago. those guys at Streamlit are building super cool things

    • @ayoolaadedeji9353
      @ayoolaadedeji9353 6 місяців тому

      I can't get the write_stream attribute to be recognised :/@@alejandro_ao

  • @AIdevel
    @AIdevel 7 місяців тому

    This is really excellent video It’s exactly what I have been looking for
    Would you please tell me how to use it with RAG applications please make video about that because it’s a game changer in python chat bots 🤖
    I tried but failed I need your assistance 😊

    • @alejandro_ao
      @alejandro_ao  7 місяців тому

      hey there! glad to hear this! sure thing. i have been covering RAG quite a bit. even though i have much more content about this coming :)
      - my most recent video about it is this one, which shows how to do RAG on a web page's contents: ua-cam.com/video/bupx08ZgSFg/v-deo.htmlsi=A8fPDeepjKuPe2oP
      - this one is a more detailed and is about PDF files, but with a slightly older version of langchain: ua-cam.com/video/dXxQ0LR-3Hg/v-deo.htmlsi=FnULh8P7fn4Iq7df

    • @AIdevel
      @AIdevel 7 місяців тому

      @@alejandro_ao Off course I am keen follower of yours I’ve seen them but I mean how to integrate the message streaming with RAG app ? In the retrieval chain ? and how exactly to achieve it ?

    • @alejandro_ao
      @alejandro_ao  7 місяців тому

      @@AIdevel oh alright! i will incorporate streaming next time i make a RAG app! 🤓 thanks for following the channel!

    • @PapaioannouOrama
      @PapaioannouOrama 5 місяців тому

      @@alejandro_ao pretty sure retriever objects don't support streaming, I know it's possible to have some elements in your chain that don't support streaming though

  • @ralphanthony5198
    @ralphanthony5198 7 місяців тому

    Great content, amigo! Awesome work!

  • @jamalnuh8565
    @jamalnuh8565 7 місяців тому

    Can u use not openAI API s

  • @chikosan99
    @chikosan99 5 місяців тому

    Thanks a lot !! great

  • @geekyprogrammer4831
    @geekyprogrammer4831 7 місяців тому

    Thank you so much ❤❤

  • @cristianaguilar4253
    @cristianaguilar4253 7 місяців тому

    nice. gracias alejandro

  • @Shakti18348
    @Shakti18348 7 місяців тому +1

    How to stream responses of the previous chatbot you made where you used create_retrieval_chain
    I'm getting an error:
    return conversational_rag_chain.stream({
    TypeError: 'generator' object is not subscriptable

  • @jamessebastian8912
    @jamessebastian8912 7 місяців тому

    Thanks!

  • @sebastianalza4595
    @sebastianalza4595 5 місяців тому

    what a voice men