-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
462 additions
and
26 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
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,35 @@ | ||
<!-- | ||
Thank you so much for your contribution! | ||
Please fill in all the sections below. | ||
Please open the PR as a draft initially. Once it is reviewed and approved, we will ask you to add documentation and examples. | ||
Please note that PRs with breaking changes or without tests will be rejected. | ||
Please note that PRs will be reviewed based on the priority of the issues they address. | ||
We ask for your patience. We are doing our best to review your PR as quickly as possible. | ||
Please refrain from pinging and asking when it will be reviewed. Thank you for understanding! | ||
--> | ||
|
||
## Issue | ||
<!-- Please specify the ID of the issue this PR is addressing. For example: "Closes #1234" or "Fixes #1234" --> | ||
Closes # | ||
|
||
## Change | ||
<!-- Please describe the changes you made. --> | ||
|
||
|
||
## General checklist | ||
<!-- Please double-check the following points and mark them like this: [X] --> | ||
- [ ] There are no breaking changes | ||
- [ ] I have added unit and/or integration tests for my change | ||
- [ ] The tests cover both positive and negative cases | ||
- [ ] I have manually run all the unit and integration tests in the module I have added/changed, and they are all green | ||
<!-- Before adding documentation and example(s) (below), please wait until the PR is reviewed and approved. --> | ||
- [ ] I have added/updated the [documentation](https://github.com/langchain4j/langchain4j/tree/main/docs/docs) | ||
- [ ] I have added an example in the [examples repo](https://github.com/langchain4j/langchain4j-examples) (only for "big" features) | ||
|
||
|
||
## Checklist for adding new Spring Boot starter | ||
<!-- Please double-check the following points and mark them like this: [X] --> | ||
- [ ] I have added my new starter in the root `pom.xml` | ||
- [ ] I have added a `org.springframework.boot.autoconfigure.AutoConfiguration.imports` file in the `langchain4j-{integration}-spring-boot-starter/src/main/resources/META-INF/spring/` directory |
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,17 @@ | ||
name: Add new PR to Project | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- opened | ||
- reopened | ||
|
||
jobs: | ||
add-to-project: | ||
name: Add PR to Project | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/[email protected] | ||
with: | ||
project-url: https://github.com/users/langchain4j/projects/2 | ||
github-token: ${{ secrets.GH_TOKEN_ADD_NEW_PRS_TO_PROJECT }} |
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
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
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
24 changes: 24 additions & 0 deletions
24
...langchain4j/service/spring/mode/automatic/Issue2133/TestAutowireAiServiceApplication.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,24 @@ | ||
package dev.langchain4j.service.spring.mode.automatic.Issue2133; | ||
|
||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
|
||
/** | ||
* @author: qing | ||
* @Date: 2024/11/20 | ||
*/ | ||
@SpringBootApplication | ||
public class TestAutowireAiServiceApplication { | ||
|
||
@Autowired | ||
TestAutowireConfiguration testAutowireConfiguration; | ||
|
||
public static void main(String[] args) { | ||
SpringApplication.run(TestAutowireAiServiceApplication.class, args); | ||
} | ||
|
||
TestAutowireConfiguration getConfiguration() { | ||
return testAutowireConfiguration; | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
...dev/langchain4j/service/spring/mode/automatic/Issue2133/TestAutowireClassAiServiceIT.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,28 @@ | ||
package dev.langchain4j.service.spring.mode.automatic.Issue2133; | ||
|
||
import dev.langchain4j.service.spring.AiServicesAutoConfig; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.boot.autoconfigure.AutoConfigurations; | ||
import org.springframework.boot.test.context.runner.ApplicationContextRunner; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
|
||
class TestAutowireClassAiServiceIT { | ||
|
||
ApplicationContextRunner contextRunner = new ApplicationContextRunner() | ||
.withConfiguration(AutoConfigurations.of(AiServicesAutoConfig.class)); | ||
|
||
@Test | ||
void should_get_configuration_class() { | ||
contextRunner | ||
.withUserConfiguration(TestAutowireAiServiceApplication.class) | ||
.withBean(TestAutowireConfiguration.class) | ||
.run(context -> { | ||
// given | ||
TestAutowireAiServiceApplication application = context.getBean(TestAutowireAiServiceApplication.class); | ||
|
||
// should get the configuration class | ||
assertNotNull(application.getConfiguration(), "TestConfiguration class should be not null"); | ||
}); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
...va/dev/langchain4j/service/spring/mode/automatic/Issue2133/TestAutowireConfiguration.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,11 @@ | ||
package dev.langchain4j.service.spring.mode.automatic.Issue2133; | ||
|
||
import org.springframework.context.annotation.Configuration; | ||
|
||
/** | ||
* @author: qing | ||
* @Date: 2024/11/20 | ||
*/ | ||
@Configuration | ||
class TestAutowireConfiguration { | ||
} |
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
28 changes: 28 additions & 0 deletions
28
...c/test/java/dev/langchain4j/service/spring/mode/automatic/withTools/AopEnhancedTools.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,28 @@ | ||
package dev.langchain4j.service.spring.mode.automatic.withTools; | ||
|
||
import dev.langchain4j.agent.tool.Tool; | ||
import dev.langchain4j.service.spring.mode.automatic.withTools.aop.ToolObserver; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
public class AopEnhancedTools { | ||
|
||
public static final String TOOL_OBSERVER_PACKAGE_NAME_DESCRIPTION = | ||
"Find the package directory where @ToolObserver is located."; | ||
public static final String TOOL_OBSERVER_PACKAGE_NAME = ToolObserver.class.getPackageName(); | ||
|
||
public static final String TOOL_OBSERVER_KEY_NAME_DESCRIPTION = | ||
"Find the key name of @ToolObserver"; | ||
public static final String TOOL_OBSERVER_KEY = "AOP_ENHANCED_TOOLS_SUPPORT_@_1122"; | ||
|
||
@Tool(TOOL_OBSERVER_PACKAGE_NAME_DESCRIPTION) | ||
public String getToolObserverPackageName() { | ||
return TOOL_OBSERVER_PACKAGE_NAME; | ||
} | ||
|
||
@ToolObserver(key = TOOL_OBSERVER_KEY) | ||
@Tool(TOOL_OBSERVER_KEY_NAME_DESCRIPTION) | ||
public String getToolObserverKey() { | ||
return TOOL_OBSERVER_KEY; | ||
} | ||
} |
Oops, something went wrong.