Skip to content

Commit

Permalink
Merge pull request #98 from ventskus-roman/main
Browse files Browse the repository at this point in the history
Tools support
  • Loading branch information
redevrx authored Mar 4, 2024
2 parents c4ce871 + 773dc2c commit 95fab7b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ class ChatCompleteText {
"top_logprobs": topLogprobs,
"seed": seed,
"tool_choice": toolChoice,
"tools": tools,
})
..removeWhere((key, value) => value == null);

Expand Down
7 changes: 6 additions & 1 deletion lib/src/model/chat_complete/response/message.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,23 @@ class Message {
final String content;
final String id = "${DateTime.now().millisecondsSinceEpoch}";
final Map<String, dynamic>? functionCall;
final List<Map<String, dynamic>>? 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<String, dynamic> json) => Message(
role: json["role"] ?? "",
content: json["content"] ?? "",
functionCall: json["function_call"],
toolCalls: json['tool_calls'] == null ? null : List<Map<String, dynamic>>.from(
json["tool_calls"].map((x) => Map<String, dynamic>.from(x)),
),
);

Map<String, dynamic> toJson() => {
"role": role,
"content": content,
"function_call": functionCall,
"tool_calls": toolCalls,
};
}

0 comments on commit 95fab7b

Please sign in to comment.