Skip to content
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 @@ -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;

Expand All @@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ public Response<BinaryData> getEmbeddingsWithResponse(
* int (Required)
* ]
* }
* finish_reason: String(stop/length/content_filter) (Required)
* finish_reason: String(stop/length/content_filter/function_call) (Required)
* }
* ]
* usage (Required): {
Expand Down Expand Up @@ -643,7 +643,7 @@ public Mono<Response<BinaryData>> getCompletionsWithResponseAsync(
* int (Required)
* ]
* }
* finish_reason: String(stop/length/content_filter) (Required)
* finish_reason: String(stop/length/content_filter/function_call) (Required)
* }
* ]
* usage (Required): {
Expand Down Expand Up @@ -689,10 +689,23 @@ public Response<BinaryData> 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)
Expand Down Expand Up @@ -720,11 +733,16 @@ public Response<BinaryData> 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)
* }
* ]
Expand Down Expand Up @@ -774,10 +792,23 @@ public Mono<Response<BinaryData>> 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)
Expand Down Expand Up @@ -805,11 +836,16 @@ public Mono<Response<BinaryData>> 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)
* }
* ]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<FunctionDefinition> 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<FunctionDefinition> 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<FunctionDefinition> 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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,7 @@ public static ChatRole fromString(String name) {
public static Collection<ChatRole> values() {
return values(ChatRole.class);
}

/** The role that provides function results for char completions. */
@Generated public static final ChatRole FUNCTION = fromString("function");
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,7 @@ public static CompletionsFinishReason fromString(String name) {
public static Collection<CompletionsFinishReason> 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");
}
Original file line number Diff line number Diff line change
@@ -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;
}
}
Original file line number Diff line number Diff line change
@@ -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() {}
}
Loading