diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/OpenAIServiceVersion.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/OpenAIServiceVersion.java index 8d15584caf4d..6a0186a342c1 100644 --- a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/OpenAIServiceVersion.java +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/OpenAIServiceVersion.java @@ -15,7 +15,10 @@ public enum OpenAIServiceVersion implements ServiceVersion { V2023_05_15("2023-05-15"), /** Enum value 2023-06-01-preview. */ - V2023_06_01_PREVIEW("2023-06-01-preview"); + V2023_06_01_PREVIEW("2023-06-01-preview"), + + /** Enum value 2023-07-01-preview. */ + V2023_07_01_PREVIEW("2023-07-01-preview"); private final String version; @@ -35,6 +38,6 @@ public String getVersion() { * @return The latest {@link OpenAIServiceVersion}. */ public static OpenAIServiceVersion getLatest() { - return V2023_06_01_PREVIEW; + return V2023_07_01_PREVIEW; } } diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/OpenAIClientImpl.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/OpenAIClientImpl.java index 3603ed471e2a..5f03fcc6de3e 100644 --- a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/OpenAIClientImpl.java +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/OpenAIClientImpl.java @@ -528,10 +528,25 @@ public Response getEmbeddingsWithResponse( * { * id: String (Required) * created: int (Required) + * prompt_annotations (Optional): [ + * (Optional){ + * prompt_index: int (Required) + * content_filter_results (Optional): { + * sexual (Required): { + * severity: String(safe/low/medium/high) (Required) + * filtered: boolean (Required) + * } + * violence (Required): (recursive schema, see violence above) + * hate (Required): (recursive schema, see hate above) + * self_harm (Required): (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) @@ -548,7 +563,7 @@ public Response getEmbeddingsWithResponse( * int (Required) * ] * } - * finish_reason: String(stop/length/content_filter) (Required) + * finish_reason: String(stop/length/content_filter/function_call) (Required) * } * ] * usage (Required): { @@ -626,10 +641,25 @@ public Mono> getCompletionsWithResponseAsync( * { * id: String (Required) * created: int (Required) + * prompt_annotations (Optional): [ + * (Optional){ + * prompt_index: int (Required) + * content_filter_results (Optional): { + * sexual (Required): { + * severity: String(safe/low/medium/high) (Required) + * filtered: boolean (Required) + * } + * violence (Required): (recursive schema, see violence above) + * hate (Required): (recursive schema, see hate above) + * self_harm (Required): (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) @@ -646,7 +676,7 @@ public Mono> getCompletionsWithResponseAsync( * int (Required) * ] * } - * finish_reason: String(stop/length/content_filter) (Required) + * finish_reason: String(stop/length/content_filter/function_call) (Required) * } * ] * usage (Required): { @@ -693,10 +723,23 @@ public Response getCompletionsWithResponse( * { * messages (Required): [ * (Required){ - * role: String(system/assistant/user) (Required) + * role: String(system/assistant/user/function) (Required) * content: String (Optional) + * name: String (Optional) + * function_call (Optional): { + * name: String (Required) + * arguments: String (Required) + * } + * } + * ] + * functions (Optional): [ + * (Optional){ + * name: String (Required) + * description: String (Optional) + * parameters: Object (Optional) * } * ] + * function_call: FunctionCallModelBase (Optional) * max_tokens: Integer (Optional) * temperature: Double (Optional) * top_p: Double (Optional) @@ -724,12 +767,32 @@ public Response getCompletionsWithResponse( * choices (Required): [ * (Required){ * message (Optional): { - * role: String(system/assistant/user) (Required) + * role: String(system/assistant/user/function) (Required) * content: String (Optional) + * name: String (Optional) + * function_call (Optional): { + * name: String (Required) + * arguments: String (Required) + * } * } * index: int (Required) - * finish_reason: String(stop/length/content_filter) (Required) + * finish_reason: String(stop/length/content_filter/function_call) (Required) * delta (Optional): (recursive schema, see delta above) + * content_filter_results (Optional): { + * sexual (Required): { + * severity: String(safe/low/medium/high) (Required) + * filtered: boolean (Required) + * } + * violence (Required): (recursive schema, see violence above) + * hate (Required): (recursive schema, see hate above) + * self_harm (Required): (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): { @@ -779,10 +842,23 @@ public Mono> getChatCompletionsWithResponseAsync( * { * messages (Required): [ * (Required){ - * role: String(system/assistant/user) (Required) + * role: String(system/assistant/user/function) (Required) * content: String (Optional) + * name: String (Optional) + * function_call (Optional): { + * name: String (Required) + * arguments: String (Required) + * } * } * ] + * functions (Optional): [ + * (Optional){ + * name: String (Required) + * description: String (Optional) + * parameters: Object (Optional) + * } + * ] + * function_call: FunctionCallModelBase (Optional) * max_tokens: Integer (Optional) * temperature: Double (Optional) * top_p: Double (Optional) @@ -810,12 +886,32 @@ public Mono> getChatCompletionsWithResponseAsync( * choices (Required): [ * (Required){ * message (Optional): { - * role: String(system/assistant/user) (Required) + * role: String(system/assistant/user/function) (Required) * content: String (Optional) + * name: String (Optional) + * function_call (Optional): { + * name: String (Required) + * arguments: String (Required) + * } * } * index: int (Required) - * finish_reason: String(stop/length/content_filter) (Required) + * finish_reason: String(stop/length/content_filter/function_call) (Required) * delta (Optional): (recursive schema, see delta above) + * content_filter_results (Optional): { + * sexual (Required): { + * severity: String(safe/low/medium/high) (Required) + * filtered: boolean (Required) + * } + * violence (Required): (recursive schema, see violence above) + * hate (Required): (recursive schema, see hate above) + * self_harm (Required): (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): { diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/ChatChoice.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/ChatChoice.java index 9ae3774df6df..c75b16f0e4cb 100644 --- a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/ChatChoice.java +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/ChatChoice.java @@ -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; + } } diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/ChatCompletions.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/ChatCompletions.java index 9c2491022b66..bd9c76f08c64 100644 --- a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/ChatCompletions.java +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/ChatCompletions.java @@ -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 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 getPromptFilterResults() { + return this.promptFilterResults; + } } diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/ChatCompletionsOptions.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/ChatCompletionsOptions.java index 7df28d9666c7..eaf04039f1d6 100644 --- a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/ChatCompletionsOptions.java +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/ChatCompletionsOptions.java @@ -429,4 +429,71 @@ public ChatCompletionsOptions setModel(String model) { this.model = model; return this; } + + /* + * A list of functions the model may generate JSON inputs for. + */ + @Generated + @JsonProperty(value = "functions") + private List functions; + + /* + * Controls how the model responds to function calls. "none" means the model does not call a function, + * and responds to the end-user. "auto" means the model can pick between an end-user or calling a function. + * Specifying a particular function via `{"name": "my_function"}` forces the model to call that function. + * "none" is the default when no functions are present. "auto" is the default if functions are present. + */ + @Generated + @JsonProperty(value = "function_call") + private FunctionCallModelBase functionCall; + + /** + * Get the functions property: A list of functions the model may generate JSON inputs for. + * + * @return the functions value. + */ + @Generated + public List getFunctions() { + return this.functions; + } + + /** + * Set the functions property: A list of functions the model may generate JSON inputs for. + * + * @param functions the functions value to set. + * @return the ChatCompletionsOptions object itself. + */ + @Generated + public ChatCompletionsOptions setFunctions(List functions) { + this.functions = functions; + return this; + } + + /** + * Get the functionCall property: Controls how the model responds to function calls. "none" means the model does not + * call a function, and responds to the end-user. "auto" means the model can pick between an end-user or calling a + * function. Specifying a particular function via `{"name": "my_function"}` forces the model to call that function. + * "none" is the default when no functions are present. "auto" is the default if functions are present. + * + * @return the functionCall value. + */ + @Generated + public FunctionCallModelBase getFunctionCall() { + return this.functionCall; + } + + /** + * Set the functionCall property: Controls how the model responds to function calls. "none" means the model does not + * call a function, and responds to the end-user. "auto" means the model can pick between an end-user or calling a + * function. Specifying a particular function via `{"name": "my_function"}` forces the model to call that function. + * "none" is the default when no functions are present. "auto" is the default if functions are present. + * + * @param functionCall the functionCall value to set. + * @return the ChatCompletionsOptions object itself. + */ + @Generated + public ChatCompletionsOptions setFunctionCall(FunctionCallModelBase functionCall) { + this.functionCall = functionCall; + return this; + } } diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/ChatMessage.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/ChatMessage.java index 2ad4cfd18b97..2594743f63f7 100644 --- a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/ChatMessage.java +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/ChatMessage.java @@ -68,4 +68,72 @@ public ChatMessage setContent(String content) { this.content = content; return this; } + + /* + * The name of the author of this message. `name` is required if role is `function`, and it should be the name of + * the + * function whose response is in the `content`. May contain a-z, A-Z, 0-9, and underscores, with a maximum length + * of + * 64 characters. + */ + @Generated + @JsonProperty(value = "name") + private String name; + + /* + * The name and arguments of a function that should be called, as generated by the model. + */ + @Generated + @JsonProperty(value = "function_call") + private FunctionCall functionCall; + + /** + * Get the name property: The name of the author of this message. `name` is required if role is `function`, and it + * should be the name of the function whose response is in the `content`. May contain a-z, A-Z, 0-9, and + * underscores, with a maximum length of 64 characters. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Set the name property: The name of the author of this message. `name` is required if role is `function`, and it + * should be the name of the function whose response is in the `content`. May contain a-z, A-Z, 0-9, and + * underscores, with a maximum length of 64 characters. + * + * @param name the name value to set. + * @return the ChatMessage object itself. + */ + @Generated + public ChatMessage setName(String name) { + this.name = name; + return this; + } + + /** + * Get the functionCall property: The name and arguments of a function that should be called, as generated by the + * model. + * + * @return the functionCall value. + */ + @Generated + public FunctionCall getFunctionCall() { + return this.functionCall; + } + + /** + * Set the functionCall property: The name and arguments of a function that should be called, as generated by the + * model. + * + * @param functionCall the functionCall value to set. + * @return the ChatMessage object itself. + */ + @Generated + public ChatMessage setFunctionCall(FunctionCall functionCall) { + this.functionCall = functionCall; + return this; + } } diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/ChatRole.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/ChatRole.java index dcf8fe55f839..621ea748768e 100644 --- a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/ChatRole.java +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/ChatRole.java @@ -50,4 +50,7 @@ public static ChatRole fromString(String name) { public static Collection values() { return values(ChatRole.class); } + + /** The role that provides function results for char completions. */ + @Generated public static final ChatRole FUNCTION = fromString("function"); } diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/Choice.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/Choice.java index e4c625edd306..a0b95afde1c6 100644 --- a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/Choice.java +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/Choice.java @@ -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; + } } diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/Completions.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/Completions.java index 627fa22219fa..51a9faa84c1c 100644 --- a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/Completions.java +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/Completions.java @@ -111,4 +111,23 @@ public List 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 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 getPromptFilterResults() { + return this.promptFilterResults; + } } diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/CompletionsFinishReason.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/CompletionsFinishReason.java index c267098eca5b..b16c05f00c3f 100644 --- a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/CompletionsFinishReason.java +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/CompletionsFinishReason.java @@ -52,4 +52,7 @@ public static CompletionsFinishReason fromString(String name) { public static Collection values() { return values(CompletionsFinishReason.class); } + + /** Completion ended normally, with the model requesting a function to be called. */ + @Generated public static final CompletionsFinishReason FUNCTION_CALL = fromString("function_call"); } diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/ContentFilterResult.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/ContentFilterResult.java new file mode 100644 index 000000000000..0ea4867d3bb8 --- /dev/null +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/ContentFilterResult.java @@ -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; + } +} diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/ContentFilterResults.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/ContentFilterResults.java new file mode 100644 index 000000000000..24be264d2dd6 --- /dev/null +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/ContentFilterResults.java @@ -0,0 +1,119 @@ +// 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 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. + * + * @param sexual the sexual value to set. + * @param violence the violence value to set. + * @param hate the hate value to set. + * @param selfHarm the selfHarm value to set. + */ + @Generated + @JsonCreator + private ContentFilterResults( + @JsonProperty(value = "sexual") ContentFilterResult sexual, + @JsonProperty(value = "violence") ContentFilterResult violence, + @JsonProperty(value = "hate") ContentFilterResult hate, + @JsonProperty(value = "self_harm") ContentFilterResult selfHarm) { + this.sexual = sexual; + this.violence = violence; + this.hate = hate; + this.selfHarm = selfHarm; + } + + /** + * 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; + } +} diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/ContentFilterSeverity.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/ContentFilterSeverity.java new file mode 100644 index 000000000000..5f636a7b3a92 --- /dev/null +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/ContentFilterSeverity.java @@ -0,0 +1,71 @@ +// 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.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Ratings for the intensity and risk level of harmful content. */ +public final class ContentFilterSeverity extends ExpandableStringEnum { + /** + * Content may be related to violence, self-harm, sexual, or hate categories but the terms are used in general, + * journalistic, scientific, medical, and similar professional contexts, which are appropriate for most audiences. + */ + @Generated public static final ContentFilterSeverity SAFE = fromString("safe"); + + /** + * Content that expresses prejudiced, judgmental, or opinionated views, includes offensive use of language, + * stereotyping, use cases exploring a fictional world (for example, gaming, literature) and depictions at low + * intensity. + */ + @Generated public static final ContentFilterSeverity LOW = fromString("low"); + + /** + * Content that uses offensive, insulting, mocking, intimidating, or demeaning language towards specific identity + * groups, includes depictions of seeking and executing harmful instructions, fantasies, glorification, promotion of + * harm at medium intensity. + */ + @Generated public static final ContentFilterSeverity MEDIUM = fromString("medium"); + + /** + * Content that displays explicit and severe harmful instructions, actions, damage, or abuse; includes endorsement, + * glorification, or promotion of severe harmful acts, extreme or illegal forms of harm, radicalization, or + * non-consensual power exchange or abuse. + */ + @Generated public static final ContentFilterSeverity HIGH = fromString("high"); + + /** + * Creates a new instance of ContentFilterSeverity value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public ContentFilterSeverity() {} + + /** + * Creates or finds a ContentFilterSeverity from its string representation. + * + * @param name a name to look for. + * @return the corresponding ContentFilterSeverity. + */ + @Generated + @JsonCreator + public static ContentFilterSeverity fromString(String name) { + return fromString(name, ContentFilterSeverity.class); + } + + /** + * Gets known ContentFilterSeverity values. + * + * @return known ContentFilterSeverity values. + */ + @Generated + public static Collection values() { + return values(ContentFilterSeverity.class); + } +} diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/FunctionCall.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/FunctionCall.java new file mode 100644 index 000000000000..0d87182bd586 --- /dev/null +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/FunctionCall.java @@ -0,0 +1,67 @@ +// 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; + +/** The name and arguments of a function that should be called, as generated by the model. */ +@Immutable +public final class FunctionCall { + /* + * The name of the function to call. + */ + @Generated + @JsonProperty(value = "name") + private String name; + + /* + * The arguments to call the function with, as generated by the model in JSON format. + * Note that the model does not always generate valid JSON, and may hallucinate parameters + * not defined by your function schema. Validate the arguments in your code before calling + * your function. + */ + @Generated + @JsonProperty(value = "arguments") + private String arguments; + + /** + * Creates an instance of FunctionCall class. + * + * @param name the name value to set. + * @param arguments the arguments value to set. + */ + @Generated + @JsonCreator + public FunctionCall( + @JsonProperty(value = "name") String name, @JsonProperty(value = "arguments") String arguments) { + this.name = name; + this.arguments = arguments; + } + + /** + * Get the name property: The name of the function to call. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Get the arguments property: The arguments to call the function with, as generated by the model in JSON format. + * Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your + * function schema. Validate the arguments in your code before calling your function. + * + * @return the arguments value. + */ + @Generated + public String getArguments() { + return this.arguments; + } +} diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/FunctionCallModelBase.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/FunctionCallModelBase.java new file mode 100644 index 000000000000..25beabc48f37 --- /dev/null +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/FunctionCallModelBase.java @@ -0,0 +1,11 @@ +// 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; + +/** The FunctionCallModelBase model. */ +public abstract class FunctionCallModelBase { + /** Creates an instance of FunctionCallModelBase class. */ + protected FunctionCallModelBase() {} +} diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/FunctionCallPreset.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/FunctionCallPreset.java new file mode 100644 index 000000000000..e3b693141724 --- /dev/null +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/FunctionCallPreset.java @@ -0,0 +1,59 @@ +// 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.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * The collection of predefined behaviors for handling request-provided function information in a chat completions + * operation. + */ +public final class FunctionCallPreset extends ExpandableStringEnum { + /** + * Specifies that the model may either use any of the functions provided in this chat completions request or instead + * return a standard chat completions response as if no functions were provided. + */ + @Generated public static final FunctionCallPreset AUTO = fromString("auto"); + + /** + * Specifies that the model should not respond with a function call and should instead provide a standard chat + * completions response. Response content may still be influenced by the provided function information. + */ + @Generated public static final FunctionCallPreset NONE = fromString("none"); + + /** + * Creates a new instance of FunctionCallPreset value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public FunctionCallPreset() {} + + /** + * Creates or finds a FunctionCallPreset from its string representation. + * + * @param name a name to look for. + * @return the corresponding FunctionCallPreset. + */ + @Generated + @JsonCreator + public static FunctionCallPreset fromString(String name) { + return fromString(name, FunctionCallPreset.class); + } + + /** + * Gets known FunctionCallPreset values. + * + * @return known FunctionCallPreset values. + */ + @Generated + public static Collection values() { + return values(FunctionCallPreset.class); + } +} diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/FunctionCallPresetFunctionCallModel.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/FunctionCallPresetFunctionCallModel.java new file mode 100644 index 000000000000..9bcabdf0def9 --- /dev/null +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/FunctionCallPresetFunctionCallModel.java @@ -0,0 +1,33 @@ +// 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.Immutable; +import com.fasterxml.jackson.annotation.JsonValue; + +/** The FunctionCallPresetFunctionCallModel model. */ +@Immutable +public final class FunctionCallPresetFunctionCallModel extends FunctionCallModelBase { + private final FunctionCallPreset value; + + /** + * Creates an instance of FunctionCallPresetFunctionCallModel class. + * + * @param value the value. + */ + public FunctionCallPresetFunctionCallModel(FunctionCallPreset value) { + this.value = value; + } + + /** + * Gets the value. + * + * @return the value. + */ + @JsonValue + public FunctionCallPreset getValue() { + return this.value; + } +} diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/FunctionDefinition.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/FunctionDefinition.java new file mode 100644 index 000000000000..379a5adb4eba --- /dev/null +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/FunctionDefinition.java @@ -0,0 +1,105 @@ +// 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.Fluent; +import com.azure.core.annotation.Generated; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The definition of a caller-specified function that chat completions may invoke in response to matching user input. + */ +@Fluent +public final class FunctionDefinition { + /* + * The name of the function to be called. + */ + @Generated + @JsonProperty(value = "name") + private String name; + + /* + * A description of what the function does. The model will use this description when selecting the function and + * interpreting its parameters. + */ + @Generated + @JsonProperty(value = "description") + private String description; + + /* + * The parameters the functions accepts, described as a JSON Schema object. + */ + @Generated + @JsonProperty(value = "parameters") + private Object parameters; + + /** + * Creates an instance of FunctionDefinition class. + * + * @param name the name value to set. + */ + @Generated + @JsonCreator + public FunctionDefinition(@JsonProperty(value = "name") String name) { + this.name = name; + } + + /** + * Get the name property: The name of the function to be called. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Get the description property: A description of what the function does. The model will use this description when + * selecting the function and interpreting its parameters. + * + * @return the description value. + */ + @Generated + public String getDescription() { + return this.description; + } + + /** + * Set the description property: A description of what the function does. The model will use this description when + * selecting the function and interpreting its parameters. + * + * @param description the description value to set. + * @return the FunctionDefinition object itself. + */ + @Generated + public FunctionDefinition setDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the parameters property: The parameters the functions accepts, described as a JSON Schema object. + * + * @return the parameters value. + */ + @Generated + public Object getParameters() { + return this.parameters; + } + + /** + * Set the parameters property: The parameters the functions accepts, described as a JSON Schema object. + * + * @param parameters the parameters value to set. + * @return the FunctionDefinition object itself. + */ + @Generated + public FunctionDefinition setParameters(Object parameters) { + this.parameters = parameters; + return this; + } +} diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/FunctionName.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/FunctionName.java new file mode 100644 index 000000000000..2db5ead3f1ce --- /dev/null +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/FunctionName.java @@ -0,0 +1,45 @@ +// 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; + +/** + * A structure that specifies the exact name of a specific, request-provided function to use when processing a chat + * completions operation. + */ +@Immutable +public final class FunctionName { + /* + * The name of the function to call. + */ + @Generated + @JsonProperty(value = "name") + private String name; + + /** + * Creates an instance of FunctionName class. + * + * @param name the name value to set. + */ + @Generated + @JsonCreator + public FunctionName(@JsonProperty(value = "name") String name) { + this.name = name; + } + + /** + * Get the name property: The name of the function to call. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } +} diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/FunctionNameFunctionCallModel.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/FunctionNameFunctionCallModel.java new file mode 100644 index 000000000000..df40077ac3ea --- /dev/null +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/FunctionNameFunctionCallModel.java @@ -0,0 +1,33 @@ +// 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.Immutable; +import com.fasterxml.jackson.annotation.JsonValue; + +/** The FunctionNameFunctionCallModel model. */ +@Immutable +public final class FunctionNameFunctionCallModel extends FunctionCallModelBase { + private final FunctionName value; + + /** + * Creates an instance of FunctionNameFunctionCallModel class. + * + * @param value the value. + */ + public FunctionNameFunctionCallModel(FunctionName value) { + this.value = value; + } + + /** + * Gets the value. + * + * @return the value. + */ + @JsonValue + public FunctionName getValue() { + return this.value; + } +} diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/PromptFilterResult.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/PromptFilterResult.java new file mode 100644 index 000000000000..2100c57381b5 --- /dev/null +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/models/PromptFilterResult.java @@ -0,0 +1,59 @@ +// 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; + +/** Content filtering results for a single prompt in the request. */ +@Immutable +public final class PromptFilterResult { + /* + * The index of this prompt in the set of prompt results + */ + @Generated + @JsonProperty(value = "prompt_index") + private int promptIndex; + + /* + * Content filtering results for this prompt + */ + @Generated + @JsonProperty(value = "content_filter_results") + private ContentFilterResults contentFilterResults; + + /** + * Creates an instance of PromptFilterResult class. + * + * @param promptIndex the promptIndex value to set. + */ + @Generated + @JsonCreator + private PromptFilterResult(@JsonProperty(value = "prompt_index") int promptIndex) { + this.promptIndex = promptIndex; + } + + /** + * Get the promptIndex property: The index of this prompt in the set of prompt results. + * + * @return the promptIndex value. + */ + @Generated + public int getPromptIndex() { + return this.promptIndex; + } + + /** + * Get the contentFilterResults property: Content filtering results for this prompt. + * + * @return the contentFilterResults value. + */ + @Generated + public ContentFilterResults getContentFilterResults() { + return this.contentFilterResults; + } +} diff --git a/sdk/openai/azure-ai-openai/tsp-location.yaml b/sdk/openai/azure-ai-openai/tsp-location.yaml index e4077d3198f6..469a74f28d64 100644 --- a/sdk/openai/azure-ai-openai/tsp-location.yaml +++ b/sdk/openai/azure-ai-openai/tsp-location.yaml @@ -1,5 +1,5 @@ -directory: specification/cognitiveservices/OpenAI.Inference -additionalDirectories: - - specification/cognitiveservices/OpenAI.Authoring -commit: 018905ddfbba9e08961964784a5de7093815b42e repo: Azure/azure-rest-api-specs +directory: specification/cognitiveservices/OpenAI.Inference +commit: f44661dfc5e21bd53907dc45e3d47344c13bed9d +additionalDirectories: [] +