A Spring Boot application that provides interesting Java programming facts using LangChain4j and Azure OpenAI.
- Java 17 or higher
- Maven 3.8+
- Azure OpenAI API access
-
Clone the repository
-
Set up the following environment variables:
export AZURE_OPENAI_API_KEY=your_api_key export AZURE_OPENAI_ENDPOINT=your_endpoint export AZURE_OPENAI_DEPLOYMENT_NAME=your_deployment_name
-
Build the project:
mvn clean install
-
Run the application:
mvn spring-boot:run
GET /api/facts/random
Response:
{
"topic": "Random",
"fact": "A randomly generated Java programming fact"
}GET /api/facts/topic?name={topic}
Response:
{
"topic": "Inheritance",
"fact": "A fact about Java inheritance"
}- RESTful API endpoints
- Integration with Azure OpenAI via LangChain4j
- In-memory caching of facts
- Input validation
- Unit tests
- Clean architecture