Skip to content

Commit

Permalink
support native-image
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcheng1982 committed Apr 12, 2024
1 parent 4cadee5 commit b357bfd
Show file tree
Hide file tree
Showing 5 changed files with 851 additions and 1 deletion.
30 changes: 29 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>io.github.alexcheng1982</groupId>
<artifactId>spring-ai-dashscope-client</artifactId>
<version>0.2.0</version>
<version>0.3.0</version>

<name>Aliyun Dashscope Spring AI Client</name>
<description>Aliyun Dashscope Spring AI Client</description>
Expand Down Expand Up @@ -41,6 +41,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<dashscope-sdk.version>2.12.0</dashscope-sdk.version>
<spring-ai.version>0.8.1</spring-ai.version>
<jackson.version>2.14.2</jackson.version>
</properties>

<dependencyManagement>
Expand All @@ -65,6 +66,11 @@
<artifactId>dashscope-sdk-java</artifactId>
<version>${dashscope-sdk.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
Expand Down Expand Up @@ -152,4 +158,26 @@
</repository>
</repositories>

<profiles>
<profile>
<id>native</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.2.5</version>
<configuration>
<excludedGroups>dummy</excludedGroups>
<groups>native-image</groups>
<argLine>
-agentlib:native-image-agent=config-output-dir=./target/config-output
</argLine>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ public DashscopeChatClient(DashscopeApi dashscopeApi,
this(dashscopeApi, options, null);
}

public DashscopeChatClient(DashscopeApi dashscopeApi,
FunctionCallbackContext functionCallbackContext) {
this(dashscopeApi, DEFAULT_OPTIONS, functionCallbackContext);
}

public DashscopeChatClient(DashscopeApi dashscopeApi,
DashscopeChatOptions options,
FunctionCallbackContext functionCallbackContext) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
import java.util.Optional;
import org.springframework.ai.chat.metadata.Usage;

/**
* {@linkplain Usage} implementation of Aliyun Dashscope
*/
public class DashscopeUsage implements Usage {

private Long promptTokens;
Expand Down
Loading

0 comments on commit b357bfd

Please sign in to comment.