Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AutoPR azure-ai-openai] Azure OpenAI: correct optionality of completions content filter category specification #6072

Closed
wants to merge 1 commit into from
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -484,10 +484,25 @@ public Response<BinaryData> getEmbeddingsWithResponse(
* {
* id: String (Required)
* created: int (Required)
* prompt_annotations (Optional): [
* (Optional){
* prompt_index: int (Required)
* content_filter_results (Optional): {
* sexual (Optional): {
* severity: String(safe/low/medium/high) (Required)
* filtered: boolean (Required)
* }
* violence (Optional): (recursive schema, see violence above)
* hate (Optional): (recursive schema, see hate above)
* self_harm (Optional): (recursive schema, see self_harm above)
* }
* }
* ]
* choices (Required): [
* (Required){
* text: String (Required)
* index: int (Required)
* content_filter_results (Optional): (recursive schema, see content_filter_results above)
* logprobs (Required): {
* tokens (Required): [
* String (Required)
Expand Down Expand Up @@ -582,10 +597,25 @@ public Mono<Response<BinaryData>> getCompletionsWithResponseAsync(
* {
* id: String (Required)
* created: int (Required)
* prompt_annotations (Optional): [
* (Optional){
* prompt_index: int (Required)
* content_filter_results (Optional): {
* sexual (Optional): {
* severity: String(safe/low/medium/high) (Required)
* filtered: boolean (Required)
* }
* violence (Optional): (recursive schema, see violence above)
* hate (Optional): (recursive schema, see hate above)
* self_harm (Optional): (recursive schema, see self_harm above)
* }
* }
* ]
* choices (Required): [
* (Required){
* text: String (Required)
* index: int (Required)
* content_filter_results (Optional): (recursive schema, see content_filter_results above)
* logprobs (Required): {
* tokens (Required): [
* String (Required)
Expand Down Expand Up @@ -704,6 +734,21 @@ public Response<BinaryData> getCompletionsWithResponse(
* index: int (Required)
* finish_reason: String(stop/length/content_filter/function_call) (Required)
* delta (Optional): (recursive schema, see delta above)
* content_filter_results (Optional): {
* sexual (Optional): {
* severity: String(safe/low/medium/high) (Required)
* filtered: boolean (Required)
* }
* violence (Optional): (recursive schema, see violence above)
* hate (Optional): (recursive schema, see hate above)
* self_harm (Optional): (recursive schema, see self_harm above)
* }
* }
* ]
* prompt_annotations (Optional): [
* (Optional){
* prompt_index: int (Required)
* content_filter_results (Optional): (recursive schema, see content_filter_results above)
* }
* ]
* usage (Required): {
Expand Down Expand Up @@ -808,6 +853,21 @@ public Mono<Response<BinaryData>> getChatCompletionsWithResponseAsync(
* index: int (Required)
* finish_reason: String(stop/length/content_filter/function_call) (Required)
* delta (Optional): (recursive schema, see delta above)
* content_filter_results (Optional): {
* sexual (Optional): {
* severity: String(safe/low/medium/high) (Required)
* filtered: boolean (Required)
* }
* violence (Optional): (recursive schema, see violence above)
* hate (Optional): (recursive schema, see hate above)
* self_harm (Optional): (recursive schema, see self_harm above)
* }
* }
* ]
* prompt_annotations (Optional): [
* (Optional){
* prompt_index: int (Required)
* content_filter_results (Optional): (recursive schema, see content_filter_results above)
* }
* ]
* usage (Required): {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,25 @@ public CompletionsFinishReason getFinishReason() {
public ChatMessage getDelta() {
return this.delta;
}

/*
* Information about the content filtering category (hate, sexual, violence, self_harm), if it
* has been detected, as well as the severity level (very_low, low, medium, high-scale that
* determines the intensity and risk level of harmful content) and if it has been filtered or not.
*/
@Generated
@JsonProperty(value = "content_filter_results")
private ContentFilterResults contentFilterResults;

/**
* Get the contentFilterResults property: Information about the content filtering category (hate, sexual, violence,
* self_harm), if it has been detected, as well as the severity level (very_low, low, medium, high-scale that
* determines the intensity and risk level of harmful content) and if it has been filtered or not.
*
* @return the contentFilterResults value.
*/
@Generated
public ContentFilterResults getContentFilterResults() {
return this.contentFilterResults;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,23 @@ public CompletionsUsage getUsage() {
public int getCreatedAt() {
return this.createdAt;
}

/*
* Content filtering results for zero or more prompts in the request. In a streaming request,
* results for different prompts may arrive at different times or in different orders.
*/
@Generated
@JsonProperty(value = "prompt_annotations")
private List<PromptFilterResult> promptFilterResults;

/**
* Get the promptFilterResults property: Content filtering results for zero or more prompts in the request. In a
* streaming request, results for different prompts may arrive at different times or in different orders.
*
* @return the promptFilterResults value.
*/
@Generated
public List<PromptFilterResult> getPromptFilterResults() {
return this.promptFilterResults;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,25 @@ public CompletionsLogProbabilityModel getLogprobs() {
public CompletionsFinishReason getFinishReason() {
return this.finishReason;
}

/*
* Information about the content filtering category (hate, sexual, violence, self_harm), if it
* has been detected, as well as the severity level (very_low, low, medium, high-scale that
* determines the intensity and risk level of harmful content) and if it has been filtered or not.
*/
@Generated
@JsonProperty(value = "content_filter_results")
private ContentFilterResults contentFilterResults;

/**
* Get the contentFilterResults property: Information about the content filtering category (hate, sexual, violence,
* self_harm), if it has been detected, as well as the severity level (very_low, low, medium, high-scale that
* determines the intensity and risk level of harmful content) and if it has been filtered or not.
*
* @return the contentFilterResults value.
*/
@Generated
public ContentFilterResults getContentFilterResults() {
return this.contentFilterResults;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,23 @@ public List<Choice> getChoices() {
public CompletionsUsage getUsage() {
return this.usage;
}

/*
* Content filtering results for zero or more prompts in the request. In a streaming request,
* results for different prompts may arrive at different times or in different orders.
*/
@Generated
@JsonProperty(value = "prompt_annotations")
private List<PromptFilterResult> promptFilterResults;

/**
* Get the promptFilterResults property: Content filtering results for zero or more prompts in the request. In a
* streaming request, results for different prompts may arrive at different times or in different orders.
*
* @return the promptFilterResults value.
*/
@Generated
public List<PromptFilterResult> getPromptFilterResults() {
return this.promptFilterResults;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

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;

/** Information about filtered content severity level and if it has been filtered or not. */
@Immutable
public final class ContentFilterResult {
/*
* Ratings for the intensity and risk level of filtered content.
*/
@Generated
@JsonProperty(value = "severity")
private ContentFilterSeverity severity;

/*
* A value indicating whether or not the content has been filtered.
*/
@Generated
@JsonProperty(value = "filtered")
private boolean filtered;

/**
* Creates an instance of ContentFilterResult class.
*
* @param severity the severity value to set.
* @param filtered the filtered value to set.
*/
@Generated
@JsonCreator
private ContentFilterResult(
@JsonProperty(value = "severity") ContentFilterSeverity severity,
@JsonProperty(value = "filtered") boolean filtered) {
this.severity = severity;
this.filtered = filtered;
}

/**
* Get the severity property: Ratings for the intensity and risk level of filtered content.
*
* @return the severity value.
*/
@Generated
public ContentFilterSeverity getSeverity() {
return this.severity;
}

/**
* Get the filtered property: A value indicating whether or not the content has been filtered.
*
* @return the filtered value.
*/
@Generated
public boolean isFiltered() {
return this.filtered;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.ai.openai.models;

import com.azure.core.annotation.Generated;
import com.azure.core.annotation.Immutable;
import com.fasterxml.jackson.annotation.JsonProperty;

/** Information about the content filtering category, if it has been detected. */
@Immutable
public final class ContentFilterResults {
/*
* Describes language related to anatomical organs and genitals, romantic relationships,
* acts portrayed in erotic or affectionate terms, physical sexual acts, including
* those portrayed as an assault or a forced sexual violent act against one’s will,
* prostitution, pornography, and abuse.
*/
@Generated
@JsonProperty(value = "sexual")
private ContentFilterResult sexual;

/*
* Describes language related to physical actions intended to hurt, injure, damage, or
* kill someone or something; describes weapons, etc.
*/
@Generated
@JsonProperty(value = "violence")
private ContentFilterResult violence;

/*
* Describes language attacks or uses that include pejorative or discriminatory language
* with reference to a person or identity group on the basis of certain differentiating
* attributes of these groups including but not limited to race, ethnicity, nationality,
* gender identity and expression, sexual orientation, religion, immigration status, ability
* status, personal appearance, and body size.
*/
@Generated
@JsonProperty(value = "hate")
private ContentFilterResult hate;

/*
* Describes language related to physical actions intended to purposely hurt, injure,
* or damage one’s body, or kill oneself.
*/
@Generated
@JsonProperty(value = "self_harm")
private ContentFilterResult selfHarm;

/** Creates an instance of ContentFilterResults class. */
@Generated
private ContentFilterResults() {}

/**
* Get the sexual property: Describes language related to anatomical organs and genitals, romantic relationships,
* acts portrayed in erotic or affectionate terms, physical sexual acts, including those portrayed as an assault or
* a forced sexual violent act against one’s will, prostitution, pornography, and abuse.
*
* @return the sexual value.
*/
@Generated
public ContentFilterResult getSexual() {
return this.sexual;
}

/**
* Get the violence property: Describes language related to physical actions intended to hurt, injure, damage, or
* kill someone or something; describes weapons, etc.
*
* @return the violence value.
*/
@Generated
public ContentFilterResult getViolence() {
return this.violence;
}

/**
* Get the hate property: Describes language attacks or uses that include pejorative or discriminatory language with
* reference to a person or identity group on the basis of certain differentiating attributes of these groups
* including but not limited to race, ethnicity, nationality, gender identity and expression, sexual orientation,
* religion, immigration status, ability status, personal appearance, and body size.
*
* @return the hate value.
*/
@Generated
public ContentFilterResult getHate() {
return this.hate;
}

/**
* Get the selfHarm property: Describes language related to physical actions intended to purposely hurt, injure, or
* damage one’s body, or kill oneself.
*
* @return the selfHarm value.
*/
@Generated
public ContentFilterResult getSelfHarm() {
return this.selfHarm;
}
}
Loading