Skip to content

Commit c7a066e

Browse files
committed
Merge branch 'integration_2024-06-06_285058385410' into 'master'
merge branch integration_2024-06-06_285058385410 into master See merge request iaasng/volcengine-java-sdk!190
2 parents b9d698d + 9c034a6 commit c7a066e

File tree

647 files changed

+12288
-243
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

647 files changed

+12288
-243
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
<dependency>
5555
<groupId>com.volcengine</groupId>
5656
<artifactId>volcengine-java-sdk-bom</artifactId>
57-
<version>0.1.113</version>
57+
<version>0.1.114</version>
5858
<type>pom</type>
5959
<scope>import</scope>
6060
</dependency>
@@ -70,12 +70,12 @@
7070
<dependency>
7171
<groupId>com.volcengine</groupId>
7272
<artifactId>volcengine-java-sdk-vpc</artifactId>
73-
<version>0.1.113</version>
73+
<version>0.1.114</version>
7474
</dependency>
7575
<dependency>
7676
<groupId>com.volcengine</groupId>
7777
<artifactId>volcengine-java-sdk-ecs</artifactId>
78-
<version>0.1.113</version>
78+
<version>0.1.114</version>
7979
</dependency>
8080
</dependencies>
8181
```

meta.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"lasted": "0.1.113",
3-
"meta_commit": "0804d09ee7273611691f35de519fde15cbeeb5fd"
2+
"lasted": "0.1.114",
3+
"meta_commit": "a6ec2b06777897f8d3af4d52398034611e2bdf77"
44
}

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<groupId>com.volcengine</groupId>
55
<artifactId>volcengine-java-sdk</artifactId>
66
<packaging>pom</packaging>
7-
<version>0.1.113</version>
7+
<version>0.1.114</version>
88
<name>volcengine-java-sdk</name>
99
<url>https://open.volcengineapi.com</url>
1010
<description>The Java SDK For Volcengine</description>

volcengine-java-sdk-alb/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<parent>
44
<artifactId>volcengine-java-sdk</artifactId>
55
<groupId>com.volcengine</groupId>
6-
<version>0.1.113</version>
6+
<version>0.1.114</version>
77
<relativePath>../pom.xml</relativePath>
88
</parent>
99
<modelVersion>4.0.0</modelVersion>

volcengine-java-sdk-ark-runtime/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<parent>
44
<artifactId>volcengine-java-sdk</artifactId>
55
<groupId>com.volcengine</groupId>
6-
<version>0.1.113</version>
6+
<version>0.1.114</version>
77
<relativePath>../pom.xml</relativePath>
88
</parent>
99
<build>

volcengine-java-sdk-ark-runtime/src/main/java/com/volcengine/ark/runtime/interceptor/EndpointStsAuthenticationInterceptor.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public class EndpointStsAuthenticationInterceptor implements Interceptor {
3131
private final ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
3232
private final ArkApi volcClient;
3333

34-
public EndpointStsAuthenticationInterceptor(String ak, String sk) {
34+
public EndpointStsAuthenticationInterceptor(String ak, String sk, String region) {
3535
Objects.requireNonNull(ak, "Ak token required");
3636
Objects.requireNonNull(sk, "Sk token required");
3737
this.ak = ak;
@@ -40,9 +40,8 @@ public EndpointStsAuthenticationInterceptor(String ak, String sk) {
4040

4141
ApiClient apiClient = new ApiClient()
4242
.setCredentials(Credentials.getCredentials(ak,sk))
43-
.setRegion("cn-beijing");
44-
ArkApi arkApi = new ArkApi(apiClient);
45-
this.volcClient = arkApi;
43+
.setRegion(region);
44+
this.volcClient = new ArkApi(apiClient);
4645
}
4746

4847
@Override
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
package com.volcengine.ark.runtime.interceptor;
2+
3+
4+
import okhttp3.Interceptor;
5+
import okhttp3.Request;
6+
import okhttp3.Response;
7+
8+
import java.io.IOException;
9+
import java.io.InterruptedIOException;
10+
11+
import static java.lang.Math.random;
12+
13+
public class RetryInterceptor implements Interceptor {
14+
15+
private final int retryTimes;
16+
private final double INITIAL_RETRY_DELAY = 0.5;
17+
private final double MAX_RETRY_DELAY = 8.0;
18+
19+
public RetryInterceptor(int retryTimes) {
20+
this.retryTimes = retryTimes;
21+
}
22+
23+
@Override
24+
public Response intercept(Chain chain) throws IOException {
25+
Request request = chain.request();
26+
27+
// try the request
28+
Response response = chain.proceed(request);
29+
30+
int tryCount = 0;
31+
while (response.code() >= 500 && tryCount < retryTimes) {
32+
tryCount++;
33+
34+
// retry the request
35+
response.close();
36+
37+
try {
38+
double interval = retryInterval(retryTimes, retryTimes - tryCount) * 1000;
39+
Thread.sleep(Math.round(interval));
40+
} catch (InterruptedException e) {
41+
Thread.currentThread().interrupt();
42+
throw new InterruptedIOException();
43+
}
44+
response = chain.proceed(request);
45+
}
46+
47+
return response;
48+
}
49+
50+
public double retryInterval(int max, int remain) {
51+
int nbRetries = max - remain;
52+
double sleepSeconds = Math.min(INITIAL_RETRY_DELAY * Math.pow(2.0, nbRetries), MAX_RETRY_DELAY);
53+
double jitter = 1 - 0.25 * random();
54+
return sleepSeconds * jitter;
55+
}
56+
}
57+

volcengine-java-sdk-ark-runtime/src/main/java/com/volcengine/ark/runtime/model/completion/chat/ChatFunctionCall.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ public class ChatFunctionCall {
1212
/**
1313
* The arguments of the call produced by the model, represented as a JsonNode for easy manipulation.
1414
*/
15-
JsonNode arguments;
15+
String arguments;
1616

17-
public ChatFunctionCall(String name, JsonNode arguments) {
17+
public ChatFunctionCall(String name, String arguments) {
1818
this.name = name;
1919
this.arguments = arguments;
2020
}
@@ -29,11 +29,11 @@ public void setName(String name) {
2929
this.name = name;
3030
}
3131

32-
public JsonNode getArguments() {
32+
public String getArguments() {
3333
return arguments;
3434
}
3535

36-
public void setArguments(JsonNode arguments) {
36+
public void setArguments(String arguments) {
3737
this.arguments = arguments;
3838
}
3939

volcengine-java-sdk-ark-runtime/src/main/java/com/volcengine/ark/runtime/model/completion/chat/ChatToolCall.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ public class ChatToolCall {
1616
/**
1717
* The function that the model called
1818
*/
19-
ChatFunction function;
19+
ChatFunctionCall function;
2020

21-
public ChatToolCall(String id, String type, ChatFunction function) {
21+
public ChatToolCall(String id, String type, ChatFunctionCall function) {
2222
this.id = id;
2323
this.type = type;
2424
this.function = function;
@@ -42,11 +42,11 @@ public void setType(String type) {
4242
this.type = type;
4343
}
4444

45-
public ChatFunction getFunction() {
45+
public ChatFunctionCall getFunction() {
4646
return function;
4747
}
4848

49-
public void setFunction(ChatFunction function) {
49+
public void setFunction(ChatFunctionCall function) {
5050
this.function = function;
5151
}
5252

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
package com.volcengine.ark.runtime.model.embeddings;
2+
3+
import java.util.List;
4+
5+
public class Embedding {
6+
7+
/**
8+
* The type of object returned, should be "embedding"
9+
*/
10+
String object;
11+
12+
/**
13+
* The embedding vector
14+
*/
15+
List<Double> embedding;
16+
17+
/**
18+
* The position of this embedding in the list
19+
*/
20+
Integer index;
21+
22+
public String getObject() {
23+
return object;
24+
}
25+
26+
public void setObject(String object) {
27+
this.object = object;
28+
}
29+
30+
public List<Double> getEmbedding() {
31+
return embedding;
32+
}
33+
34+
public void setEmbedding(List<Double> embedding) {
35+
this.embedding = embedding;
36+
}
37+
38+
public Integer getIndex() {
39+
return index;
40+
}
41+
42+
public void setIndex(Integer index) {
43+
this.index = index;
44+
}
45+
46+
@Override
47+
public String toString() {
48+
return "Embedding{" +
49+
"object='" + object + '\'' +
50+
", embedding=" + embedding +
51+
", index=" + index +
52+
'}';
53+
}
54+
}

0 commit comments

Comments
 (0)