Generative-AI-for-beginners-java / nl
AGENTS.md559 starsChanged 5 months agoMITView on GitHub
Dit is een educatieve repository om Generative AI-ontwikkeling met Java te leren. Het biedt een uitgebreide hands-on cursus die Large Language Models (LLM’s), prompt engineering, embeddings, RAG (Retrieval-Augmented Generation) en het Model Context Protocol (MCP) behandelt. Belangrijke Technologieën: - Java 21 - Spring Boot 3.5.x - Spring AI 1.1.x - Maven - LangChain4j - Azure AI Foundry, Azure OpenAI en OpenAI SDK’s Architectuur: - Meerdere zelfstandige Spring Boot applicaties georganiseerd per hoofdstuk - Voorbeeldprojecten die verschillende AI-patronen demonstreren - GitHub…
- Reads credentials
- Deletes or force-pushes
- Installs packages
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository55 other files it gives its agents.
- AGENTS.mdAGENTS.md
- translations/ar/AGENTS.mdAGENTS.md
- translations/bg/AGENTS.mdAGENTS.md
- translations/bn/AGENTS.mdAGENTS.md
- translations/cs/AGENTS.mdAGENTS.md
- translations/da/AGENTS.mdAGENTS.md
- translations/de/AGENTS.mdAGENTS.md
- translations/el/AGENTS.mdAGENTS.md
- translations/en/AGENTS.mdAGENTS.md
- translations/es/AGENTS.mdAGENTS.md
- translations/et/AGENTS.mdAGENTS.md
- translations/fa/AGENTS.mdAGENTS.md
- translations/fi/AGENTS.mdAGENTS.md
- translations/fr/AGENTS.mdAGENTS.md
- translations/he/AGENTS.mdAGENTS.md
- translations/hi/AGENTS.mdAGENTS.md
- translations/hr/AGENTS.mdAGENTS.md
- translations/hu/AGENTS.mdAGENTS.md
- translations/id/AGENTS.mdAGENTS.md
- translations/it/AGENTS.mdAGENTS.md
- translations/ja/AGENTS.mdAGENTS.md
- translations/km/AGENTS.mdAGENTS.md
- translations/kn/AGENTS.mdAGENTS.md
- translations/ko/AGENTS.mdAGENTS.md
- translations/lt/AGENTS.mdAGENTS.md
- translations/ml/AGENTS.mdAGENTS.md
- translations/mr/AGENTS.mdAGENTS.md
- translations/ms/AGENTS.mdAGENTS.md
- translations/my/AGENTS.mdAGENTS.md
- translations/ne/AGENTS.mdAGENTS.md
- translations/no/AGENTS.mdAGENTS.md
- translations/pa/AGENTS.mdAGENTS.md
- translations/pcm/AGENTS.mdAGENTS.md
- translations/pl/AGENTS.mdAGENTS.md
- translations/pt-BR/AGENTS.mdAGENTS.md
- translations/pt-PT/AGENTS.mdAGENTS.md
- translations/ro/AGENTS.mdAGENTS.md
- translations/ru/AGENTS.mdAGENTS.md
- translations/sk/AGENTS.mdAGENTS.md
- translations/sl/AGENTS.mdAGENTS.md
- translations/sr/AGENTS.mdAGENTS.md
- translations/sv/AGENTS.mdAGENTS.md
- translations/sw/AGENTS.mdAGENTS.md
- translations/ta/AGENTS.mdAGENTS.md
- translations/te/AGENTS.mdAGENTS.md
- translations/th/AGENTS.mdAGENTS.md
- translations/tl/AGENTS.mdAGENTS.md
- translations/tr/AGENTS.mdAGENTS.md
- translations/uk/AGENTS.mdAGENTS.md
- translations/ur/AGENTS.mdAGENTS.md
- translations/vi/AGENTS.mdAGENTS.md
- translations/zh-CN/AGENTS.mdAGENTS.md
- translations/zh-HK/AGENTS.mdAGENTS.md
- translations/zh-MO/AGENTS.mdAGENTS.md
- translations/zh-TW/AGENTS.mdAGENTS.md
The file
We split this AGENTS.md into the rules it gives an agent
4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 166
Start de applicatie met mvn spring-boot:run
- Distinctive: line 167
Test endpoints of interacteer met de CLI
- Distinctive: line 173
Test content filtering met het verantwoordelijke AI voorbeeld in Hoofdstuk 5
- Very specific: line 355
Commit nooit .env bestanden (staan al in .gitignore)
≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
AGENTS.md
Projectoverzicht
Dit is een educatieve repository om Generative AI-ontwikkeling met Java te leren. Het biedt een uitgebreide hands-on cursus die Large Language Models (LLM’s), prompt engineering, embeddings, RAG (Retrieval-Augmented Generation) en het Model Context Protocol (MCP) behandelt.
Belangrijke Technologieën:
- Java 21
- Spring Boot 3.5.x
- Spring AI 1.1.x
- Maven
- LangChain4j
- Azure AI Foundry, Azure OpenAI en OpenAI SDK’s
Architectuur:
- Meerdere zelfstandige Spring Boot applicaties georganiseerd per hoofdstuk
- Voorbeeldprojecten die verschillende AI-patronen demonstreren
- GitHub Codespaces-ready met vooraf geconfigureerde ontwikkelcontainers
Installatiecommando’s
Vereisten
- Java 21 of hoger
- Maven 3.x
- Azure-abonnement met een Azure AI Foundry model-implementatie (voorzie met
azd up) - Azure CLI (
az) en Azure Developer CLI (azd), ingelogd voor keyless authenticatie
Omgevingsinstelling
Optie 1: GitHub Codespaces (Aanbevolen)
# Fork de repository en maak een codespace aan vanuit de GitHub UI
# De dev container zal automatisch alle afhankelijkheden installeren
# Wacht ongeveer 2 minuten voor de omgeving is opgezetOptie 2: Lokale ontwikkelcontainer
# Kloneer opslagplaats
git clone https://github.com/microsoft/Generative-AI-for-beginners-java.git
cd Generative-AI-for-beginners-java
# Open in VS Code met Dev Containers-extensie
# Opnieuw openen in container wanneer gevraagdOptie 3: Lokale installatie
# Installeer afhankelijkheden
sudo apt-get update
sudo apt-get install -y maven openjdk-21-jdk
# Verifieer installatie
java -version
mvn -versionConfiguratie
Azure AI Foundry Setup (keyless, aanbevolen):
# Zorg voor de Foundry-account + modelimplementaties als code
cd 02-SetupDevEnvironment
azd auth login
az login
azd up
# azd schrijft examples/basic-chat-azure/.env met jouw endpoint (geen sleutel)Handmatige endpointconfiguratie:
# Als je azd niet gebruikte, stel dan zelf de endpoint in (auth blijft sleutelvrij via az login)
cd 02-SetupDevEnvironment/examples/basic-chat-azure
cp .env.example .env
# Bewerk .env: AZURE_OPENAI_ENDPOINT=https://<resource>.openai.azure.com/Ontwikkelworkflow
Projectstructuur
/
├── 01-IntroToGenAI/ # Chapter 1: Introduction
├── 02-SetupDevEnvironment/ # Chapter 2: Environment setup
│ └── examples/ # Working examples
├── 03-CoreGenerativeAITechniques/ # Chapter 3: Core techniques
├── 04-PracticalSamples/ # Chapter 4: Sample projects
│ ├── calculator/ # MCP service example
│ ├── foundrylocal/ # Local model integration
│ └── petstory/ # Multi-modal app
├── 05-ResponsibleGenAI/ # Chapter 5: Responsible AI
└── translations/ # Multi-language supportApplicaties draaien
Een Spring Boot applicatie draaien:
cd [project-directory]
mvn spring-boot:runEen project bouwen:
cd [project-directory]
mvn clean installDe MCP Calculator Server starten:
cd 04-PracticalSamples/calculator
mvn spring-boot:run
# Server draait op http://localhost:8080Clientvoorbeelden uitvoeren:
# Nadat de server is gestart in een ander terminalvenster
cd 04-PracticalSamples/calculator
# Directe MCP-client
mvn exec:java -Dexec.mainClass="com.microsoft.mcp.sample.client.SDKClient"
# AI-gestuurde client (vereist AZURE_OPENAI_ENDPOINT + az login)
mvn exec:java -Dexec.mainClass="com.microsoft.mcp.sample.client.LangChain4jClient"
# Interactieve bot
mvn exec:java -Dexec.mainClass="com.microsoft.mcp.sample.client.Bot"Hot Reload
Spring Boot DevTools is inbegrepen in projecten die hot reload ondersteunen:
# Wijzigingen in Java-bestanden worden automatisch opnieuw geladen bij het opslaan
mvn spring-boot:runTestinstructies
Tests uitvoeren
Alle tests in een project uitvoeren:
cd [project-directory]
mvn testTests met uitgebreide output uitvoeren:
mvn test -XSpecifieke testklasse uitvoeren:
mvn test -Dtest=CalculatorServiceTestTeststructuur
- Testbestanden gebruiken JUnit 5 (Jupiter)
- Testklassen bevinden zich in
src/test/java/ - Clientvoorbeelden in het calculator-project zijn in
src/test/java/com/microsoft/mcp/sample/client/
Handmatig testen
Veel voorbeelden zijn interactieve applicaties die handmatig getest moeten worden:
- Start de applicatie met
mvn spring-boot:run - Test endpoints of interacteer met de CLI
- Controleer of het verwachte gedrag overeenkomt met de documentatie in de README.md van elk project
Testen met Azure AI Foundry
- Log in met
az loginvóór het uitvoeren van voorbeelden (keyless authenticatie) - Zorg dat je account de rol Cognitive Services OpenAI User heeft op de resource
- Test content filtering met het verantwoordelijke AI voorbeeld in Hoofdstuk 5
Code Stijl Richtlijnen
Java Conventies
- Java Versie: Java 21 met moderne features
- Stijl: Volg standaard Java conventies
- Naamgeving:
- Klassen: PascalCase
- Methoden/variabelen: camelCase
- Constants: UPPER_SNAKE_CASE
- Pakketten: kleine letters
Spring Boot Patronen
- Gebruik
@Servicevoor businesslogica - Gebruik
@RestControllervoor REST endpoints - Configuratie via
application.ymlofapplication.properties - Omgevingsvariabelen geven de voorkeur boven hardcoded waarden
- Gebruik
@Toolannotatie voor MCP-blootgestelde methoden
Bestandsorganisatie
src/
├── main/
│ ├── java/
│ │ └── com/microsoft/[component]/
│ │ ├── [Component]Application.java
│ │ ├── config/
│ │ ├── controller/
│ │ ├── service/
│ │ └── exception/
│ └── resources/
│ ├── application.yml
│ └── static/
└── test/
└── java/
└── com/microsoft/[component]/Afhankelijkheden
- Beheerd via Maven
pom.xml - Spring AI BOM voor versiebeheer
- LangChain4j voor AI-integraties
- Spring Boot starter parent voor Spring-afhankelijkheden
Codecommentaar
- Voeg JavaDoc toe voor publieke API’s
- Voeg verklarende commentaren toe voor complexe AI-interacties
- Documenteer MCP tool omschrijvingen duidelijk
Bouwen en Implementatie
Projecten bouwen
Bouwen zonder tests:
mvn clean install -DskipTestsBouwen met alle controles:
mvn clean installApplicatie packagen:
mvn package
# Maakt JAR aan in de target/ mapOutputmappen
- Gecompileerde classes:
target/classes/ - Testclasses:
target/test-classes/ - JAR-bestanden:
target/*.jar - Maven-artifacts:
target/
Omgevingsspecifieke configuratie
Ontwikkeling:
# application.yml (keyless - no api-key; auth via DefaultAzureCredential)
spring:
ai:
azure:
openai:
endpoint: ${AZURE_OPENAI_ENDPOINT}
chat:
options:
deployment-name: ${AZURE_OPENAI_DEPLOYMENT:gpt-4o-mini}Productie:
- Gebruik een managed identity in plaats van
az loginvoor keyless authenticatie - Verwijs de
AZURE_OPENAI_ENDPOINTnaar uw productie Foundry resource - Beheer configuratie via omgevingsvariabelen of Azure Key Vault
Overwegingen bij implementatie
- Dit is een educatieve repository met voorbeeldapplicaties
- Niet ontworpen voor productie-implementatie zoals het is
- Voorbeelden tonen patronen die u kunt aanpassen voor productiegebruik
- Zie de individuele project-README’s voor specifieke implementatie-aantekeningen
Extra Notities
Azure AI Foundry
- Keyless authenticatie: verbinden met Microsoft Entra ID — geen API-sleutels om te beheren
- Voorzien als code: Bicep + azd (
azd up) maken het account en modelimplementaties aan - Dezelfde OpenAI-compatibele code draait lokaal (
az login) en in Azure (managed identity)
Werken met Meerdere Projecten
Elk voorbeeldproject staat op zichzelf:
# Navigeer naar een specifiek project
cd 04-PracticalSamples/[project-name]
# Elk heeft zijn eigen pom.xml en kan onafhankelijk worden gebouwd
mvn clean installVeelvoorkomende Problemen
Java Versie Onverenigbaar:
# Verifieer Java 21
java -version
# Werk JAVA_HOME bij indien nodig
export JAVA_HOME=/usr/lib/jvm/msopenjdk-currentProblemen met Dependency Download:
# Maak de Maven-cache leeg en probeer opnieuw
rm -rf ~/.m2/repository
mvn clean installEndpoint of Inloggen Niet Gevonden:
# Stel het eindpunt in de huidige sessie in en meld aan (zonder sleutel)
export AZURE_OPENAI_ENDPOINT="https://your-resource.openai.azure.com/"
az login
# Of gebruik een .env-bestand in de projectmap
echo "AZURE_OPENAI_ENDPOINT=https://your-resource.openai.azure.com/" > .envPoort Al in Gebruik:
# Spring Boot gebruikt standaard poort 8080
# Wijzig in application.properties:
server.port=8081Meertalige Ondersteuning
- Documentatie beschikbaar in 45+ talen via automatische vertaling
- Vertalingen in de map
translations/ - Vertaling wordt beheerd door een GitHub Actions workflow
Leerpad
- Begin met 02-SetupDevEnvironment
- Volg de hoofdstukken op volgorde (01 → 05)
- Voltooi hands-on voorbeelden in elk hoofdstuk
- Verken voorbeeldprojecten in Hoofdstuk 4
- Leer verantwoordelijke AI-praktijken in Hoofdstuk 5
Ontwikkelcontainer
De .devcontainer/devcontainer.json configureert:
- Java 21 ontwikkelomgeving
- Maven vooraf geïnstalleerd
- VS Code Java extensies
- Spring Boot tools
- GitHub Copilot integratie
- Docker-in-Docker ondersteuning
- Azure CLI
Prestatie-overwegingen
- Azure AI Foundry-implementaties hebben quota per minuut voor tokens/verzoeken
- Gebruik geschikte batchgroottes voor embeddings
- Overweeg caching voor herhaalde API-aanroepen
- Monitor tokenverbruik voor kostenoptimalisatie
Beveiligingsnotities
- Commit nooit
.envbestanden (staan al in.gitignore) - Geef de voorkeur aan keyless authenticatie (Microsoft Entra ID) boven API-sleutels
- Gebruik managed identities in Azure;
az loginvoor lokale ontwikkeling - Volg verantwoordelijke AI-richtlijnen in Hoofdstuk 5
<!-- CO-OP TRANSLATOR DISCLAIMER START -->Disclaimer: Dit document is vertaald met behulp van de AI vertaaldienst Co-op Translator. Hoewel we streven naar nauwkeurigheid, dient u er rekening mee te houden dat geautomatiseerde vertalingen fouten of onnauwkeurigheden kunnen bevatten. Het originele document in de oorspronkelijke taal moet worden beschouwd als de gezaghebbende bron. Voor kritieke informatie wordt professionele menselijke vertaling aanbevolen. Wij zijn niet aansprakelijk voor eventuele misverstanden of verkeerde interpretaties die voortvloeien uit het gebruik van deze vertaling.
<!-- CO-OP TRANSLATOR DISCLAIMER END -->Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

