-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FEATURE] Get all metadata of AiService & Tool when the Spring Boot s…
…tarts langchain4j/langchain4j#2112
- Loading branch information
1 parent
c7a57e7
commit 4e5cc40
Showing
6 changed files
with
76 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 0 additions & 6 deletions
6
.../src/main/java/dev/langchain4j/service/spring/event/AiServiceRegisteredEventListener.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
...chain4j/service/spring/mode/automatic/withTools/listener/AbstractApplicationListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package dev.langchain4j.service.spring.mode.automatic.withTools.listener; | ||
|
||
import org.springframework.context.ApplicationEvent; | ||
import org.springframework.context.ApplicationListener; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class AbstractApplicationListener<E extends ApplicationEvent> implements ApplicationListener<E> { | ||
|
||
private boolean eventReceived = false; | ||
private final List<E> receivedEvents = new ArrayList<>(); | ||
|
||
@Override | ||
public void onApplicationEvent(E event) { | ||
eventReceived = true; | ||
receivedEvents.add(event); | ||
} | ||
|
||
public List<E> getReceivedEvents() { | ||
return receivedEvents; | ||
} | ||
|
||
public boolean isEventReceived() { | ||
return eventReceived; | ||
} | ||
|
||
public void reset() { | ||
eventReceived = false; | ||
receivedEvents.clear(); | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
...4j/service/spring/mode/automatic/withTools/listener/AiServiceRegisteredEventListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package dev.langchain4j.service.spring.mode.automatic.withTools.listener; | ||
|
||
import dev.langchain4j.service.spring.event.AiServiceRegisteredEvent; | ||
import org.springframework.stereotype.Component; | ||
@Component | ||
public class AiServiceRegisteredEventListener extends AbstractApplicationListener<AiServiceRegisteredEvent> { | ||
} |