The Magic of AI Services with LangChain4J

Поделиться
HTML-код
  • Опубликовано: 30 июл 2024
  • LangChain4J is a port of the Python project LangChain to the Java world. It has many capabilities, but one particularly useful one is that it can generate AI “services” from a simple interface that interact with whatever language model you choose.
    This video demonstrates:
    * How to set up a Java project that uses LangChain4J
    * How to log requests and responses
    * How to submit requests to LLMs like OpenAI
    * How to test the responses
    * How the Gson parser works under the hood
    LangChain4J: github.com/langchain4j
    Langchain4j-examples: github.com/langchain4j/langch...
    Devoxx 2023 talk by Lize Raes: • Java Meets AI: A Hands...
    Tales from the jar side:
    ▶️ Newsletter: kenkousen.substack.com
    ▶️ RUclips channel: www.youtube.com/@talesfromthe...
    ▶️ Home page: www.kousenit.com
    Welcome to Tales from the jar side! New newsletter every Sunday, new newsletter video every Monday, and additional technical videos (Java, Gradle, JUnit, Spring, and lots more) every week.
    Affiliate links:
    These are products I use on a regular basis. If you click on them, your price doesn't change, but I may receive a small referral fee. Feel free to try them out.
    ▶️ Descript: www.descript.com/?lmref=HHcVuA
    This is a great program for transcribing videos and letting you edit them by editing the transcript. It also has several AI features like Studio Sound, Background Removal, Eye Tracking, Autodub, and more. I use it especially for RUclips Shorts.
    ▶️ TubeBuddy: www.tubebuddy.com/pricing?a=t...
    This is about the best tool around for giving you statistics on RUclips videos.
    ▶️ CleanShot: cleanshot.sjv.io/Tftjs
    I use this as my primary way of making screenshots. You can save them locally or to the cloud, crop and do other edits, add backgrounds, and more.
    ▶️ Manning Publications: www.manning.com/?...
    This is where my first book, "Making Java Groovy", was published, but you can use the link for any Manning books
    00:00 - Welcome to Tales from the jar side
    00:25 - Introducing LangChain4J
    02:00 - langchain4j-examples project
    02:46 - Setting up a LangChain4J project
    03:37 - Hello, LangChain!
    04:50 - PromptTemplates
    06:48 - AI Services
    08:19 - A Translator Service
    10:39 - Sentiment Analyzer
    13:07 - DateTimeExtractor
    14:51 - Extracting a Record
    15:38 - Adding Logging
  • НаукаНаука

Комментарии • 18

  • @jonescomas5728
    @jonescomas5728 2 месяца назад

    What a passioned and sympathic guy! Thank you!

  • @mckeeh3
    @mckeeh3 2 месяца назад

    Fantastic video! Thanks for the very helpful explanation.

  • @lhxperimental
    @lhxperimental 4 месяца назад +1

    Cool demo. The challenge with all these AI tools is they don't work 100% of the time. You can't rely on the response which makes them unsuitable for a large number of enterprisey tasks. There was a recent case of a airline company chatbot that advised a customer to cancel tickets to get a refund when there was a no-refund policy. The customer took the airline to court and court ruled in the customer's favor. Enterprises are shit scared of such things and rightly so.

    • @talesfromthejarside
      @talesfromthejarside  4 месяца назад

      Definitely true, and more people should know about it. Thanks for commenting :)

  • @duanesearsmith634
    @duanesearsmith634 4 месяца назад

    Thanks, that was very helpful! I am working on a Clojure wrapper for Langchain4j (I really hate having to use python from Java/Clojure). I see in the API that you can bypass the Annotation mechanism and create tool descriptors yourself and then stuff those into the builder. That would be best for me since Java Annotations are not so elegant in Clojure.

    • @talesfromthejarside
      @talesfromthejarside  4 месяца назад

      Fascinating. I've always liked Clojure, though I know very little about it. I've been happy with the annotations in Java (or Groovy, or even Kotlin). I hope the API support for you is as helpful as it appears. Good luck!

  • @massimodaros391
    @massimodaros391 5 месяцев назад +1

    It's a very interesting video.
    The LangChain4j is a very interesting project. For sure I will experiment somethig with it !!
    Thanks

    • @talesfromthejarside
      @talesfromthejarside  5 месяцев назад +2

      I agree. I'm playing with the tool capabilities of langchain4j in preparing for another video, and they're great

    • @massimodaros391
      @massimodaros391 5 месяцев назад

      @@talesfromthejarside Thanks. It's very important that LangChain4J make available such powerful capabilities for the Java ecosystem

  • @hrishikeshmishra1929
    @hrishikeshmishra1929 3 месяца назад

    I'm using the Hugging Face LLM model with this, however the response of this llm model is not so accurate, I was curious if I can change the model type of it, as there are many freely available models in hugging face. And also if possible please provide a code snippet.

    • @talesfromthejarside
      @talesfromthejarside  3 месяца назад

      Sure, you can use any LLM model you like. The code is in a GitHub repo, but most of it is based on the langchain4j-examples project: github.com/langchain4j/langchain4j-examples .

  • @mondrisokundolor9172
    @mondrisokundolor9172 6 месяцев назад

    How can I connect LangChain4J to work with MySQL database just like LangChain ?

    • @talesfromthejarside
      @talesfromthejarside  5 месяцев назад

      I use the DB in an AI-based app the same way I use it in regular apps. I write the code to retrieve the data in a DAO layer, analyze it in a services layer, and then store the results as usual. The framework doesn't affect all that, because it doesn't care where the data comes from. If I'm dealing with RAG applications, however, we have a different situation, and I'll be addressing that in future videos.

    • @mondrisokundolor9172
      @mondrisokundolor9172 5 месяцев назад

      @@talesfromthejarside Thanks I video of how to do this while using LangChain will be great. There is no such video on RUclips

  • @freebusdoctor
    @freebusdoctor 7 месяцев назад

    Thanks sir it was quite informative video.