From 7cd58e5d191c7a946465708e3539c80a0c9aa810 Mon Sep 17 00:00:00 2001 From: Anas Fikhi Date: Wed, 8 May 2024 16:31:22 +0100 Subject: [PATCH] [ Edit ] removed the non-usable url field in the chat completion content model --- CHANGELOG.md | 6 ++++++ .../choices/sub_models/sub_models/content.dart | 14 ++++---------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f018e906..8572a352 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## NEXT + +- Support for logprobs in the chat completions API. + +- Bug fixes. + ## 5.1.0 - Massive issues fixes related to incorrecr use of types, model fields..., audio transcription file streaming error handling, and more. diff --git a/lib/src/core/models/chat/sub_models/choices/sub_models/sub_models/content.dart b/lib/src/core/models/chat/sub_models/choices/sub_models/sub_models/content.dart index 3285c97c..6d410757 100644 --- a/lib/src/core/models/chat/sub_models/choices/sub_models/sub_models/content.dart +++ b/lib/src/core/models/chat/sub_models/choices/sub_models/sub_models/content.dart @@ -9,25 +9,20 @@ class OpenAIChatCompletionChoiceMessageContentItemModel { /// The text content of the item. final String? text; - /// The image url content of the item. - final String? url; - /// The image url object. final Map? imageUrl; final String? imageBase64; @override - int get hashCode => type.hashCode ^ text.hashCode ^ imageUrl.hashCode ^ url.hashCode; + int get hashCode => type.hashCode ^ text.hashCode ^ imageUrl.hashCode; /// {@macro openai_chat_completion_choice_message_content_item_model} OpenAIChatCompletionChoiceMessageContentItemModel._({ required this.type, this.text, this.imageUrl, - this.url this.imageBase64, - }); /// This is used to convert a [Map] object to a [OpenAIChatCompletionChoiceMessageContentItemModel] object. @@ -38,9 +33,7 @@ class OpenAIChatCompletionChoiceMessageContentItemModel { type: asMap['type'], text: asMap['text'], imageUrl: asMap['image_url'], - url: asMap['url'] imageBase64: asMap['imageBase64'], - ); } @@ -77,7 +70,8 @@ class OpenAIChatCompletionChoiceMessageContentItemModel { "type": type, if (text != null) "text": text, if (imageUrl != null) "image_url": imageUrl, - if (imageBase64 != null) "image_url": {"url": "data:image/jpeg;base64,${imageBase64}"} + if (imageBase64 != null) + "image_url": {"url": "data:image/jpeg;base64,${imageBase64}"} }; } @@ -99,7 +93,7 @@ class OpenAIChatCompletionChoiceMessageContentItemModel { 'OpenAIChatCompletionChoiceMessageContentItemModel(type: $type, text: $text)', 'image' => 'OpenAIChatCompletionChoiceMessageContentItemModel(type: $type, imageUrl: $imageUrl)', - 'image_base64' => + 'image_base64' => 'OpenAIChatCompletionChoiceMessageContentItemModel(type: $type, imageBase64: $imageBase64)', _ => 'OpenAIChatCompletionChoiceMessageContentItemModel(type: $type)', };