-
-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add support for Message Batches in anthropic_sdk_dart (#585)
- Loading branch information
1 parent
4f0d9cf
commit a41270a
Showing
13 changed files
with
1,680 additions
and
5 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
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
47 changes: 47 additions & 0 deletions
47
packages/anthropic_sdk_dart/lib/src/generated/schema/batch_message_request.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,47 @@ | ||
// coverage:ignore-file | ||
// GENERATED CODE - DO NOT MODIFY BY HAND | ||
// ignore_for_file: type=lint | ||
// ignore_for_file: invalid_annotation_target | ||
part of anthropic_schema; | ||
|
||
// ========================================== | ||
// CLASS: BatchMessageRequest | ||
// ========================================== | ||
|
||
/// An individual message request within a batch. | ||
@freezed | ||
class BatchMessageRequest with _$BatchMessageRequest { | ||
const BatchMessageRequest._(); | ||
|
||
/// Factory constructor for BatchMessageRequest | ||
const factory BatchMessageRequest({ | ||
/// Developer-provided ID created for each request in a Message Batch. Useful for | ||
/// matching results to requests, as results may be given out of request order. | ||
/// | ||
/// Must be unique for each request within the Message Batch. | ||
@JsonKey(name: 'custom_id') required String customId, | ||
|
||
/// The request parameters for creating a message. | ||
required CreateMessageRequest params, | ||
}) = _BatchMessageRequest; | ||
|
||
/// Object construction from a JSON representation | ||
factory BatchMessageRequest.fromJson(Map<String, dynamic> json) => | ||
_$BatchMessageRequestFromJson(json); | ||
|
||
/// List of all property names of schema | ||
static const List<String> propertyNames = ['custom_id', 'params']; | ||
|
||
/// Perform validations on the schema property values | ||
String? validateSchema() { | ||
return null; | ||
} | ||
|
||
/// Map representation of object (not serialized) | ||
Map<String, dynamic> toMap() { | ||
return { | ||
'custom_id': customId, | ||
'params': params, | ||
}; | ||
} | ||
} |
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
40 changes: 40 additions & 0 deletions
40
packages/anthropic_sdk_dart/lib/src/generated/schema/create_message_batch_request.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,40 @@ | ||
// coverage:ignore-file | ||
// GENERATED CODE - DO NOT MODIFY BY HAND | ||
// ignore_for_file: type=lint | ||
// ignore_for_file: invalid_annotation_target | ||
part of anthropic_schema; | ||
|
||
// ========================================== | ||
// CLASS: CreateMessageBatchRequest | ||
// ========================================== | ||
|
||
/// The request parameters for creating a message batch. | ||
@freezed | ||
class CreateMessageBatchRequest with _$CreateMessageBatchRequest { | ||
const CreateMessageBatchRequest._(); | ||
|
||
/// Factory constructor for CreateMessageBatchRequest | ||
const factory CreateMessageBatchRequest({ | ||
/// List of requests for prompt completion. Each is an individual request to create a Message. | ||
required List<BatchMessageRequest> requests, | ||
}) = _CreateMessageBatchRequest; | ||
|
||
/// Object construction from a JSON representation | ||
factory CreateMessageBatchRequest.fromJson(Map<String, dynamic> json) => | ||
_$CreateMessageBatchRequestFromJson(json); | ||
|
||
/// List of all property names of schema | ||
static const List<String> propertyNames = ['requests']; | ||
|
||
/// Perform validations on the schema property values | ||
String? validateSchema() { | ||
return null; | ||
} | ||
|
||
/// Map representation of object (not serialized) | ||
Map<String, dynamic> toMap() { | ||
return { | ||
'requests': requests, | ||
}; | ||
} | ||
} |
98 changes: 98 additions & 0 deletions
98
packages/anthropic_sdk_dart/lib/src/generated/schema/message_batch.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,98 @@ | ||
// coverage:ignore-file | ||
// GENERATED CODE - DO NOT MODIFY BY HAND | ||
// ignore_for_file: type=lint | ||
// ignore_for_file: invalid_annotation_target | ||
part of anthropic_schema; | ||
|
||
// ========================================== | ||
// CLASS: MessageBatch | ||
// ========================================== | ||
|
||
/// A batch of message requests. | ||
@freezed | ||
class MessageBatch with _$MessageBatch { | ||
const MessageBatch._(); | ||
|
||
/// Factory constructor for MessageBatch | ||
const factory MessageBatch({ | ||
/// Unique object identifier for the message batch. | ||
required String id, | ||
|
||
/// RFC 3339 datetime string representing the time at which the Message Batch was created. | ||
@JsonKey(name: 'created_at') required String createdAt, | ||
|
||
/// RFC 3339 datetime string representing the time at which the Message Batch will expire and end processing, which is 24 hours after creation. | ||
@JsonKey(name: 'expires_at') required String expiresAt, | ||
|
||
/// Processing status of the Message Batch. | ||
@JsonKey(name: 'processing_status') | ||
required MessageBatchProcessingStatus processingStatus, | ||
|
||
/// Tallies requests within the Message Batch, categorized by their status. | ||
@JsonKey(name: 'request_counts') | ||
required MessageBatchRequestCounts requestCounts, | ||
|
||
/// URL to a `.jsonl` file containing the results of the Message Batch requests. Specified only once processing ends. | ||
@JsonKey(name: 'results_url', includeIfNull: false) String? resultsUrl, | ||
|
||
/// Object type. For Message Batches, this is always `"message_batch"`. | ||
required MessageBatchType type, | ||
}) = _MessageBatch; | ||
|
||
/// Object construction from a JSON representation | ||
factory MessageBatch.fromJson(Map<String, dynamic> json) => | ||
_$MessageBatchFromJson(json); | ||
|
||
/// List of all property names of schema | ||
static const List<String> propertyNames = [ | ||
'id', | ||
'created_at', | ||
'expires_at', | ||
'processing_status', | ||
'request_counts', | ||
'results_url', | ||
'type' | ||
]; | ||
|
||
/// Perform validations on the schema property values | ||
String? validateSchema() { | ||
return null; | ||
} | ||
|
||
/// Map representation of object (not serialized) | ||
Map<String, dynamic> toMap() { | ||
return { | ||
'id': id, | ||
'created_at': createdAt, | ||
'expires_at': expiresAt, | ||
'processing_status': processingStatus, | ||
'request_counts': requestCounts, | ||
'results_url': resultsUrl, | ||
'type': type, | ||
}; | ||
} | ||
} | ||
|
||
// ========================================== | ||
// ENUM: MessageBatchProcessingStatus | ||
// ========================================== | ||
|
||
/// Processing status of the Message Batch. | ||
enum MessageBatchProcessingStatus { | ||
@JsonValue('in_progress') | ||
inProgress, | ||
@JsonValue('canceling') | ||
canceling, | ||
@JsonValue('ended') | ||
ended, | ||
} | ||
|
||
// ========================================== | ||
// ENUM: MessageBatchType | ||
// ========================================== | ||
|
||
/// Object type. For Message Batches, this is always `"message_batch"`. | ||
enum MessageBatchType { | ||
@JsonValue('message_batch') | ||
messageBatch, | ||
} |
Oops, something went wrong.