How codefarm0/spring-ai works
Project type and purpose
• This is a Spring Boot–based backend microservice (“openai-demo-service”) whose goal is to demonstrate integration with the OpenAI API.
• It exposes REST endpoints (via OpenAIQnAController) that accept incoming questions or requests (e.g., “get capital”) and use prompt templates to drive calls to an external LLM service.
File structure
• Top level:
• README.md – high‐level description (“Spring AI Projects and tutorial”)
• docs/ – supplemental guides
• openai-demo-service/ – the Gradle‐based Spring Boot application
• openai-demo-service/src/main/java/com/codefarm/openai/demo/service/:
• OpenaiDemoServiceApplication.java – entry point
• OpenAIQnAController.java – HTTP layer (REST API)
• service/OpenAiService.java – business logic & external API integration
• model/… – domain data classes (Question, Answer, CapitalRequest/Response)
• openai-demo-service/src/main/resources/templates/*.st – StringTemplate prompt definitions
• openai-demo-service/src/test/java/… – comprehensive prompt‐driven test suite
• Configuration: application.properties holds API key and properties
README for additional insights
• The README simply positions this repo as a “Spring AI Projects and tutorial,” implying this is a learning/demo project rather than a production system.
Details
• Layer with the package or folder name (e.g., com.codefarm.openai.demo.service.service).