Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Spring AI Onboarding

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)

Agent Decision Flow

Alt Text

Project stack

  • Kotlin
  • Spring Boot
  • Java 21 LTS
  • Postgresql

Prerequired

  • 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

Test with RestAPI

  • Get user profile
    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"
    }'
    The response you'll get:
    {
        "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
    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?"
    }'
    Response:
    {
        "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:
    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"
    }'
    Response:
    {
        "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.
    curl --location 'http://localhost:8080/api/ai/chat' \
    --header 'Content-Type: application/json' \
    --data '{
        "prompt": "What is his onboarding schedule?"
    }'
    Response:
    {
        "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
    }

Docker compose configuration

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

Reference:

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages