diff --git a/packages/openai_dart/lib/src/generated/client.dart b/packages/openai_dart/lib/src/generated/client.dart index aca8f85f..66c918d1 100644 --- a/packages/openai_dart/lib/src/generated/client.dart +++ b/packages/openai_dart/lib/src/generated/client.dart @@ -58,7 +58,7 @@ class OpenAIClientException implements Exception { // CLASS: OpenAIClient // ========================================== -/// Client for OpenAI API (v.2.0.0) +/// Client for OpenAI API (v.2.1.0) /// /// The OpenAI REST API. Please see https://platform.openai.com/docs/api-reference for more details. class OpenAIClient { @@ -1846,7 +1846,7 @@ class OpenAIClient { // METHOD: cancelBatch // ------------------------------------------ - /// Cancels an in-progress batch. + /// Cancels an in-progress batch. The batch will be in status `cancelling` for up to 10 minutes, before changing to `cancelled`, where it will have partial results (if any) available in the output file. /// /// `batchId`: The ID of the batch to cancel. /// diff --git a/packages/openai_dart/lib/src/generated/schema/assistant_tools.dart b/packages/openai_dart/lib/src/generated/schema/assistant_tools.dart index 6e45f715..043a7d9a 100644 --- a/packages/openai_dart/lib/src/generated/schema/assistant_tools.dart +++ b/packages/openai_dart/lib/src/generated/schema/assistant_tools.dart @@ -30,7 +30,11 @@ sealed class AssistantTools with _$AssistantTools { /// FileSearch tool const factory AssistantTools.fileSearch({ /// The type of tool being defined: `file_search` - @Default('file_search') String type, + required String type, + + /// Overrides for the file search tool. + @JsonKey(name: 'file_search', includeIfNull: false) + AssistantToolsFileSearchFileSearch? fileSearch, }) = AssistantToolsFileSearch; // ------------------------------------------ @@ -63,3 +67,54 @@ enum AssistantToolsEnumType { @JsonValue('function') function, } + +// ========================================== +// CLASS: AssistantToolsFileSearchFileSearch +// ========================================== + +/// Overrides for the file search tool. +@freezed +class AssistantToolsFileSearchFileSearch + with _$AssistantToolsFileSearchFileSearch { + const AssistantToolsFileSearchFileSearch._(); + + /// Factory constructor for AssistantToolsFileSearchFileSearch + const factory AssistantToolsFileSearchFileSearch({ + /// The maximum number of results the file search tool should output. The default is 20 for gpt-4* models + /// and 5 for gpt-3.5-turbo. This number should be between 1 and 50 inclusive. + /// + /// Note that the file search tool may output fewer than `max_num_results` results. See the [file search + /// tool documentation](/docs/assistants/tools/file-search/number-of-chunks-returned) for more information. + @JsonKey(name: 'max_num_results', includeIfNull: false) int? maxNumResults, + }) = _AssistantToolsFileSearchFileSearch; + + /// Object construction from a JSON representation + factory AssistantToolsFileSearchFileSearch.fromJson( + Map json) => + _$AssistantToolsFileSearchFileSearchFromJson(json); + + /// List of all property names of schema + static const List propertyNames = ['max_num_results']; + + /// Validation constants + static const maxNumResultsMinValue = 1; + static const maxNumResultsMaxValue = 50; + + /// Perform validations on the schema property values + String? validateSchema() { + if (maxNumResults != null && maxNumResults! < maxNumResultsMinValue) { + return "The value of 'maxNumResults' cannot be < $maxNumResultsMinValue"; + } + if (maxNumResults != null && maxNumResults! > maxNumResultsMaxValue) { + return "The value of 'maxNumResults' cannot be > $maxNumResultsMaxValue"; + } + return null; + } + + /// Map representation of object (not serialized) + Map toMap() { + return { + 'max_num_results': maxNumResults, + }; + } +} diff --git a/packages/openai_dart/lib/src/generated/schema/create_batch_request.dart b/packages/openai_dart/lib/src/generated/schema/create_batch_request.dart index 5014b4f1..b7a86f72 100644 --- a/packages/openai_dart/lib/src/generated/schema/create_batch_request.dart +++ b/packages/openai_dart/lib/src/generated/schema/create_batch_request.dart @@ -19,7 +19,7 @@ class CreateBatchRequest with _$CreateBatchRequest { /// /// See [upload file](https://platform.openai.com/docs/api-reference/files/create) for how to upload a file. /// - /// Your input file must be formatted as a JSONL file, and must be uploaded with the purpose `batch`. + /// Your input file must be formatted as a [JSONL file](https://platform.openai.com/docs/api-reference/batch/request-input), and must be uploaded with the purpose `batch`. The file can contain up to 50,000 requests, and can be up to 100 MB in size. @JsonKey(name: 'input_file_id') required String inputFileId, /// The endpoint to be used for all requests in the batch. Currently `/v1/chat/completions`, `/v1/embeddings`, and `/v1/completions` are supported. Note that `/v1/embeddings` batches are also restricted to a maximum of 50,000 embedding inputs across all requests in the batch. diff --git a/packages/openai_dart/lib/src/generated/schema/create_fine_tuning_job_request.dart b/packages/openai_dart/lib/src/generated/schema/create_fine_tuning_job_request.dart index 14929898..17b649aa 100644 --- a/packages/openai_dart/lib/src/generated/schema/create_fine_tuning_job_request.dart +++ b/packages/openai_dart/lib/src/generated/schema/create_fine_tuning_job_request.dart @@ -23,7 +23,12 @@ class CreateFineTuningJobRequest with _$CreateFineTuningJobRequest { /// /// See [upload file](https://platform.openai.com/docs/api-reference/files/create) for how to upload a file. /// - /// Your dataset must be formatted as a JSONL file. Additionally, you must upload your file with the purpose `fine-tune`. + /// Your dataset must be formatted as a JSONL file. Additionally, you must upload your file with the purpose + /// `fine-tune`. + /// + /// The contents of the file should differ depending on if the model uses the + /// [chat](https://platform.openai.com/docs/api-reference/fine-tuning/chat-input) or + /// [completions](https://platform.openai.com/docs/api-reference/fine-tuning/completions-input) format. /// /// See the [fine-tuning guide](https://platform.openai.com/docs/guides/fine-tuning) for more details. @JsonKey(name: 'training_file') required String trainingFile, diff --git a/packages/openai_dart/lib/src/generated/schema/message_content_text_annotations_file_citation.dart b/packages/openai_dart/lib/src/generated/schema/message_content_text_annotations_file_citation.dart index 1e6807c9..c8d3a8f1 100644 --- a/packages/openai_dart/lib/src/generated/schema/message_content_text_annotations_file_citation.dart +++ b/packages/openai_dart/lib/src/generated/schema/message_content_text_annotations_file_citation.dart @@ -18,9 +18,6 @@ class MessageContentTextAnnotationsFileCitation const factory MessageContentTextAnnotationsFileCitation({ /// The ID of the specific File the citation is from. @JsonKey(name: 'file_id') required String fileId, - - /// The specific quote in the file. - @JsonKey(includeIfNull: false) String? quote, }) = _MessageContentTextAnnotationsFileCitation; /// Object construction from a JSON representation @@ -29,7 +26,7 @@ class MessageContentTextAnnotationsFileCitation _$MessageContentTextAnnotationsFileCitationFromJson(json); /// List of all property names of schema - static const List propertyNames = ['file_id', 'quote']; + static const List propertyNames = ['file_id']; /// Perform validations on the schema property values String? validateSchema() { @@ -40,7 +37,6 @@ class MessageContentTextAnnotationsFileCitation Map toMap() { return { 'file_id': fileId, - 'quote': quote, }; } } diff --git a/packages/openai_dart/lib/src/generated/schema/schema.freezed.dart b/packages/openai_dart/lib/src/generated/schema/schema.freezed.dart index 16efa483..0bc9015f 100644 --- a/packages/openai_dart/lib/src/generated/schema/schema.freezed.dart +++ b/packages/openai_dart/lib/src/generated/schema/schema.freezed.dart @@ -13428,7 +13428,12 @@ mixin _$CreateFineTuningJobRequest { /// /// See [upload file](https://platform.openai.com/docs/api-reference/files/create) for how to upload a file. /// - /// Your dataset must be formatted as a JSONL file. Additionally, you must upload your file with the purpose `fine-tune`. + /// Your dataset must be formatted as a JSONL file. Additionally, you must upload your file with the purpose + /// `fine-tune`. + /// + /// The contents of the file should differ depending on if the model uses the + /// [chat](https://platform.openai.com/docs/api-reference/fine-tuning/chat-input) or + /// [completions](https://platform.openai.com/docs/api-reference/fine-tuning/completions-input) format. /// /// See the [fine-tuning guide](https://platform.openai.com/docs/guides/fine-tuning) for more details. @JsonKey(name: 'training_file') @@ -13682,7 +13687,12 @@ class _$CreateFineTuningJobRequestImpl extends _CreateFineTuningJobRequest { /// /// See [upload file](https://platform.openai.com/docs/api-reference/files/create) for how to upload a file. /// - /// Your dataset must be formatted as a JSONL file. Additionally, you must upload your file with the purpose `fine-tune`. + /// Your dataset must be formatted as a JSONL file. Additionally, you must upload your file with the purpose + /// `fine-tune`. + /// + /// The contents of the file should differ depending on if the model uses the + /// [chat](https://platform.openai.com/docs/api-reference/fine-tuning/chat-input) or + /// [completions](https://platform.openai.com/docs/api-reference/fine-tuning/completions-input) format. /// /// See the [fine-tuning guide](https://platform.openai.com/docs/guides/fine-tuning) for more details. @override @@ -13815,7 +13825,12 @@ abstract class _CreateFineTuningJobRequest extends CreateFineTuningJobRequest { /// /// See [upload file](https://platform.openai.com/docs/api-reference/files/create) for how to upload a file. /// - /// Your dataset must be formatted as a JSONL file. Additionally, you must upload your file with the purpose `fine-tune`. + /// Your dataset must be formatted as a JSONL file. Additionally, you must upload your file with the purpose + /// `fine-tune`. + /// + /// The contents of the file should differ depending on if the model uses the + /// [chat](https://platform.openai.com/docs/api-reference/fine-tuning/chat-input) or + /// [completions](https://platform.openai.com/docs/api-reference/fine-tuning/completions-input) format. /// /// See the [fine-tuning guide](https://platform.openai.com/docs/guides/fine-tuning) for more details. @JsonKey(name: 'training_file') @@ -40381,10 +40396,6 @@ mixin _$MessageContentTextAnnotationsFileCitation { @JsonKey(name: 'file_id') String get fileId => throw _privateConstructorUsedError; - /// The specific quote in the file. - @JsonKey(includeIfNull: false) - String? get quote => throw _privateConstructorUsedError; - Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) $MessageContentTextAnnotationsFileCitationCopyWith< @@ -40400,9 +40411,7 @@ abstract class $MessageContentTextAnnotationsFileCitationCopyWith<$Res> { _$MessageContentTextAnnotationsFileCitationCopyWithImpl<$Res, MessageContentTextAnnotationsFileCitation>; @useResult - $Res call( - {@JsonKey(name: 'file_id') String fileId, - @JsonKey(includeIfNull: false) String? quote}); + $Res call({@JsonKey(name: 'file_id') String fileId}); } /// @nodoc @@ -40421,17 +40430,12 @@ class _$MessageContentTextAnnotationsFileCitationCopyWithImpl<$Res, @override $Res call({ Object? fileId = null, - Object? quote = freezed, }) { return _then(_value.copyWith( fileId: null == fileId ? _value.fileId : fileId // ignore: cast_nullable_to_non_nullable as String, - quote: freezed == quote - ? _value.quote - : quote // ignore: cast_nullable_to_non_nullable - as String?, ) as $Val); } } @@ -40445,9 +40449,7 @@ abstract class _$$MessageContentTextAnnotationsFileCitationImplCopyWith<$Res> __$$MessageContentTextAnnotationsFileCitationImplCopyWithImpl<$Res>; @override @useResult - $Res call( - {@JsonKey(name: 'file_id') String fileId, - @JsonKey(includeIfNull: false) String? quote}); + $Res call({@JsonKey(name: 'file_id') String fileId}); } /// @nodoc @@ -40464,17 +40466,12 @@ class __$$MessageContentTextAnnotationsFileCitationImplCopyWithImpl<$Res> @override $Res call({ Object? fileId = null, - Object? quote = freezed, }) { return _then(_$MessageContentTextAnnotationsFileCitationImpl( fileId: null == fileId ? _value.fileId : fileId // ignore: cast_nullable_to_non_nullable as String, - quote: freezed == quote - ? _value.quote - : quote // ignore: cast_nullable_to_non_nullable - as String?, )); } } @@ -40484,8 +40481,7 @@ class __$$MessageContentTextAnnotationsFileCitationImplCopyWithImpl<$Res> class _$MessageContentTextAnnotationsFileCitationImpl extends _MessageContentTextAnnotationsFileCitation { const _$MessageContentTextAnnotationsFileCitationImpl( - {@JsonKey(name: 'file_id') required this.fileId, - @JsonKey(includeIfNull: false) this.quote}) + {@JsonKey(name: 'file_id') required this.fileId}) : super._(); factory _$MessageContentTextAnnotationsFileCitationImpl.fromJson( @@ -40497,14 +40493,9 @@ class _$MessageContentTextAnnotationsFileCitationImpl @JsonKey(name: 'file_id') final String fileId; - /// The specific quote in the file. - @override - @JsonKey(includeIfNull: false) - final String? quote; - @override String toString() { - return 'MessageContentTextAnnotationsFileCitation(fileId: $fileId, quote: $quote)'; + return 'MessageContentTextAnnotationsFileCitation(fileId: $fileId)'; } @override @@ -40512,13 +40503,12 @@ class _$MessageContentTextAnnotationsFileCitationImpl return identical(this, other) || (other.runtimeType == runtimeType && other is _$MessageContentTextAnnotationsFileCitationImpl && - (identical(other.fileId, fileId) || other.fileId == fileId) && - (identical(other.quote, quote) || other.quote == quote)); + (identical(other.fileId, fileId) || other.fileId == fileId)); } @JsonKey(ignore: true) @override - int get hashCode => Object.hash(runtimeType, fileId, quote); + int get hashCode => Object.hash(runtimeType, fileId); @JsonKey(ignore: true) @override @@ -40541,8 +40531,7 @@ class _$MessageContentTextAnnotationsFileCitationImpl abstract class _MessageContentTextAnnotationsFileCitation extends MessageContentTextAnnotationsFileCitation { const factory _MessageContentTextAnnotationsFileCitation( - {@JsonKey(name: 'file_id') required final String fileId, - @JsonKey(includeIfNull: false) final String? quote}) = + {@JsonKey(name: 'file_id') required final String fileId}) = _$MessageContentTextAnnotationsFileCitationImpl; const _MessageContentTextAnnotationsFileCitation._() : super._(); @@ -40556,11 +40545,6 @@ abstract class _MessageContentTextAnnotationsFileCitation @JsonKey(name: 'file_id') String get fileId; @override - - /// The specific quote in the file. - @JsonKey(includeIfNull: false) - String? get quote; - @override @JsonKey(ignore: true) _$$MessageContentTextAnnotationsFileCitationImplCopyWith< _$MessageContentTextAnnotationsFileCitationImpl> @@ -48068,7 +48052,7 @@ mixin _$CreateBatchRequest { /// /// See [upload file](https://platform.openai.com/docs/api-reference/files/create) for how to upload a file. /// - /// Your input file must be formatted as a JSONL file, and must be uploaded with the purpose `batch`. + /// Your input file must be formatted as a [JSONL file](https://platform.openai.com/docs/api-reference/batch/request-input), and must be uploaded with the purpose `batch`. The file can contain up to 50,000 requests, and can be up to 100 MB in size. @JsonKey(name: 'input_file_id') String get inputFileId => throw _privateConstructorUsedError; @@ -48214,7 +48198,7 @@ class _$CreateBatchRequestImpl extends _CreateBatchRequest { /// /// See [upload file](https://platform.openai.com/docs/api-reference/files/create) for how to upload a file. /// - /// Your input file must be formatted as a JSONL file, and must be uploaded with the purpose `batch`. + /// Your input file must be formatted as a [JSONL file](https://platform.openai.com/docs/api-reference/batch/request-input), and must be uploaded with the purpose `batch`. The file can contain up to 50,000 requests, and can be up to 100 MB in size. @override @JsonKey(name: 'input_file_id') final String inputFileId; @@ -48300,7 +48284,7 @@ abstract class _CreateBatchRequest extends CreateBatchRequest { /// /// See [upload file](https://platform.openai.com/docs/api-reference/files/create) for how to upload a file. /// - /// Your input file must be formatted as a JSONL file, and must be uploaded with the purpose `batch`. + /// Your input file must be formatted as a [JSONL file](https://platform.openai.com/docs/api-reference/batch/request-input), and must be uploaded with the purpose `batch`. The file can contain up to 50,000 requests, and can be up to 100 MB in size. @JsonKey(name: 'input_file_id') String get inputFileId; @override @@ -52790,21 +52774,33 @@ mixin _$AssistantTools { @optionalTypeArgs TResult when({ required TResult Function(String type) codeInterpreter, - required TResult Function(String type) fileSearch, + required TResult Function( + String type, + @JsonKey(name: 'file_search', includeIfNull: false) + AssistantToolsFileSearchFileSearch? fileSearch) + fileSearch, required TResult Function(String type, FunctionObject function) function, }) => throw _privateConstructorUsedError; @optionalTypeArgs TResult? whenOrNull({ TResult? Function(String type)? codeInterpreter, - TResult? Function(String type)? fileSearch, + TResult? Function( + String type, + @JsonKey(name: 'file_search', includeIfNull: false) + AssistantToolsFileSearchFileSearch? fileSearch)? + fileSearch, TResult? Function(String type, FunctionObject function)? function, }) => throw _privateConstructorUsedError; @optionalTypeArgs TResult maybeWhen({ TResult Function(String type)? codeInterpreter, - TResult Function(String type)? fileSearch, + TResult Function( + String type, + @JsonKey(name: 'file_search', includeIfNull: false) + AssistantToolsFileSearchFileSearch? fileSearch)? + fileSearch, TResult Function(String type, FunctionObject function)? function, required TResult orElse(), }) => @@ -52952,7 +52948,11 @@ class _$AssistantToolsCodeInterpreterImpl @optionalTypeArgs TResult when({ required TResult Function(String type) codeInterpreter, - required TResult Function(String type) fileSearch, + required TResult Function( + String type, + @JsonKey(name: 'file_search', includeIfNull: false) + AssistantToolsFileSearchFileSearch? fileSearch) + fileSearch, required TResult Function(String type, FunctionObject function) function, }) { return codeInterpreter(type); @@ -52962,7 +52962,11 @@ class _$AssistantToolsCodeInterpreterImpl @optionalTypeArgs TResult? whenOrNull({ TResult? Function(String type)? codeInterpreter, - TResult? Function(String type)? fileSearch, + TResult? Function( + String type, + @JsonKey(name: 'file_search', includeIfNull: false) + AssistantToolsFileSearchFileSearch? fileSearch)? + fileSearch, TResult? Function(String type, FunctionObject function)? function, }) { return codeInterpreter?.call(type); @@ -52972,7 +52976,11 @@ class _$AssistantToolsCodeInterpreterImpl @optionalTypeArgs TResult maybeWhen({ TResult Function(String type)? codeInterpreter, - TResult Function(String type)? fileSearch, + TResult Function( + String type, + @JsonKey(name: 'file_search', includeIfNull: false) + AssistantToolsFileSearchFileSearch? fileSearch)? + fileSearch, TResult Function(String type, FunctionObject function)? function, required TResult orElse(), }) { @@ -53053,7 +53061,12 @@ abstract class _$$AssistantToolsFileSearchImplCopyWith<$Res> __$$AssistantToolsFileSearchImplCopyWithImpl<$Res>; @override @useResult - $Res call({String type}); + $Res call( + {String type, + @JsonKey(name: 'file_search', includeIfNull: false) + AssistantToolsFileSearchFileSearch? fileSearch}); + + $AssistantToolsFileSearchFileSearchCopyWith<$Res>? get fileSearch; } /// @nodoc @@ -53069,32 +53082,57 @@ class __$$AssistantToolsFileSearchImplCopyWithImpl<$Res> @override $Res call({ Object? type = null, + Object? fileSearch = freezed, }) { return _then(_$AssistantToolsFileSearchImpl( type: null == type ? _value.type : type // ignore: cast_nullable_to_non_nullable as String, + fileSearch: freezed == fileSearch + ? _value.fileSearch + : fileSearch // ignore: cast_nullable_to_non_nullable + as AssistantToolsFileSearchFileSearch?, )); } + + @override + @pragma('vm:prefer-inline') + $AssistantToolsFileSearchFileSearchCopyWith<$Res>? get fileSearch { + if (_value.fileSearch == null) { + return null; + } + + return $AssistantToolsFileSearchFileSearchCopyWith<$Res>(_value.fileSearch!, + (value) { + return _then(_value.copyWith(fileSearch: value)); + }); + } } /// @nodoc @JsonSerializable() class _$AssistantToolsFileSearchImpl extends AssistantToolsFileSearch { - const _$AssistantToolsFileSearchImpl({this.type = 'file_search'}) : super._(); + const _$AssistantToolsFileSearchImpl( + {required this.type, + @JsonKey(name: 'file_search', includeIfNull: false) this.fileSearch}) + : super._(); factory _$AssistantToolsFileSearchImpl.fromJson(Map json) => _$$AssistantToolsFileSearchImplFromJson(json); /// The type of tool being defined: `file_search` @override - @JsonKey() final String type; + /// Overrides for the file search tool. + @override + @JsonKey(name: 'file_search', includeIfNull: false) + final AssistantToolsFileSearchFileSearch? fileSearch; + @override String toString() { - return 'AssistantTools.fileSearch(type: $type)'; + return 'AssistantTools.fileSearch(type: $type, fileSearch: $fileSearch)'; } @override @@ -53102,12 +53140,14 @@ class _$AssistantToolsFileSearchImpl extends AssistantToolsFileSearch { return identical(this, other) || (other.runtimeType == runtimeType && other is _$AssistantToolsFileSearchImpl && - (identical(other.type, type) || other.type == type)); + (identical(other.type, type) || other.type == type) && + (identical(other.fileSearch, fileSearch) || + other.fileSearch == fileSearch)); } @JsonKey(ignore: true) @override - int get hashCode => Object.hash(runtimeType, type); + int get hashCode => Object.hash(runtimeType, type, fileSearch); @JsonKey(ignore: true) @override @@ -53120,32 +53160,44 @@ class _$AssistantToolsFileSearchImpl extends AssistantToolsFileSearch { @optionalTypeArgs TResult when({ required TResult Function(String type) codeInterpreter, - required TResult Function(String type) fileSearch, + required TResult Function( + String type, + @JsonKey(name: 'file_search', includeIfNull: false) + AssistantToolsFileSearchFileSearch? fileSearch) + fileSearch, required TResult Function(String type, FunctionObject function) function, }) { - return fileSearch(type); + return fileSearch(type, this.fileSearch); } @override @optionalTypeArgs TResult? whenOrNull({ TResult? Function(String type)? codeInterpreter, - TResult? Function(String type)? fileSearch, + TResult? Function( + String type, + @JsonKey(name: 'file_search', includeIfNull: false) + AssistantToolsFileSearchFileSearch? fileSearch)? + fileSearch, TResult? Function(String type, FunctionObject function)? function, }) { - return fileSearch?.call(type); + return fileSearch?.call(type, this.fileSearch); } @override @optionalTypeArgs TResult maybeWhen({ TResult Function(String type)? codeInterpreter, - TResult Function(String type)? fileSearch, + TResult Function( + String type, + @JsonKey(name: 'file_search', includeIfNull: false) + AssistantToolsFileSearchFileSearch? fileSearch)? + fileSearch, TResult Function(String type, FunctionObject function)? function, required TResult orElse(), }) { if (fileSearch != null) { - return fileSearch(type); + return fileSearch(type, this.fileSearch); } return orElse(); } @@ -53194,7 +53246,10 @@ class _$AssistantToolsFileSearchImpl extends AssistantToolsFileSearch { } abstract class AssistantToolsFileSearch extends AssistantTools { - const factory AssistantToolsFileSearch({final String type}) = + const factory AssistantToolsFileSearch( + {required final String type, + @JsonKey(name: 'file_search', includeIfNull: false) + final AssistantToolsFileSearchFileSearch? fileSearch}) = _$AssistantToolsFileSearchImpl; const AssistantToolsFileSearch._() : super._(); @@ -53205,6 +53260,10 @@ abstract class AssistantToolsFileSearch extends AssistantTools { /// The type of tool being defined: `file_search` String get type; + + /// Overrides for the file search tool. + @JsonKey(name: 'file_search', includeIfNull: false) + AssistantToolsFileSearchFileSearch? get fileSearch; @override @JsonKey(ignore: true) _$$AssistantToolsFileSearchImplCopyWith<_$AssistantToolsFileSearchImpl> @@ -53310,7 +53369,11 @@ class _$AssistantToolsFunctionImpl extends AssistantToolsFunction { @optionalTypeArgs TResult when({ required TResult Function(String type) codeInterpreter, - required TResult Function(String type) fileSearch, + required TResult Function( + String type, + @JsonKey(name: 'file_search', includeIfNull: false) + AssistantToolsFileSearchFileSearch? fileSearch) + fileSearch, required TResult Function(String type, FunctionObject function) function, }) { return function(type, this.function); @@ -53320,7 +53383,11 @@ class _$AssistantToolsFunctionImpl extends AssistantToolsFunction { @optionalTypeArgs TResult? whenOrNull({ TResult? Function(String type)? codeInterpreter, - TResult? Function(String type)? fileSearch, + TResult? Function( + String type, + @JsonKey(name: 'file_search', includeIfNull: false) + AssistantToolsFileSearchFileSearch? fileSearch)? + fileSearch, TResult? Function(String type, FunctionObject function)? function, }) { return function?.call(type, this.function); @@ -53330,7 +53397,11 @@ class _$AssistantToolsFunctionImpl extends AssistantToolsFunction { @optionalTypeArgs TResult maybeWhen({ TResult Function(String type)? codeInterpreter, - TResult Function(String type)? fileSearch, + TResult Function( + String type, + @JsonKey(name: 'file_search', includeIfNull: false) + AssistantToolsFileSearchFileSearch? fileSearch)? + fileSearch, TResult Function(String type, FunctionObject function)? function, required TResult orElse(), }) { @@ -53405,6 +53476,187 @@ abstract class AssistantToolsFunction extends AssistantTools { get copyWith => throw _privateConstructorUsedError; } +AssistantToolsFileSearchFileSearch _$AssistantToolsFileSearchFileSearchFromJson( + Map json) { + return _AssistantToolsFileSearchFileSearch.fromJson(json); +} + +/// @nodoc +mixin _$AssistantToolsFileSearchFileSearch { + /// The maximum number of results the file search tool should output. The default is 20 for gpt-4* models + /// and 5 for gpt-3.5-turbo. This number should be between 1 and 50 inclusive. + /// + /// Note that the file search tool may output fewer than `max_num_results` results. See the [file search + /// tool documentation](/docs/assistants/tools/file-search/number-of-chunks-returned) for more information. + @JsonKey(name: 'max_num_results', includeIfNull: false) + int? get maxNumResults => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $AssistantToolsFileSearchFileSearchCopyWith< + AssistantToolsFileSearchFileSearch> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $AssistantToolsFileSearchFileSearchCopyWith<$Res> { + factory $AssistantToolsFileSearchFileSearchCopyWith( + AssistantToolsFileSearchFileSearch value, + $Res Function(AssistantToolsFileSearchFileSearch) then) = + _$AssistantToolsFileSearchFileSearchCopyWithImpl<$Res, + AssistantToolsFileSearchFileSearch>; + @useResult + $Res call( + {@JsonKey(name: 'max_num_results', includeIfNull: false) + int? maxNumResults}); +} + +/// @nodoc +class _$AssistantToolsFileSearchFileSearchCopyWithImpl<$Res, + $Val extends AssistantToolsFileSearchFileSearch> + implements $AssistantToolsFileSearchFileSearchCopyWith<$Res> { + _$AssistantToolsFileSearchFileSearchCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? maxNumResults = freezed, + }) { + return _then(_value.copyWith( + maxNumResults: freezed == maxNumResults + ? _value.maxNumResults + : maxNumResults // ignore: cast_nullable_to_non_nullable + as int?, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$AssistantToolsFileSearchFileSearchImplCopyWith<$Res> + implements $AssistantToolsFileSearchFileSearchCopyWith<$Res> { + factory _$$AssistantToolsFileSearchFileSearchImplCopyWith( + _$AssistantToolsFileSearchFileSearchImpl value, + $Res Function(_$AssistantToolsFileSearchFileSearchImpl) then) = + __$$AssistantToolsFileSearchFileSearchImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {@JsonKey(name: 'max_num_results', includeIfNull: false) + int? maxNumResults}); +} + +/// @nodoc +class __$$AssistantToolsFileSearchFileSearchImplCopyWithImpl<$Res> + extends _$AssistantToolsFileSearchFileSearchCopyWithImpl<$Res, + _$AssistantToolsFileSearchFileSearchImpl> + implements _$$AssistantToolsFileSearchFileSearchImplCopyWith<$Res> { + __$$AssistantToolsFileSearchFileSearchImplCopyWithImpl( + _$AssistantToolsFileSearchFileSearchImpl _value, + $Res Function(_$AssistantToolsFileSearchFileSearchImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? maxNumResults = freezed, + }) { + return _then(_$AssistantToolsFileSearchFileSearchImpl( + maxNumResults: freezed == maxNumResults + ? _value.maxNumResults + : maxNumResults // ignore: cast_nullable_to_non_nullable + as int?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$AssistantToolsFileSearchFileSearchImpl + extends _AssistantToolsFileSearchFileSearch { + const _$AssistantToolsFileSearchFileSearchImpl( + {@JsonKey(name: 'max_num_results', includeIfNull: false) + this.maxNumResults}) + : super._(); + + factory _$AssistantToolsFileSearchFileSearchImpl.fromJson( + Map json) => + _$$AssistantToolsFileSearchFileSearchImplFromJson(json); + + /// The maximum number of results the file search tool should output. The default is 20 for gpt-4* models + /// and 5 for gpt-3.5-turbo. This number should be between 1 and 50 inclusive. + /// + /// Note that the file search tool may output fewer than `max_num_results` results. See the [file search + /// tool documentation](/docs/assistants/tools/file-search/number-of-chunks-returned) for more information. + @override + @JsonKey(name: 'max_num_results', includeIfNull: false) + final int? maxNumResults; + + @override + String toString() { + return 'AssistantToolsFileSearchFileSearch(maxNumResults: $maxNumResults)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$AssistantToolsFileSearchFileSearchImpl && + (identical(other.maxNumResults, maxNumResults) || + other.maxNumResults == maxNumResults)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, maxNumResults); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$AssistantToolsFileSearchFileSearchImplCopyWith< + _$AssistantToolsFileSearchFileSearchImpl> + get copyWith => __$$AssistantToolsFileSearchFileSearchImplCopyWithImpl< + _$AssistantToolsFileSearchFileSearchImpl>(this, _$identity); + + @override + Map toJson() { + return _$$AssistantToolsFileSearchFileSearchImplToJson( + this, + ); + } +} + +abstract class _AssistantToolsFileSearchFileSearch + extends AssistantToolsFileSearchFileSearch { + const factory _AssistantToolsFileSearchFileSearch( + {@JsonKey(name: 'max_num_results', includeIfNull: false) + final int? maxNumResults}) = _$AssistantToolsFileSearchFileSearchImpl; + const _AssistantToolsFileSearchFileSearch._() : super._(); + + factory _AssistantToolsFileSearchFileSearch.fromJson( + Map json) = + _$AssistantToolsFileSearchFileSearchImpl.fromJson; + + @override + + /// The maximum number of results the file search tool should output. The default is 20 for gpt-4* models + /// and 5 for gpt-3.5-turbo. This number should be between 1 and 50 inclusive. + /// + /// Note that the file search tool may output fewer than `max_num_results` results. See the [file search + /// tool documentation](/docs/assistants/tools/file-search/number-of-chunks-returned) for more information. + @JsonKey(name: 'max_num_results', includeIfNull: false) + int? get maxNumResults; + @override + @JsonKey(ignore: true) + _$$AssistantToolsFileSearchFileSearchImplCopyWith< + _$AssistantToolsFileSearchFileSearchImpl> + get copyWith => throw _privateConstructorUsedError; +} + MessageContent _$MessageContentFromJson(Map json) { switch (json['type']) { case 'image_file': diff --git a/packages/openai_dart/lib/src/generated/schema/schema.g.dart b/packages/openai_dart/lib/src/generated/schema/schema.g.dart index 8b4963d6..5795dcc1 100644 --- a/packages/openai_dart/lib/src/generated/schema/schema.g.dart +++ b/packages/openai_dart/lib/src/generated/schema/schema.g.dart @@ -3906,24 +3906,13 @@ _$MessageContentTextAnnotationsFileCitationImpl Map json) => _$MessageContentTextAnnotationsFileCitationImpl( fileId: json['file_id'] as String, - quote: json['quote'] as String?, ); Map _$$MessageContentTextAnnotationsFileCitationImplToJson( - _$MessageContentTextAnnotationsFileCitationImpl instance) { - final val = { - 'file_id': instance.fileId, - }; - - void writeNotNull(String key, dynamic value) { - if (value != null) { - val[key] = value; - } - } - - writeNotNull('quote', instance.quote); - return val; -} + _$MessageContentTextAnnotationsFileCitationImpl instance) => + { + 'file_id': instance.fileId, + }; _$MessageDeltaContentImageUrlObjectImpl _$$MessageDeltaContentImageUrlObjectImplFromJson( @@ -5114,14 +5103,28 @@ Map _$$AssistantToolsCodeInterpreterImplToJson( _$AssistantToolsFileSearchImpl _$$AssistantToolsFileSearchImplFromJson( Map json) => _$AssistantToolsFileSearchImpl( - type: json['type'] as String? ?? 'file_search', + type: json['type'] as String, + fileSearch: json['file_search'] == null + ? null + : AssistantToolsFileSearchFileSearch.fromJson( + json['file_search'] as Map), ); Map _$$AssistantToolsFileSearchImplToJson( - _$AssistantToolsFileSearchImpl instance) => - { - 'type': instance.type, - }; + _$AssistantToolsFileSearchImpl instance) { + final val = { + 'type': instance.type, + }; + + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull('file_search', instance.fileSearch?.toJson()); + return val; +} _$AssistantToolsFunctionImpl _$$AssistantToolsFunctionImplFromJson( Map json) => @@ -5138,6 +5141,27 @@ Map _$$AssistantToolsFunctionImplToJson( 'function': instance.function.toJson(), }; +_$AssistantToolsFileSearchFileSearchImpl + _$$AssistantToolsFileSearchFileSearchImplFromJson( + Map json) => + _$AssistantToolsFileSearchFileSearchImpl( + maxNumResults: json['max_num_results'] as int?, + ); + +Map _$$AssistantToolsFileSearchFileSearchImplToJson( + _$AssistantToolsFileSearchFileSearchImpl instance) { + final val = {}; + + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull('max_num_results', instance.maxNumResults); + return val; +} + _$MessageContentImageFileObjectImpl _$$MessageContentImageFileObjectImplFromJson(Map json) => _$MessageContentImageFileObjectImpl( diff --git a/packages/openai_dart/oas/openapi_curated.yaml b/packages/openai_dart/oas/openapi_curated.yaml index 07b38bb8..bb054143 100644 --- a/packages/openai_dart/oas/openapi_curated.yaml +++ b/packages/openai_dart/oas/openapi_curated.yaml @@ -4,7 +4,7 @@ openapi: 3.0.0 info: title: OpenAI API description: The OpenAI REST API. Please see https://platform.openai.com/docs/api-reference for more details. - version: "2.0.0" + version: "2.1.0" termsOfService: https://openai.com/policies/terms-of-use contact: name: OpenAI Support @@ -1465,7 +1465,7 @@ paths: operationId: cancelBatch tags: - Batch - summary: Cancels an in-progress batch. + summary: Cancels an in-progress batch. The batch will be in status `cancelling` for up to 10 minutes, before changing to `cancelled`, where it will have partial results (if any) available in the output file. parameters: - in: path name: batch_id @@ -2668,8 +2668,13 @@ components: See [upload file](https://platform.openai.com/docs/api-reference/files/create) for how to upload a file. - Your dataset must be formatted as a JSONL file. Additionally, you must upload your file with the purpose `fine-tune`. + Your dataset must be formatted as a JSONL file. Additionally, you must upload your file with the purpose + `fine-tune`. + The contents of the file should differ depending on if the model uses the + [chat](https://platform.openai.com/docs/api-reference/fine-tuning/chat-input) or + [completions](https://platform.openai.com/docs/api-reference/fine-tuning/completions-input) format. + See the [fine-tuning guide](https://platform.openai.com/docs/guides/fine-tuning) for more details. type: string example: "file-abc123" @@ -3710,7 +3715,23 @@ components: type: type: string description: "The type of tool being defined: `file_search`" - default: "file_search" + default: file_search + file_search: + type: object + description: Overrides for the file search tool. + properties: + max_num_results: + type: integer + minimum: 1 + maximum: 50 + description: | + The maximum number of results the file search tool should output. The default is 20 for gpt-4* models + and 5 for gpt-3.5-turbo. This number should be between 1 and 50 inclusive. + + Note that the file search tool may output fewer than `max_num_results` results. See the [file search + tool documentation](/docs/assistants/tools/file-search/number-of-chunks-returned) for more information. + required: + - type AssistantToolsFunction: type: object description: Function tool @@ -4885,12 +4906,8 @@ components: file_id: description: The ID of the specific File the citation is from. type: string - quote: - description: The specific quote in the file. - type: string required: - file_id - # - quote # https://github.com/openai/openai-openapi/issues/263 MessageContentTextAnnotationsFilePathObject: type: object description: A URL for the file that's generated when the assistant used the `code_interpreter` tool to generate a file. @@ -6115,7 +6132,7 @@ components: See [upload file](https://platform.openai.com/docs/api-reference/files/create) for how to upload a file. - Your input file must be formatted as a JSONL file, and must be uploaded with the purpose `batch`. + Your input file must be formatted as a [JSONL file](https://platform.openai.com/docs/api-reference/batch/request-input), and must be uploaded with the purpose `batch`. The file can contain up to 50,000 requests, and can be up to 100 MB in size. endpoint: $ref: "#/components/schemas/BatchEndpoint" completion_window: diff --git a/packages/openai_dart/oas/openapi_official.yaml b/packages/openai_dart/oas/openapi_official.yaml index 395d6481..6763b140 100644 --- a/packages/openai_dart/oas/openapi_official.yaml +++ b/packages/openai_dart/oas/openapi_official.yaml @@ -2,7 +2,7 @@ openapi: 3.0.0 info: title: OpenAI API description: The OpenAI REST API. Please see https://platform.openai.com/docs/api-reference for more details. - version: "2.0.0" + version: "2.1.0" termsOfService: https://openai.com/policies/terms-of-use contact: name: OpenAI Support @@ -16,7 +16,7 @@ tags: - name: Assistants description: Build Assistants that can call models and use tools. - name: Audio - description: Learn how to turn audio into text or text into audio. + description: Turn audio into text or text into audio. - name: Chat description: Given a list of messages comprising a conversation, the model will return a response. - name: Completions @@ -1506,9 +1506,9 @@ paths: The Assistants API supports files up to 2 million tokens and of specific file types. See the [Assistants Tools guide](/docs/assistants/tools) for details. - The Fine-tuning API only supports `.jsonl` files. + The Fine-tuning API only supports `.jsonl` files. The input also has certain required formats for fine-tuning [chat](/docs/api-reference/fine-tuning/chat-input) or [completions](/docs/api-reference/fine-tuning/completions-input) models. - The Batch API only supports `.jsonl` files up to 100 MB in size. + The Batch API only supports `.jsonl` files up to 100 MB in size. The input also has a specific required [format](/docs/api-reference/batch/request-input). Please [contact us](https://help.openai.com/) if you need to increase these storage limits. requestBody: @@ -4005,7 +4005,8 @@ paths: "incomplete_details": null, "usage": null, "response_format": "auto", - "tool_choice": "auto" + "tool_choice": "auto", + "parallel_tool_calls": true } - title: Streaming @@ -4067,13 +4068,13 @@ paths: data: {"id":"thread_123","object":"thread","created_at":1710348075,"metadata":{}} event: thread.run.created - data: {"id":"run_123","object":"thread.run","created_at":1710348075,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":null,"expires_at":1710348675,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4-turbo","instructions":null,"tools":[],"tool_resources":{},"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto"} + data: {"id":"run_123","object":"thread.run","created_at":1710348075,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":null,"expires_at":1710348675,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4-turbo","instructions":null,"tools":[],"tool_resources":{},"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true} event: thread.run.queued - data: {"id":"run_123","object":"thread.run","created_at":1710348075,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":null,"expires_at":1710348675,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4-turbo","instructions":null,"tools":[],"tool_resources":{},"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto"} + data: {"id":"run_123","object":"thread.run","created_at":1710348075,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":null,"expires_at":1710348675,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4-turbo","instructions":null,"tools":[],"tool_resources":{},"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true} event: thread.run.in_progress - data: {"id":"run_123","object":"thread.run","created_at":1710348075,"assistant_id":"asst_123","thread_id":"thread_123","status":"in_progress","started_at":null,"expires_at":1710348675,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4-turbo","instructions":null,"tools":[],"tool_resources":{},"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto"} + data: {"id":"run_123","object":"thread.run","created_at":1710348075,"assistant_id":"asst_123","thread_id":"thread_123","status":"in_progress","started_at":null,"expires_at":1710348675,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4-turbo","instructions":null,"tools":[],"tool_resources":{},"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true} event: thread.run.step.created data: {"id":"step_001","object":"thread.run.step","created_at":1710348076,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"in_progress","cancelled_at":null,"completed_at":null,"expires_at":1710348675,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_001"}},"usage":null} @@ -4105,7 +4106,7 @@ paths: data: {"id":"step_001","object":"thread.run.step","created_at":1710348076,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"completed","cancelled_at":null,"completed_at":1710348077,"expires_at":1710348675,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_001"}},"usage":{"prompt_tokens":20,"completion_tokens":11,"total_tokens":31}} event: thread.run.completed - {"id":"run_123","object":"thread.run","created_at":1710348076,"assistant_id":"asst_123","thread_id":"thread_123","status":"completed","started_at":1713226836,"expires_at":null,"cancelled_at":null,"failed_at":null,"completed_at":1713226837,"required_action":null,"last_error":null,"model":"gpt-4-turbo","instructions":null,"tools":[],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":{"prompt_tokens":345,"completion_tokens":11,"total_tokens":356},"response_format":"auto","tool_choice":"auto"} + {"id":"run_123","object":"thread.run","created_at":1710348076,"assistant_id":"asst_123","thread_id":"thread_123","status":"completed","started_at":1713226836,"expires_at":null,"cancelled_at":null,"failed_at":null,"completed_at":1713226837,"required_action":null,"last_error":null,"model":"gpt-4-turbo","instructions":null,"tools":[],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":{"prompt_tokens":345,"completion_tokens":11,"total_tokens":356},"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true} event: done data: [DONE] @@ -4236,13 +4237,13 @@ paths: data: {"id":"thread_123","object":"thread","created_at":1710351818,"metadata":{}} event: thread.run.created - data: {"id":"run_123","object":"thread.run","created_at":1710351818,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":null,"expires_at":1710352418,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4-turbo","instructions":null,"tools":[{"type":"function","function":{"name":"get_current_weather","description":"Get the current weather in a given location","parameters":{"type":"object","properties":{"location":{"type":"string","description":"The city and state, e.g. San Francisco, CA"},"unit":{"type":"string","enum":["celsius","fahrenheit"]}},"required":["location"]}}}],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto"}} + data: {"id":"run_123","object":"thread.run","created_at":1710351818,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":null,"expires_at":1710352418,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4-turbo","instructions":null,"tools":[{"type":"function","function":{"name":"get_current_weather","description":"Get the current weather in a given location","parameters":{"type":"object","properties":{"location":{"type":"string","description":"The city and state, e.g. San Francisco, CA"},"unit":{"type":"string","enum":["celsius","fahrenheit"]}},"required":["location"]}}}],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} event: thread.run.queued - data: {"id":"run_123","object":"thread.run","created_at":1710351818,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":null,"expires_at":1710352418,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4-turbo","instructions":null,"tools":[{"type":"function","function":{"name":"get_current_weather","description":"Get the current weather in a given location","parameters":{"type":"object","properties":{"location":{"type":"string","description":"The city and state, e.g. San Francisco, CA"},"unit":{"type":"string","enum":["celsius","fahrenheit"]}},"required":["location"]}}}],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto"}} + data: {"id":"run_123","object":"thread.run","created_at":1710351818,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":null,"expires_at":1710352418,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4-turbo","instructions":null,"tools":[{"type":"function","function":{"name":"get_current_weather","description":"Get the current weather in a given location","parameters":{"type":"object","properties":{"location":{"type":"string","description":"The city and state, e.g. San Francisco, CA"},"unit":{"type":"string","enum":["celsius","fahrenheit"]}},"required":["location"]}}}],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} event: thread.run.in_progress - data: {"id":"run_123","object":"thread.run","created_at":1710351818,"assistant_id":"asst_123","thread_id":"thread_123","status":"in_progress","started_at":1710351818,"expires_at":1710352418,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4-turbo","instructions":null,"tools":[{"type":"function","function":{"name":"get_current_weather","description":"Get the current weather in a given location","parameters":{"type":"object","properties":{"location":{"type":"string","description":"The city and state, e.g. San Francisco, CA"},"unit":{"type":"string","enum":["celsius","fahrenheit"]}},"required":["location"]}}}],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto"}} + data: {"id":"run_123","object":"thread.run","created_at":1710351818,"assistant_id":"asst_123","thread_id":"thread_123","status":"in_progress","started_at":1710351818,"expires_at":1710352418,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4-turbo","instructions":null,"tools":[{"type":"function","function":{"name":"get_current_weather","description":"Get the current weather in a given location","parameters":{"type":"object","properties":{"location":{"type":"string","description":"The city and state, e.g. San Francisco, CA"},"unit":{"type":"string","enum":["celsius","fahrenheit"]}},"required":["location"]}}}],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} event: thread.run.step.created data: {"id":"step_001","object":"thread.run.step","created_at":1710351819,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"tool_calls","status":"in_progress","cancelled_at":null,"completed_at":null,"expires_at":1710352418,"failed_at":null,"last_error":null,"step_details":{"type":"tool_calls","tool_calls":[]},"usage":null} @@ -4268,7 +4269,7 @@ paths: data: {"id":"step_001","object":"thread.run.step.delta","delta":{"step_details":{"type":"tool_calls","tool_calls":[{"index":0,"type":"function","function":{"arguments":"\"}"}}]}}} event: thread.run.requires_action - data: {"id":"run_123","object":"thread.run","created_at":1710351818,"assistant_id":"asst_123","thread_id":"thread_123","status":"requires_action","started_at":1710351818,"expires_at":1710352418,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":{"type":"submit_tool_outputs","submit_tool_outputs":{"tool_calls":[{"id":"call_XXNp8YGaFrjrSjgqxtC8JJ1B","type":"function","function":{"name":"get_current_weather","arguments":"{\"location\":\"San Francisco, CA\",\"unit\":\"fahrenheit\"}"}}]}},"last_error":null,"model":"gpt-4-turbo","instructions":null,"tools":[{"type":"function","function":{"name":"get_current_weather","description":"Get the current weather in a given location","parameters":{"type":"object","properties":{"location":{"type":"string","description":"The city and state, e.g. San Francisco, CA"},"unit":{"type":"string","enum":["celsius","fahrenheit"]}},"required":["location"]}}}],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":{"prompt_tokens":345,"completion_tokens":11,"total_tokens":356},"response_format":"auto","tool_choice":"auto"}} + data: {"id":"run_123","object":"thread.run","created_at":1710351818,"assistant_id":"asst_123","thread_id":"thread_123","status":"requires_action","started_at":1710351818,"expires_at":1710352418,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":{"type":"submit_tool_outputs","submit_tool_outputs":{"tool_calls":[{"id":"call_XXNp8YGaFrjrSjgqxtC8JJ1B","type":"function","function":{"name":"get_current_weather","arguments":"{\"location\":\"San Francisco, CA\",\"unit\":\"fahrenheit\"}"}}]}},"last_error":null,"model":"gpt-4-turbo","instructions":null,"tools":[{"type":"function","function":{"name":"get_current_weather","description":"Get the current weather in a given location","parameters":{"type":"object","properties":{"location":{"type":"string","description":"The city and state, e.g. San Francisco, CA"},"unit":{"type":"string","enum":["celsius","fahrenheit"]}},"required":["location"]}}}],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":{"prompt_tokens":345,"completion_tokens":11,"total_tokens":356},"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} event: done data: [DONE] @@ -4400,7 +4401,8 @@ paths: "last_messages": null }, "response_format": "auto", - "tool_choice": "auto" + "tool_choice": "auto", + "parallel_tool_calls": true }, { "id": "run_abc456", @@ -4446,7 +4448,8 @@ paths: "last_messages": null }, "response_format": "auto", - "tool_choice": "auto" + "tool_choice": "auto", + "parallel_tool_calls": true } ], "first_id": "run_abc123", @@ -4552,7 +4555,8 @@ paths: "last_messages": null }, "response_format": "auto", - "tool_choice": "auto" + "tool_choice": "auto", + "parallel_tool_calls": true } - title: Streaming request: @@ -4596,13 +4600,13 @@ paths: main(); response: | event: thread.run.created - data: {"id":"run_123","object":"thread.run","created_at":1710330640,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":null,"expires_at":1710331240,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4-turbo","instructions":null,"tools":[],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto"}} + data: {"id":"run_123","object":"thread.run","created_at":1710330640,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":null,"expires_at":1710331240,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4-turbo","instructions":null,"tools":[],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} event: thread.run.queued - data: {"id":"run_123","object":"thread.run","created_at":1710330640,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":null,"expires_at":1710331240,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4-turbo","instructions":null,"tools":[],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto"}} + data: {"id":"run_123","object":"thread.run","created_at":1710330640,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":null,"expires_at":1710331240,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4-turbo","instructions":null,"tools":[],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} event: thread.run.in_progress - data: {"id":"run_123","object":"thread.run","created_at":1710330640,"assistant_id":"asst_123","thread_id":"thread_123","status":"in_progress","started_at":1710330641,"expires_at":1710331240,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4-turbo","instructions":null,"tools":[],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto"}} + data: {"id":"run_123","object":"thread.run","created_at":1710330640,"assistant_id":"asst_123","thread_id":"thread_123","status":"in_progress","started_at":1710330641,"expires_at":1710331240,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4-turbo","instructions":null,"tools":[],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} event: thread.run.step.created data: {"id":"step_001","object":"thread.run.step","created_at":1710330641,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"in_progress","cancelled_at":null,"completed_at":null,"expires_at":1710331240,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_001"}},"usage":null} @@ -4634,7 +4638,7 @@ paths: data: {"id":"step_001","object":"thread.run.step","created_at":1710330641,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"completed","cancelled_at":null,"completed_at":1710330642,"expires_at":1710331240,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_001"}},"usage":{"prompt_tokens":20,"completion_tokens":11,"total_tokens":31}} event: thread.run.completed - data: {"id":"run_123","object":"thread.run","created_at":1710330640,"assistant_id":"asst_123","thread_id":"thread_123","status":"completed","started_at":1710330641,"expires_at":null,"cancelled_at":null,"failed_at":null,"completed_at":1710330642,"required_action":null,"last_error":null,"model":"gpt-4-turbo","instructions":null,"tools":[],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":{"prompt_tokens":20,"completion_tokens":11,"total_tokens":31},"response_format":"auto","tool_choice":"auto"}} + data: {"id":"run_123","object":"thread.run","created_at":1710330640,"assistant_id":"asst_123","thread_id":"thread_123","status":"completed","started_at":1710330641,"expires_at":null,"cancelled_at":null,"failed_at":null,"completed_at":1710330642,"required_action":null,"last_error":null,"model":"gpt-4-turbo","instructions":null,"tools":[],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":{"prompt_tokens":20,"completion_tokens":11,"total_tokens":31},"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} event: done data: [DONE] @@ -4751,13 +4755,13 @@ paths: main(); response: | event: thread.run.created - data: {"id":"run_123","object":"thread.run","created_at":1710348075,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":null,"expires_at":1710348675,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4-turbo","instructions":null,"tools":[],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto"}} + data: {"id":"run_123","object":"thread.run","created_at":1710348075,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":null,"expires_at":1710348675,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4-turbo","instructions":null,"tools":[],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} event: thread.run.queued - data: {"id":"run_123","object":"thread.run","created_at":1710348075,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":null,"expires_at":1710348675,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4-turbo","instructions":null,"tools":[],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto"}} + data: {"id":"run_123","object":"thread.run","created_at":1710348075,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":null,"expires_at":1710348675,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4-turbo","instructions":null,"tools":[],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} event: thread.run.in_progress - data: {"id":"run_123","object":"thread.run","created_at":1710348075,"assistant_id":"asst_123","thread_id":"thread_123","status":"in_progress","started_at":1710348075,"expires_at":1710348675,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4-turbo","instructions":null,"tools":[],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto"}} + data: {"id":"run_123","object":"thread.run","created_at":1710348075,"assistant_id":"asst_123","thread_id":"thread_123","status":"in_progress","started_at":1710348075,"expires_at":1710348675,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4-turbo","instructions":null,"tools":[],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} event: thread.run.step.created data: {"id":"step_001","object":"thread.run.step","created_at":1710348076,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"in_progress","cancelled_at":null,"completed_at":null,"expires_at":1710348675,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_001"}},"usage":null} @@ -4789,7 +4793,7 @@ paths: data: {"id":"step_001","object":"thread.run.step","created_at":1710348076,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"completed","cancelled_at":null,"completed_at":1710348077,"expires_at":1710348675,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_001"}},"usage":{"prompt_tokens":20,"completion_tokens":11,"total_tokens":31}} event: thread.run.completed - data: {"id":"run_123","object":"thread.run","created_at":1710348075,"assistant_id":"asst_123","thread_id":"thread_123","status":"completed","started_at":1710348075,"expires_at":null,"cancelled_at":null,"failed_at":null,"completed_at":1710348077,"required_action":null,"last_error":null,"model":"gpt-4-turbo","instructions":null,"tools":[],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":{"prompt_tokens":20,"completion_tokens":11,"total_tokens":31},"response_format":"auto","tool_choice":"auto"}} + data: {"id":"run_123","object":"thread.run","created_at":1710348075,"assistant_id":"asst_123","thread_id":"thread_123","status":"completed","started_at":1710348075,"expires_at":null,"cancelled_at":null,"failed_at":null,"completed_at":1710348077,"required_action":null,"last_error":null,"model":"gpt-4-turbo","instructions":null,"tools":[],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":{"prompt_tokens":20,"completion_tokens":11,"total_tokens":31},"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} event: done data: [DONE] @@ -4893,7 +4897,8 @@ paths: "last_messages": null }, "response_format": "auto", - "tool_choice": "auto" + "tool_choice": "auto", + "parallel_tool_calls": true } post: operationId: modifyRun @@ -5021,7 +5026,8 @@ paths: "last_messages": null }, "response_format": "auto", - "tool_choice": "auto" + "tool_choice": "auto", + "parallel_tool_calls": true } /threads/{thread_id}/runs/{run_id}/submit_tool_outputs: @@ -5167,7 +5173,8 @@ paths: "last_messages": null }, "response_format": "auto", - "tool_choice": "auto" + "tool_choice": "auto", + "parallel_tool_calls": true } - title: Streaming @@ -5234,10 +5241,10 @@ paths: data: {"id":"step_001","object":"thread.run.step","created_at":1710352449,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"tool_calls","status":"completed","cancelled_at":null,"completed_at":1710352475,"expires_at":1710353047,"failed_at":null,"last_error":null,"step_details":{"type":"tool_calls","tool_calls":[{"id":"call_iWr0kQ2EaYMaxNdl0v3KYkx7","type":"function","function":{"name":"get_current_weather","arguments":"{\"location\":\"San Francisco, CA\",\"unit\":\"fahrenheit\"}","output":"70 degrees and sunny."}}]},"usage":{"prompt_tokens":291,"completion_tokens":24,"total_tokens":315}} event: thread.run.queued - data: {"id":"run_123","object":"thread.run","created_at":1710352447,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":1710352448,"expires_at":1710353047,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4-turbo","instructions":null,"tools":[{"type":"function","function":{"name":"get_current_weather","description":"Get the current weather in a given location","parameters":{"type":"object","properties":{"location":{"type":"string","description":"The city and state, e.g. San Francisco, CA"},"unit":{"type":"string","enum":["celsius","fahrenheit"]}},"required":["location"]}}}],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto"}} + data: {"id":"run_123","object":"thread.run","created_at":1710352447,"assistant_id":"asst_123","thread_id":"thread_123","status":"queued","started_at":1710352448,"expires_at":1710353047,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4-turbo","instructions":null,"tools":[{"type":"function","function":{"name":"get_current_weather","description":"Get the current weather in a given location","parameters":{"type":"object","properties":{"location":{"type":"string","description":"The city and state, e.g. San Francisco, CA"},"unit":{"type":"string","enum":["celsius","fahrenheit"]}},"required":["location"]}}}],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} event: thread.run.in_progress - data: {"id":"run_123","object":"thread.run","created_at":1710352447,"assistant_id":"asst_123","thread_id":"thread_123","status":"in_progress","started_at":1710352475,"expires_at":1710353047,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4-turbo","instructions":null,"tools":[{"type":"function","function":{"name":"get_current_weather","description":"Get the current weather in a given location","parameters":{"type":"object","properties":{"location":{"type":"string","description":"The city and state, e.g. San Francisco, CA"},"unit":{"type":"string","enum":["celsius","fahrenheit"]}},"required":["location"]}}}],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto"}} + data: {"id":"run_123","object":"thread.run","created_at":1710352447,"assistant_id":"asst_123","thread_id":"thread_123","status":"in_progress","started_at":1710352475,"expires_at":1710353047,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4-turbo","instructions":null,"tools":[{"type":"function","function":{"name":"get_current_weather","description":"Get the current weather in a given location","parameters":{"type":"object","properties":{"location":{"type":"string","description":"The city and state, e.g. San Francisco, CA"},"unit":{"type":"string","enum":["celsius","fahrenheit"]}},"required":["location"]}}}],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} event: thread.run.step.created data: {"id":"step_002","object":"thread.run.step","created_at":1710352476,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"in_progress","cancelled_at":null,"completed_at":null,"expires_at":1710353047,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_002"}},"usage":null} @@ -5275,7 +5282,7 @@ paths: data: {"id":"step_002","object":"thread.run.step","created_at":1710352476,"run_id":"run_123","assistant_id":"asst_123","thread_id":"thread_123","type":"message_creation","status":"completed","cancelled_at":null,"completed_at":1710352477,"expires_at":1710353047,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_002"}},"usage":{"prompt_tokens":329,"completion_tokens":18,"total_tokens":347}} event: thread.run.completed - data: {"id":"run_123","object":"thread.run","created_at":1710352447,"assistant_id":"asst_123","thread_id":"thread_123","status":"completed","started_at":1710352475,"expires_at":null,"cancelled_at":null,"failed_at":null,"completed_at":1710352477,"required_action":null,"last_error":null,"model":"gpt-4-turbo","instructions":null,"tools":[{"type":"function","function":{"name":"get_current_weather","description":"Get the current weather in a given location","parameters":{"type":"object","properties":{"location":{"type":"string","description":"The city and state, e.g. San Francisco, CA"},"unit":{"type":"string","enum":["celsius","fahrenheit"]}},"required":["location"]}}}],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":{"prompt_tokens":20,"completion_tokens":11,"total_tokens":31},"response_format":"auto","tool_choice":"auto"}} + data: {"id":"run_123","object":"thread.run","created_at":1710352447,"assistant_id":"asst_123","thread_id":"thread_123","status":"completed","started_at":1710352475,"expires_at":null,"cancelled_at":null,"failed_at":null,"completed_at":1710352477,"required_action":null,"last_error":null,"model":"gpt-4-turbo","instructions":null,"tools":[{"type":"function","function":{"name":"get_current_weather","description":"Get the current weather in a given location","parameters":{"type":"object","properties":{"location":{"type":"string","description":"The city and state, e.g. San Francisco, CA"},"unit":{"type":"string","enum":["celsius","fahrenheit"]}},"required":["location"]}}}],"metadata":{},"temperature":1.0,"top_p":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":{"prompt_tokens":20,"completion_tokens":11,"total_tokens":31},"response_format":"auto","tool_choice":"auto","parallel_tool_calls":true}} event: done data: [DONE] @@ -5373,7 +5380,9 @@ paths: "usage": null, "temperature": 1.0, "top_p": 1.0, - "response_format": "auto" + "response_format": "auto", + "tool_choice": "auto", + "parallel_tool_calls": true } /threads/{thread_id}/runs/{run_id}/steps: @@ -6655,7 +6664,7 @@ paths: See [upload file](/docs/api-reference/files/create) for how to upload a file. - Your input file must be formatted as a [JSONL file](/docs/api-reference/batch/requestInput), and must be uploaded with the purpose `batch`. The file can contain up to 50,000 requests, and can be up to 100 MB in size. + Your input file must be formatted as a [JSONL file](/docs/api-reference/batch/request-input), and must be uploaded with the purpose `batch`. The file can contain up to 50,000 requests, and can be up to 100 MB in size. endpoint: type: string enum: @@ -6930,7 +6939,7 @@ paths: operationId: cancelBatch tags: - Batch - summary: Cancels an in-progress batch. + summary: Cancels an in-progress batch. The batch will be in status `cancelling` for up to 10 minutes, before changing to `cancelled`, where it will have partial results (if any) available in the output file. parameters: - in: path name: batch_id @@ -7501,6 +7510,20 @@ components: required: - role + FineTuneChatCompletionRequestAssistantMessage: + allOf: + - type: object + title: Assistant message + deprecated: false + properties: + weight: + type: integer + enum: [ 0, 1 ] + description: "Controls whether the assistant message is trained against (0 or 1)" + - $ref: "#/components/schemas/ChatCompletionRequestAssistantMessage" + required: + - role + ChatCompletionRequestToolMessage: type: object title: Tool message @@ -8647,6 +8670,8 @@ components: Your dataset must be formatted as a JSONL file. Additionally, you must upload your file with the purpose `fine-tune`. + The contents of the file should differ depending on if the model uses the [chat](/docs/api-reference/fine-tuning/chat-input) or [completions](/docs/api-reference/fine-tuning/completions-input) format. + See the [fine-tuning guide](/docs/guides/fine-tuning) for more details. type: string example: "file-abc123" @@ -9594,6 +9619,98 @@ components: "step_number": 88 } + FinetuneChatRequestInput: + type: object + description: The per-line training example of a fine-tuning input file for chat models + properties: + messages: + type: array + minItems: 1 + items: + oneOf: + - $ref: "#/components/schemas/ChatCompletionRequestSystemMessage" + - $ref: "#/components/schemas/ChatCompletionRequestUserMessage" + - $ref: "#/components/schemas/FineTuneChatCompletionRequestAssistantMessage" + - $ref: "#/components/schemas/ChatCompletionRequestToolMessage" + - $ref: "#/components/schemas/ChatCompletionRequestFunctionMessage" + x-oaiExpandable: true + tools: + type: array + description: A list of tools the model may generate JSON inputs for. + items: + $ref: "#/components/schemas/ChatCompletionTool" + parallel_tool_calls: + $ref: "#/components/schemas/ParallelToolCalls" + functions: + deprecated: true + description: + A list of functions the model may generate JSON inputs for. + type: array + minItems: 1 + maxItems: 128 + items: + $ref: "#/components/schemas/ChatCompletionFunctions" + x-oaiMeta: + name: Training format for chat models + example: | + { + "messages": [ + { "role": "user", "content": "What is the weather in San Francisco?" }, + { + "role": "assistant", + "tool_calls": [ + { + "id": "call_id", + "type": "function", + "function": { + "name": "get_current_weather", + "arguments": "{\"location\": \"San Francisco, USA\", \"format\": \"celsius\"}" + } + } + ] + } + ], + "parallel_tool_calls": false, + "tools": [ + { + "type": "function", + "function": { + "name": "get_current_weather", + "description": "Get the current weather", + "parameters": { + "type": "object", + "properties": { + "location": { + "type": "string", + "description": "The city and country, eg. San Francisco, USA" + }, + "format": { "type": "string", "enum": ["celsius", "fahrenheit"] } + }, + "required": ["location", "format"] + } + } + } + ] + } + + FinetuneCompletionRequestInput: + type: object + description: The per-line training example of a fine-tuning input file for completions models + properties: + prompt: + type: string + description: The input prompt for this training example. + completion: + type: string + description: The desired completion for this training example. + x-oaiMeta: + name: Training format for completions models + example: | + { + "prompt": "What is the answer to 2+2", + "completion": "4" + } + CompletionUsage: type: object description: Usage statistics for the completion request. @@ -10083,6 +10200,29 @@ components: - type AssistantToolsFileSearch: + type: object + title: FileSearch tool + properties: + type: + type: string + description: "The type of tool being defined: `file_search`" + enum: [ "file_search" ] + file_search: + type: object + description: Overrides for the file search tool. + properties: + max_num_results: + type: integer + minimum: 1 + maximum: 50 + description: | + The maximum number of results the file search tool should output. The default is 20 for gpt-4* models and 5 for gpt-3.5-turbo. This number should be between 1 and 50 inclusive. + + Note that the file search tool may output fewer than `max_num_results` results. See the [file search tool documentation](/docs/assistants/tools/file-search/number-of-chunks-returned) for more information. + required: + - type + + AssistantToolsFileSearchTypeOnly: type: object title: FileSearch tool properties: @@ -11006,7 +11146,7 @@ components: items: oneOf: - $ref: "#/components/schemas/AssistantToolsCode" - - $ref: "#/components/schemas/AssistantToolsFileSearch" + - $ref: "#/components/schemas/AssistantToolsFileSearchTypeOnly" x-oaiExpandable: true description: A list of files attached to the message, and the tools they were added to. nullable: true @@ -11151,7 +11291,7 @@ components: items: oneOf: - $ref: "#/components/schemas/AssistantToolsCode" - - $ref: "#/components/schemas/AssistantToolsFileSearch" + - $ref: "#/components/schemas/AssistantToolsFileSearchTypeOnly" x-oaiExpandable: true description: A list of files attached to the message, and the tools they should be added to. required: @@ -11384,12 +11524,8 @@ components: file_id: description: The ID of the specific File the citation is from. type: string - quote: - description: The specific quote in the file. - type: string required: - file_id - - quote start_index: type: integer minimum: 0 @@ -13133,6 +13269,12 @@ x-oaiMeta: - type: endpoint key: cancelFineTuningJob path: cancel + - type: object + key: FinetuneChatRequestInput + path: chat-input + - type: object + key: FinetuneCompletionRequestInput + path: completions-input - type: object key: FineTuningJob path: object @@ -13167,10 +13309,10 @@ x-oaiMeta: path: object - type: object key: BatchRequestInput - path: requestInput + path: request-input - type: object key: BatchRequestOutput - path: requestOutput + path: request-output - id: files title: Files description: |