From 486ea67e543d6b984e5f255b05a633fcc4634630 Mon Sep 17 00:00:00 2001 From: Roman Ventskus Date: Sun, 3 Mar 2024 20:28:59 +0100 Subject: [PATCH 1/6] init --- lib/src/model/chat_complete/request/chat_complete_text.dart | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/src/model/chat_complete/request/chat_complete_text.dart b/lib/src/model/chat_complete/request/chat_complete_text.dart index e34dd2f..268b312 100644 --- a/lib/src/model/chat_complete/request/chat_complete_text.dart +++ b/lib/src/model/chat_complete/request/chat_complete_text.dart @@ -214,6 +214,7 @@ class ChatCompleteText { "top_logprobs": topLogprobs, "seed": seed, "tool_choice": toolChoice, + "tools": tools, }) ..removeWhere((key, value) => value == null); From c459648b93a3bc3796ea624d4183814d8bc47dc6 Mon Sep 17 00:00:00 2001 From: Roman Ventskus Date: Sun, 3 Mar 2024 20:53:53 +0100 Subject: [PATCH 2/6] init --- lib/src/model/chat_complete/response/message.dart | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/src/model/chat_complete/response/message.dart b/lib/src/model/chat_complete/response/message.dart index 2342a43..bec74fe 100644 --- a/lib/src/model/chat_complete/response/message.dart +++ b/lib/src/model/chat_complete/response/message.dart @@ -3,18 +3,21 @@ class Message { final String content; final String id = "${DateTime.now().millisecondsSinceEpoch}"; final Map? functionCall; + final Map? toolCalls; - Message({required this.role, required this.content, this.functionCall}); + Message({required this.role, required this.content, this.functionCall, this.toolCalls}); factory Message.fromJson(Map json) => Message( role: json["role"] ?? "", content: json["content"] ?? "", functionCall: json["function_call"], + toolCalls: json["tools_call"], ); Map toJson() => { "role": role, "content": content, "function_call": functionCall, + "tools_call": toolCalls, }; } From 556b076033c463d552ee9c50f9a1f6a83f971ee3 Mon Sep 17 00:00:00 2001 From: Roman Ventskus Date: Sun, 3 Mar 2024 20:57:09 +0100 Subject: [PATCH 3/6] init --- lib/src/model/chat_complete/response/message.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/src/model/chat_complete/response/message.dart b/lib/src/model/chat_complete/response/message.dart index bec74fe..740f81b 100644 --- a/lib/src/model/chat_complete/response/message.dart +++ b/lib/src/model/chat_complete/response/message.dart @@ -11,13 +11,13 @@ class Message { role: json["role"] ?? "", content: json["content"] ?? "", functionCall: json["function_call"], - toolCalls: json["tools_call"], + toolCalls: json["tool_calls"], ); Map toJson() => { "role": role, "content": content, "function_call": functionCall, - "tools_call": toolCalls, + "tool_calls": toolCalls, }; } From 44bddc286b03f4c6272ca8dd7e4208323967c4bd Mon Sep 17 00:00:00 2001 From: Roman Ventskus Date: Sun, 3 Mar 2024 20:59:16 +0100 Subject: [PATCH 4/6] init --- lib/src/model/chat_complete/response/message.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/src/model/chat_complete/response/message.dart b/lib/src/model/chat_complete/response/message.dart index 740f81b..8bc20cc 100644 --- a/lib/src/model/chat_complete/response/message.dart +++ b/lib/src/model/chat_complete/response/message.dart @@ -3,7 +3,7 @@ class Message { final String content; final String id = "${DateTime.now().millisecondsSinceEpoch}"; final Map? functionCall; - final Map? toolCalls; + final List>? toolCalls; Message({required this.role, required this.content, this.functionCall, this.toolCalls}); From 6a23b85c2ae9204f2747db64ecb9744349ede3d6 Mon Sep 17 00:00:00 2001 From: Roman Ventskus Date: Sun, 3 Mar 2024 21:02:46 +0100 Subject: [PATCH 5/6] init --- lib/src/model/chat_complete/response/message.dart | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/src/model/chat_complete/response/message.dart b/lib/src/model/chat_complete/response/message.dart index 8bc20cc..4cda87b 100644 --- a/lib/src/model/chat_complete/response/message.dart +++ b/lib/src/model/chat_complete/response/message.dart @@ -11,7 +11,9 @@ class Message { role: json["role"] ?? "", content: json["content"] ?? "", functionCall: json["function_call"], - toolCalls: json["tool_calls"], + toolCalls: List>.from( + json["tool_calls"].map((x) => Map.from(x)), + ), ); Map toJson() => { From 773dc2cb4a1ecc5bd8650ba833f5373e13d452b7 Mon Sep 17 00:00:00 2001 From: Roman Ventskus Date: Sun, 3 Mar 2024 21:04:26 +0100 Subject: [PATCH 6/6] init --- lib/src/model/chat_complete/response/message.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/src/model/chat_complete/response/message.dart b/lib/src/model/chat_complete/response/message.dart index 4cda87b..bc02ed6 100644 --- a/lib/src/model/chat_complete/response/message.dart +++ b/lib/src/model/chat_complete/response/message.dart @@ -11,7 +11,7 @@ class Message { role: json["role"] ?? "", content: json["content"] ?? "", functionCall: json["function_call"], - toolCalls: List>.from( + toolCalls: json['tool_calls'] == null ? null : List>.from( json["tool_calls"].map((x) => Map.from(x)), ), );