OpenAIFunctionModel.withParameters constructor

OpenAIFunctionModel.withParameters({
  1. required String name,
  2. String? description,
  3. required Iterable<OpenAIFunctionProperty> parameters,
})

This class is used to represent an OpenAI function. This a factory constructor that allows you to create a new function with valid parameters schema.

Implementation

factory OpenAIFunctionModel.withParameters({
  required String name,
  String? description,
  required Iterable<OpenAIFunctionProperty> parameters,
}) {
  return OpenAIFunctionModel(
    name: name,
    description: description,
    parametersSchema: OpenAIFunctionProperty.object(
      name: '',
      properties: parameters,
    ).typeMap(),
  );
}