- 38
- 24 712
Code Wiz
Australia
Приєднався 3 кві 2024
Empowering programmers with expert guidance and practical insights for coding success!
Smart Investment Portfolio Advisor App with Java, Spring, Langchain4j, and OpenAI/Ollama
In this video, we'll walk you through creating a smart investment portfolio advisor app using Java, Spring Boot, Langchain4j, and OpenAI/Ollama. This project integrates advanced features like function/tool calling in LLMs to access real-time financial information and assist in decision-making. We'll explore how to store stock orders, calculate positions, integrate with external APIs. Perfect for developers looking to blend AI and finance with modern tech stacks!
Topics Covered:
• Creating an API to store stock orders in PostgreSQL and calculate portfolio position
• Exploring different methods of calling LLM with Langchain4j
• Integrating Langchain4j with a Spring Boot stock advisor API using AIServices
• Sending various types of messages to LLM
• Implementing chat memory
• Overview of Retrieval-Augmented Generation (RAG)
• Overview of Tool/Function calling and its functionality
• Fetching the latest company information from financialmodellingprep.com with RestClient
• Exposing company information services as tools to LLM
• Using chat to receive investment advice based on latest company data using tools
• Testing tool flows and tracing the application during testing
• Walkthrough of a UI created with Next.js and React for the portfolio advisor interface
Exposing order creation and listing services as tools and using chat for order management
Source - github.com/CodeWizzard01/stock-portfolio-advisor/tree/branch1
Blog - codewiz.info/blog/investment-advisor-langchain4j/
Medium Story - medium.com/@code.wizzard01/build-a-smart-investment-portfolio-advisor-with-java-spring-boot-and-langchain4j-and-ai-ce20591c962f
Tags: #SpringBoot #Langchain4j #OpenAI #Ollama #InvestmentAdvisor #FinanceApp #LLM #AI #RAG #NextJS #React
Topics Covered:
• Creating an API to store stock orders in PostgreSQL and calculate portfolio position
• Exploring different methods of calling LLM with Langchain4j
• Integrating Langchain4j with a Spring Boot stock advisor API using AIServices
• Sending various types of messages to LLM
• Implementing chat memory
• Overview of Retrieval-Augmented Generation (RAG)
• Overview of Tool/Function calling and its functionality
• Fetching the latest company information from financialmodellingprep.com with RestClient
• Exposing company information services as tools to LLM
• Using chat to receive investment advice based on latest company data using tools
• Testing tool flows and tracing the application during testing
• Walkthrough of a UI created with Next.js and React for the portfolio advisor interface
Exposing order creation and listing services as tools and using chat for order management
Source - github.com/CodeWizzard01/stock-portfolio-advisor/tree/branch1
Blog - codewiz.info/blog/investment-advisor-langchain4j/
Medium Story - medium.com/@code.wizzard01/build-a-smart-investment-portfolio-advisor-with-java-spring-boot-and-langchain4j-and-ai-ce20591c962f
Tags: #SpringBoot #Langchain4j #OpenAI #Ollama #InvestmentAdvisor #FinanceApp #LLM #AI #RAG #NextJS #React
Переглядів: 216
Відео
Free AI Code Assistant in VS Code & IntelliJ IDEA with Ollama , Open Source LLM & Continue
Переглядів 31814 днів тому
In this tutorial, I'll guide you through setting up a powerful, free AI code assistant in popular IDEs like VS Code and IntelliJ IDEA. We’ll use Ollama to run open-source models optimized for coding, and the Continue plugin to enhance your coding experience-all running completely on your local machine. Whether you're a beginner or an advanced coder, this setup will elevate your workflow and pro...
Mastering Integration Testing in Spring Boot with Test Containers & Rest Assured
Переглядів 15628 днів тому
In this tutorial, learn how to create efficient integration tests for your Spring Boot APIs using Test containers and the Rest Assured library. We’ll walk you through building fluent integration tests for an API that interacts with MongoDB and AWS S3, ensuring your microservices are properly tested with real containers. Whether you're just getting started with Spring Boot or looking to enhance ...
Mastering Pattern Matching with Java 23: Records, Sealed Classes, Destructuring and More!
Переглядів 68Місяць тому
In this tutorial, we'll explore the powerful new pattern matching features released till Java 23. Learn how these features simplify your code and enhance its readability. This video covers: • Overview of pattern matching features released till Java 23 • Introduction to Java Records • Pattern matching with records in instanceof and switch expressions • Using record destructuring patterns to extr...
Build a Social Media App UI with Next.js 14, React, Tailwind, and Shadcn UI
Переглядів 143Місяць тому
In this tutorial, we dive into building a social media app user interface using Next.js 14, React, Tailwind CSS, and Shadcn UI. From configuring the App Router in Next.js to implementing both client-side and server-side components, we cover a full spectrum of features. Learn how to handle user authentication, interact with backend APIs using JWT tokens, and create an engaging experience with in...
Mastering JWT Authentication with Spring 6 Security and MongoDB
Переглядів 6002 місяці тому
In this video tutorial, we will dive deep into implementing JWT authentication using Spring 6 Security and MongoDB, following best practices recommended in Spring docs without custom filters. Get hands-on with practical examples and learn how to secure your applications effectively. Key topics include: • Overview of JWT structure and how security works with JWT • Understanding how Spring Securi...
REST API with Spring Boot 3.3, Mongo DB, AWS S3 and Java 22 | Build a Social Media App
Переглядів 7542 місяці тому
In this tutorial, we’ll build a fully functional social media post API using Spring Boot 3.3, Java 22, MongoDB, and AWS S3. Whether you’re new to these technologies or looking to enhance your skills, this video has you covered. We’ll walk through everything from setting up MongoDB in Docker to integrating AWS S3 for file uploads. Topics Covered: Overview of the Social Media Post API we will bui...
Next.js 14 & React Server Components Tutorial | Build an Event Booking App with GraphQL Integration
Переглядів 5063 місяці тому
In this comprehensive tutorial, we'll dive into the powerful features of Next.js 14 and React Server Components by building a fully functional event booking app. You'll learn: • How to use the App Router in Next.js • React Server Components • Server-side Rendering (SSR) • Client-side Components • Server Actions • Streaming • Integration with GraphQL API Perfect for developers looking to stay ah...
Docker Basics | Run Spring Boot App in a Container
Переглядів 1733 місяці тому
In this comprehensive tutorial, we'll dive into the world of Docker, a powerful tool that has revolutionized software development and deployment. Whether you're new to Docker or looking to refine your skills, this video covers everything you need to know to get started and succeed with Docker. Topics Covered: 1. What is Docker? - An introduction to Docker and its benefits. 2. Why Docker? - The ...
Retrieval-Augmented Generation (RAG) with Spring AI, PGVector and Open AI
Переглядів 7164 місяці тому
Build a Chat Engine with RAG and Chat Memory using Spring AI, PGVector, and OpenAI In this video, we dive into the world of Retrieval Augmented Generation (RAG) using Spring AI, PG Vector, and Open AI. We'll build a chat engine capable of answering questions based on the latest information or specific to your company's data. Here's what we cover: • Understanding the necessity of RAG in modern A...
Build Intelligent Spring Boot Apps using Spring AI and Ollama | Trip Planner App
Переглядів 1 тис.4 місяці тому
This video will guide you through the process of building a smart trip planner app using Spring AI and Ollama. We'll use AI to generate travel plans based on user-entered locations and dates, factoring in the latest reviews, ratings, and weather forecasts. Here's what we'll cover: 1. Overview of Ollama and running different LLMs locally 2. Accessing Ollama chat and API 3. Introduction to Spring...
Master API Integration in Spring Boot with Rest Client - Integrate Google Maps & Open Weather API
Переглядів 1,1 тис.4 місяці тому
Learn how to do production-ready efficient API integration by building a travel planner API that integrates with Google Maps Places API and a Weather API. This project will fetch top tourist places and weather details for travel destinations for a specific travel date. What's Covered: • Rest Client API: Learn how to effectively call APIs using the new Rest Client. • Integration with Google Maps...
GraphQL Subscription | Build realtime updates for ticket availability in a ticket booking app
Переглядів 984 місяці тому
Learn how to harness the power of GraphQL subscriptions for real-time updates in your applications! In this tutorial, we'll cover everything you need to know about GraphQL subscriptions, including: 1. What GraphQL subscriptions are and how they work. 2. Adding a subscription to a ticket booking GraphQL API to get real-time ticket availability. 3. Testing your subscription using Apollo Explorer....
JWT Tutorial l Securing GraphQL APIs
Переглядів 2755 місяців тому
Learn how to implement robust authentication and authorisation using JWT (JSON Web Tokens) in your GraphQL API. In this tutorial, we'll cover everything from the basics of JWT to advanced implementation strategies, ensuring your API is secure and efficient. Covered Topics: • How JWT can be used for authentication and authorisation • Understanding the structure of JWT and what makes it secure • ...
GraphQL Crash Course for Beginners :Build a Ticket Booking API with Node, Apollo, TypeScript & MySQL
Переглядів 3575 місяців тому
Welcome to the ultimate beginner's guide to GraphQL! In this comprehensive tutorial, we'll walk you through building a robust ticket booking API using GraphQL, Node.js, Apollo Server, TypeScript, TypeORM, and MySQL. Whether you're a seasoned developer or just starting out, this video has something for you. 📌 What You'll Learn: 1. Evolution of API Technology: Understand how API technology has ev...
Model Entities | Create ERD and Generate Code in VS Code or IntelliJ IDEA
Переглядів 9555 місяців тому
Model Entities | Create ERD and Generate Code in VS Code or IntelliJ IDEA
Server-Sent Events (SSE) with Java and Spring Boot | Build a News Feed App
Переглядів 1,4 тис.5 місяців тому
Server-Sent Events (SSE) with Java and Spring Boot | Build a News Feed App
WebSocket with Spring Boot and Java | Build a Chat App
Переглядів 2,5 тис.5 місяців тому
WebSocket with Spring Boot and Java | Build a Chat App
Server Sent Events (SSE) Beginners Guide | Build Realtime News Feed App
Переглядів 4805 місяців тому
Server Sent Events (SSE) Beginners Guide | Build Realtime News Feed App
WebSockets Tutorial for Beginners | Build a Chat App using Node, React, WebSocket and Socket.IO
Переглядів 8746 місяців тому
WebSockets Tutorial for Beginners | Build a Chat App using Node, React, WebSocket and Socket.IO
How to enable Preview Features in Java 22
Переглядів 8166 місяців тому
How to enable Preview Features in Java 22
Stream Gatherers | Java 22 New Feature
Переглядів 8826 місяців тому
Stream Gatherers | Java 22 New Feature
Top JAVA Interview Questions #4 - #hashmap #priorityqueue #linkedlist #arraylist #treeset #hashset
Переглядів 2056 місяців тому
Top JAVA Interview Questions #4 - #hashmap #priorityqueue #linkedlist #arraylist #treeset #hashset
JAVA Interview Questions with Explanation - Q#3 - ArrayList & LinkedList #javacollections #ArrayList
Переглядів 5286 місяців тому
JAVA Interview Questions with Explanation - Q#3 - ArrayList & LinkedList #javacollections #ArrayList
JAVA Interview Questions with Explanation - Q#2 - HashMap
Переглядів 6826 місяців тому
JAVA Interview Questions with Explanation - Q#2 - HashMap
Virtual Threads and Structured Concurrency | Java 21 Features
Переглядів 3766 місяців тому
Virtual Threads and Structured Concurrency | Java 21 Features
C# DotNet Q#3 - Association, Aggregation, Composition
Переглядів 5216 місяців тому
C# DotNet Q#3 - Association, Aggregation, Composition
Awesome explanation. Thanks!
Thanks a lot for the feedback
wow,this is cool to understand and implementation.thank you Code Wiz.
Hi,this project really excited me and also interesting.I am getting this exeception: software.amazon.awssdk.services.s3.model.S3Exception: The request signature we calculated does not match the signature you provided. Check your key and signing method. I tried to fix it but i couldn't and i am passing the aws.s3.accesskey and aws.s3.secretKey as VM arguments. Can you guide me in this.
Thanks for the feedback Ravi. That error looks like auth issue. May be first debug/log to see if the access key and secret key are getting set while initialising S3Client. Also you can test the credentials through AWS CLI. First install AWS CLI, then run `aws configure` and enter the credentials. Then run command `aws s3 ls` and see if bucket is getting listed.
Can you do a video with redis and using similarity search with filter expression?
Sure, will plan that. Thanks for the recommendation
Excited for part 2 thank you
Part2 is already there - ua-cam.com/video/63PrzfVqnmw/v-deo.html We are working on the last one (UI) 😀
Excellent
How many videos (approx idea) will this project have? Or total duration??
Two more videos to go, one for user authentication and second one for UI. Both should be around 60-90 minutes. Planning to do that in next 2-3 weeks. Thanks for checking.
@@Code.Wizzard thanks 🙏🏼
How do you use env file I am not able to do that
For this video I had set it up as an environment variable in my OS I think. Since I am using mac I added something like `export places.api.key="testkey"` in .zshrc file. In windows this can be done in environment variables. Another way is to pass this as environment variable while starting the app. If you are doing it from intellij go to `Run->Edit Configuration` and then add `places.api.key=testkey` in Environment Variables section.
@@Code.Wizzard thank you
but i have a question: so how we can test 2nd version of your example with postman? Is it absolutly impossible? or is it just hard and inconveniently?
Since the second one uses STOMP protocol on top of Websocket, I think it might not work since there are no options in postman to enable that. Will try to explore more.
@@Code.Wizzard so it is a case to create simple html page to test your backend app, right? Or maybe is there an ability to write integration tests for this purpose?
@@OleksandrProkopenko_ua correct, either can test it from a UI or write integration test using WebSocketStompClient
its just a very good video. Thanks
Thanks for your kind feedback
Thank you :)
Create for a full stack app bro
Sure, thanks for the feedback. Will plan something
Hello bro Can you do this with offline ai model using ollma
Sure, I'll plan a video for that. Thanks for the feedback! Meanwhile, if you want to try it out, it's really easy to swap OpenAI with Ollama. Simply change the dependency from spring-ai-openai-spring-boot-starter to spring-ai-ollama-spring-boot-starter. This video has instructions on how to set up Ollama locally: ua-cam.com/video/AnOh0C5SdFY/v-deo.html
@@Code.Wizzard i have tried it out but not rag feature, so thought of asking you
That's great! Just switching the dependency in codebase of this video should do the trick then. However, while running Ollama locally, keep in mind that we usually use 7B or 13B models. This might lead to some reduction in accuracy compared to OpenAI's paid models, which use a much larger model, around 1.7 trillion parameters or so.
@@Code.Wizzard let me try this 👍,, and bro please explain some more use. Cases with. Ai
Thankyou for this. Best video on spring websocket so far.
Can you please tell me on how to switch to wss from ws using SSL. (I am using spring websocket without stomp & sockjs)
Thanks for your kind comments. Switching to SSL is straight forward For dev environment you can first create a self signed certificate using the below command. For production, it's recommended to obtain a certificate from a trusted CA. keytool -genkeypair -alias websocket -keyalg RSA -keysize 2048 -storetype PKCS12 -keystore websocket.p12 -validity 3650 Add the below to application.properties server.ssl.key-store=file:<Path>/websocket.p12 server.ssl.key-store-password=<password> server.ssl.keyStoreType=PKCS12 server.ssl.keyAlias=websocket server.ssl.enabled=true After that you can access the websocket using url starting with wss://
If I already have a SQL Script for the tables creation, can this tool generates the diagram from the script?
That would be a nice feature to have. But it looks like this plugin doesn't support that. There are other tools like dbdiagram.io/d available, dbeaver.io/ which can be used for that. But I haven't used those.
Yes, prepare the .sql file Right click on the blank erd.json file & choose import If the erd.json has content, it will overwrite/replace with the imported .sql
Nice
Nice concept thanks 🎉🎉🎉
Thanks, Vijayarajan
What if we have to fetch the data from db
Usually, for real-time use cases, messages are pushed to your app via queue/topic or by calling your API by a client/external app. But if you want to push data from a DB over SSE, you can poll the DB at regular intervals for new data and push this data incrementally to the client using an SseEmitter. Hope that answers your question.
Thank brother
Please sir. Topic about nestjs graphql Prisma with notification graphql-ws(authentication over socket)
We have a video on Graph QL Subscriptions over Websockets - ua-cam.com/video/yRX7uTPOONE/v-deo.html Will definitely plan other topics in future. Thanks for the feedback.
graphql is an overkill. just a fb solution for fb problem
Why not List.of(...) to create a List? you are working with streams
Good point. List.of() is more optimised for this scenario since it provides an immutable list. Thanks for the feedback. Although Arrays.asList() provides a fixed size list, you can still replace an element in an existing index with another one using set operation
Why use generic T instead of String?
To make it generic, so you can use an type of list in future
Thanks Patrick for answering. Building Gatherers with generics will allow us to use the same gatherer for other types. For example we can use the same fixed window gatherer for list of Person objects instead of String.
thank you so much , can you give me some tips how to learn spring boot and spring flux
Thanks for the comment. I would suggest to first get an in depth understanding of Spring Web before starting with web flux. We have one video on Spring Web which is a short one - ua-cam.com/video/iRiJqI3oAqA/v-deo.html. Planning to do a detailed crash course sometime soon. There are some nice courses in Spring Academy which are good for beginners like spring.academy/courses/building-a-rest-api-with-spring-boot. Also check some popular crash courses in UA-cam. Along with the courses start building some projects. That is the best way to learn.
Is it possible to send push notifications for PWA using this ??
Nice question @patilrohan. Haven't tried this in PWA. But I think you can get this working by bypassing the service worker for SSE requests and using EventSource API directly in the main thread. I think service worker is inherently designed to handle offline scenarios, so it won't support persistent connection. Also, you might need to handle offline scenarios in the onError handler of EventSource API depending on the use case and avoid too many retries. Also, you might need to persist the last received event ID and pass it in the header while reconnecting.
Nice one❤
Fantastic breakdown! Your explanation really clarified some of the finer points of Java 22. Looking forward to more content like this!
Thank you !
Videos in the Core JAVA Quiz Series: Top JAVA Interview Questions Series - Core Java - Part1 - Quiz Format ua-cam.com/video/JtbS9halkyg/v-deo.htmlsi=oaqToJsKdqkxEx_U Top JAVA Interview Questions Series - Core Java - Part2 - Quiz Format ua-cam.com/video/3Yw7wAHWcsk/v-deo.htmlsi=bL94lu2JaMCOsSR Top JAVA Interview Questions Series - Core Java - Part3 - Quiz Format ua-cam.com/video/19dN6tE1mSw/v-deo.htmlsi=NHDeHVmmAMc6EVms
Videos in the SQL Quiz Series: Top SQL/Database Interview Questions Series - Part1 - Quiz Format ua-cam.com/video/e71EP9pA3ec/v-deo.html Top SQL/Database Interview Questions Series - Part2 - Quiz Format ua-cam.com/video/n9AIf59w5w4/v-deo.htmlsi=-eJ1J9hYCm6c3AaK Top SQL/Database Interview Questions Series - Part3 - Quiz Format ua-cam.com/video/hEKFhH50BKg/v-deo.htmlsi=1UMYxRsB2EcJ7rk7
Videos in this Series: Top JAVA Interview Questions Series - Core Java - Part1 - Quiz Format ua-cam.com/video/JtbS9halkyg/v-deo.htmlsi=oaqToJsKdqkxEx_U Top JAVA Interview Questions Series - Core Java - Part2 - Quiz Format ua-cam.com/video/3Yw7wAHWcsk/v-deo.htmlsi=bL94lu2JaMCOsSR Top JAVA Interview Questions Series - Core Java - Part3 - Quiz Format ua-cam.com/video/19dN6tE1mSw/v-deo.htmlsi=NHDeHVmmAMc6EVms
Videos in the SQL Quiz Series: Top SQL/Database Interview Questions Series - Part1 - Quiz Format ua-cam.com/video/e71EP9pA3ec/v-deo.html Top SQL/Database Interview Questions Series - Part2 - Quiz Format ua-cam.com/video/n9AIf59w5w4/v-deo.htmlsi=-eJ1J9hYCm6c3AaK Top SQL/Database Interview Questions Series - Part3 - Quiz Format ua-cam.com/video/hEKFhH50BKg/v-deo.htmlsi=1UMYxRsB2EcJ7rk7
Top C# DotNet Interview Questions Series - Part1 - Quiz Format ua-cam.com/video/WikBPm4Nnyg/v-deo.html
Videos in the SQL Quiz Series: Top SQL/Database Interview Questions Series - Part1 - Quiz Format ua-cam.com/video/e71EP9pA3ec/v-deo.html Top SQL/Database Interview Questions Series - Part2 - Quiz Format ua-cam.com/video/n9AIf59w5w4/v-deo.htmlsi=-eJ1J9hYCm6c3AaK Top SQL/Database Interview Questions Series - Part3 - Quiz Format ua-cam.com/video/hEKFhH50BKg/v-deo.htmlsi=1UMYxRsB2EcJ7rk7
Top C# DotNet Interview Questions Series - Part1 - Quiz Format ua-cam.com/video/WikBPm4Nnyg/v-deo.html
Videos in the SQL Quiz Series: Top SQL/Database Interview Questions Series - Part1 - Quiz Format ua-cam.com/video/e71EP9pA3ec/v-deo.html Top SQL/Database Interview Questions Series - Part2 - Quiz Format ua-cam.com/video/n9AIf59w5w4/v-deo.htmlsi=-eJ1J9hYCm6c3AaK Top SQL/Database Interview Questions Series - Part3 - Quiz Format ua-cam.com/video/hEKFhH50BKg/v-deo.htmlsi=1UMYxRsB2EcJ7rk7
Top C# DotNet Interview Questions Series - Part1 - Quiz Format ua-cam.com/video/WikBPm4Nnyg/v-deo.html
Videos in the SQL Quiz Series: Top SQL/Database Interview Questions Series - Part1 - Quiz Format ua-cam.com/video/e71EP9pA3ec/v-deo.html Top SQL/Database Interview Questions Series - Part2 - Quiz Format ua-cam.com/video/n9AIf59w5w4/v-deo.htmlsi=-eJ1J9hYCm6c3AaK Top SQL/Database Interview Questions Series - Part3 - Quiz Format ua-cam.com/video/hEKFhH50BKg/v-deo.htmlsi=1UMYxRsB2EcJ7rk7
Videos in the SQL Quiz Series: Top SQL/Database Interview Questions Series - Part1 - Quiz Format ua-cam.com/video/e71EP9pA3ec/v-deo.html Top SQL/Database Interview Questions Series - Part2 - Quiz Format ua-cam.com/video/n9AIf59w5w4/v-deo.htmlsi=-eJ1J9hYCm6c3AaK Top SQL/Database Interview Questions Series - Part3 - Quiz Format ua-cam.com/video/hEKFhH50BKg/v-deo.htmlsi=1UMYxRsB2EcJ7rk7