Replies: 3 comments
-
ok
I just have to forget the FunctionExecutor. |
Beta Was this translation helpful? Give feedback.
-
@iapafoto, thanks for using simple-openai.
Short answer, no. The discussion in this issue could be pertinent for your subsidiary question: #206 |
Beta Was this translation helpful? Give feedback.
-
@iapafoto Regarding how to use enums, first, you need to take a look at the following example: then, the functions are defined here: Finally, for enums, you could define your function like this: public static class UserData implements Functional {
@JsonPropertyDescription("The user fullname")
@JsonProperty(required = true)
public String fullname;
@JsonPropertyDescription("The user gender")
@JsonProperty(required = true)
public Gender gender;
@Override
public Object execute() {
return fullname + " - " + gender;
}
public enum Gender {
MALE,
FEMALE;
}
} Internally, the FunctionExcecutor is going to build the JsonSchemas using those functions defined as classes. |
Beta Was this translation helpful? Give feedback.
-
Hello and thanks you for simple-openai!
The OpenAI API enables to define a enum of possible choices for parameters
"enum": [ "celsius", "fahrenheit"]
but I cannot find how to define it in
FunctionDef.builder()
How to define it ?
Subsidiary question: is it possible to define function as a simple json instead of statics existing functions ?
https://platform.openai.com/docs/guides/function-calling
Thanks a lot!
Beta Was this translation helpful? Give feedback.
All reactions