anasfik / openai

Dart/Flutter SDK for ChatGPT and all OpenAI APIs (GPT, Dall-e..)
https://pub.dev/packages/dart_openai
MIT License
591 stars 184 forks source link

Structured Outputs Support (ResponseFormat) #195

Closed johannes-honeder closed 2 months ago

johannes-honeder commented 2 months ago

A new feature called Structured Outputs from the OpenAI API is not fully supported in the current version of this package (V5.0.0). The new feature allows to specify a JSON Schema in the 'response_format' parameter when creating a new chat/stream. Currently, only Map<String, String>? data type is supported, but to pass a JSON schema, Map<String, dynamic>? would be required in the Chat API.

Code Lines to be adapted: https://github.com/anasfik/openai/blob/v5.0.0/lib/src/instance/chat/chat.dart#L83 https://github.com/anasfik/openai/blob/v5.0.0/lib/src/instance/chat/chat.dart#L175 https://github.com/anasfik/openai/blob/v5.0.0/lib/src/instance/chat/chat.dart#L224

johannes-honeder commented 2 months ago

I just saw that this issue is already handled by PR #193