Skip to content

Commit 588c8be

Browse files
author
潘婉宁
committed
feat: support thinking
1 parent e419f5c commit 588c8be

File tree

1 file changed

+62
-28
lines changed

1 file changed

+62
-28
lines changed

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

Lines changed: 62 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,46 @@ public class ChatCompletionRequest {
158158
@JsonProperty("response_format")
159159
ChatCompletionRequestResponseFormat responseFormat;
160160

161+
@JsonProperty("thinking")
162+
ChatCompletionRequestThinking thinking;
163+
164+
@Override
165+
public String toString() {
166+
return "ChatCompletionRequest{" +
167+
"model='" + model + '\'' +
168+
", messages=" + messages +
169+
", temperature=" + temperature +
170+
", topP=" + topP +
171+
", stream=" + stream +
172+
", streamOptions=" + streamOptions +
173+
", serviceTier='" + serviceTier + '\'' +
174+
", stop=" + stop +
175+
", maxTokens=" + maxTokens +
176+
", presencePenalty=" + presencePenalty +
177+
", frequencyPenalty=" + frequencyPenalty +
178+
", logitBias=" + logitBias +
179+
", user='" + user + '\'' +
180+
", tools=" + tools +
181+
", functionCall=" + functionCall +
182+
", logprobs=" + logprobs +
183+
", topLogprobs=" + topLogprobs +
184+
", repetitionPenalty=" + repetitionPenalty +
185+
", n=" + n +
186+
", parallelToolCalls=" + parallelToolCalls +
187+
", toolChoice=" + toolChoice +
188+
", responseFormat=" + responseFormat +
189+
", thinking=" + thinking +
190+
'}';
191+
}
192+
193+
public ChatCompletionRequestThinking getThinking() {
194+
return thinking;
195+
}
196+
197+
public void setThinking(ChatCompletionRequestThinking thinking) {
198+
this.thinking = thinking;
199+
}
200+
161201
public String getModel() {
162202
return model;
163203
}
@@ -334,34 +374,6 @@ public void setResponseFormat(ChatCompletionRequestResponseFormat responseFormat
334374
this.responseFormat = responseFormat;
335375
}
336376

337-
@Override
338-
public String toString() {
339-
return "ChatCompletionRequest{" +
340-
"model='" + model + '\'' +
341-
", messages=" + messages +
342-
", temperature=" + temperature +
343-
", topP=" + topP +
344-
", stream=" + stream +
345-
", streamOptions=" + streamOptions +
346-
", serviceTier=" + serviceTier +
347-
", stop=" + stop +
348-
", maxTokens=" + maxTokens +
349-
", presencePenalty=" + presencePenalty +
350-
", frequencyPenalty=" + frequencyPenalty +
351-
", logitBias=" + logitBias +
352-
", user='" + user + '\'' +
353-
", tools=" + tools +
354-
", functionCall=" + functionCall +
355-
", logprobs=" + logprobs +
356-
", topLogprobs=" + topLogprobs +
357-
", repetitionPenalty=" + repetitionPenalty +
358-
", n=" + n +
359-
", parallelToolCalls=" + parallelToolCalls +
360-
", toolChoice=" + toolChoice +
361-
", responseFormat=" + responseFormat +
362-
'}';
363-
}
364-
365377
public static class ChatCompletionRequestFunctionCall {
366378
String name;
367379

@@ -480,6 +492,22 @@ public ChatCompletionRequestToolChoice(String type, ChatCompletionRequestToolCho
480492

481493
}
482494

495+
public static class ChatCompletionRequestThinking{
496+
public ChatCompletionRequestThinking(String type) {
497+
this.type = type;
498+
}
499+
500+
public String getType() {
501+
return type;
502+
}
503+
504+
public void setType(String type) {
505+
this.type = type;
506+
}
507+
508+
String type;
509+
}
510+
483511
public static class ChatCompletionRequestToolChoiceFunction {
484512
String name;
485513

@@ -523,6 +551,7 @@ public static class Builder {
523551
private Boolean parallelToolCalls;
524552
private Object toolChoice;
525553
private ChatCompletionRequestResponseFormat responseFormat;
554+
private ChatCompletionRequestThinking thinking;
526555

527556
public ChatCompletionRequest.Builder model(String model) {
528557
this.model = model;
@@ -639,6 +668,10 @@ public ChatCompletionRequest.Builder responseFormat(ChatCompletionRequestRespons
639668
return this;
640669
}
641670

671+
public ChatCompletionRequest.Builder thinking(ChatCompletionRequestThinking thinking) {
672+
this.thinking = thinking;
673+
return this;
674+
}
642675
public ChatCompletionRequest build() {
643676
ChatCompletionRequest chatCompletionRequest = new ChatCompletionRequest();
644677
chatCompletionRequest.setModel(model);
@@ -663,6 +696,7 @@ public ChatCompletionRequest build() {
663696
chatCompletionRequest.setParallelToolCalls(parallelToolCalls);
664697
chatCompletionRequest.setToolChoice(toolChoice);
665698
chatCompletionRequest.setResponseFormat(responseFormat);
699+
chatCompletionRequest.setThinking(thinking);
666700
return chatCompletionRequest;
667701
}
668702
}

0 commit comments

Comments
 (0)