Artificial Intelligence (AI)
Notes for Oreilly Courses
- Using AI as Personal Learning Coach
- vonage-learning
- GitHub Copilot
- Skills Plan: AI Agents
- Spring AI
- Claude
- MCP
- OpenCode and GitAI
- Comparisions
References
- Text
- Video
Why AI for Java Developers?
- Industry-wide AI Adoption?
- Retail
- Healthcare
- etc
- Enhance Problem Solving Abilities
- Stay Competitive in the Job Market
Items Covered
- Intro to LLM OpenAPI ChatGPT
- Chat based AI apps using OpenAI APIs
- Prompt Engineering
- Generate Structured Data with OpenAI
- Function Calling using Tools with OpenAI
- RAG Based Q&A
- Multimodality : Images, Vision and Audio with OpenAI
- Run LLMs locally and build AI apps interact with them.
Spring AI
- Module for building applications using LLM for easy AI integration into Spring Framework
- Builds Enterprise-Grade AI applications
- spring-ai docs here
Using OpenAI with spring-ai
- Account Setup
- Create OpenAI account
- create APIkey and store it as env variable
- check the playground and do compare by asking same question -
What is an LLM?- 4o vs 4o-mini
- 4o gives options
- 4o-mini assumed we asked for Large Language Model
- Install Java 24 using sdkman
sdk list javaandsdk install java 24.0.1-tem - clone instructor’s project here
org.springframework.ai:spring-ai-starter-model-openaiand propertyspring.ai.openai.api-key=${OPENAI_KEY}- ChatClient calls internally OpenAI chat completion endpoint here
- Promt, Tokens and Tokenizations
user prompt -> tokenizations -> Processing using Transformer Architecture -> Generate Tokens -> De-tokenization -> output
- importatnt params -
temprature(lower is more relvant response),max_completion_tokens - Prompt -
User Message+System Message+Assistant Message- system message like *SystemMessage(“You are a helpful assistant, who can answer java based questions. For any other questions, please respond with I don’t know in a funny way!”);
- Streaming ChatClient response (Async - Non blocking) using Flux in response instead of sync response Object
- conversation - What’s my name return don’t know an
ChatClient.builder().build()
.prompt()
.user(userInput.prompt())
.system(systemMessage)
.call()
.content()
- SpringAdvisors