-
-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add usage to Run/RunStep in openai_dart client (#302)
- Loading branch information
1 parent
4a6e104
commit cc6538b
Showing
11 changed files
with
861 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
packages/openai_dart/lib/src/generated/schema/run_completion_usage.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// coverage:ignore-file | ||
// GENERATED CODE - DO NOT MODIFY BY HAND | ||
// ignore_for_file: type=lint | ||
// ignore_for_file: invalid_annotation_target | ||
part of open_a_i_schema; | ||
|
||
// ========================================== | ||
// CLASS: RunCompletionUsage | ||
// ========================================== | ||
|
||
/// Usage statistics related to the run. This value will be `null` if the run is not in a terminal state (i.e. `in_progress`, `queued`, etc.). | ||
@freezed | ||
class RunCompletionUsage with _$RunCompletionUsage { | ||
const RunCompletionUsage._(); | ||
|
||
/// Factory constructor for RunCompletionUsage | ||
const factory RunCompletionUsage({ | ||
/// Number of completion tokens used over the course of the run. | ||
@JsonKey(name: 'completion_tokens') required int completionTokens, | ||
|
||
/// Number of prompt tokens used over the course of the run. | ||
@JsonKey(name: 'prompt_tokens') required int promptTokens, | ||
|
||
/// Total number of tokens used (prompt + completion). | ||
@JsonKey(name: 'total_tokens') required int totalTokens, | ||
}) = _RunCompletionUsage; | ||
|
||
/// Object construction from a JSON representation | ||
factory RunCompletionUsage.fromJson(Map<String, dynamic> json) => | ||
_$RunCompletionUsageFromJson(json); | ||
|
||
/// List of all property names of schema | ||
static const List<String> propertyNames = [ | ||
'completion_tokens', | ||
'prompt_tokens', | ||
'total_tokens' | ||
]; | ||
|
||
/// Perform validations on the schema property values | ||
String? validateSchema() { | ||
return null; | ||
} | ||
|
||
/// Map representation of object (not serialized) | ||
Map<String, dynamic> toMap() { | ||
return { | ||
'completion_tokens': completionTokens, | ||
'prompt_tokens': promptTokens, | ||
'total_tokens': totalTokens, | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
packages/openai_dart/lib/src/generated/schema/run_step_completion_usage.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// coverage:ignore-file | ||
// GENERATED CODE - DO NOT MODIFY BY HAND | ||
// ignore_for_file: type=lint | ||
// ignore_for_file: invalid_annotation_target | ||
part of open_a_i_schema; | ||
|
||
// ========================================== | ||
// CLASS: RunStepCompletionUsage | ||
// ========================================== | ||
|
||
/// Usage statistics related to the run step. This value will be `null` while the run step's status is `in_progress`. | ||
@freezed | ||
class RunStepCompletionUsage with _$RunStepCompletionUsage { | ||
const RunStepCompletionUsage._(); | ||
|
||
/// Factory constructor for RunStepCompletionUsage | ||
const factory RunStepCompletionUsage({ | ||
/// Number of completion tokens used over the course of the run step. | ||
@JsonKey(name: 'completion_tokens') required int completionTokens, | ||
|
||
/// Number of prompt tokens used over the course of the run step. | ||
@JsonKey(name: 'prompt_tokens') required int promptTokens, | ||
|
||
/// Total number of tokens used (prompt + completion). | ||
@JsonKey(name: 'total_tokens') required int totalTokens, | ||
}) = _RunStepCompletionUsage; | ||
|
||
/// Object construction from a JSON representation | ||
factory RunStepCompletionUsage.fromJson(Map<String, dynamic> json) => | ||
_$RunStepCompletionUsageFromJson(json); | ||
|
||
/// List of all property names of schema | ||
static const List<String> propertyNames = [ | ||
'completion_tokens', | ||
'prompt_tokens', | ||
'total_tokens' | ||
]; | ||
|
||
/// Perform validations on the schema property values | ||
String? validateSchema() { | ||
return null; | ||
} | ||
|
||
/// Map representation of object (not serialized) | ||
Map<String, dynamic> toMap() { | ||
return { | ||
'completion_tokens': completionTokens, | ||
'prompt_tokens': promptTokens, | ||
'total_tokens': totalTokens, | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.