Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Regenerate OpenAI models without property required annotation
  • Loading branch information
srnagar committed Jun 6, 2023
commit a1a72a96ea591ff59df0b4d1afd43e8e360c7348
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import com.azure.core.util.Configuration;
import com.azure.core.util.CoreUtils;
import com.azure.core.util.builder.ClientBuilderUtil;
import com.azure.core.util.logging.ClientLogger;
import com.azure.core.util.serializer.JacksonAdapter;
import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -81,6 +82,9 @@ public OpenAIClientBuilder() {
@Generated
@Override
public OpenAIClientBuilder pipeline(HttpPipeline pipeline) {
if (this.pipeline != null && pipeline == null) {
LOGGER.info("HttpPipeline is being set to 'null' when it was previously configured.");
}
this.pipeline = pipeline;
return this;
}
Expand Down Expand Up @@ -377,4 +381,6 @@ public OpenAIClient buildClient() {
}
return new OpenAIClient(buildInnerClient());
}

private static final ClientLogger LOGGER = new ClientLogger(OpenAIClientBuilder.class);
}
Original file line number Diff line number Diff line change
Expand Up @@ -637,10 +637,7 @@ public Response<BinaryData> getCompletionsWithResponse(
* }
* index: int (Required)
* finish_reason: String(stopped/tokenLimitReached/contentFiltered) (Required)
* delta (Optional): {
* role: String(system/assistant/user) (Optional)
* content: String (Optional)
* }
* delta (Optional): (recursive schema, see delta above)
* }
* ]
* usage (Required): {
Expand Down Expand Up @@ -725,10 +722,7 @@ public Mono<Response<BinaryData>> getChatCompletionsWithResponseAsync(
* }
* index: int (Required)
* finish_reason: String(stopped/tokenLimitReached/contentFiltered) (Required)
* delta (Optional): {
* role: String(system/assistant/user) (Optional)
* content: String (Optional)
* }
* delta (Optional): (recursive schema, see delta above)
* }
* ]
* usage (Required): {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

package com.azure.ai.openai.models;

import com.azure.core.annotation.Generated;
import com.azure.core.annotation.Immutable;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
Expand All @@ -18,37 +19,42 @@ public final class ChatChoice {
/*
* The chat message for a given chat completions prompt.
*/
@Generated
@JsonProperty(value = "message")
private ChatMessage message;

/*
* The ordered index associated with this chat completions choice.
*/
@JsonProperty(value = "index", required = true)
@Generated
@JsonProperty(value = "index")
private int index;

/*
* The reason that this chat completions choice completed its generated.
*/
@JsonProperty(value = "finish_reason", required = true)
@Generated
@JsonProperty(value = "finish_reason")
private CompletionsFinishReason finishReason;

/*
* The delta message content for a streaming response.
*/
@Generated
@JsonProperty(value = "delta")
private ChatMessageDelta delta;
private ChatMessage delta;

/**
* Creates an instance of ChatChoice class.
*
* @param index the index value to set.
* @param finishReason the finishReason value to set.
*/
@Generated
@JsonCreator
private ChatChoice(
@JsonProperty(value = "index", required = true) int index,
@JsonProperty(value = "finish_reason", required = true) CompletionsFinishReason finishReason) {
@JsonProperty(value = "index") int index,
@JsonProperty(value = "finish_reason") CompletionsFinishReason finishReason) {
this.index = index;
this.finishReason = finishReason;
}
Expand All @@ -58,6 +64,7 @@ private ChatChoice(
*
* @return the message value.
*/
@Generated
public ChatMessage getMessage() {
return this.message;
}
Expand All @@ -67,6 +74,7 @@ public ChatMessage getMessage() {
*
* @return the index value.
*/
@Generated
public int getIndex() {
return this.index;
}
Expand All @@ -76,6 +84,7 @@ public int getIndex() {
*
* @return the finishReason value.
*/
@Generated
public CompletionsFinishReason getFinishReason() {
return this.finishReason;
}
Expand All @@ -85,7 +94,8 @@ public CompletionsFinishReason getFinishReason() {
*
* @return the delta value.
*/
public ChatMessageDelta getDelta() {
@Generated
public ChatMessage getDelta() {
return this.delta;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

package com.azure.ai.openai.models;

import com.azure.core.annotation.Generated;
import com.azure.core.annotation.Immutable;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
Expand All @@ -18,28 +19,32 @@ public final class ChatCompletions {
/*
* A unique identifier associated with this chat completions response.
*/
@JsonProperty(value = "id", required = true)
@Generated
@JsonProperty(value = "id")
private String id;

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

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

/*
* Usage information for tokens processed and generated as part of this completions operation.
*/
@JsonProperty(value = "usage", required = true)
@Generated
@JsonProperty(value = "usage")
private CompletionsUsage usage;

/**
Expand All @@ -50,12 +55,13 @@ public final class ChatCompletions {
* @param choices the choices value to set.
* @param usage the usage value to set.
*/
@Generated
@JsonCreator
private ChatCompletions(
@JsonProperty(value = "id", required = true) String id,
@JsonProperty(value = "created", required = true) int created,
@JsonProperty(value = "choices", required = true) List<ChatChoice> choices,
@JsonProperty(value = "usage", required = true) CompletionsUsage usage) {
@JsonProperty(value = "id") String id,
@JsonProperty(value = "created") int created,
@JsonProperty(value = "choices") List<ChatChoice> choices,
@JsonProperty(value = "usage") CompletionsUsage usage) {
this.id = id;
this.created = created;
this.choices = choices;
Expand All @@ -67,6 +73,7 @@ private ChatCompletions(
*
* @return the id value.
*/
@Generated
public String getId() {
return this.id;
}
Expand All @@ -77,6 +84,7 @@ public String getId() {
*
* @return the created value.
*/
@Generated
public int getCreated() {
return this.created;
}
Expand All @@ -88,6 +96,7 @@ public int getCreated() {
*
* @return the choices value.
*/
@Generated
public List<ChatChoice> getChoices() {
return this.choices;
}
Expand All @@ -98,6 +107,7 @@ public List<ChatChoice> getChoices() {
*
* @return the usage value.
*/
@Generated
public CompletionsUsage getUsage() {
return this.usage;
}
Expand Down
Loading