Hi, this is a channel for the dev, by the dev. I produce content related to coding, data science, cybersecurity, and software developer life. Welcome to visit, let me know if you like the content here!
Hi, yes, that's a known issue, it's not perfect. Pdf readers often struggle with table data even in the best RAG solutions, and of course cannot easily understand any information that's not in text format already. It's mostly for poc level example, to make it work better, much more work is needed. What can be done? - check which part is not parsed properly - you can isolate the code that parses pdf and play with it - there are typically adjustments you can make to better meet your needs, but as mentioned, it can mostly handle text chapters and titles, table data and images need some other approach overall - possibility to see the library issues list, see if anyone else is struggling with same issues - possibility to check to see if there's a better library available for your needs - there typically are options. This was just one that was fast to get working. So, pdf documents are not the easiest usecase to feed for RAG, something that would be better structured is typically going to give better results. But it's a nice starting place. I'm a bit concerned myself about losing the graphs, images, and potentially having table data cut in halves etc, those can alter the results vastly. If you can find any better means of converting the pdf to any structured format that would retain what you need, that would improve the results.
one doubt i have ollama which will have a ai model lets say mistral or meta now i am connecting this to my springboot app and lets say i have a pdf about my product can show me how a rag implementation done here and when a api is sent it should give me the data about the PDF
Great video! Ideas for future videos: Try out different embedding models (I think the ChromaDB default is all-MiniLM-L6-v2) Set up a separate embedding database. Maybe something more familiar with developers like Postgres + pgvector + hnsw indexing (Important to trial out different index building parameters)
Well, I use both. VSCode is awesome for dealing with multiple languages and config files, very flexible. Jupyter is great when dealing with mostly Python and data files, soecialized in those. I've got Jupyter plugin in VSCode too, so I use both, depending on what I'm working on.
Is there a way to enable jdk 22 features by default without mentioning it everytime “-preview-enable -source 22”? If I use JAVA_TOOL_OPTIONS = -preview-enable -source 22 environment variable, then I’m getting “Unrecognized option: -source”. And tried JDK_JAVA_OPTIONS environment variable instead of JAVA_TOOL_OPTIONS. It’s working 🎉 But now vscode is not working as expected 😅. Is there a solution for this?
No, the preview features are always behind the preview flag. Of course the idea is that eventually they get out of preview and become just normal features and thus flag is no longer neede. (Or not, they may never become features, or may change a lot before becoming features). So anything behind the flag is more like a cutting edge sneak peak than something actually released and stable. So good for playing and feedback, but not so reliable for production use - yet. Of course you can hide any flags you need in some kind of startup script etc, so nobody needs to actually see them. Java typically uses all kinds of parameterization anyways.
Oh yes, you've hit one of the weaknesses/limitations of the current RAG model in general (and vector databases). They are suprisingly awesome at digesting and using huge amounts of unstructured data. But the simple examples do not even attempt to deal with bits that require specific interpretations. PDF readers are good at grabbing document data, titles and paragraphs, to make sense of it. But they currently already struggle with tabular data, diagrams, charts, and yes, math formulas. Furthermore, those are fed into vector database as text typically, and similarity search also works text-based. And when you retrieve it, you retrieve text. I'm afraid there's not much to do about it, except you can of course create a specific pre-parser for the documents, or tune your pdf processor or write your own, to decide the rules how the pdf or html is interpreted and stored. I don't know your exact use case, but my advice would be: yes, it's not working, because it's not a trivial problem to solve. Yes, you can probably solve it, but you need to rethink it. Math formulas typically benefit from more structured content. You can always handle them outside the system, perhaps store some links or references in the rag solution to find and fetch them etc. I have to say haven't had to solve this issue yet but already the tables are a common challenge and question with current gen RAG solutions. It's a decent start but more is needed.
Oh, forgot one thing: multimodal models that are able to make sense of images might be interesting to explore for formulas, to work around text conversion.
Create a Basic RAG model AI chatbot using any open-source model available. Database: Zilliz/Supabase or any Vector DB, of your choice. Backend: Java Frontend: HTML/CSS/JS (or anything you are familiar with) Backend should haveAPI for: • Upload a file or text - text should then be converted into chunks and then embeddings (You can use any open-source embedding model or paid one too). Embedding should then be stored in a vector DB with vector index of your choice (Cosine/ L2/KNN). • Chat API -> prompt or user queries should be passed in this API and using prompt engineering response should be derived from any Language model. Frontend: UI does not have to look pretty. basic pages should be there - 1. For uploading docs or text for training the RAG model. 2. Basic chat interface where user can send message and receive the response. Sir please help me how to do this project🙏🙏🙏🙏🙏🙏
Thank you for the video! I think what must be said is the non-techincal filter on job applications. Many recruiters/HR will be inundated with applications in these market conditions, so, why not offer yourself another reason to get put in the 'positive' pile.
Oh yeah, a very good point. Job market is a bit more challenging right now, so anything concrete to be able to show might just give you that edge. In that sense, even the lightweight free certificates you can do within few hours work. Probably not going to be the main decision factor, but just a little bit of extra on top.
Thank you! I did not include frontend because on top of API that is quite straightforward, and tried to keep the video compact. But I've been thinking of doing a bigger video with full stack, because it looks a lot nicer. But not there yet, at least. It would really be a trivial NextJs (or any other framework) web app that you dump into spring boot 'public' folder under sourcecode. So I'll definitely take that under consideration, but probably not going to happen soon.
Hey, I just saw this video and I think the potential is huge, really great video! I was wondering if you could show how to correlate with the different tags you can add in oura? That would be really helpful :)
Interesting idea, haven't done that yet so need to look into it, if I find something cool I'll definitely be back. Not sure how the API works for them yet, but can see how that could be useful.
Thank you for the feedback! Much appreciated! Love to learn and share these things, I understand best by building and tinkering. Some more cool RAG stuff coming up soon! :)
Sure, I've done few in the past on my channel, but of course might be nice to redo since both Java and Spring have gone a long way since then. I've mostly been showing Spring Boot + Web module, to create RESTful APIs, and what you want to do behind that is of course up to you, but most often it includes database. But, while waiting for new video, these should still work to give you the big picture: - ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-xxRw0XIoKvA.html - ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-KsWg6nPVwsg.html - ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-Sg1b0sugbtg.html Thanks for tuning to my channel!
Great video. I had a question. lets say we are building a chatBot and we need to make sure that the bot answers questions that are available in a document as well as personalized questions for a specific customer [which can be retrieved using some API's that have been exposed]. How would you do it?
Hmm ,interesting question. If I got it right, some customers would get answers based on the document, but others would get answers based on some APIs? If so, in both cases you want to inject some context in system level instruction, either from vector database/document, or an API - so that part remains the same. So when you need to answer an API, you would call the API, get the context for the question, then include that in system direction. No need for vector database, as long as what the API returns a) has all the context info needed and b) is relevant and c) is not too massive to chat in the available tokens. So in both cases, grab the context information, feed in the system level instruction like in my code. Decide on top of that which context is used for which user. One thing I'm not doing in this video, is keeping a conversational memory: I'm just asking a question, and activating context + chatgpt to handle it, but then forgetting all the conversation. So with conversational memory, would need to be a bit more careful, because also the conversational context is typically injected into the calls. Also I think would have to be careful with size, of course depending on your model token limits. And you would need to keep the contexts separate so each user would see their own personal context only (instead of same shared one for everyone). I hope this helps and I got the question right!
Thank you! It seems RAG usecases are in demand right now, and there's also uses for own internal tools. Some of these of course will appear as part of available tooling, but being able to do it yourself is great for like-minded tinkerers that like to understand things by building them, I think.
JNI is cool. I once tried to build an ide with it: but i failed bc i was on mac and for some stupid reason java runs JNI on a separate thread: and as you know, mac only wants guis fron the main thread… and my structure would’ve been this: JNI - will handle GUI, and java - would handle the actual syntax highlighting, and all at junk
Haha, you know, I coded myself an IDE too, when starting to learn Java Swing. It never got full featured enough, but it was fun to build it from scratch and then use it to develop it further. Also made me appreciate people who work on modern IDEs a lot more - there's a boatload of details to solve and take care of to make them work beautifully.
@@DevXplaining i tried to do it with imgui, and failed bc macos is stupid :( and i never even figured out how to make it so JNI executes on the main thread. Altho if java adds a feature like this then ill probably try doing it all over again
Very interesting sample of Virtual threads. How does this integrate when youre building an application with a framework? Dont the framework handle the creation of threads?
Yes, a good question. Short answer is that yes, typically that's what happens, and typical software project inside any web framework pretty much ignores you needing to tap into parallelism - you just think about it when accessing background resources. But two reasons to still keep up with Java parallelism features: 1) Well sometimes you do build something from scratch, that would mainly happen if you want to do some intensive calculations without web servers, or if you are building a server. 2) Virtual Threads are currently finding their way into popular servers and frameworks, so mostly you can just enjoy the benefits, but it's at least good to get the idea why they may bring more performance when your favorite framework start using them. So mostly I think this is the message that Java platform is still very much alive and kicking, and still getting better. Spring Framework is already embracing them, for example: spring.io/blog/2022/10/11/embracing-virtual-threads Might be a fun topic for a future video.
okay great. Maybe you might consider making a video in the future for this question or you could please share your ideas here. I'm a bit confused if Virtual Threads are going to replace Reactive Programming. If they would, why? and if they won't, why?@@DevXplaining
This is really cool. Thank you for making this video, now I have to look more into SpringAI. But what would you say about code safety when using AI, dont that have access to your code that shouldn't be public?
Yeah, it's a good question. AI takes many forms, so rule of thumb is: anything you would not like to/be permitted to publish on front page of a popular magazine tomorrow, you should not send to AI - unless you know how the data is handled, stored, etc. And additionally, is your input used to train the models (which could cause it to pop up as an answer for future users). So for example using ChatGPT like I do here, I'd limit it to general advice. But for example Github Copilot Enterprise is my tool for daily work, and there are some rules in place to stop my code from leaking. So either know how your AI handles input data, or be safe and just use it for general questions. But as always, keep your secrets secret! :)
JEP 463 should have been since more than 10 years ago on Java! As someone who learned Java in 2001 this JEP would have been a godsend at that time. I always have said that Java is not a beginner friendly programming language
Yes, agreed. I was teaching Java for a decade and that getting started part for new coders is tough with it. Once you push through it does get better. So I'm very happy to see they finally added beginner-friendly features, even though old hands really don't need all that :) But much easier to learn it, teach it, do something small just for fun.
Hi, that's a good question. That's built-in the speech recognition library, so it stops to interpret the speech when there's long enough pause. So I'm kinda giving it the whole text by not pausing before I'm at the end. Similarly, the SR library also starts interpreting speech to text only when some audio begins. For any SR library (I'm using Google API in this example), there are typically settings to adjust how long pause means speech has ended, and it's time to interpret it. Alternatively, there's also possibility to introduce walkie-talkie-like push button to speak mechanism to signal end. Finally, one could also of course just interpret constant length blocks constantly, but then that might not make sense to be sent for AI to interpret.
To give a more concrete answer, here are the parameters that could be passed in my code to adjust how long pause means end of block of speech (in seconds): recognizer = sr.Recognizer(pause_threshold=0.5) # or other value
Hi, you know, that is a possibility I've been thinking about. :) Two things on the way: It takes some effort, so I need to find the time for it. Second, there's been a lot of options available currently, so need to choose which one is good. If I can find the time, what I've been thinking about would be to get something running in Raspberry Pi/other low-end hardware that's easily available. I would probably use a suitable Mistral model right now. But no promises, time is hard to come by these days :)
I love your videos-please make more! I recently got an aura ring, and your videos really helped me orient to its capabilities. I was very excited to play with the SPO2 and temperature data and am very disappointed with the granularity in terms of what is available for those data points. Just curious if you were able to overcome this barrier, and or what you would recommend for an inspiring developer such as myself.
Oh thank you, much appreciated! Feedback like this definitely inspires me to create more. Yeah, two problems with Oura data is that it's not real-time for performance reasons, and granularity for some datapoints is very sparse, sleep scores being another tough area because you only get them after, and some of them accumulate through the night. That's kind of by design, to conserve energy. I don't remember the granularity of SPO2/temperature, but I don't have any special tricks to overcome. I tend to treat the data based on what granularity/latency I get, aka: Typically just zoom out and get a wider view. On a sidenote, I am suprised that my Oura 3 is still alive and kicking well, previous one died early for battery issues, this one is up and running. For inspiration, here's my view for Oura data. If you just want to analyze it, Oura software and dashboard already does pretty good job in calculating the scores and showing the history. What was interesting for me, was to figure out how to combine that data with other sources, for example compare my heart rate/heart rate recovery against my daily or weekly schedule, my sleep schedule, music I am listening, etc.
I like that Java keeps updating, outdated features are deprecated, then removed. New features are brought in constantly. Using Java 21 and beyond feels so fresh.
@@DevXplaining yeah, coding in java 1.4 vs Java 21 feels like almost totally different languages. I am happy now I can make simple program/scripts in Java and throw away python almost entirely. Looking how to use GraalVM to use Java to automatize small Scripting fit tasks without the overhead of the JVM. The best time to be a Java coder is now.
Hello, this is very interesting. Can I ask if this video is the most current that will support the latest updates from Python? Also, would you have coding to create an ai assistant from beginning to end? Thanks again.
Hi, happy to hear you liked this. This is one of my favourite pet projects, and every now and then I actually turn it on and have a chat, because it's fun :) If you mean latest Python versions, sure, I typically use latest available when recording and this is quite recent. The OpenAI APIs have changed a bit, this video and code uses the latest version of those as well. So should be quite up to date. Of course few months have passed so things may have updated a bit, but as far as I know nothing that would have an impact here. I used then latest available preview model. For the coding from beginning to end.. If you take a look at the code, it's only 69 rows, so not much to it, mainly some decisions on which libraries to choose to get the results I wanted. I try to keep my videos short and sweet when I can, that's why I just shared and showed the result (link to git in the description section). Here, libraries do all the heavy lifting. But this is a fun topic so would probably not mind doing something from scratch, with all the steps. But wouldn't want to do exactly the same thing, so it would have to wait until I get some nice update idea for this. I have some plans cooking but nothing concrete yet. But I would say: It's a nice tool, simple bit of code to get started, inspired, and make it your own, take it further.
Hey, thanks for your detailed reply. That was very helpful. I’m keen to see what you come up with. I’m after my own self learning AI assistant that could do a multiple amount of things for me. Problem is, most coding includes so much limitations on the extent of what an AI platform can do. A true AI assistant should be limitless. The possibilities would be endless.
I want to represent the neutral positive and negative comments as the part of a pie chart (i.e percentage of positive negative and neutral comments )how can i do that can you please upload a video on that.
Ah, that would be a sidestep from the original theme, don't plan on that video currently. But. There are several ways to do it. I play a lot with Jupyter Notebooks for visualization, so I see two parts here. Step 1: Get the data I gather above in a nice regular numeric format, csv files tend to be nice. Step 2: Get a visualization library of your own preference, for example Matplotlib for Python, Plotly, etc, and plot that data out. Easier path could be to just do it in Excel. Once you get the data in table format, anything is easy. So that specific thing is probably not the next video on my channel, but hard part is getting the data, then many things become possible. Thanks for watching the video!
Thank you for your outstanding videos about the Oura Ring API. I discovered your channel while playing around with the Oura Ring export data, looking for some more detail on the API as I find the Oura V2 description of their API is sorely lacking in detail. Unless I am missing something, I can't find details on the numbers for many of the columns compared to what I saw in your video, which shows a previous version of the API documentation. Also, what the exported data shows me and what the Oura Dashboard shows me on my iPhone is different, and so far, I don't quite understand why this is the case. For example, the data for January 19, 2024, CSV export differs from what I can see in the Oura App on my iPhone. This is under the assumption that the data shows in seconds, which I get from your video, as there doesn't seem to be information in the API documentation if the export is actually seconds. CSV Export Data: What the Oura Dahsborad on my iPhone shows me for that date: Total Sleep Duration: 25,920s = 7h 12 min 10 h 6 m Awake Time: 6,117s = 1 h 41 min 57 s 2 h 37 min REM Sleep Duration: 5,310s = 1 h 28 min 30 s 1 h 16 min Light Sleep Duration: 18,510s = 5 h 8 min 30 s 5 h 28 min Deep Sleep Duration: 2,100s = 35 min 0 s 46 min 0 s I get quite a discrepancy which I find frustrating, and the documentation is not very helpful. I will now try it with API calls to see if I get different response compared to the CSV file export which wouldn't make any sense but who knows.
Thank you for your feedback, much appreciated! Interesting finding. I've never actually compared the oura app stats to the excel exports or API-returned results. It's of course possible that they wouldn't match, but I find it a bit odd. One thing I realized playing with the data is that you easily get a one-off error, for two reasons: 1) data you can export/pull from API is of course not real-time. For data to be there, the ring must have send data to app, and app must have sent it to cloud. This makes the most recent data almost always incomplete. So data gets more reliable after it's few days back in the history.Which takes me to second point 2) there's some data that's available as it's created, but sleep data accumulates over night, and any metrics are calculated and ready for the night afterwards. so if I grab todays data, I get previous nights sleep data along with current dates activity data, this easily confuses the results. So I'd have two questions to narrow down the issue: 1) compare some data at least few days back in history. If the sleep number from API seems to not match what the app tells you, check the days around it, does it match one of them? If so, there's probably logical one-off issue you can compensate to put the data to correct day 2) if there are mismatches, are they regular so that all days are off, or are most days correct, with one day off here and there. If latter, then it sounds like issue with Oura data, otherwise I'd double check my own process and logic. Videos here - no guarantee they are more reliable source of information than Oura documentation. There's been rare cases of me being wrong as well (typically once in a decade or so :) - but Oura is also very secretive about their algorithms, because it's competitive advantage, so I've kind of reverse engineered some details, but no way to check things 100% correct. Just my observations here, sharing my path in hope to get others also interested and dig into it. But I am a big fan of gathering and analyzing metrics, treating myself as an IoT device, so Oura definitely fits that bill. :)
It sure is! Not something I have experience on, nor videos, but looks like fun as well. Here's a good writeup of how they work together. julia.quantecon.org/getting_started_julia/getting_started.html#running-jupyterlab