Closed davidmigloz closed 3 months ago
Example:
final res = await client.createChatCompletion( request: CreateChatCompletionRequest( model: ChatCompletionModel.model( ChatCompletionModels.gpt4oMini, ), messages: [ ChatCompletionMessage.system( content: 'You are a helpful assistant. That extracts names from text.', ), ChatCompletionMessage.user( content: ChatCompletionUserMessageContent.string( 'John, Mary, and Peter.', ), ), ], temperature: 0, responseFormat: ResponseFormat.jsonSchema( jsonSchema: JsonSchemaObject( name: 'Names', description: 'A list of names', strict: true, schema: { 'type': 'object', 'properties': { 'names': { 'type': 'array', 'items': { 'type': 'string', }, }, }, 'additionalProperties': false, 'required': ['names'], }, ), ), ), ); // {"names":["John","Mary","Peter"]}
Reverted to split the PR in two
Example: