Skip to content

Commit bf4fdac

Browse files
authored
Regenerate OpenAI models without property required annotation (#35336)
1 parent 0450e46 commit bf4fdac

25 files changed

+268
-211
lines changed

sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/OpenAIClientBuilder.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
import com.azure.core.util.Configuration;
4040
import com.azure.core.util.CoreUtils;
4141
import com.azure.core.util.builder.ClientBuilderUtil;
42+
import com.azure.core.util.logging.ClientLogger;
4243
import com.azure.core.util.serializer.JacksonAdapter;
4344
import java.util.ArrayList;
4445
import java.util.List;
@@ -81,6 +82,9 @@ public OpenAIClientBuilder() {
8182
@Generated
8283
@Override
8384
public OpenAIClientBuilder pipeline(HttpPipeline pipeline) {
85+
if (this.pipeline != null && pipeline == null) {
86+
LOGGER.info("HttpPipeline is being set to 'null' when it was previously configured.");
87+
}
8488
this.pipeline = pipeline;
8589
return this;
8690
}
@@ -377,4 +381,6 @@ public OpenAIClient buildClient() {
377381
}
378382
return new OpenAIClient(buildInnerClient());
379383
}
384+
385+
private static final ClientLogger LOGGER = new ClientLogger(OpenAIClientBuilder.class);
380386
}

sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/OpenAIClientImpl.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -637,10 +637,7 @@ public Response<BinaryData> getCompletionsWithResponse(
637637
* }
638638
* index: int (Required)
639639
* finish_reason: String(stopped/tokenLimitReached/contentFiltered) (Required)
640-
* delta (Optional): {
641-
* role: String(system/assistant/user) (Optional)
642-
* content: String (Optional)
643-
* }
640+
* delta (Optional): (recursive schema, see delta above)
644641
* }
645642
* ]
646643
* usage (Required): {
@@ -725,10 +722,7 @@ public Mono<Response<BinaryData>> getChatCompletionsWithResponseAsync(
725722
* }
726723
* index: int (Required)
727724
* finish_reason: String(stopped/tokenLimitReached/contentFiltered) (Required)
728-
* delta (Optional): {
729-
* role: String(system/assistant/user) (Optional)
730-
* content: String (Optional)
731-
* }
725+
* delta (Optional): (recursive schema, see delta above)
732726
* }
733727
* ]
734728
* usage (Required): {

sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/ChatChoice.java

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
package com.azure.ai.openai.models;
66

7+
import com.azure.core.annotation.Generated;
78
import com.azure.core.annotation.Immutable;
89
import com.fasterxml.jackson.annotation.JsonCreator;
910
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -18,37 +19,42 @@ public final class ChatChoice {
1819
/*
1920
* The chat message for a given chat completions prompt.
2021
*/
22+
@Generated
2123
@JsonProperty(value = "message")
2224
private ChatMessage message;
2325

2426
/*
2527
* The ordered index associated with this chat completions choice.
2628
*/
27-
@JsonProperty(value = "index", required = true)
29+
@Generated
30+
@JsonProperty(value = "index")
2831
private int index;
2932

3033
/*
3134
* The reason that this chat completions choice completed its generated.
3235
*/
33-
@JsonProperty(value = "finish_reason", required = true)
36+
@Generated
37+
@JsonProperty(value = "finish_reason")
3438
private CompletionsFinishReason finishReason;
3539

3640
/*
3741
* The delta message content for a streaming response.
3842
*/
43+
@Generated
3944
@JsonProperty(value = "delta")
40-
private ChatMessageDelta delta;
45+
private ChatMessage delta;
4146

4247
/**
4348
* Creates an instance of ChatChoice class.
4449
*
4550
* @param index the index value to set.
4651
* @param finishReason the finishReason value to set.
4752
*/
53+
@Generated
4854
@JsonCreator
4955
private ChatChoice(
50-
@JsonProperty(value = "index", required = true) int index,
51-
@JsonProperty(value = "finish_reason", required = true) CompletionsFinishReason finishReason) {
56+
@JsonProperty(value = "index") int index,
57+
@JsonProperty(value = "finish_reason") CompletionsFinishReason finishReason) {
5258
this.index = index;
5359
this.finishReason = finishReason;
5460
}
@@ -58,6 +64,7 @@ private ChatChoice(
5864
*
5965
* @return the message value.
6066
*/
67+
@Generated
6168
public ChatMessage getMessage() {
6269
return this.message;
6370
}
@@ -67,6 +74,7 @@ public ChatMessage getMessage() {
6774
*
6875
* @return the index value.
6976
*/
77+
@Generated
7078
public int getIndex() {
7179
return this.index;
7280
}
@@ -76,6 +84,7 @@ public int getIndex() {
7684
*
7785
* @return the finishReason value.
7886
*/
87+
@Generated
7988
public CompletionsFinishReason getFinishReason() {
8089
return this.finishReason;
8190
}
@@ -85,7 +94,8 @@ public CompletionsFinishReason getFinishReason() {
8594
*
8695
* @return the delta value.
8796
*/
88-
public ChatMessageDelta getDelta() {
97+
@Generated
98+
public ChatMessage getDelta() {
8999
return this.delta;
90100
}
91101
}

sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/ChatCompletions.java

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
package com.azure.ai.openai.models;
66

7+
import com.azure.core.annotation.Generated;
78
import com.azure.core.annotation.Immutable;
89
import com.fasterxml.jackson.annotation.JsonCreator;
910
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -18,28 +19,32 @@ public final class ChatCompletions {
1819
/*
1920
* A unique identifier associated with this chat completions response.
2021
*/
21-
@JsonProperty(value = "id", required = true)
22+
@Generated
23+
@JsonProperty(value = "id")
2224
private String id;
2325

2426
/*
2527
* The first timestamp associated with generation activity for this completions response,
2628
* represented as seconds since the beginning of the Unix epoch of 00:00 on 1 Jan 1970.
2729
*/
28-
@JsonProperty(value = "created", required = true)
30+
@Generated
31+
@JsonProperty(value = "created")
2932
private int created;
3033

3134
/*
3235
* The collection of completions choices associated with this completions response.
3336
* Generally, `n` choices are generated per provided prompt with a default value of 1.
3437
* Token limits and other settings may limit the number of choices generated.
3538
*/
36-
@JsonProperty(value = "choices", required = true)
39+
@Generated
40+
@JsonProperty(value = "choices")
3741
private List<ChatChoice> choices;
3842

3943
/*
4044
* Usage information for tokens processed and generated as part of this completions operation.
4145
*/
42-
@JsonProperty(value = "usage", required = true)
46+
@Generated
47+
@JsonProperty(value = "usage")
4348
private CompletionsUsage usage;
4449

4550
/**
@@ -50,12 +55,13 @@ public final class ChatCompletions {
5055
* @param choices the choices value to set.
5156
* @param usage the usage value to set.
5257
*/
58+
@Generated
5359
@JsonCreator
5460
private ChatCompletions(
55-
@JsonProperty(value = "id", required = true) String id,
56-
@JsonProperty(value = "created", required = true) int created,
57-
@JsonProperty(value = "choices", required = true) List<ChatChoice> choices,
58-
@JsonProperty(value = "usage", required = true) CompletionsUsage usage) {
61+
@JsonProperty(value = "id") String id,
62+
@JsonProperty(value = "created") int created,
63+
@JsonProperty(value = "choices") List<ChatChoice> choices,
64+
@JsonProperty(value = "usage") CompletionsUsage usage) {
5965
this.id = id;
6066
this.created = created;
6167
this.choices = choices;
@@ -67,6 +73,7 @@ private ChatCompletions(
6773
*
6874
* @return the id value.
6975
*/
76+
@Generated
7077
public String getId() {
7178
return this.id;
7279
}
@@ -77,6 +84,7 @@ public String getId() {
7784
*
7885
* @return the created value.
7986
*/
87+
@Generated
8088
public int getCreated() {
8189
return this.created;
8290
}
@@ -88,6 +96,7 @@ public int getCreated() {
8896
*
8997
* @return the choices value.
9098
*/
99+
@Generated
91100
public List<ChatChoice> getChoices() {
92101
return this.choices;
93102
}
@@ -98,6 +107,7 @@ public List<ChatChoice> getChoices() {
98107
*
99108
* @return the usage value.
100109
*/
110+
@Generated
101111
public CompletionsUsage getUsage() {
102112
return this.usage;
103113
}

0 commit comments

Comments
 (0)