Skip to content

Commit

Permalink
Merge pull request #8 from showpune/asa
Browse files Browse the repository at this point in the history
Asa
  • Loading branch information
showpune authored May 21, 2024
2 parents 1604e45 + c1cf40a commit d95e8c0
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 1 deletion.
6 changes: 6 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,12 @@
<version>${langchain4j.version}</version>
</dependency>

<dependency>
<groupId>com.azure.spring</groupId>
<artifactId>spring-cloud-azure-starter-keyvault</artifactId>
<version>5.11.0</version>
</dependency>

</dependencies>
<repositories>
<repository>
Expand Down
6 changes: 6 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,15 @@ You can talk with the agent, it can help to recommend the vet according to the s
Go to the owner page, you can see you are registered as an owner with the help of the agent
![image](https://github.com/showpune/spring-petclinic-langchain4j/assets/1787505/e7da4ede-5405-437d-a35f-fcd60af45ba7)

## LLM Progamming
Normally a LLM application contains 5 parts: Prompt, Model, Memory, Native Functions( tools )and RAG (content retriever)

### Prompt
The prompt is defined in [agent](https://github.com/showpune/spring-petclinic-langchain4j/blob/master/src/main/java/org/springframework/samples/petclinic/chat/Agent.java)

### Model
The model is is defined in [model](https://github.com/showpune/spring-petclinic-langchain4j/blob/3d2dcc1c303a7352f681892bb0871dbea1daaebd/src/main/java/org/springframework/samples/petclinic/chat/AgentConfig.java#L36), the model can be used for [chat](https://github.com/showpune/spring-petclinic-langchain4j/blob/3d2dcc1c303a7352f681892bb0871dbea1daaebd/src/main/java/org/springframework/samples/petclinic/chat/AgentConfig.java#L26), or can be used for [content augmentor](https://github.com/showpune/spring-petclinic-langchain4j/blob/3d2dcc1c303a7352f681892bb0871dbea1daaebd/src/main/java/org/springframework/samples/petclinic/chat/AgentConfig.java#L50)

### Memory
Memory Store: The demo still use the local memory defined in [memory store](https://github.com/showpune/spring-petclinic-langchain4j/blob/c95a598f4fdaf68a3f331b32ca42ef5ef95e5c17/src/main/java/org/springframework/samples/petclinic/chat/LocalConfig.java#L39), it means it can not share memory between instances, you can enhance it use memory on Redis

Expand Down
29 changes: 29 additions & 0 deletions src/main/resources/application.properties.azure
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# database init, supports mysql too
database=h2
spring.sql.init.schema-locations=classpath*:db/${database}/schema.sql
spring.sql.init.data-locations=classpath*:db/${database}/data.sql
# Web
spring.thymeleaf.mode=HTML
# JPA
spring.jpa.hibernate.ddl-auto=none
spring.jpa.open-in-view=true
# Internationalization
spring.messages.basename=messages/messages
# Actuator
management.endpoints.web.exposure.include=*
# Logging
logging.level.org.springframework=INFO
# logging.level.org.springframework.web=DEBUG
# logging.level.org.springframework.context.annotation=TRACE
# Maximum time static resources should be cached
spring.web.resources.cache.cachecontrol.max-age=12h

langchain4j.local.spring.memory.use-local=true
langchain4j.local.spring.memory.memory-size=20
langchain4j.local.spring.content-retriever.use-local=true
langchain4j.local.spring.content-retriever.max-results=1
langchain4j.local.spring.content-retriever.min-score=0.6
langchain4j.local.spring.content-retriever.content-path=classpath:petclinic-terms-of-use.txt
spring.cloud.azure.keyvault.secret.property-sources[0].endpoint=https://kv-kaiqian-petclinic.vault.azure.net/
#spring.cloud.azure.keyvault.secret.property-sources[0].credential.managed-identity-enabled=true
petclinic.agent.name=Petclinic Agent
1 change: 0 additions & 1 deletion src/main/resources/application.properties.sample
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,4 @@ langchain4j.local.spring.content-retriever.use-local=true
langchain4j.local.spring.content-retriever.max-results=1
langchain4j.local.spring.content-retriever.min-score=0.6
langchain4j.local.spring.content-retriever.content-path=classpath:petclinic-terms-of-use.txt

petclinic.agent.name=petclinic

0 comments on commit d95e8c0

Please sign in to comment.