This project is create with kotlin and spring for demo use case about HR has new boarding. And connect with opensource AI model (running by Ollama)
- Kotlin
- Spring Boot
- Java 21 LTS
- Postgresql
- Ollama on your local machine (Download and Install)
- Use ollama command to pull model to local
ollama pull gemma4:e2b
- Docker
Execute project all in one with docker compose.
docker compose up -d --build- Get user profile
The response you'll get:
curl --location 'http://localhost:8080/api/ai/chat' \ --header 'Content-Type: application/json' \ --data-raw '{ "prompt": "Show me the information of profile for mohamed.salah@company.com" }'
{ "question": "Show me the information of profile for mohamed.salah@company.com", "generatedQuery": "", "results": [ { "response": "Employee Profile:\n- Full Name: Mohamed Salah\n- Email: mohamed.salah@company.com\n- Department: Engineering\n- Role: Senior Java Developer" } ], "error": null, "success": true } - Get onbaording schedule
Response:
curl --location 'http://localhost:8080/api/ai/chat' \ --header 'Content-Type: application/json' \ --data-raw '{ "prompt": "Show me the information of onboarding schedule for mohamed.salah@company.com?" }'
{ "question": "Show me the information of onboarding schedule for mohamed.salah@company.com?", "generatedQuery": "", "results": [ { "response": "Onboarding Schedule:\n- Plan: Backend Engineering Track\n- Start Date: 2025-06-01\n- End Date: 2025-06-30\n- Mentor: Karim Benali\n- Status: IN_PROGRESS" } ], "error": null, "success": true } - Get summary user profile and schedule:
Response:
curl --location 'http://localhost:8080/api/ai/chat' \ --header 'Content-Type: application/json' \ --data-raw '{ "prompt": "Prepare the full onboarding summary for mohamed.salah@company.com" }'
{ "question": "Prepare the full onboarding summary for mohamed.salah@company.com", "generatedQuery": "", "results": [ { "response": "Here is the full onboarding summary for Mohamed Salah:\n\n**Employee Profile:**\n* **Full Name**: Mohamed Salah\n* **Email**: mohamed.salah@company.com\n* **Department**: Engineering\n* **Role**: Senior Java Developer\n\n**Onboarding Schedule:**\n* **Plan**: Backend Engineering Track\n* **Start Date**: 2025-06-01\n* **End Date**: 2025-06-30\n* **Mentor**: Karim Benali\n* **Status**: IN_PROGRESS" } ], "error": null, "success": true } - Memory test, after send Promt early.
Response:
curl --location 'http://localhost:8080/api/ai/chat' \ --header 'Content-Type: application/json' \ --data '{ "prompt": "What is his onboarding schedule?" }'
{ "question": "What is his onboarding schedule?", "generatedQuery": "", "results": [ { "response": "The onboarding schedule for mohamed.salah@company.com is as follows:\n\n* **Plan**: Backend Engineering Track\n* **Start Date**: 2025-06-01\n* **End Date**: 2025-06-30\n* **Mentor**: Karim Benali\n* **Status**: IN_PROGRESS" } ], "error": null, "success": true }
environment:
TZ: Asia/Bangkok
JAVA_OPTS: |-
-Xms256m
-Xmx512m
-XX:+UseG1GC
-XX:MaxGCPauseMillis=200
-XX:+UseStringDeduplication
-XX:+UseContainerSupport
-XX:MaxRAMPercentage=75.0
-XX:InitialRAMPercentage=75.0
-XX:+ExitOnOutOfMemoryError
SERVER_PORT: 8080
DB_HOST: onboarding-db
DB_NAME: onboarding
DB_USER: onboarding
DB_PASS: onboarding
AI_OLLAMA_URL: http://host.docker.internal:11434
AI_OLLAMA_MODEL: gemma4:e2b
AI_OLLAMA_TEMPERATURE: 0.2