From 9405043b50ac950a556b80c675a629f52491ac75 Mon Sep 17 00:00:00 2001 From: "redev.rx" Date: Sat, 18 May 2024 22:29:37 +0700 Subject: [PATCH] feat: add new model gpt-4o #111 --- .flutter-plugins-dependencies | 2 +- CHANGELOG.md | 6 +++- README.md | 2 +- example/pubspec.lock | 32 +++++++++---------- example/pubspec.yaml | 2 +- example_app/openai_app/pubspec.lock | 30 ++++++++--------- example_app/openai_app/pubspec.yaml | 2 +- .../model/assistant/enum/assistant_model.dart | 8 +++++ .../model/chat_complete/enum/chat_model.dart | 8 +++++ lib/src/utils/constants.dart | 2 ++ pubspec.yaml | 6 ++-- 11 files changed, 61 insertions(+), 39 deletions(-) diff --git a/.flutter-plugins-dependencies b/.flutter-plugins-dependencies index 7254fe8..9cf48d9 100644 --- a/.flutter-plugins-dependencies +++ b/.flutter-plugins-dependencies @@ -1 +1 @@ -{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"path_provider_foundation","path":"C:\\\\Users\\\\kasem\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_foundation-2.3.2\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"android":[{"name":"path_provider_android","path":"C:\\\\Users\\\\kasem\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_android-2.2.4\\\\","native_build":true,"dependencies":[]}],"macos":[{"name":"path_provider_foundation","path":"C:\\\\Users\\\\kasem\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_foundation-2.3.2\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"C:\\\\Users\\\\kasem\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_linux-2.2.1\\\\","native_build":false,"dependencies":[]}],"windows":[{"name":"path_provider_windows","path":"C:\\\\Users\\\\kasem\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_windows-2.2.1\\\\","native_build":false,"dependencies":[]}],"web":[]},"dependencyGraph":[{"name":"path_provider","dependencies":["path_provider_android","path_provider_foundation","path_provider_linux","path_provider_windows"]},{"name":"path_provider_android","dependencies":[]},{"name":"path_provider_foundation","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]}],"date_created":"2024-04-28 10:57:09.717723","version":"3.19.6"} \ No newline at end of file +{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"path_provider_foundation","path":"/Users/redev.rx/.pub-cache/hosted/pub.dev/path_provider_foundation-2.4.0/","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"android":[{"name":"path_provider_android","path":"/Users/redev.rx/.pub-cache/hosted/pub.dev/path_provider_android-2.2.4/","native_build":true,"dependencies":[]}],"macos":[{"name":"path_provider_foundation","path":"/Users/redev.rx/.pub-cache/hosted/pub.dev/path_provider_foundation-2.4.0/","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"/Users/redev.rx/.pub-cache/hosted/pub.dev/path_provider_linux-2.2.1/","native_build":false,"dependencies":[]}],"windows":[{"name":"path_provider_windows","path":"/Users/redev.rx/.pub-cache/hosted/pub.dev/path_provider_windows-2.2.1/","native_build":false,"dependencies":[]}],"web":[]},"dependencyGraph":[{"name":"path_provider","dependencies":["path_provider_android","path_provider_foundation","path_provider_linux","path_provider_windows"]},{"name":"path_provider_android","dependencies":[]},{"name":"path_provider_foundation","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]}],"date_created":"2024-05-18 22:28:30.482237","version":"3.22.0"} \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index e988276..ef78e5d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -232,4 +232,8 @@ ## 3.0.7 - Fix list run case id is null - Message add runId -- Add fix for assistant_data json parsing \ No newline at end of file +- Add fix for assistant_data json parsing + +## 3.0.8 + - Assistants Add gpt4o model + - Complete Add gpt4o model \ No newline at end of file diff --git a/README.md b/README.md index 947d056..6d57870 100644 --- a/README.md +++ b/README.md @@ -111,7 +111,7 @@ supervised and reinforcement learning techniques. ## Install Package ```dart -chat_gpt_sdk: 3.0.7 +chat_gpt_sdk: 3.0.8 ``` ## Create OpenAI Instance diff --git a/example/pubspec.lock b/example/pubspec.lock index 05affcf..580aa66 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -31,7 +31,7 @@ packages: path: ".." relative: true source: path - version: "3.0.7" + version: "3.0.8" clock: dependency: transitive description: @@ -235,26 +235,26 @@ packages: dependency: transitive description: name: leak_tracker - sha256: "78eb209deea09858f5269f5a5b02be4049535f568c07b275096836f01ea323fa" + sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a" url: "https://pub.dev" source: hosted - version: "10.0.0" + version: "10.0.4" leak_tracker_flutter_testing: dependency: transitive description: name: leak_tracker_flutter_testing - sha256: b46c5e37c19120a8a01918cfaf293547f47269f7cb4b0058f21531c2465d6ef0 + sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8" url: "https://pub.dev" source: hosted - version: "2.0.1" + version: "3.0.3" leak_tracker_testing: dependency: transitive description: name: leak_tracker_testing - sha256: a597f72a664dbd293f3bfc51f9ba69816f84dcd403cdac7066cb3f6003f3ab47 + sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" url: "https://pub.dev" source: hosted - version: "2.0.1" + version: "3.0.1" lints: dependency: transitive description: @@ -291,10 +291,10 @@ packages: dependency: transitive description: name: meta - sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04 + sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136" url: "https://pub.dev" source: hosted - version: "1.11.0" + version: "1.12.0" mime: dependency: transitive description: @@ -315,10 +315,10 @@ packages: dependency: transitive description: name: path_provider - sha256: b27217933eeeba8ff24845c34003b003b2b22151de3c908d0e679e8fe1aa078b + sha256: c9e7d3a4cd1410877472158bee69963a4579f78b68c65a2b7d40d1a7a88bb161 url: "https://pub.dev" source: hosted - version: "2.1.2" + version: "2.1.3" path_provider_android: dependency: transitive description: @@ -424,10 +424,10 @@ packages: dependency: transitive description: name: test_api - sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" + sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f" url: "https://pub.dev" source: hosted - version: "0.6.1" + version: "0.7.0" typed_data: dependency: transitive description: @@ -448,10 +448,10 @@ packages: dependency: transitive description: name: vm_service - sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957 + sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec" url: "https://pub.dev" source: hosted - version: "13.0.0" + version: "14.2.1" web: dependency: transitive description: @@ -477,5 +477,5 @@ packages: source: hosted version: "1.0.4" sdks: - dart: ">=3.3.4 <4.0.0" + dart: ">=3.4.0 <4.0.0" flutter: ">=3.19.0" diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 59f707f..8daa38f 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -20,7 +20,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev version: 1.0.0 environment: - sdk: '>=3.3.4 <4.0.0' + sdk: '>=3.4.0 <4.0.0' # Dependencies specify other packages that your package needs in order to work. # To automatically upgrade your package dependencies to the latest versions diff --git a/example_app/openai_app/pubspec.lock b/example_app/openai_app/pubspec.lock index c8f6741..1f81443 100644 --- a/example_app/openai_app/pubspec.lock +++ b/example_app/openai_app/pubspec.lock @@ -195,34 +195,34 @@ packages: dependency: "direct main" description: name: injectable - sha256: "3d98967224a5fdd4094a61bf53ed9616c3fbcf3e090bf83e7cb7d436d0c20041" + sha256: fb722c86cf8233008e4db41c696a6145721f45dc8aeba91103e3128c3d63c9c6 url: "https://pub.dev" source: hosted - version: "2.4.1" + version: "2.4.0" leak_tracker: dependency: transitive description: name: leak_tracker - sha256: "78eb209deea09858f5269f5a5b02be4049535f568c07b275096836f01ea323fa" + sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a" url: "https://pub.dev" source: hosted - version: "10.0.0" + version: "10.0.4" leak_tracker_flutter_testing: dependency: transitive description: name: leak_tracker_flutter_testing - sha256: b46c5e37c19120a8a01918cfaf293547f47269f7cb4b0058f21531c2465d6ef0 + sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8" url: "https://pub.dev" source: hosted - version: "2.0.1" + version: "3.0.3" leak_tracker_testing: dependency: transitive description: name: leak_tracker_testing - sha256: a597f72a664dbd293f3bfc51f9ba69816f84dcd403cdac7066cb3f6003f3ab47 + sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" url: "https://pub.dev" source: hosted - version: "2.0.1" + version: "3.0.1" lints: dependency: transitive description: @@ -267,10 +267,10 @@ packages: dependency: transitive description: name: meta - sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04 + sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136" url: "https://pub.dev" source: hosted - version: "1.11.0" + version: "1.12.0" nested: dependency: transitive description: @@ -512,10 +512,10 @@ packages: dependency: transitive description: name: test_api - sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" + sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f" url: "https://pub.dev" source: hosted - version: "0.6.1" + version: "0.7.0" typed_data: dependency: transitive description: @@ -536,10 +536,10 @@ packages: dependency: transitive description: name: vm_service - sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957 + sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec" url: "https://pub.dev" source: hosted - version: "13.0.0" + version: "14.2.1" web: dependency: transitive description: @@ -565,5 +565,5 @@ packages: source: hosted version: "1.0.4" sdks: - dart: ">=3.3.4 <4.0.0" + dart: ">=3.4.0 <4.0.0" flutter: ">=3.19.2" diff --git a/example_app/openai_app/pubspec.yaml b/example_app/openai_app/pubspec.yaml index 91a1225..83f007a 100644 --- a/example_app/openai_app/pubspec.yaml +++ b/example_app/openai_app/pubspec.yaml @@ -19,7 +19,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev version: 1.0.1+6 environment: - sdk: '>=3.3.4 <4.0.0' + sdk: '>=3.4.0 <4.0.0' # Dependencies specify other packages that your package needs in order to work. # To automatically upgrade your package dependencies to the latest versions diff --git a/lib/src/model/assistant/enum/assistant_model.dart b/lib/src/model/assistant/enum/assistant_model.dart index 3733668..0abe0e3 100644 --- a/lib/src/model/assistant/enum/assistant_model.dart +++ b/lib/src/model/assistant/enum/assistant_model.dart @@ -26,6 +26,14 @@ class Gpt41106PreviewAModel extends AssistantModel { Gpt41106PreviewAModel() : super(model: kGpt41106Preview); } +class Gpt4OModel extends AssistantModel { + Gpt4OModel() : super(model: kGpt4o); +} + +class Gpt4O2024Model extends AssistantModel { + Gpt4O2024Model() : super(model: kGpt4O2024); +} + class AssistantModelFromValue extends AssistantModel { AssistantModelFromValue({required super.model}); } diff --git a/lib/src/model/chat_complete/enum/chat_model.dart b/lib/src/model/chat_complete/enum/chat_model.dart index 6a465c0..18a96c0 100644 --- a/lib/src/model/chat_complete/enum/chat_model.dart +++ b/lib/src/model/chat_complete/enum/chat_model.dart @@ -53,6 +53,14 @@ class Gpt4VisionPreviewChatModel extends ChatModel { Gpt4VisionPreviewChatModel() : super(model: kGpt4VisionPreview); } +class Gpt4OChatModel extends ChatModel { + Gpt4OChatModel() : super(model: kGpt4o); +} + +class Gpt4O2024ChatModel extends ChatModel { + Gpt4O2024ChatModel() : super(model: kGpt4O2024); +} + class Gpt41106PreviewChatModel extends ChatModel { Gpt41106PreviewChatModel() : super(model: kGpt41106Preview); } diff --git a/lib/src/utils/constants.dart b/lib/src/utils/constants.dart index d477394..5c2ce7d 100644 --- a/lib/src/utils/constants.dart +++ b/lib/src/utils/constants.dart @@ -73,6 +73,8 @@ const kChatGptTurbo16k0613 = 'gpt-3.5-turbo-16k-0613'; const kChatGpt40631 = 'gpt-4-0613'; const kGpt41106Preview = 'gpt-4-1106-preview'; const kGpt4VisionPreview = 'gpt-4-vision-preview'; +const kGpt4o = 'gpt-4o'; +const kGpt4O2024 = 'gpt-4o-2024-05-13'; ///edits // using gpt 4 diff --git a/pubspec.yaml b/pubspec.yaml index d5e3382..de9a3ea 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,16 +1,16 @@ 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.0.7 +version: 3.0.8 homepage: https://www.facebook.com/REDEVRX repository: https://github.com/redevRx/Flutter-ChatGPT environment: - sdk: '>=3.3.4 <4.0.0' + sdk: '>=3.4.0 <4.0.0' dependencies: dio: ^5.4.3+1 http_parser: ^4.0.2 - path_provider: ^2.1.2 + path_provider: ^2.1.3 dev_dependencies: mockito: ^5.4.1