Skip to content

Commit

Permalink
[ Fix ] fixed non-serializable field in RequestFunctionMessage toMap(…
Browse files Browse the repository at this point in the history
…) method
  • Loading branch information
anasfik committed Nov 21, 2023
1 parent 29b124b commit ed9a444
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions example/lib/chat_example_with_tools.dart
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ Future<void> main() async {
print(assistantMsg1.content);
return;
}

final funcCall = toolCalls.first.function;

final weather = getCurrentWeather(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ base class RequestFunctionMessage
Map<String, dynamic> toMap() {
return {
"role": role.name,
"content": content,
"content": content?.map((toolCall) => toolCall.toMap()).toList(),
"tool_call_id": toolCallId,
};
}
Expand Down
3 changes: 2 additions & 1 deletion lib/src/core/models/embedding/sub-models/usage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@ final class OpenAIEmbeddingsUsageModel {
@override
int get hashCode => promptTokens.hashCode ^ totalTokens.hashCode;

/// {@template openai_embeddings_usage_model}
/// {@macro openai_embeddings_usage_model}
const OpenAIEmbeddingsUsageModel({
required this.promptTokens,
required this.totalTokens,
});

/// {@template openai_embeddings_usage_model}
/// This method is used to convert a [Map<String, dynamic>] object to a [OpenAIEmbeddingsUsageModel] object.
/// {@endtemplate}
factory OpenAIEmbeddingsUsageModel.fromMap(Map<String, dynamic> map) {
return OpenAIEmbeddingsUsageModel(
promptTokens: map['prompt_tokens'] as int,
Expand Down

0 comments on commit ed9a444

Please sign in to comment.