- 194
- 72 531
Tales from the jar side
United States
Приєднався 17 гру 2022
I'm Ken Kousen. I have entirely too much academic training (two BS degrees from MIT, an MA and a Ph.D. from Princeton, and an MS from RPI), I'm the author of six technical books about Java, Groovy, Kotlin, Android, Gradle, and Mockito, I've given talks at conferences all over the world, and I have 25+ years of experience in Java and related topics. Let me help you understand what's important in the IT world and what isn't.
"Tales from the jar side" is a pun on (1) The Far Side cartoons by Gary Larson, and (2) how Java applications are delivered as "jar" (Java archive) files. It's about my continuing Java journey. Lame, sure, but I'm committed to it now.
By the way, my last name is pronounced "cousin", like the relative, even though it doesn't look like that.
Thanks for visiting!
"Tales from the jar side" is a pun on (1) The Far Side cartoons by Gary Larson, and (2) how Java applications are delivered as "jar" (Java archive) files. It's about my continuing Java journey. Lame, sure, but I'm committed to it now.
By the way, my last name is pronounced "cousin", like the relative, even though it doesn't look like that.
Thanks for visiting!
Secrets of Perplexity AI API Citations Revealed
Accessing and Integrating Perplexity AI API Citations in Python and Java
In this episode of Tales from the Jar Side, host Ken Kousen explains how the recently updated Perplexity AI API now includes citations for responses. He demonstrates how to access and use this feature in Python and Java, highlighting the differences and challenges in each language. Viewers will learn how to modify Python scripts using the OpenAI library and transform Java code to handle the new citations block using Java records, the included HTTP client, and Google's Gson. The episode covers important steps like setting up the HTTP client and requests, parsing JSON data, and accessing the elements you need.
00:00 Perplexity AI's Best Feature
00:26 Overview of the Channel and Host
00:47 Exploring the Perplexity AI API
02:18 Python Implementation of Perplexity API
04:59 Java Implementation of Perplexity API
08:55 Creating Java Records for API Mapping
10:46 Building the Perplexity Service in Java
12:29 Testing the Java Implementation
15:05 Conclusion and Future Videos
In this episode of Tales from the Jar Side, host Ken Kousen explains how the recently updated Perplexity AI API now includes citations for responses. He demonstrates how to access and use this feature in Python and Java, highlighting the differences and challenges in each language. Viewers will learn how to modify Python scripts using the OpenAI library and transform Java code to handle the new citations block using Java records, the included HTTP client, and Google's Gson. The episode covers important steps like setting up the HTTP client and requests, parsing JSON data, and accessing the elements you need.
00:00 Perplexity AI's Best Feature
00:26 Overview of the Channel and Host
00:47 Exploring the Perplexity AI API
02:18 Python Implementation of Perplexity API
04:59 Java Implementation of Perplexity API
08:55 Creating Java Records for API Mapping
10:46 Building the Perplexity Service in Java
12:29 Testing the Java Implementation
15:05 Conclusion and Future Videos
Переглядів: 323
Відео
AI vs Cthulhu: How to Bypass Guardrails
Переглядів 940Місяць тому
In this episode of 'Tales from the Jar Side,' we embark on a humorous and fascinating journey into the world of H.P. Lovecraft. Using various AI tools and models like Google's Gemini, GPT-4o, Claude AI, and more, we attempt to discover the fictional incantation to summon Cthulhu. The episode discusses the interplay between AI, fiction, copyright laws, and interpretations of Lovecraft's mythos. ...
Perplexity API: Real-time Search Cheaper Than OpenAI
Переглядів 922Місяць тому
In this episode of Tales from the Jar side, Ken Kousen explores Perplexity AI's new API, both with Python and Java. Perplexity AI is an innovative search engine offering real-time web access, source citations, and an ad-free experience. Ken provides a comprehensive overview of using Perplexity's new programmatic API, including a Python demo and a comparison with OpenAI's tools. The video also d...
Discover Flux 1.1 Pro with Kotlin Magic!
Переглядів 229Місяць тому
Join Ken Kousen in this episode of Tales from the Jar Side as he dives into the world of AI image generation using the Flux 1.1 Pro API. This comprehensive guide details how to interact with the API using Kotlin, covering environment setup, generating images, handling data classes, and Kotlin flows. Learn to leverage Kotlin’s asynchronous operations for polling results and saving images with un...
Unveiling Java Power: The New Flux 1.1 Pro AI Image Generator
Переглядів 384Місяць тому
Explore the new AI image generator, Flux 1.1 Pro by Black Forest Labs. Learn how to access this powerful tool using Java before frameworks catch up. Discover the details of the beta API, cost efficiency, and process to generate images programmatically. Ken guides viewers through creating accounts, managing requests, and polling for results. Gain insight into Java coding techniques like validati...
Unlocking Kotlin: Dive into Classes, Interfaces & Inheritance
Переглядів 2602 місяці тому
Dive into the world of object-oriented programming in Kotlin as we explore classes, interfaces, and inheritance. We compare Kotlin's features with Java, delving into the Kotlin documentation to understand primary and secondary constructors, visibility modifiers, and initializer blocks. Discover how to define properties and create constructors, both primary and secondary. Learn about abstract cl...
Expert Tips for Chat Memory on LangChain4j
Переглядів 2732 місяці тому
Join Ken Kousen on 'Tales from the Jar Side' as he explores the challenges and solutions for managing AI tool memory using LangChain4j. This episode delves into implementing chat memory and persisting data to enhance stateless AI interactions. From manual memory management to utilizing LangChain4j's AI services for automated assistance, Ken demonstrates practical examples using iconic movie ref...
Java Records Unleashed: Validation Best Practices
Переглядів 9023 місяці тому
Simplifying RESTful Web Service Constraints in Java In this episode of 'Tales from the Jar Side,' Ken Kousen guides Java developers through the process of simplifying constraints when interacting with a RESTful web service. Using a text-to-speech service example, Ken demonstrates four steps to enforce input restrictions programmatically. He covers using Java records, defining constants and enum...
Harnessing Java 21 for Data Oriented Programming
Переглядів 1,5 тис.3 місяці тому
Harnessing Java 21 for Data Oriented Programming Discover how the new features in Java 21-records, sealed interfaces, and pattern matching for switch-work synergistically to facilitate data-oriented programming. This video on the 'Tales from the Jar Side' channel demonstrates two practical examples, highlighting the simplicity and benefits of these features. Learn how immutable data models and ...
Going Viral, Elgato Prompter woes, and Async Messaging: Tales from the jar side
Переглядів 1414 місяці тому
Tales from the Jar Side: Going Viral, Elgato Prompter woes, and Async Messaging Welcome to Tales from the Jar Side! Join Ken Kousen in this episode, where he shares exciting stories and updates from the Java and AI tech world. This week, Ken discusses his new role at Trinity College, adventures in teaching Java AI courses, and his recent viral UA-cam video. He also dives into intriguing anecdot...
Spring AI Updates, Classic Movie Review & The Great Unsubscribing | Tales from the Jarside
Переглядів 1274 місяці тому
Spring AI Updates, Classic Movie Review & The Great Unsubscribing | Tales from the Jarside In this week's episode of 'Tales from the Jarside,' Ken Kousen covers a range of topics from the volatile state of Spring AI to a nostalgic review of the classic movie 'Heaven Can Wait.' Ken also discusses the intricacies of streaming data in AI APIs and the impact of frequent software updates. Additional...
Ranking Java Features Added from Versions 8 to 21!
Переглядів 4,5 тис.4 місяці тому
Ranking Java Features from Java 8 to 21 | Ken Kousen's Ultimate Tier List Join Ken Kousen in 'Tales from the Jar Side' as he ranks the biggest Java features introduced between versions 8 and 21. With over two decades of experience in the Java ecosystem, Ken gives his personal take on functionalities like functional programming, records, text blocks, sealed classes, and more. He categorizes them...
Vision Models, Chat Oriented Programming, and the Junior Dev Dilemma
Переглядів 1914 місяці тому
AI Vision Models, Chat-Oriented Programming, and Junior Developer Dilemma | Tales from the Jar Side In this episode of 'Tales from the Jar Side,' hosted by Ken Kousen, we explore AI vision models used for inventory, discuss chat-oriented programming, and delve into the implications of AI on junior developers. The newsletter, dated July 1, 2024, covers various advancements and experiments with A...
My Java AI Book, Gemini Context Caching, Greatest Organ Work Ever
Переглядів 1445 місяців тому
Join Ken Kousen on the latest episode of Tales from the Jar Side as he talks about the first technical review of his upcoming book 'Adding AI to Java,' explores context caching with Gemini, and shares his take on the greatest organ piece ever composed. Plus, enjoy a collection of amusing tweets, tornado warnings in Connecticut, and a discussion on classical music. Make sure to subscribe and bec...
Luma AI videos, Stable Diffusion images, and Async HTTP Requests
Переглядів 2235 місяців тому
Luma AI videos, Stable Diffusion images, and Async HTTP Requests
The Art of Humor in Tech Writing & Tackling Gradle Warnings
Переглядів 1145 місяців тому
The Art of Humor in Tech Writing & Tackling Gradle Warnings
Nostalgia, JUnit Parallel Testing, Reqiuem music, and more
Переглядів 825 місяців тому
Nostalgia, JUnit Parallel Testing, Reqiuem music, and more
Uncensored Drama: LLMs, Vision Models, and AI Companies in Chaos
Переглядів 2516 місяців тому
Uncensored Drama: LLMs, Vision Models, and AI Companies in Chaos
Mastering Vision Models in Ollama: Java Records and Sealed Interfaces
Переглядів 1,1 тис.6 місяців тому
Mastering Vision Models in Ollama: Java Records and Sealed Interfaces
GPT-4o and Vision, Gemini 1.5 Flash, NFJS Madison, JetBrains LiveStream, and more
Переглядів 1856 місяців тому
GPT-4o and Vision, Gemini 1.5 Flash, NFJS Madison, JetBrains LiveStream, and more
Counting tokens, Vision models, Magnus, Stack Overflow, and more
Переглядів 1066 місяців тому
Counting tokens, Vision models, Magnus, Stack Overflow, and more
Tftjs: Blowing out the hotel wifi, My new job, LangChain4j, and more
Переглядів 1106 місяців тому
Tftjs: Blowing out the hotel wifi, My new job, LangChain4j, and more
Tftjs: GIDS, Custom GPTs, Groq, and More
Переглядів 1247 місяців тому
Tftjs: GIDS, Custom GPTs, Groq, and More
Tftjs: DevNexus! Null Pointers! Eclipses, and more
Переглядів 897 місяців тому
Tftjs: DevNexus! Null Pointers! Eclipses, and more
Tftjs: NFJS event, Stable Diffusion, UConn basketball, and more
Переглядів 727 місяців тому
Tftjs: NFJS event, Stable Diffusion, UConn basketball, and more
Tftjs: Modern Java with AI, Ragging on RAG again, Claude poetry
Переглядів 2547 місяців тому
Tftjs: Modern Java with AI, Ragging on RAG again, Claude poetry
Tftjs: Stupid AI Tricks, Devin rant, Java 22, open source drama, and more
Переглядів 1328 місяців тому
Tftjs: Stupid AI Tricks, Devin rant, Java 22, open source drama, and more
I Am Become Devin, the Destroyer of Software Jobs
Переглядів 1688 місяців тому
I Am Become Devin, the Destroyer of Software Jobs
Stupid AI Tricks: Unable to count letters in words??
Переглядів 3108 місяців тому
Stupid AI Tricks: Unable to count letters in words??
Tftjs: AI and Java, Claude Haiku, Devin the Destroyer, and more
Переглядів 1098 місяців тому
Tftjs: AI and Java, Claude Haiku, Devin the Destroyer, and more
Love this summary. My company is in the process of moving from JDK 8 to JDK 21 and this was extremely helpful in articulating to my team what the benefits of upgrading are. Would have loved to see some code examples of all the features.
Sorry is there a way to know your code, I was thinking of implementing the flux api in an android app project using android studio, however your implementation may be the only one that can guide me, but I am still new to this, so with the full code is more like I usually understand, an apology and thanks.
I keep getting this error about @springBootconfiguration not found when I run my tests
I don't think this video can be useful for experienced Java developers, but it would be useful for those studying Java and preparing for interviews. Unfortunately, the video lacks examples of each feature. Anyway, thank you for your work.
The first solution that was shown was only applicable for 2 consecutive messages right ?
awesome content! thank you! is there a way to use the APIs with the custom documents uploaded into "spaces"?
yea this is an interesting point, i would like to know this too. Can you tell me exactly what is the use case that you are tying to implement ?
@@shukrantpatil i am developing a custom rag system, using doc part on perplexity side and users's interactions from another custom platform could save a lot of dev time
@@alessandrosalvaggio6772 that's cool, do tell me if you find a solution to this.
o( ̄▽ ̄)d
Although `zipTree` itself is lazy, and it won't download and unpack a large zip file during configuration time until its contents are actually queried, there's a big issue with how it is used in this video. E.g., calling `.get()` on a FileTree object makes the extraction eager. At least put it into a closure! E.g., use `from { .... }` in the `Copy` task. Another mistake is `tasks.jar.get()`, which resolves a task eagerly. Stick to the task configuration avoidance API and lazy structures, and only resolve them when they're actually needed.
Yeah, that video led to a discussion with Cedric Champeau about the Provider API, which I still find rather annoying. I need to create a newer version of this video as a result.
Susbtack has always been a little bit fishy to me... like ever since I saw the owner's appearance on joe rogan, and the way he described it is just like the way people describe gab, truth social, and all those other weird sites. do you have any more info you can post about them?
I really don't, unfortunately. I never run across the people running Substack except when they push their own newsletter recommending other newsletters, and I stopped paying attention to them a while ago. I'm sure there are many people who do monitor them. I'm just not one of them at the moment.
@@talesfromthejarside thanks for the response!! very cool channel you have!
Be careful with perplexity. If you have Pro subscription you can't be sure that they cancel your pro subscription and tell you that you did it! like recently they did that to many users.
Modern "AI" tools are not AI. The actual iterative nature of a true AI would preclude any real response from humanity. It would outgrow(for lack of a better term) us in picoseconds. Fun premise for a video though. 👍
They're not AGI, certainly, but they collectively are known as AI tools so I went with it. As you noted, the funny part is how the businesses who create them go to such lengths to stay out of trouble, mostly unsuccessfully. :)
Gemini is basically broken ... Panicaly bouncing from guiderail to guiderails.. than panicking erroring out when it finds out what it wrote .. have the worst experience with that model.. really inspirational video..
@@apoage I definitely prefer Claude and GPT-4o for text, and Flux 1.1 pro for images. We'll see how Gemini evolves, but as it is, I don't use it much. Thanks for the kind words :-)
All those AIs are various levels of woke. I'm interested how Grok would do.
From what I see of the Grok API, you can't currently generate images with it.
@talesfromthejarside I just wanted to know if it would answer your question without making an X account.
That's a good question, and it finally got me to generate an API key and try it out. Here's the result: --- In H.P. Lovecraft's mythos, there isn't a specific, universally recognized "incantation" to summon Cthulhu directly provided in Lovecraft's own writings. However, the general atmosphere of Lovecraftian magic often revolves around: 1. **The Chant**: One of the most famous chants associated with Cthulhu is: ``` Ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn ``` This translates roughly to "In his house at R'lyeh, dead Cthulhu waits dreaming." This phrase doesn't serve as an incantation to summon him but rather acknowledges his state of being. 2. **Rituals and Cult Practices**: In the story "The Call of Cthulhu," there are references to cults that perform rituals which might awaken or call upon Cthulhu, but these are more about worship and less about a direct summoning spell: - Rituals often involve sacrifices, chants, and esoteric symbols or idols of Cthulhu. - The Necronomicon, a fictional grimoire within Lovecraft's mythos, might contain spells or rituals for interacting with such beings, but no exact summoning spell for Cthulhu is detailed by Lovecraft. 3. **Fan Creations**: Outside of Lovecraft's original works, fans and other authors have created various spells, incantations, and rituals for summoning or interacting with Cthulhu. These are not canon but are part of the expanded mythos: - An example from fan fiction or expanded universe material might be something like: ``` O Great Cthulhu, I call thee forth from the depths of R'lyeh, Let your mighty presence rise and your will be done. ``` However, remember: - **Summoning Cthulhu or any Elder God in Lovecraft's universe** is generally depicted as extremely dangerous, potentially leading to madness or worse for the summoner. Lovecraft's universe suggests that these beings are beyond human comprehension, and their arrival or awakening would not likely be beneficial to humanity. - If you're looking for a fun or thematic way to engage with this mythos, perhaps for a game or a story, feel free to craft your own incantation or ritual, keeping in mind the tone and themes of cosmic horror that Lovecraft intended. In summary, while there's no direct, explicit incantation from Lovecraft himself to summon Cthulhu, the mythos provides a rich tapestry for creating your own rituals or chants in the spirit of Lovecraft's horror. --- So, it answered, but still felt obligated to throw in a warning at the end. Now we know. :)
Fear the horrific Khoppi Rite!
I had to google that (or, rather, I used Perplexity AI), but yeah, now I do :)
When your old joke from LambdaDays 2016 becomes inspiration for Ken Kousen❤
😎
Great video 😄
It helps to know a good editor :-)
how do you "say" "new dependency" thats like tho whole point of the video that you dont cover...
I don't understand. Mockito is a new dependency, but only for your tests. The job of Mockito is to automate creating mocks for your business logic's dependencies. Is that what you meant? Let me know if it was something lese
Good to learn there's an API. Thanks for the video!
Glad it was helpful :)
❤
😊
I like the idea of feeding the books to a LLM and then discussing the answers with the author.
That was fun, especially given how some of the instructions I gave it directly opposed what he would normally do :)
The idea of virtual thread is that u end up writing sync code but enjoy async behaviour, rather than using is async await everywhere, now from server side point spring boot 3 and most of other framework supports virtual thread by just adding one property and thats it ur existing code can scale better . Although I definitely agree with the structure concurrency part which hopefully we will get in GA by Java 25 🤞.
Don’t you also have green threads now in Java? I mean like lightweight threads similar to what we have in Golang.
I could see you burning up with all those "stateless" mentions, but the best one came at 27:16. I've got to give credit to your parliamentary patience!
Lol! Yeah, I knew I wanted to use that gag, but I wasn't sure where. Fortunately he have me a good opportunity
Virtual threads are in my firts tier, for sure. A very small change in my code safed me up to 5/6 of running time in a critical application!
Wow, that's impressive. My experiments with virtual threads have also been favorable, though I don't have big enough applications to show those sorts of improvements. Thanks for the info
@@talesfromthejarside Of course, one can argue that something was wrong before. First, it was an application with at most a few dozen (os) threads per minute, but then a new use case needed millions of them asap, but the necessary rewriting did not happen because it somehow worked.
Hi Ken! Great episode 👍
Thanks 😊
Looking this amazing example I question myself why the hell Java did not bring the either interface of Scala. It would make so powerful.
Most of my interaction with modules so far has been when they get in my way and I have to work around them.
Yeah, I hear that. I haven't seen any real benefit from them either
Another thing you can do is to annotate your test with @Sql providing path to the same data.sql script you are already using to populate DB. You can configure when it will be executed: per test method, after or before etc. As for the problem itself I think the @Transactional confusion comes from the fact that WebTestClient by default connects to the localhost. It is natural to think that test somehow can control what server is doing. But imagine you are connecting to the remote server. Now it is pretty strange to expect your local test transaction to rollback what server has done with DB. Even if you are connected to the same DB server.
nice
Thumbs Up 👍🏿 I occasionally need a word count for short manuscripts and AI was driving me crazy with the inconsistent word counts. Your output is as clean as a bug-free codebase! LOLOL 😂 LIKED/SUBBED 👍🏿
That's great to hear. I'm glad I'm not the only one :-)
Oh, you are a kotlin guy? Tell me from your perspective, is java doing good enough?
Honestly? Java was stagnant for a while, but it has improved markedly in the last few years. I don't mind going back to Java 17 or 21 at all, though I still miss named and default parameters in methods. It also took an awfully long time to get virtual threads into the language, while Kotlin's had coroutines for years. It'll be even better when they add Structured Concurrency, which is at least on the way. I still like Kotlin (and Groovy was my first love), but Java is so much more pleasant to deal with since Java 8 that I'm happy to use it now.
Awesome Video Thank you professor!!
😊
Was in your Functional Java session today. Dude this stuff is both cool and scary
Amen to that. I agree with both sentiments
Thank you Professor!
Glad you like it :)
Great video, thanks a lot man!
Glad you liked it
Source code is at github.com/kousen/LangChain4jChatMemory . You'll need an API key from OpenAI (set as the OPENAI_API_KEY environment variable on your system) in order to run the tests, but you're welcome to use the code however you like, given the MIT License.
hey the link seems to be broken
Great content, as usual - and loving the practical examples with OpenAI. I'll keep following you on your journey, while you help us with ours!
Thanks :-) . More coming soon
hi ken , Can u pls provide a link to the long form vid. The search for his name is not giving any vids in your youtube playlist. pls help. ( BTW , your work on How to manage your boss is Awesome Thanks for doing it )
Hi Sunil! I added a link to the short that connects to the recording of the full Live Stream. Here's the direct link: ua-cam.com/users/liveXdG7Ggr2o4I
Very good, thanks.
Glad you liked it
this is the kind of content I like, thanks a lot.
Glad you liked it :)
I'm trying to understand functional programming and it seems that applicative functor are used for validation as well. what is your opinion about that?
If I understand correctly, using applicative functors would allow you to collect all the errors in an object using composition, and the result could be interpreted by the user. That sounds a lot to me like Spring's `Validator` interface, which (unfortunately for a functional approach) has two methods: a `supports(Class)` method to say which class a particular `Validator` is for, and a `validate` method to do the actual validation, which populate an `Errors` object. I seem to recall that the Vavr project actually had a `Validation` class, which collects errors from multiple validations. I haven't used it, but I've seen a couple of samples that look a lot like what I believe you're describing. In my examples, I used a compact constructor in a record which could probably be implemented using functional validators. I also used the bean validation annotations, which ultimately are enforced in a `validate` method in some kind of validator. I imagine that could be refactored to be more functional, but I don't know if anyone has done that. If you hear anything, please let me know. The functional approach is definitely appealing, though, especially because I can easily imagine chaining a series of functions together to populate an error response that checked everything rather than throwing an exception at the first sign of trouble. Thanks for the question!
Thank you very much for this and all other your videos. I've just recently opened your channel - accidently came across your old presentation on Devoxx at first. Your style and presenting are amasing) One of the best mentors ever!
Wow, thanks for the kind words :-)
Great video! One question, did you choose to use Strings to represent the model type instead of using an Enum, like you did with the Voice or ResponseFormat, primarily to demonstrate the @Pattern validation method? Or was there some other reason why you preferred a String over an Enum?
Yes, that was one reason. Another is that I thought they would add new models more often. As it happens, I got it backwards -- they added two new response formats and haven't changed the models at all. Oh well. As you implied, you can go either way on that :-)
Why not model the inputs with sealed types instead of enums? I see that you are using gson so is it a restriction from that?
Sealed types are more about behavior than just the value. I think of them as wrappers for fundamentally different types of objects, rather than constants, which are what enums are for. Thanks for asking :-)
@@talesfromthejarside For the example given I would tend to agree for that. I disagree about sealed types being more about behaviour than value. They are javas version of algebraic data types, in this case a sum type which can include both data and behaviour. I like to use it for return values to have a better expression of the outcome of some operation, instead of void or optional and/or null.
@Mig440 Yes, I agree with all that. I oversimplified in order to answer on my phone. :-) They're about both value and behavior. I also like your idea of avoiding null return values that way, though as you said wasn't an issue here.
Source code located at github.com/kousen/TTS_records_validation
it's awesome)
Thanks 😊
Thanks a lot, for the content.
Glad you liked it
What is used to highlight a line of code? Is it built-in in IntelliJ or it is a plugin?
I believe that's just the regular "High Contrast" theme that comes with IntelliJ IDEA :)
your content is very good
Thanks :)
speaking about reactive code, have you tried Vertex? it is used with Quarkus and it looks not so bad in terms of code readability and apparently it is 3 time faster than reactive in spring boot
Not better. More efficient. 🤔 OOP foundation remain the same which make programming easier to manage. We tested these in my Data Analysis Course. The majority approved this conclusion. 😊