From bae4917e51f7dc0c4936b7dd5923a31ff992b172 Mon Sep 17 00:00:00 2001 From: "redev.rx" Date: Sat, 21 Dec 2024 08:40:44 +0700 Subject: [PATCH] release 3.1.4 --- .flutter-plugins-dependencies | 1 - CHANGELOG.md | 5 ++++- README.md | 2 +- example/pubspec.lock | 2 +- example_app/openai_app/pubspec.lock | 2 +- .../chat_complete/request/response_format.dart | 10 +++++----- lib/src/model/message/response/content_v2.dart | 16 +++++++++------- lib/src/model/message/response/image_data.dart | 16 ++++++++-------- lib/src/openai.dart | 3 +-- pubspec.yaml | 2 +- 10 files changed, 31 insertions(+), 28 deletions(-) delete mode 100644 .flutter-plugins-dependencies diff --git a/.flutter-plugins-dependencies b/.flutter-plugins-dependencies deleted file mode 100644 index 116d613..0000000 --- a/.flutter-plugins-dependencies +++ /dev/null @@ -1 +0,0 @@ -{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"cupertino_http","path":"/home/bpijet/.pub-cache/hosted/pub.dev/cupertino_http-1.5.1/","native_build":true,"dependencies":[]}],"android":[{"name":"cronet_http","path":"/home/bpijet/.pub-cache/hosted/pub.dev/cronet_http-1.3.2/","native_build":true,"dependencies":["jni"]},{"name":"jni","path":"/home/bpijet/.pub-cache/hosted/pub.dev/jni-0.10.1/","native_build":true,"dependencies":[]}],"macos":[{"name":"cupertino_http","path":"/home/bpijet/.pub-cache/hosted/pub.dev/cupertino_http-1.5.1/","native_build":true,"dependencies":[]}],"linux":[{"name":"jni","path":"/home/bpijet/.pub-cache/hosted/pub.dev/jni-0.10.1/","native_build":true,"dependencies":[]}],"windows":[{"name":"jni","path":"/home/bpijet/.pub-cache/hosted/pub.dev/jni-0.10.1/","native_build":true,"dependencies":[]}],"web":[]},"dependencyGraph":[{"name":"cronet_http","dependencies":["jni"]},{"name":"cupertino_http","dependencies":[]},{"name":"jni","dependencies":[]}],"date_created":"2024-11-12 13:59:27.464677","version":"3.24.3","swift_package_manager_enabled":false} \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index b048630..f36158a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -256,4 +256,7 @@ ## 3.1.3 - Implement support for streaming responses from OpenAI on web platform - Merge Code from contributors - - Added json_schema support to ResponseFormat \ No newline at end of file + - Added json_schema support to ResponseFormat + +# 3.1.4 + - Added support for image data i.e, type (image_file, image_url) in content v2 \ No newline at end of file diff --git a/README.md b/README.md index d023ee0..501f747 100644 --- a/README.md +++ b/README.md @@ -114,7 +114,7 @@ supervised and reinforcement learning techniques. ## Install Package ```dart -chat_gpt_sdk: 3.1.3 +chat_gpt_sdk: 3.1.4 ``` ## Create OpenAI Instance diff --git a/example/pubspec.lock b/example/pubspec.lock index 7fcd342..720a354 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -31,7 +31,7 @@ packages: path: ".." relative: true source: path - version: "3.1.3" + version: "3.1.4" clock: dependency: transitive description: diff --git a/example_app/openai_app/pubspec.lock b/example_app/openai_app/pubspec.lock index dfa9fe9..25ec117 100644 --- a/example_app/openai_app/pubspec.lock +++ b/example_app/openai_app/pubspec.lock @@ -55,7 +55,7 @@ packages: path: "../.." relative: true source: path - version: "3.1.3" + version: "3.1.4" clock: dependency: transitive description: diff --git a/lib/src/model/chat_complete/request/response_format.dart b/lib/src/model/chat_complete/request/response_format.dart index a029c5a..cdbe7b5 100644 --- a/lib/src/model/chat_complete/request/response_format.dart +++ b/lib/src/model/chat_complete/request/response_format.dart @@ -2,17 +2,17 @@ import 'package:chat_gpt_sdk/src/model/chat_complete/request/json_schema.dart'; class ResponseFormat { final String type; - final JsonSchema? json_schema; + final JsonSchema? jsonSchema; - ResponseFormat({required this.type, this.json_schema}); + ResponseFormat({required this.type, this.jsonSchema}); - ResponseFormat.jsonSchema({required this.json_schema}) : type = 'json_schema'; + ResponseFormat.jsonSchema({required this.jsonSchema}) : type = 'json_schema'; Map toJson() { final data = {}; data['type'] = type; - if (json_schema != null) { - data['json_schema'] = json_schema!.toJson(); + if (jsonSchema != null) { + data['json_schema'] = jsonSchema!.toJson(); } return data; diff --git a/lib/src/model/message/response/content_v2.dart b/lib/src/model/message/response/content_v2.dart index 0f7c014..50b24cb 100644 --- a/lib/src/model/message/response/content_v2.dart +++ b/lib/src/model/message/response/content_v2.dart @@ -16,20 +16,22 @@ class ContentV2 { final type = json["type"]; final image = (type == 'image_url' || type == 'image_file') ? json[type] != null - ? ImageData.fromJson(json[type]!) - : null + ? ImageData.fromJson(json[type]!) + : null : null; return ContentV2( type: type, - text: type == 'text' && json["text"] != null ? TextData.fromJson(json["text"]!) : null, + text: type == 'text' && json["text"] != null + ? TextData.fromJson(json["text"]!) + : null, image: image, ); } Map toJson() => { - "type": type, - "text": text?.toJson(), - type: image?.toJson(), // Dynamically set 'image_url' or 'image_file' - }; + "type": type, + "text": text?.toJson(), + type: image?.toJson(), // Dynamically set 'image_url' or 'image_file' + }; } diff --git a/lib/src/model/message/response/image_data.dart b/lib/src/model/message/response/image_data.dart index ac1ca69..a20a058 100644 --- a/lib/src/model/message/response/image_data.dart +++ b/lib/src/model/message/response/image_data.dart @@ -10,14 +10,14 @@ class ImageData { }); factory ImageData.fromJson(Map json) => ImageData( - fileId: json["file_id"] ?? '', - url: json["url"] ?? '', - detail: json["detail"] ?? '', - ); + fileId: json["file_id"] ?? '', + url: json["url"] ?? '', + detail: json["detail"] ?? '', + ); Map toJson() => { - "file_id": fileId, - "url": url, - "detail": detail, - }; + "file_id": fileId, + "url": url, + "detail": detail, + }; } diff --git a/lib/src/openai.dart b/lib/src/openai.dart index 1c1995a..f114ad8 100644 --- a/lib/src/openai.dart +++ b/lib/src/openai.dart @@ -83,8 +83,7 @@ class OpenAI implements IOpenAI { assert(setup.proxy.isEmpty || !setup.streamingWebApi, 'You can\'t provide both proxy and experimental streaming api support currently'); - assert( - !setup.streamingWebApi || kIsWeb, + assert(!setup.streamingWebApi || kIsWeb, 'You can\'t run web specific API on other platforms'); if (setup.streamingWebApi) { diff --git a/pubspec.yaml b/pubspec.yaml index 7c5144f..c7b36cc 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: chat_gpt_sdk description: create chat bot and other bot with ChatGPT SDK Support GPT-4 , 3.5 and SSE Generate Prompt (Stream) -version: 3.1.3 +version: 3.1.4 homepage: https://www.facebook.com/REDEVRX repository: https://github.com/redevRx/Flutter-ChatGPT