OpenAIFunctionProperty.object constructor
OpenAIFunctionProperty.object({
- required String name,
- String? description,
- required Iterable<
OpenAIFunctionProperty> properties, - bool isRequired = false,
This class is used to represent an OpenAI function property. This a factory constructor that allows you to create a new function property with an object (Map) type.
Implementation
factory OpenAIFunctionProperty.object({
required String name,
String? description,
required Iterable<OpenAIFunctionProperty> properties,
bool isRequired = false,
}) {
final requiredProperties = properties
.where((property) => property.isRequired)
.map((property) => property.name)
.toList(growable: false);
return OpenAIFunctionProperty(
name: name,
typeMap: {
'type': functionTypeObject,
if (description != null) 'description': description,
'properties': Map.fromEntries(
properties.map(
(property) => property.typeEntry(),
),
),
'required': requiredProperties,
},
isRequired: isRequired,
);
}