Skip to content

showpune/spring-petclinic-springai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spring PetClinic Sample Application With Azure OpenAI and springAi

Understanding the Spring Petclinic application with a few diagrams

This is the spring ai version for spring petclinic, if you want to see a langchain4j version, please refer to spring-petclinic-langchain4j

Run Petclinic locally

Spring Petclinic is a Spring Boot application built using Maven. You can build a jar file and run it from the command line (it should work just as well with Java 17 or newer), Before you build the application, you need to setup some openai properties in src/main/resources/application.properties:

git clone https://github.com/showpune/spring-petclinic-springai.git
cd spring-petclinic-springai
mv src/main/resources/application.properties.example src/main/resources/application.properties

edit the src/main/resources/application.properties file and add the following properties:

spring.ai.azure.openai.api-key=**
spring.ai.azure.openai.endpoint=https://***.openai.azure.com/
spring.ai.azure.openai.chat.options.deployment-name=gpt-4
spring.ai.azure.openai.chat.options.temperature=0.8
spring.ai.chat.client.enabled=true
spring.ai.azure.openai.embedding.options.deployment-name=text-embedding-ada-002

You can build the application by running the following command:

./mvnw package
java -jar target/*.jar

You can then access the Petclinic at http://localhost:8080/ petclinic-screenshot

And the OpenAI chatbot at http://localhost:8080/chat.html. petclinic-screenshot

Workthrough of the chat agent

Go to the owner page, you can query all owner information of "Davis" image

You can also talk with the agent, query your information. image

you can also talk with Chinese image

Go to the owner page you can see your information is added image

License

The Spring PetClinic sample application is released under version 2.0 of the Apache License.