OpenAIFunctionProperty.primitive constructor

OpenAIFunctionProperty.primitive({
  1. required String name,
  2. String? description,
  3. bool isRequired = false,
  4. required String type,
  5. List? enumValues,
})

This class is used to represent an OpenAI function property. This a factory constructor that allows you to create a new function property with a primitive type.

Implementation

factory OpenAIFunctionProperty.primitive({
  required String name,
  String? description,
  bool isRequired = false,
  required String type,
  List? enumValues,
}) {
  return OpenAIFunctionProperty(
    name: name,
    isRequired: isRequired,
    typeMap: {
      'type': type,
      if (description != null) 'description': description,
      if (enumValues != null) 'enum': enumValues,
    },
  );
}