Skip to content

Commit d946d39

Browse files
author
r.shi
committed
feat: support use customize model name #50
1 parent 06107d5 commit d946d39

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/main/java/org/devlive/sdk/common/DefaultClient.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ public CompleteResponse createCompletion(CompletionEntity configure)
8080
configure.setStream(true);
8181
this.createEventSource(url, configure);
8282
return null;
83-
} else {
83+
}
84+
else {
8485
return this.api.fetchCompletions(url, configure)
8586
.blockingGet();
8687
}
@@ -110,7 +111,8 @@ public ChatResponse createChatCompletion(ChatEntity configure)
110111
configure.setStream(true);
111112
this.createEventSource(url, configure);
112113
return null;
113-
} else {
114+
}
115+
else {
114116
return this.api.fetchChatCompletions(url, configure)
115117
.blockingGet();
116118
}
@@ -382,7 +384,8 @@ private void createEventSource(String url, Object configure)
382384
.post(RequestBody.create(MultipartBodyUtils.JSON, mapper.writeValueAsString(configure)))
383385
.build();
384386
factory.newEventSource(request, this.listener);
385-
} catch (Exception e) {
387+
}
388+
catch (Exception e) {
386389
throw new RequestException(String.format("Failed to create event source: %s", e.getMessage()));
387390
}
388391
}

src/main/java/org/devlive/sdk/openai/entity/ChatEntity.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ public ChatEntityBuilder maxTokens(Integer maxTokens)
120120
if (Objects.isNull(completionModel)) {
121121
this.maxTokens = maxTokens;
122122
return this;
123-
} else {
123+
}
124+
else {
124125
if (ObjectUtils.isNotEmpty(this.model)
125126
&& maxTokens > completionModel.getMaxTokens()) {
126127
throw new ParamException(String.format(

0 commit comments

Comments
 (0)