From e916ad3c0c4e322319cedac8b06b5908f1c31935 Mon Sep 17 00:00:00 2001 From: David Miguel Lozano Date: Thu, 29 Aug 2024 00:06:31 +0200 Subject: [PATCH] feat: Option to include file search results in assistants API (#543) --- packages/openai_dart/README.md | 134 +- packages/openai_dart/lib/openai_dart.dart | 2 +- .../openai_dart/lib/src/generated/client.dart | 16 + .../schema/assistant_stream_event.dart | 4 +- .../src/generated/schema/assistant_tools.dart | 18 +- .../generated/schema/file_search_ranker.dart | 17 + .../schema/file_search_ranking_options.dart | 62 + .../schema/run_step_details_tool_calls.dart | 5 +- ...n_step_details_tool_calls_file_search.dart | 48 + ...ls_file_search_ranking_options_object.dart | 56 + ...tool_calls_file_search_result_content.dart | 46 + ..._tool_calls_file_search_result_object.dart | 71 + .../lib/src/generated/schema/schema.dart | 6 + .../src/generated/schema/schema.freezed.dart | 1415 ++++++++++++++++- .../lib/src/generated/schema/schema.g.dart | 141 +- packages/openai_dart/oas/openapi_curated.yaml | 117 +- .../openai_dart/oas/openapi_official.yaml | 140 +- packages/openai_dart/pubspec.yaml | 2 +- 18 files changed, 2171 insertions(+), 129 deletions(-) create mode 100644 packages/openai_dart/lib/src/generated/schema/file_search_ranker.dart create mode 100644 packages/openai_dart/lib/src/generated/schema/file_search_ranking_options.dart create mode 100644 packages/openai_dart/lib/src/generated/schema/run_step_details_tool_calls_file_search.dart create mode 100644 packages/openai_dart/lib/src/generated/schema/run_step_details_tool_calls_file_search_ranking_options_object.dart create mode 100644 packages/openai_dart/lib/src/generated/schema/run_step_details_tool_calls_file_search_result_content.dart create mode 100644 packages/openai_dart/lib/src/generated/schema/run_step_details_tool_calls_file_search_result_object.dart diff --git a/packages/openai_dart/README.md b/packages/openai_dart/README.md index df9cc58b..12f5b51f 100644 --- a/packages/openai_dart/README.md +++ b/packages/openai_dart/README.md @@ -20,7 +20,7 @@ Unofficial Dart client for [OpenAI](https://platform.openai.com/docs/api-referen **Supported endpoints:** -- Chat (with tools and streaming support) +- Chat (with structured outputs, tools and streaming support) - Completions (legacy) - Embeddings - Fine-tuning @@ -28,7 +28,7 @@ Unofficial Dart client for [OpenAI](https://platform.openai.com/docs/api-referen - Images - Models - Moderations -- Assistants v2 (with tools and streaming support) `beta` +- Assistants v2 (with structured outputs, tools and streaming support) `beta` * Threads * Messages * Runs @@ -97,14 +97,14 @@ final client = OpenAIClient( Given a list of messages comprising a conversation, the model will return a response. -Related guide: [Chat Completions](https://platform.openai.com/docs/guides/text-generation) +Related guide: [Chat Completions](https://platform.openai.com/docs/guides/chat-completions) **Create chat completion:** ```dart final res = await client.createChatCompletion( request: CreateChatCompletionRequest( - model: ChatCompletionModel.modelId('gpt-4'), + model: ChatCompletionModel.modelId('gpt-4o'), messages: [ ChatCompletionMessage.system( content: 'You are a helpful assistant.', @@ -121,28 +121,28 @@ print(res.choices.first.message.content); ``` `ChatCompletionModel` is a sealed class that offers two ways to specify the model: -- `ChatCompletionModel.modelId('model-id')`: the model ID as string (e.g. `'gpt-4'` or your fine-tuned model ID). -- `ChatCompletionModel.model(ChatCompletionModels.gpt4)`: a value from `ChatCompletionModels` enum which lists all of the available models. +- `ChatCompletionModel.modelId('model-id')`: the model ID as string (e.g. `'gpt-4o'` or your fine-tuned model ID). +- `ChatCompletionModel.model(ChatCompletionModels.gpt4o)`: a value from `ChatCompletionModels` enum which lists all of the available models. `ChatCompletionMessage` is a sealed class that supports the following message types: - `ChatCompletionMessage.system()`: a system message. - `ChatCompletionMessage.user()`: a user message. - `ChatCompletionMessage.assistant()`: an assistant message. - `ChatCompletionMessage.tool()`: a tool message. -- `ChatCompletionMessage.function()`: a function message. +- `ChatCompletionMessage.function()`: a function message (deprecated in favor of tools). `ChatCompletionMessage.user()` takes a `ChatCompletionUserMessageContent` object that supports the following content types: - `ChatCompletionUserMessageContent.string('content')`: string content. - `ChatCompletionUserMessageContent.parts([...])`: multi-modal content (check the 'Multi-modal prompt' section below). * `ChatCompletionMessageContentPart.text('content')`: text content. - * `ChatCompletionMessageContentPart.image(imageUrl: ...)`: image content. + * `ChatCompletionMessageContentPart.image(...)`: image content (URL or base64-encoded image). **Stream chat completion:** ```dart final stream = client.createChatCompletionStream( request: CreateChatCompletionRequest( - model: ChatCompletionModel.modelId('gpt-4-turbo'), + model: ChatCompletionModel.modelId('gpt-4o'), messages: [ ChatCompletionMessage.system( content: @@ -167,6 +167,8 @@ await for (final res in stream) { **Multi-modal prompt:** ([docs](https://platform.openai.com/docs/guides/vision)) +You can either provide the image URL: + ```dart final res = await client.createChatCompletion( request: CreateChatCompletionRequest( @@ -198,37 +200,31 @@ print(res.choices.first.message.content); // The fruit in the image is an apple. ``` -**JSON mode:** ([docs](https://platform.openai.com/docs/guides/structured-outputs/json-mode)) - +Or provide the base64-encoded image: ```dart -final res = await client.createChatCompletion( - request: CreateChatCompletionRequest( - model: ChatCompletionModel.model( - ChatCompletionModels.gpt41106Preview, - ), - messages: [ - ChatCompletionMessage.system( - content: - 'You are a helpful assistant. That extracts names from text ' - 'and returns them in a JSON array.', +//... +ChatCompletionMessage.user( + content: ChatCompletionUserMessageContent.parts( + [ + ChatCompletionMessageContentPart.text( + text: 'What fruit is this?', ), - ChatCompletionMessage.user( - content: ChatCompletionUserMessageContent.string( - 'John, Mary, and Peter.', + ChatCompletionMessageContentPart.image( + imageUrl: ChatCompletionMessageImageUrl( + url: '/9j/4AAQSkZJRgABAQAAAQABAAD/2wB...P3s/XHQ8cE/nmiupbL0+fz/r/MjnSbsr69/Rdu1j//2Q==', + detail: ChatCompletionMessageImageDetail.high, ), ), ], - temperature: 0, - responseFormat: ChatCompletionResponseFormat( - type: ChatCompletionResponseFormatType.jsonObject, - ), ), -); -// { "names": ["John", "Mary", "Peter"] } +), +//... ``` **Structured output: ([docs](https://platform.openai.com/docs/guides/structured-outputs))** +Structured Outputs is a feature that ensures the model will always generate responses that adhere to your supplied JSON Schema. + ```dart final res = await client.createChatCompletion( request: CreateChatCompletionRequest( @@ -237,8 +233,7 @@ final res = await client.createChatCompletion( ), messages: [ ChatCompletionMessage.system( - content: - 'You are a helpful assistant. That extracts names from text.', + content: 'You are a helpful assistant. That extracts names from text.', ), ChatCompletionMessage.user( content: ChatCompletionUserMessageContent.string( @@ -272,8 +267,41 @@ final res = await client.createChatCompletion( // {"names":["John","Mary","Peter"]} ``` +**JSON mode:** ([docs](https://platform.openai.com/docs/guides/structured-outputs/json-mode)) + +> JSON mode is a more basic version of the Structured Outputs feature. While JSON mode ensures that model output is valid JSON, Structured Outputs reliably matches the model's output to the schema you specify. It us recommended to use Structured Outputs if it is supported for your use case. + +```dart +final res = await client.createChatCompletion( + request: CreateChatCompletionRequest( + model: ChatCompletionModel.model( + ChatCompletionModels.gpt41106Preview, + ), + messages: [ + ChatCompletionMessage.system( + content: + 'You are a helpful assistant. That extracts names from text ' + 'and returns them in a JSON array.', + ), + ChatCompletionMessage.user( + content: ChatCompletionUserMessageContent.string( + 'John, Mary, and Peter.', + ), + ), + ], + temperature: 0, + responseFormat: ChatCompletionResponseFormat( + type: ChatCompletionResponseFormatType.jsonObject, + ), + ), +); +// { "names": ["John", "Mary", "Peter"] } +``` + **Tools:** ([docs](https://platform.openai.com/docs/guides/function-calling)) +Tool calling allows you to connect models to external tools and systems. + ```dart const function = FunctionObject( name: 'get_current_weather', @@ -301,7 +329,7 @@ const tool = ChatCompletionTool( final res1 = await client.createChatCompletion( request: CreateChatCompletionRequest( - model: const ChatCompletionModel.model( + model: ChatCompletionModel.model( ChatCompletionModels.gpt4oMini, ), messages: [ @@ -353,6 +381,8 @@ final answer = res2.choices.first.message.content; // The weather in Boston right now is sunny with a temperature of 22°C ``` +You can enable Structured Outputs for your tools by setting `strict: true` in your `FunctionObject` definition. Structured Outputs ensures that the arguments generated by the model for a tool call exactly match the JSON Schema you provided in the tool definition. + **Function calling:** (deprecated in favor of tools) ```dart @@ -813,7 +843,7 @@ final res = await client.createThreadMessage( ), MessageContent.imageUrl( imageUrl: MessageContentImageUrl( - url: 'https://example.com/image.jpg', + url: 'https://example.com/image.jpg', // or base64-encoded image ), ), ]), @@ -867,6 +897,42 @@ final res = await client.createThreadRun( ); ``` +You can also use Structured Outputs to ensure that the model-generated responses adhere to a specific JSON schema: + +```dart + +final res = await client.createThreadRun( + threadId: threadId, + request: CreateRunRequest( + assistantId: assistantId, + instructions: 'You are a helpful assistant that extracts names from text.', + model: CreateRunRequestModel.modelId('gpt-4o'), + responseFormat: CreateRunRequestResponseFormat.responseFormat( + ResponseFormat.jsonSchema( + jsonSchema: JsonSchemaObject( + name: 'Names', + description: 'A list of names', + strict: true, + schema: { + 'type': 'object', + 'properties': { + 'names': { + 'type': 'array', + 'items': { + 'type': 'string', + }, + }, + }, + 'additionalProperties': false, + 'required': ['names'], + }, + ), + ) + ) + ), +); +``` + **Create run: (streaming)** ```dart diff --git a/packages/openai_dart/lib/openai_dart.dart b/packages/openai_dart/lib/openai_dart.dart index 7600ced2..57003125 100644 --- a/packages/openai_dart/lib/openai_dart.dart +++ b/packages/openai_dart/lib/openai_dart.dart @@ -1,4 +1,4 @@ -/// Dart client for the OpenAI API. Supports completions (GPT-3.5 Turbo), chat (GPT-4o, etc.), embeddings (Embedding v3), images (DALL·E 3), assistants v2 (threads, runs, vector stores, etc.) batch, fine-tuning, etc. +/// Dart client for the OpenAI API. Supports chat (GPT-4o, etc.), completions, embeddings, images (DALL·E 3), assistants (threads, runs, vector stores, etc.), batch, fine-tuning, etc. library; export 'src/client.dart'; diff --git a/packages/openai_dart/lib/src/generated/client.dart b/packages/openai_dart/lib/src/generated/client.dart index 828b26be..b58d7e15 100644 --- a/packages/openai_dart/lib/src/generated/client.dart +++ b/packages/openai_dart/lib/src/generated/client.dart @@ -1175,11 +1175,14 @@ class OpenAIClient { /// /// `threadId`: The ID of the thread to run. /// + /// `include`: A list of additional fields to include in the response. Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the file search result content. See the [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search/customizing-file-search-settings) for more information. + /// /// `request`: Request object for the Create run endpoint. /// /// `POST` `https://api.openai.com/v1/threads/{thread_id}/runs` Future createThreadRun({ required String threadId, + String? include, required CreateRunRequest request, }) async { final r = await makeRequest( @@ -1190,6 +1193,9 @@ class OpenAIClient { requestType: 'application/json', responseType: 'application/json', body: request, + queryParams: { + if (include != null) 'include': include, + }, ); return RunObject.fromJson(_jsonDecode(r)); } @@ -1324,6 +1330,8 @@ class OpenAIClient { /// /// `before`: A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. /// + /// `include`: A list of additional fields to include in the response. Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the file search result content. See the [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search/customizing-file-search-settings) for more information. + /// /// `GET` `https://api.openai.com/v1/threads/{thread_id}/runs/{run_id}/steps` Future listThreadRunSteps({ required String threadId, @@ -1332,6 +1340,7 @@ class OpenAIClient { String order = 'desc', String? after, String? before, + String? include, }) async { final r = await makeRequest( baseUrl: 'https://api.openai.com/v1', @@ -1345,6 +1354,7 @@ class OpenAIClient { 'order': order, if (after != null) 'after': after, if (before != null) 'before': before, + if (include != null) 'include': include, }, ); return ListRunStepsResponse.fromJson(_jsonDecode(r)); @@ -1362,11 +1372,14 @@ class OpenAIClient { /// /// `stepId`: The ID of the run step to retrieve. /// + /// `include`: A list of additional fields to include in the response. Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the file search result content. See the [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search/customizing-file-search-settings) for more information. + /// /// `GET` `https://api.openai.com/v1/threads/{thread_id}/runs/{run_id}/steps/{step_id}` Future getThreadRunStep({ required String threadId, required String runId, required String stepId, + String? include, }) async { final r = await makeRequest( baseUrl: 'https://api.openai.com/v1', @@ -1375,6 +1388,9 @@ class OpenAIClient { isMultipart: false, requestType: '', responseType: 'application/json', + queryParams: { + if (include != null) 'include': include, + }, ); return RunStepObject.fromJson(_jsonDecode(r)); } diff --git a/packages/openai_dart/lib/src/generated/schema/assistant_stream_event.dart b/packages/openai_dart/lib/src/generated/schema/assistant_stream_event.dart index 348155db..0686da7b 100644 --- a/packages/openai_dart/lib/src/generated/schema/assistant_stream_event.dart +++ b/packages/openai_dart/lib/src/generated/schema/assistant_stream_event.dart @@ -61,7 +61,7 @@ sealed class AssistantStreamEvent with _$AssistantStreamEvent { // UNION: RunStepStreamEvent // ------------------------------------------ - /// Occurs when a new [run step](https://platform.openai.com/docs/api-reference/runs/step-object) changes state. + /// Occurs when a new [run step](https://platform.openai.com/docs/api-reference/run-steps/step-object) changes state. const factory AssistantStreamEvent.runStepStreamEvent({ /// The type of the event. required EventType event, @@ -74,7 +74,7 @@ sealed class AssistantStreamEvent with _$AssistantStreamEvent { // UNION: RunStepStreamDeltaEvent // ------------------------------------------ - /// Occurs when a new [run step](https://platform.openai.com/docs/api-reference/runs/step-object) changes state. + /// Occurs when a new [run step](https://platform.openai.com/docs/api-reference/run-steps/step-object) changes state. const factory AssistantStreamEvent.runStepStreamDeltaEvent({ /// The type of the event. required EventType event, 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 e36cd8e6..920d2301 100644 --- a/packages/openai_dart/lib/src/generated/schema/assistant_tools.dart +++ b/packages/openai_dart/lib/src/generated/schema/assistant_tools.dart @@ -83,9 +83,17 @@ class 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](https://platform.openai.com/docs/assistants/tools/file-search/number-of-chunks-returned) for more information. + /// Note that the file search tool may output fewer than `max_num_results` results. See the + /// [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search/customizing-file-search-settings) + /// for more information. @JsonKey(name: 'max_num_results', includeIfNull: false) int? maxNumResults, + + /// The ranking options for the file search. + /// + /// See the [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search/customizing-file-search-settings) + /// for more information. + @JsonKey(name: 'ranking_options', includeIfNull: false) + FileSearchRankingOptions? rankingOptions, }) = _AssistantToolsFileSearchFileSearch; /// Object construction from a JSON representation @@ -94,7 +102,10 @@ class AssistantToolsFileSearchFileSearch _$AssistantToolsFileSearchFileSearchFromJson(json); /// List of all property names of schema - static const List propertyNames = ['max_num_results']; + static const List propertyNames = [ + 'max_num_results', + 'ranking_options' + ]; /// Validation constants static const maxNumResultsMinValue = 1; @@ -115,6 +126,7 @@ class AssistantToolsFileSearchFileSearch Map toMap() { return { 'max_num_results': maxNumResults, + 'ranking_options': rankingOptions, }; } } diff --git a/packages/openai_dart/lib/src/generated/schema/file_search_ranker.dart b/packages/openai_dart/lib/src/generated/schema/file_search_ranker.dart new file mode 100644 index 00000000..6dfc6218 --- /dev/null +++ b/packages/openai_dart/lib/src/generated/schema/file_search_ranker.dart @@ -0,0 +1,17 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: invalid_annotation_target +part of open_a_i_schema; + +// ========================================== +// ENUM: FileSearchRanker +// ========================================== + +/// The ranker to use for the file search. If not specified will use the `auto` ranker. +enum FileSearchRanker { + @JsonValue('auto') + auto, + @JsonValue('default_2024_08_21') + default20240821, +} diff --git a/packages/openai_dart/lib/src/generated/schema/file_search_ranking_options.dart b/packages/openai_dart/lib/src/generated/schema/file_search_ranking_options.dart new file mode 100644 index 00000000..e60070f0 --- /dev/null +++ b/packages/openai_dart/lib/src/generated/schema/file_search_ranking_options.dart @@ -0,0 +1,62 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: invalid_annotation_target +part of open_a_i_schema; + +// ========================================== +// CLASS: FileSearchRankingOptions +// ========================================== + +/// The ranking options for the file search. +/// +/// See the [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search/customizing-file-search-settings) +/// for more information. +@freezed +class FileSearchRankingOptions with _$FileSearchRankingOptions { + const FileSearchRankingOptions._(); + + /// Factory constructor for FileSearchRankingOptions + const factory FileSearchRankingOptions({ + /// The ranker to use for the file search. If not specified will use the `auto` ranker. + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue, + ) + FileSearchRanker? ranker, + + /// The score threshold for the file search. All values must be a floating point number between 0 and 1. + @JsonKey(name: 'score_threshold', includeIfNull: false) + double? scoreThreshold, + }) = _FileSearchRankingOptions; + + /// Object construction from a JSON representation + factory FileSearchRankingOptions.fromJson(Map json) => + _$FileSearchRankingOptionsFromJson(json); + + /// List of all property names of schema + static const List propertyNames = ['ranker', 'score_threshold']; + + /// Validation constants + static const scoreThresholdMinValue = 0.0; + static const scoreThresholdMaxValue = 1.0; + + /// Perform validations on the schema property values + String? validateSchema() { + if (scoreThreshold != null && scoreThreshold! < scoreThresholdMinValue) { + return "The value of 'scoreThreshold' cannot be < $scoreThresholdMinValue"; + } + if (scoreThreshold != null && scoreThreshold! > scoreThresholdMaxValue) { + return "The value of 'scoreThreshold' cannot be > $scoreThresholdMaxValue"; + } + return null; + } + + /// Map representation of object (not serialized) + Map toMap() { + return { + 'ranker': ranker, + 'score_threshold': scoreThreshold, + }; + } +} diff --git a/packages/openai_dart/lib/src/generated/schema/run_step_details_tool_calls.dart b/packages/openai_dart/lib/src/generated/schema/run_step_details_tool_calls.dart index c4605b7b..327de9f5 100644 --- a/packages/openai_dart/lib/src/generated/schema/run_step_details_tool_calls.dart +++ b/packages/openai_dart/lib/src/generated/schema/run_step_details_tool_calls.dart @@ -42,8 +42,9 @@ sealed class RunStepDetailsToolCalls with _$RunStepDetailsToolCalls { /// The type of tool call. This is always going to be `file_search` for this type of tool call. required String type, - /// For now, this is always going to be an empty object. - @JsonKey(name: 'file_search') required Map fileSearch, + /// The definition of the file search that was called. + @JsonKey(name: 'file_search') + required RunStepDetailsToolCallsFileSearch fileSearch, }) = RunStepDetailsToolCallsFileSearchObject; // ------------------------------------------ diff --git a/packages/openai_dart/lib/src/generated/schema/run_step_details_tool_calls_file_search.dart b/packages/openai_dart/lib/src/generated/schema/run_step_details_tool_calls_file_search.dart new file mode 100644 index 00000000..16f72322 --- /dev/null +++ b/packages/openai_dart/lib/src/generated/schema/run_step_details_tool_calls_file_search.dart @@ -0,0 +1,48 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: invalid_annotation_target +part of open_a_i_schema; + +// ========================================== +// CLASS: RunStepDetailsToolCallsFileSearch +// ========================================== + +/// The definition of the file search that was called. +@freezed +class RunStepDetailsToolCallsFileSearch + with _$RunStepDetailsToolCallsFileSearch { + const RunStepDetailsToolCallsFileSearch._(); + + /// Factory constructor for RunStepDetailsToolCallsFileSearch + const factory RunStepDetailsToolCallsFileSearch({ + /// The ranking options for the file search. + @JsonKey(name: 'ranking_options', includeIfNull: false) + RunStepDetailsToolCallsFileSearchRankingOptionsObject? rankingOptions, + + /// The results of the file search. + @JsonKey(includeIfNull: false) + List? results, + }) = _RunStepDetailsToolCallsFileSearch; + + /// Object construction from a JSON representation + factory RunStepDetailsToolCallsFileSearch.fromJson( + Map json) => + _$RunStepDetailsToolCallsFileSearchFromJson(json); + + /// List of all property names of schema + static const List propertyNames = ['ranking_options', 'results']; + + /// Perform validations on the schema property values + String? validateSchema() { + return null; + } + + /// Map representation of object (not serialized) + Map toMap() { + return { + 'ranking_options': rankingOptions, + 'results': results, + }; + } +} diff --git a/packages/openai_dart/lib/src/generated/schema/run_step_details_tool_calls_file_search_ranking_options_object.dart b/packages/openai_dart/lib/src/generated/schema/run_step_details_tool_calls_file_search_ranking_options_object.dart new file mode 100644 index 00000000..61b2ff06 --- /dev/null +++ b/packages/openai_dart/lib/src/generated/schema/run_step_details_tool_calls_file_search_ranking_options_object.dart @@ -0,0 +1,56 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: invalid_annotation_target +part of open_a_i_schema; + +// ========================================== +// CLASS: RunStepDetailsToolCallsFileSearchRankingOptionsObject +// ========================================== + +/// The ranking options for the file search. +@freezed +class RunStepDetailsToolCallsFileSearchRankingOptionsObject + with _$RunStepDetailsToolCallsFileSearchRankingOptionsObject { + const RunStepDetailsToolCallsFileSearchRankingOptionsObject._(); + + /// Factory constructor for RunStepDetailsToolCallsFileSearchRankingOptionsObject + const factory RunStepDetailsToolCallsFileSearchRankingOptionsObject({ + /// The ranker to use for the file search. If not specified will use the `auto` ranker. + required FileSearchRanker ranker, + + /// The score threshold for the file search. All values must be a floating point number between 0 and 1. + @JsonKey(name: 'score_threshold') required double scoreThreshold, + }) = _RunStepDetailsToolCallsFileSearchRankingOptionsObject; + + /// Object construction from a JSON representation + factory RunStepDetailsToolCallsFileSearchRankingOptionsObject.fromJson( + Map json) => + _$RunStepDetailsToolCallsFileSearchRankingOptionsObjectFromJson(json); + + /// List of all property names of schema + static const List propertyNames = ['ranker', 'score_threshold']; + + /// Validation constants + static const scoreThresholdMinValue = 0.0; + static const scoreThresholdMaxValue = 1.0; + + /// Perform validations on the schema property values + String? validateSchema() { + if (scoreThreshold < scoreThresholdMinValue) { + return "The value of 'scoreThreshold' cannot be < $scoreThresholdMinValue"; + } + if (scoreThreshold > scoreThresholdMaxValue) { + return "The value of 'scoreThreshold' cannot be > $scoreThresholdMaxValue"; + } + return null; + } + + /// Map representation of object (not serialized) + Map toMap() { + return { + 'ranker': ranker, + 'score_threshold': scoreThreshold, + }; + } +} diff --git a/packages/openai_dart/lib/src/generated/schema/run_step_details_tool_calls_file_search_result_content.dart b/packages/openai_dart/lib/src/generated/schema/run_step_details_tool_calls_file_search_result_content.dart new file mode 100644 index 00000000..3ba23a07 --- /dev/null +++ b/packages/openai_dart/lib/src/generated/schema/run_step_details_tool_calls_file_search_result_content.dart @@ -0,0 +1,46 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: invalid_annotation_target +part of open_a_i_schema; + +// ========================================== +// CLASS: RunStepDetailsToolCallsFileSearchResultContent +// ========================================== + +/// The content of the result that was found. +@freezed +class RunStepDetailsToolCallsFileSearchResultContent + with _$RunStepDetailsToolCallsFileSearchResultContent { + const RunStepDetailsToolCallsFileSearchResultContent._(); + + /// Factory constructor for RunStepDetailsToolCallsFileSearchResultContent + const factory RunStepDetailsToolCallsFileSearchResultContent({ + /// The type of the content. + @Default('text') String type, + + /// The text content of the file. + @JsonKey(includeIfNull: false) String? text, + }) = _RunStepDetailsToolCallsFileSearchResultContent; + + /// Object construction from a JSON representation + factory RunStepDetailsToolCallsFileSearchResultContent.fromJson( + Map json) => + _$RunStepDetailsToolCallsFileSearchResultContentFromJson(json); + + /// List of all property names of schema + static const List propertyNames = ['type', 'text']; + + /// Perform validations on the schema property values + String? validateSchema() { + return null; + } + + /// Map representation of object (not serialized) + Map toMap() { + return { + 'type': type, + 'text': text, + }; + } +} diff --git a/packages/openai_dart/lib/src/generated/schema/run_step_details_tool_calls_file_search_result_object.dart b/packages/openai_dart/lib/src/generated/schema/run_step_details_tool_calls_file_search_result_object.dart new file mode 100644 index 00000000..4b1a1de0 --- /dev/null +++ b/packages/openai_dart/lib/src/generated/schema/run_step_details_tool_calls_file_search_result_object.dart @@ -0,0 +1,71 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: invalid_annotation_target +part of open_a_i_schema; + +// ========================================== +// CLASS: RunStepDetailsToolCallsFileSearchResultObject +// ========================================== + +/// A result instance of the file search. +@freezed +class RunStepDetailsToolCallsFileSearchResultObject + with _$RunStepDetailsToolCallsFileSearchResultObject { + const RunStepDetailsToolCallsFileSearchResultObject._(); + + /// Factory constructor for RunStepDetailsToolCallsFileSearchResultObject + const factory RunStepDetailsToolCallsFileSearchResultObject({ + /// The ID of the file that result was found in. + @JsonKey(name: 'file_id') required String fileId, + + /// The name of the file that result was found in. + @JsonKey(name: 'file_name') required String fileName, + + /// The score of the result. All values must be a floating point number between 0 and 1. + required double score, + + /// The content of the result that was found. The content is only included if requested via the include + /// query parameter. + @JsonKey(includeIfNull: false) + List? content, + }) = _RunStepDetailsToolCallsFileSearchResultObject; + + /// Object construction from a JSON representation + factory RunStepDetailsToolCallsFileSearchResultObject.fromJson( + Map json) => + _$RunStepDetailsToolCallsFileSearchResultObjectFromJson(json); + + /// List of all property names of schema + static const List propertyNames = [ + 'file_id', + 'file_name', + 'score', + 'content' + ]; + + /// Validation constants + static const scoreMinValue = 0.0; + static const scoreMaxValue = 1.0; + + /// Perform validations on the schema property values + String? validateSchema() { + if (score < scoreMinValue) { + return "The value of 'score' cannot be < $scoreMinValue"; + } + if (score > scoreMaxValue) { + return "The value of 'score' cannot be > $scoreMaxValue"; + } + return null; + } + + /// Map representation of object (not serialized) + Map toMap() { + return { + 'file_id': fileId, + 'file_name': fileName, + 'score': score, + 'content': content, + }; + } +} diff --git a/packages/openai_dart/lib/src/generated/schema/schema.dart b/packages/openai_dart/lib/src/generated/schema/schema.dart index 028e108f..a48b094d 100644 --- a/packages/openai_dart/lib/src/generated/schema/schema.dart +++ b/packages/openai_dart/lib/src/generated/schema/schema.dart @@ -73,6 +73,8 @@ part 'create_assistant_request.dart'; part 'modify_assistant_request.dart'; part 'delete_assistant_response.dart'; part 'list_assistants_response.dart'; +part 'file_search_ranking_options.dart'; +part 'file_search_ranker.dart'; part 'assistants_named_tool_choice.dart'; part 'assistants_function_call_option.dart'; part 'truncation_object.dart'; @@ -119,6 +121,10 @@ part 'run_step_details_tool_calls_code_object_code_interpreter.dart'; part 'run_step_delta_step_details_tool_calls_code_object_code_interpreter.dart'; part 'run_step_details_tool_calls_code_output_image.dart'; part 'run_step_delta_step_details_tool_calls_code_output_image.dart'; +part 'run_step_details_tool_calls_file_search.dart'; +part 'run_step_details_tool_calls_file_search_ranking_options_object.dart'; +part 'run_step_details_tool_calls_file_search_result_object.dart'; +part 'run_step_details_tool_calls_file_search_result_content.dart'; part 'run_step_completion_usage.dart'; part 'vector_store_expiration_after.dart'; part 'vector_store_object.dart'; 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 76274966..5753970f 100644 --- a/packages/openai_dart/lib/src/generated/schema/schema.freezed.dart +++ b/packages/openai_dart/lib/src/generated/schema/schema.freezed.dart @@ -27762,6 +27762,222 @@ abstract class _ListAssistantsResponse extends ListAssistantsResponse { get copyWith => throw _privateConstructorUsedError; } +FileSearchRankingOptions _$FileSearchRankingOptionsFromJson( + Map json) { + return _FileSearchRankingOptions.fromJson(json); +} + +/// @nodoc +mixin _$FileSearchRankingOptions { + /// The ranker to use for the file search. If not specified will use the `auto` ranker. + @JsonKey( + includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + FileSearchRanker? get ranker => throw _privateConstructorUsedError; + + /// The score threshold for the file search. All values must be a floating point number between 0 and 1. + @JsonKey(name: 'score_threshold', includeIfNull: false) + double? get scoreThreshold => throw _privateConstructorUsedError; + + /// Serializes this FileSearchRankingOptions to a JSON map. + Map toJson() => throw _privateConstructorUsedError; + + /// Create a copy of FileSearchRankingOptions + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + $FileSearchRankingOptionsCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $FileSearchRankingOptionsCopyWith<$Res> { + factory $FileSearchRankingOptionsCopyWith(FileSearchRankingOptions value, + $Res Function(FileSearchRankingOptions) then) = + _$FileSearchRankingOptionsCopyWithImpl<$Res, FileSearchRankingOptions>; + @useResult + $Res call( + {@JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + FileSearchRanker? ranker, + @JsonKey(name: 'score_threshold', includeIfNull: false) + double? scoreThreshold}); +} + +/// @nodoc +class _$FileSearchRankingOptionsCopyWithImpl<$Res, + $Val extends FileSearchRankingOptions> + implements $FileSearchRankingOptionsCopyWith<$Res> { + _$FileSearchRankingOptionsCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of FileSearchRankingOptions + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? ranker = freezed, + Object? scoreThreshold = freezed, + }) { + return _then(_value.copyWith( + ranker: freezed == ranker + ? _value.ranker + : ranker // ignore: cast_nullable_to_non_nullable + as FileSearchRanker?, + scoreThreshold: freezed == scoreThreshold + ? _value.scoreThreshold + : scoreThreshold // ignore: cast_nullable_to_non_nullable + as double?, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$FileSearchRankingOptionsImplCopyWith<$Res> + implements $FileSearchRankingOptionsCopyWith<$Res> { + factory _$$FileSearchRankingOptionsImplCopyWith( + _$FileSearchRankingOptionsImpl value, + $Res Function(_$FileSearchRankingOptionsImpl) then) = + __$$FileSearchRankingOptionsImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {@JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + FileSearchRanker? ranker, + @JsonKey(name: 'score_threshold', includeIfNull: false) + double? scoreThreshold}); +} + +/// @nodoc +class __$$FileSearchRankingOptionsImplCopyWithImpl<$Res> + extends _$FileSearchRankingOptionsCopyWithImpl<$Res, + _$FileSearchRankingOptionsImpl> + implements _$$FileSearchRankingOptionsImplCopyWith<$Res> { + __$$FileSearchRankingOptionsImplCopyWithImpl( + _$FileSearchRankingOptionsImpl _value, + $Res Function(_$FileSearchRankingOptionsImpl) _then) + : super(_value, _then); + + /// Create a copy of FileSearchRankingOptions + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? ranker = freezed, + Object? scoreThreshold = freezed, + }) { + return _then(_$FileSearchRankingOptionsImpl( + ranker: freezed == ranker + ? _value.ranker + : ranker // ignore: cast_nullable_to_non_nullable + as FileSearchRanker?, + scoreThreshold: freezed == scoreThreshold + ? _value.scoreThreshold + : scoreThreshold // ignore: cast_nullable_to_non_nullable + as double?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$FileSearchRankingOptionsImpl extends _FileSearchRankingOptions { + const _$FileSearchRankingOptionsImpl( + {@JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + this.ranker, + @JsonKey(name: 'score_threshold', includeIfNull: false) + this.scoreThreshold}) + : super._(); + + factory _$FileSearchRankingOptionsImpl.fromJson(Map json) => + _$$FileSearchRankingOptionsImplFromJson(json); + + /// The ranker to use for the file search. If not specified will use the `auto` ranker. + @override + @JsonKey( + includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + final FileSearchRanker? ranker; + + /// The score threshold for the file search. All values must be a floating point number between 0 and 1. + @override + @JsonKey(name: 'score_threshold', includeIfNull: false) + final double? scoreThreshold; + + @override + String toString() { + return 'FileSearchRankingOptions(ranker: $ranker, scoreThreshold: $scoreThreshold)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$FileSearchRankingOptionsImpl && + (identical(other.ranker, ranker) || other.ranker == ranker) && + (identical(other.scoreThreshold, scoreThreshold) || + other.scoreThreshold == scoreThreshold)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, ranker, scoreThreshold); + + /// Create a copy of FileSearchRankingOptions + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$FileSearchRankingOptionsImplCopyWith<_$FileSearchRankingOptionsImpl> + get copyWith => __$$FileSearchRankingOptionsImplCopyWithImpl< + _$FileSearchRankingOptionsImpl>(this, _$identity); + + @override + Map toJson() { + return _$$FileSearchRankingOptionsImplToJson( + this, + ); + } +} + +abstract class _FileSearchRankingOptions extends FileSearchRankingOptions { + const factory _FileSearchRankingOptions( + {@JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + final FileSearchRanker? ranker, + @JsonKey(name: 'score_threshold', includeIfNull: false) + final double? scoreThreshold}) = _$FileSearchRankingOptionsImpl; + const _FileSearchRankingOptions._() : super._(); + + factory _FileSearchRankingOptions.fromJson(Map json) = + _$FileSearchRankingOptionsImpl.fromJson; + + /// The ranker to use for the file search. If not specified will use the `auto` ranker. + @override + @JsonKey( + includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + FileSearchRanker? get ranker; + + /// The score threshold for the file search. All values must be a floating point number between 0 and 1. + @override + @JsonKey(name: 'score_threshold', includeIfNull: false) + double? get scoreThreshold; + + /// Create a copy of FileSearchRankingOptions + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$FileSearchRankingOptionsImplCopyWith<_$FileSearchRankingOptionsImpl> + get copyWith => throw _privateConstructorUsedError; +} + AssistantsNamedToolChoice _$AssistantsNamedToolChoiceFromJson( Map json) { return _AssistantsNamedToolChoice.fromJson(json); @@ -46412,6 +46628,975 @@ abstract class _RunStepDeltaStepDetailsToolCallsCodeOutputImage get copyWith => throw _privateConstructorUsedError; } +RunStepDetailsToolCallsFileSearch _$RunStepDetailsToolCallsFileSearchFromJson( + Map json) { + return _RunStepDetailsToolCallsFileSearch.fromJson(json); +} + +/// @nodoc +mixin _$RunStepDetailsToolCallsFileSearch { + /// The ranking options for the file search. + @JsonKey(name: 'ranking_options', includeIfNull: false) + RunStepDetailsToolCallsFileSearchRankingOptionsObject? get rankingOptions => + throw _privateConstructorUsedError; + + /// The results of the file search. + @JsonKey(includeIfNull: false) + List? get results => + throw _privateConstructorUsedError; + + /// Serializes this RunStepDetailsToolCallsFileSearch to a JSON map. + Map toJson() => throw _privateConstructorUsedError; + + /// Create a copy of RunStepDetailsToolCallsFileSearch + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + $RunStepDetailsToolCallsFileSearchCopyWith + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $RunStepDetailsToolCallsFileSearchCopyWith<$Res> { + factory $RunStepDetailsToolCallsFileSearchCopyWith( + RunStepDetailsToolCallsFileSearch value, + $Res Function(RunStepDetailsToolCallsFileSearch) then) = + _$RunStepDetailsToolCallsFileSearchCopyWithImpl<$Res, + RunStepDetailsToolCallsFileSearch>; + @useResult + $Res call( + {@JsonKey(name: 'ranking_options', includeIfNull: false) + RunStepDetailsToolCallsFileSearchRankingOptionsObject? rankingOptions, + @JsonKey(includeIfNull: false) + List? results}); + + $RunStepDetailsToolCallsFileSearchRankingOptionsObjectCopyWith<$Res>? + get rankingOptions; +} + +/// @nodoc +class _$RunStepDetailsToolCallsFileSearchCopyWithImpl<$Res, + $Val extends RunStepDetailsToolCallsFileSearch> + implements $RunStepDetailsToolCallsFileSearchCopyWith<$Res> { + _$RunStepDetailsToolCallsFileSearchCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of RunStepDetailsToolCallsFileSearch + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? rankingOptions = freezed, + Object? results = freezed, + }) { + return _then(_value.copyWith( + rankingOptions: freezed == rankingOptions + ? _value.rankingOptions + : rankingOptions // ignore: cast_nullable_to_non_nullable + as RunStepDetailsToolCallsFileSearchRankingOptionsObject?, + results: freezed == results + ? _value.results + : results // ignore: cast_nullable_to_non_nullable + as List?, + ) as $Val); + } + + /// Create a copy of RunStepDetailsToolCallsFileSearch + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $RunStepDetailsToolCallsFileSearchRankingOptionsObjectCopyWith<$Res>? + get rankingOptions { + if (_value.rankingOptions == null) { + return null; + } + + return $RunStepDetailsToolCallsFileSearchRankingOptionsObjectCopyWith<$Res>( + _value.rankingOptions!, (value) { + return _then(_value.copyWith(rankingOptions: value) as $Val); + }); + } +} + +/// @nodoc +abstract class _$$RunStepDetailsToolCallsFileSearchImplCopyWith<$Res> + implements $RunStepDetailsToolCallsFileSearchCopyWith<$Res> { + factory _$$RunStepDetailsToolCallsFileSearchImplCopyWith( + _$RunStepDetailsToolCallsFileSearchImpl value, + $Res Function(_$RunStepDetailsToolCallsFileSearchImpl) then) = + __$$RunStepDetailsToolCallsFileSearchImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {@JsonKey(name: 'ranking_options', includeIfNull: false) + RunStepDetailsToolCallsFileSearchRankingOptionsObject? rankingOptions, + @JsonKey(includeIfNull: false) + List? results}); + + @override + $RunStepDetailsToolCallsFileSearchRankingOptionsObjectCopyWith<$Res>? + get rankingOptions; +} + +/// @nodoc +class __$$RunStepDetailsToolCallsFileSearchImplCopyWithImpl<$Res> + extends _$RunStepDetailsToolCallsFileSearchCopyWithImpl<$Res, + _$RunStepDetailsToolCallsFileSearchImpl> + implements _$$RunStepDetailsToolCallsFileSearchImplCopyWith<$Res> { + __$$RunStepDetailsToolCallsFileSearchImplCopyWithImpl( + _$RunStepDetailsToolCallsFileSearchImpl _value, + $Res Function(_$RunStepDetailsToolCallsFileSearchImpl) _then) + : super(_value, _then); + + /// Create a copy of RunStepDetailsToolCallsFileSearch + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? rankingOptions = freezed, + Object? results = freezed, + }) { + return _then(_$RunStepDetailsToolCallsFileSearchImpl( + rankingOptions: freezed == rankingOptions + ? _value.rankingOptions + : rankingOptions // ignore: cast_nullable_to_non_nullable + as RunStepDetailsToolCallsFileSearchRankingOptionsObject?, + results: freezed == results + ? _value._results + : results // ignore: cast_nullable_to_non_nullable + as List?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$RunStepDetailsToolCallsFileSearchImpl + extends _RunStepDetailsToolCallsFileSearch { + const _$RunStepDetailsToolCallsFileSearchImpl( + {@JsonKey(name: 'ranking_options', includeIfNull: false) + this.rankingOptions, + @JsonKey(includeIfNull: false) + final List? results}) + : _results = results, + super._(); + + factory _$RunStepDetailsToolCallsFileSearchImpl.fromJson( + Map json) => + _$$RunStepDetailsToolCallsFileSearchImplFromJson(json); + + /// The ranking options for the file search. + @override + @JsonKey(name: 'ranking_options', includeIfNull: false) + final RunStepDetailsToolCallsFileSearchRankingOptionsObject? rankingOptions; + + /// The results of the file search. + final List? _results; + + /// The results of the file search. + @override + @JsonKey(includeIfNull: false) + List? get results { + final value = _results; + if (value == null) return null; + if (_results is EqualUnmodifiableListView) return _results; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(value); + } + + @override + String toString() { + return 'RunStepDetailsToolCallsFileSearch(rankingOptions: $rankingOptions, results: $results)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$RunStepDetailsToolCallsFileSearchImpl && + (identical(other.rankingOptions, rankingOptions) || + other.rankingOptions == rankingOptions) && + const DeepCollectionEquality().equals(other._results, _results)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, rankingOptions, + const DeepCollectionEquality().hash(_results)); + + /// Create a copy of RunStepDetailsToolCallsFileSearch + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$RunStepDetailsToolCallsFileSearchImplCopyWith< + _$RunStepDetailsToolCallsFileSearchImpl> + get copyWith => __$$RunStepDetailsToolCallsFileSearchImplCopyWithImpl< + _$RunStepDetailsToolCallsFileSearchImpl>(this, _$identity); + + @override + Map toJson() { + return _$$RunStepDetailsToolCallsFileSearchImplToJson( + this, + ); + } +} + +abstract class _RunStepDetailsToolCallsFileSearch + extends RunStepDetailsToolCallsFileSearch { + const factory _RunStepDetailsToolCallsFileSearch( + {@JsonKey(name: 'ranking_options', includeIfNull: false) + final RunStepDetailsToolCallsFileSearchRankingOptionsObject? + rankingOptions, + @JsonKey(includeIfNull: false) + final List? results}) = + _$RunStepDetailsToolCallsFileSearchImpl; + const _RunStepDetailsToolCallsFileSearch._() : super._(); + + factory _RunStepDetailsToolCallsFileSearch.fromJson( + Map json) = + _$RunStepDetailsToolCallsFileSearchImpl.fromJson; + + /// The ranking options for the file search. + @override + @JsonKey(name: 'ranking_options', includeIfNull: false) + RunStepDetailsToolCallsFileSearchRankingOptionsObject? get rankingOptions; + + /// The results of the file search. + @override + @JsonKey(includeIfNull: false) + List? get results; + + /// Create a copy of RunStepDetailsToolCallsFileSearch + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$RunStepDetailsToolCallsFileSearchImplCopyWith< + _$RunStepDetailsToolCallsFileSearchImpl> + get copyWith => throw _privateConstructorUsedError; +} + +RunStepDetailsToolCallsFileSearchRankingOptionsObject + _$RunStepDetailsToolCallsFileSearchRankingOptionsObjectFromJson( + Map json) { + return _RunStepDetailsToolCallsFileSearchRankingOptionsObject.fromJson(json); +} + +/// @nodoc +mixin _$RunStepDetailsToolCallsFileSearchRankingOptionsObject { + /// The ranker to use for the file search. If not specified will use the `auto` ranker. + FileSearchRanker get ranker => throw _privateConstructorUsedError; + + /// The score threshold for the file search. All values must be a floating point number between 0 and 1. + @JsonKey(name: 'score_threshold') + double get scoreThreshold => throw _privateConstructorUsedError; + + /// Serializes this RunStepDetailsToolCallsFileSearchRankingOptionsObject to a JSON map. + Map toJson() => throw _privateConstructorUsedError; + + /// Create a copy of RunStepDetailsToolCallsFileSearchRankingOptionsObject + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + $RunStepDetailsToolCallsFileSearchRankingOptionsObjectCopyWith< + RunStepDetailsToolCallsFileSearchRankingOptionsObject> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $RunStepDetailsToolCallsFileSearchRankingOptionsObjectCopyWith< + $Res> { + factory $RunStepDetailsToolCallsFileSearchRankingOptionsObjectCopyWith( + RunStepDetailsToolCallsFileSearchRankingOptionsObject value, + $Res Function(RunStepDetailsToolCallsFileSearchRankingOptionsObject) + then) = + _$RunStepDetailsToolCallsFileSearchRankingOptionsObjectCopyWithImpl<$Res, + RunStepDetailsToolCallsFileSearchRankingOptionsObject>; + @useResult + $Res call( + {FileSearchRanker ranker, + @JsonKey(name: 'score_threshold') double scoreThreshold}); +} + +/// @nodoc +class _$RunStepDetailsToolCallsFileSearchRankingOptionsObjectCopyWithImpl<$Res, + $Val extends RunStepDetailsToolCallsFileSearchRankingOptionsObject> + implements + $RunStepDetailsToolCallsFileSearchRankingOptionsObjectCopyWith<$Res> { + _$RunStepDetailsToolCallsFileSearchRankingOptionsObjectCopyWithImpl( + this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of RunStepDetailsToolCallsFileSearchRankingOptionsObject + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? ranker = null, + Object? scoreThreshold = null, + }) { + return _then(_value.copyWith( + ranker: null == ranker + ? _value.ranker + : ranker // ignore: cast_nullable_to_non_nullable + as FileSearchRanker, + scoreThreshold: null == scoreThreshold + ? _value.scoreThreshold + : scoreThreshold // ignore: cast_nullable_to_non_nullable + as double, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$RunStepDetailsToolCallsFileSearchRankingOptionsObjectImplCopyWith< + $Res> + implements + $RunStepDetailsToolCallsFileSearchRankingOptionsObjectCopyWith<$Res> { + factory _$$RunStepDetailsToolCallsFileSearchRankingOptionsObjectImplCopyWith( + _$RunStepDetailsToolCallsFileSearchRankingOptionsObjectImpl value, + $Res Function( + _$RunStepDetailsToolCallsFileSearchRankingOptionsObjectImpl) + then) = + __$$RunStepDetailsToolCallsFileSearchRankingOptionsObjectImplCopyWithImpl< + $Res>; + @override + @useResult + $Res call( + {FileSearchRanker ranker, + @JsonKey(name: 'score_threshold') double scoreThreshold}); +} + +/// @nodoc +class __$$RunStepDetailsToolCallsFileSearchRankingOptionsObjectImplCopyWithImpl< + $Res> + extends _$RunStepDetailsToolCallsFileSearchRankingOptionsObjectCopyWithImpl< + $Res, _$RunStepDetailsToolCallsFileSearchRankingOptionsObjectImpl> + implements + _$$RunStepDetailsToolCallsFileSearchRankingOptionsObjectImplCopyWith< + $Res> { + __$$RunStepDetailsToolCallsFileSearchRankingOptionsObjectImplCopyWithImpl( + _$RunStepDetailsToolCallsFileSearchRankingOptionsObjectImpl _value, + $Res Function(_$RunStepDetailsToolCallsFileSearchRankingOptionsObjectImpl) + _then) + : super(_value, _then); + + /// Create a copy of RunStepDetailsToolCallsFileSearchRankingOptionsObject + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? ranker = null, + Object? scoreThreshold = null, + }) { + return _then(_$RunStepDetailsToolCallsFileSearchRankingOptionsObjectImpl( + ranker: null == ranker + ? _value.ranker + : ranker // ignore: cast_nullable_to_non_nullable + as FileSearchRanker, + scoreThreshold: null == scoreThreshold + ? _value.scoreThreshold + : scoreThreshold // ignore: cast_nullable_to_non_nullable + as double, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$RunStepDetailsToolCallsFileSearchRankingOptionsObjectImpl + extends _RunStepDetailsToolCallsFileSearchRankingOptionsObject { + const _$RunStepDetailsToolCallsFileSearchRankingOptionsObjectImpl( + {required this.ranker, + @JsonKey(name: 'score_threshold') required this.scoreThreshold}) + : super._(); + + factory _$RunStepDetailsToolCallsFileSearchRankingOptionsObjectImpl.fromJson( + Map json) => + _$$RunStepDetailsToolCallsFileSearchRankingOptionsObjectImplFromJson( + json); + + /// The ranker to use for the file search. If not specified will use the `auto` ranker. + @override + final FileSearchRanker ranker; + + /// The score threshold for the file search. All values must be a floating point number between 0 and 1. + @override + @JsonKey(name: 'score_threshold') + final double scoreThreshold; + + @override + String toString() { + return 'RunStepDetailsToolCallsFileSearchRankingOptionsObject(ranker: $ranker, scoreThreshold: $scoreThreshold)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other + is _$RunStepDetailsToolCallsFileSearchRankingOptionsObjectImpl && + (identical(other.ranker, ranker) || other.ranker == ranker) && + (identical(other.scoreThreshold, scoreThreshold) || + other.scoreThreshold == scoreThreshold)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, ranker, scoreThreshold); + + /// Create a copy of RunStepDetailsToolCallsFileSearchRankingOptionsObject + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$RunStepDetailsToolCallsFileSearchRankingOptionsObjectImplCopyWith< + _$RunStepDetailsToolCallsFileSearchRankingOptionsObjectImpl> + get copyWith => + __$$RunStepDetailsToolCallsFileSearchRankingOptionsObjectImplCopyWithImpl< + _$RunStepDetailsToolCallsFileSearchRankingOptionsObjectImpl>( + this, _$identity); + + @override + Map toJson() { + return _$$RunStepDetailsToolCallsFileSearchRankingOptionsObjectImplToJson( + this, + ); + } +} + +abstract class _RunStepDetailsToolCallsFileSearchRankingOptionsObject + extends RunStepDetailsToolCallsFileSearchRankingOptionsObject { + const factory _RunStepDetailsToolCallsFileSearchRankingOptionsObject( + {required final FileSearchRanker ranker, + @JsonKey(name: 'score_threshold') + required final double scoreThreshold}) = + _$RunStepDetailsToolCallsFileSearchRankingOptionsObjectImpl; + const _RunStepDetailsToolCallsFileSearchRankingOptionsObject._() : super._(); + + factory _RunStepDetailsToolCallsFileSearchRankingOptionsObject.fromJson( + Map json) = + _$RunStepDetailsToolCallsFileSearchRankingOptionsObjectImpl.fromJson; + + /// The ranker to use for the file search. If not specified will use the `auto` ranker. + @override + FileSearchRanker get ranker; + + /// The score threshold for the file search. All values must be a floating point number between 0 and 1. + @override + @JsonKey(name: 'score_threshold') + double get scoreThreshold; + + /// Create a copy of RunStepDetailsToolCallsFileSearchRankingOptionsObject + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$RunStepDetailsToolCallsFileSearchRankingOptionsObjectImplCopyWith< + _$RunStepDetailsToolCallsFileSearchRankingOptionsObjectImpl> + get copyWith => throw _privateConstructorUsedError; +} + +RunStepDetailsToolCallsFileSearchResultObject + _$RunStepDetailsToolCallsFileSearchResultObjectFromJson( + Map json) { + return _RunStepDetailsToolCallsFileSearchResultObject.fromJson(json); +} + +/// @nodoc +mixin _$RunStepDetailsToolCallsFileSearchResultObject { + /// The ID of the file that result was found in. + @JsonKey(name: 'file_id') + String get fileId => throw _privateConstructorUsedError; + + /// The name of the file that result was found in. + @JsonKey(name: 'file_name') + String get fileName => throw _privateConstructorUsedError; + + /// The score of the result. All values must be a floating point number between 0 and 1. + double get score => throw _privateConstructorUsedError; + + /// The content of the result that was found. The content is only included if requested via the include + /// query parameter. + @JsonKey(includeIfNull: false) + List? get content => + throw _privateConstructorUsedError; + + /// Serializes this RunStepDetailsToolCallsFileSearchResultObject to a JSON map. + Map toJson() => throw _privateConstructorUsedError; + + /// Create a copy of RunStepDetailsToolCallsFileSearchResultObject + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + $RunStepDetailsToolCallsFileSearchResultObjectCopyWith< + RunStepDetailsToolCallsFileSearchResultObject> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $RunStepDetailsToolCallsFileSearchResultObjectCopyWith<$Res> { + factory $RunStepDetailsToolCallsFileSearchResultObjectCopyWith( + RunStepDetailsToolCallsFileSearchResultObject value, + $Res Function(RunStepDetailsToolCallsFileSearchResultObject) then) = + _$RunStepDetailsToolCallsFileSearchResultObjectCopyWithImpl<$Res, + RunStepDetailsToolCallsFileSearchResultObject>; + @useResult + $Res call( + {@JsonKey(name: 'file_id') String fileId, + @JsonKey(name: 'file_name') String fileName, + double score, + @JsonKey(includeIfNull: false) + List? content}); +} + +/// @nodoc +class _$RunStepDetailsToolCallsFileSearchResultObjectCopyWithImpl<$Res, + $Val extends RunStepDetailsToolCallsFileSearchResultObject> + implements $RunStepDetailsToolCallsFileSearchResultObjectCopyWith<$Res> { + _$RunStepDetailsToolCallsFileSearchResultObjectCopyWithImpl( + this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of RunStepDetailsToolCallsFileSearchResultObject + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? fileId = null, + Object? fileName = null, + Object? score = null, + Object? content = freezed, + }) { + return _then(_value.copyWith( + fileId: null == fileId + ? _value.fileId + : fileId // ignore: cast_nullable_to_non_nullable + as String, + fileName: null == fileName + ? _value.fileName + : fileName // ignore: cast_nullable_to_non_nullable + as String, + score: null == score + ? _value.score + : score // ignore: cast_nullable_to_non_nullable + as double, + content: freezed == content + ? _value.content + : content // ignore: cast_nullable_to_non_nullable + as List?, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$RunStepDetailsToolCallsFileSearchResultObjectImplCopyWith< + $Res> + implements $RunStepDetailsToolCallsFileSearchResultObjectCopyWith<$Res> { + factory _$$RunStepDetailsToolCallsFileSearchResultObjectImplCopyWith( + _$RunStepDetailsToolCallsFileSearchResultObjectImpl value, + $Res Function(_$RunStepDetailsToolCallsFileSearchResultObjectImpl) + then) = + __$$RunStepDetailsToolCallsFileSearchResultObjectImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {@JsonKey(name: 'file_id') String fileId, + @JsonKey(name: 'file_name') String fileName, + double score, + @JsonKey(includeIfNull: false) + List? content}); +} + +/// @nodoc +class __$$RunStepDetailsToolCallsFileSearchResultObjectImplCopyWithImpl<$Res> + extends _$RunStepDetailsToolCallsFileSearchResultObjectCopyWithImpl<$Res, + _$RunStepDetailsToolCallsFileSearchResultObjectImpl> + implements + _$$RunStepDetailsToolCallsFileSearchResultObjectImplCopyWith<$Res> { + __$$RunStepDetailsToolCallsFileSearchResultObjectImplCopyWithImpl( + _$RunStepDetailsToolCallsFileSearchResultObjectImpl _value, + $Res Function(_$RunStepDetailsToolCallsFileSearchResultObjectImpl) _then) + : super(_value, _then); + + /// Create a copy of RunStepDetailsToolCallsFileSearchResultObject + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? fileId = null, + Object? fileName = null, + Object? score = null, + Object? content = freezed, + }) { + return _then(_$RunStepDetailsToolCallsFileSearchResultObjectImpl( + fileId: null == fileId + ? _value.fileId + : fileId // ignore: cast_nullable_to_non_nullable + as String, + fileName: null == fileName + ? _value.fileName + : fileName // ignore: cast_nullable_to_non_nullable + as String, + score: null == score + ? _value.score + : score // ignore: cast_nullable_to_non_nullable + as double, + content: freezed == content + ? _value._content + : content // ignore: cast_nullable_to_non_nullable + as List?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$RunStepDetailsToolCallsFileSearchResultObjectImpl + extends _RunStepDetailsToolCallsFileSearchResultObject { + const _$RunStepDetailsToolCallsFileSearchResultObjectImpl( + {@JsonKey(name: 'file_id') required this.fileId, + @JsonKey(name: 'file_name') required this.fileName, + required this.score, + @JsonKey(includeIfNull: false) + final List? content}) + : _content = content, + super._(); + + factory _$RunStepDetailsToolCallsFileSearchResultObjectImpl.fromJson( + Map json) => + _$$RunStepDetailsToolCallsFileSearchResultObjectImplFromJson(json); + + /// The ID of the file that result was found in. + @override + @JsonKey(name: 'file_id') + final String fileId; + + /// The name of the file that result was found in. + @override + @JsonKey(name: 'file_name') + final String fileName; + + /// The score of the result. All values must be a floating point number between 0 and 1. + @override + final double score; + + /// The content of the result that was found. The content is only included if requested via the include + /// query parameter. + final List? _content; + + /// The content of the result that was found. The content is only included if requested via the include + /// query parameter. + @override + @JsonKey(includeIfNull: false) + List? get content { + final value = _content; + if (value == null) return null; + if (_content is EqualUnmodifiableListView) return _content; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(value); + } + + @override + String toString() { + return 'RunStepDetailsToolCallsFileSearchResultObject(fileId: $fileId, fileName: $fileName, score: $score, content: $content)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$RunStepDetailsToolCallsFileSearchResultObjectImpl && + (identical(other.fileId, fileId) || other.fileId == fileId) && + (identical(other.fileName, fileName) || + other.fileName == fileName) && + (identical(other.score, score) || other.score == score) && + const DeepCollectionEquality().equals(other._content, _content)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, fileId, fileName, score, + const DeepCollectionEquality().hash(_content)); + + /// Create a copy of RunStepDetailsToolCallsFileSearchResultObject + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$RunStepDetailsToolCallsFileSearchResultObjectImplCopyWith< + _$RunStepDetailsToolCallsFileSearchResultObjectImpl> + get copyWith => + __$$RunStepDetailsToolCallsFileSearchResultObjectImplCopyWithImpl< + _$RunStepDetailsToolCallsFileSearchResultObjectImpl>( + this, _$identity); + + @override + Map toJson() { + return _$$RunStepDetailsToolCallsFileSearchResultObjectImplToJson( + this, + ); + } +} + +abstract class _RunStepDetailsToolCallsFileSearchResultObject + extends RunStepDetailsToolCallsFileSearchResultObject { + const factory _RunStepDetailsToolCallsFileSearchResultObject( + {@JsonKey(name: 'file_id') required final String fileId, + @JsonKey(name: 'file_name') required final String fileName, + required final double score, + @JsonKey(includeIfNull: false) + final List? + content}) = _$RunStepDetailsToolCallsFileSearchResultObjectImpl; + const _RunStepDetailsToolCallsFileSearchResultObject._() : super._(); + + factory _RunStepDetailsToolCallsFileSearchResultObject.fromJson( + Map json) = + _$RunStepDetailsToolCallsFileSearchResultObjectImpl.fromJson; + + /// The ID of the file that result was found in. + @override + @JsonKey(name: 'file_id') + String get fileId; + + /// The name of the file that result was found in. + @override + @JsonKey(name: 'file_name') + String get fileName; + + /// The score of the result. All values must be a floating point number between 0 and 1. + @override + double get score; + + /// The content of the result that was found. The content is only included if requested via the include + /// query parameter. + @override + @JsonKey(includeIfNull: false) + List? get content; + + /// Create a copy of RunStepDetailsToolCallsFileSearchResultObject + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$RunStepDetailsToolCallsFileSearchResultObjectImplCopyWith< + _$RunStepDetailsToolCallsFileSearchResultObjectImpl> + get copyWith => throw _privateConstructorUsedError; +} + +RunStepDetailsToolCallsFileSearchResultContent + _$RunStepDetailsToolCallsFileSearchResultContentFromJson( + Map json) { + return _RunStepDetailsToolCallsFileSearchResultContent.fromJson(json); +} + +/// @nodoc +mixin _$RunStepDetailsToolCallsFileSearchResultContent { + /// The type of the content. + String get type => throw _privateConstructorUsedError; + + /// The text content of the file. + @JsonKey(includeIfNull: false) + String? get text => throw _privateConstructorUsedError; + + /// Serializes this RunStepDetailsToolCallsFileSearchResultContent to a JSON map. + Map toJson() => throw _privateConstructorUsedError; + + /// Create a copy of RunStepDetailsToolCallsFileSearchResultContent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + $RunStepDetailsToolCallsFileSearchResultContentCopyWith< + RunStepDetailsToolCallsFileSearchResultContent> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $RunStepDetailsToolCallsFileSearchResultContentCopyWith<$Res> { + factory $RunStepDetailsToolCallsFileSearchResultContentCopyWith( + RunStepDetailsToolCallsFileSearchResultContent value, + $Res Function(RunStepDetailsToolCallsFileSearchResultContent) then) = + _$RunStepDetailsToolCallsFileSearchResultContentCopyWithImpl<$Res, + RunStepDetailsToolCallsFileSearchResultContent>; + @useResult + $Res call({String type, @JsonKey(includeIfNull: false) String? text}); +} + +/// @nodoc +class _$RunStepDetailsToolCallsFileSearchResultContentCopyWithImpl<$Res, + $Val extends RunStepDetailsToolCallsFileSearchResultContent> + implements $RunStepDetailsToolCallsFileSearchResultContentCopyWith<$Res> { + _$RunStepDetailsToolCallsFileSearchResultContentCopyWithImpl( + this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of RunStepDetailsToolCallsFileSearchResultContent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? type = null, + Object? text = freezed, + }) { + return _then(_value.copyWith( + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as String, + text: freezed == text + ? _value.text + : text // ignore: cast_nullable_to_non_nullable + as String?, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$RunStepDetailsToolCallsFileSearchResultContentImplCopyWith< + $Res> + implements $RunStepDetailsToolCallsFileSearchResultContentCopyWith<$Res> { + factory _$$RunStepDetailsToolCallsFileSearchResultContentImplCopyWith( + _$RunStepDetailsToolCallsFileSearchResultContentImpl value, + $Res Function(_$RunStepDetailsToolCallsFileSearchResultContentImpl) + then) = + __$$RunStepDetailsToolCallsFileSearchResultContentImplCopyWithImpl<$Res>; + @override + @useResult + $Res call({String type, @JsonKey(includeIfNull: false) String? text}); +} + +/// @nodoc +class __$$RunStepDetailsToolCallsFileSearchResultContentImplCopyWithImpl<$Res> + extends _$RunStepDetailsToolCallsFileSearchResultContentCopyWithImpl<$Res, + _$RunStepDetailsToolCallsFileSearchResultContentImpl> + implements + _$$RunStepDetailsToolCallsFileSearchResultContentImplCopyWith<$Res> { + __$$RunStepDetailsToolCallsFileSearchResultContentImplCopyWithImpl( + _$RunStepDetailsToolCallsFileSearchResultContentImpl _value, + $Res Function(_$RunStepDetailsToolCallsFileSearchResultContentImpl) _then) + : super(_value, _then); + + /// Create a copy of RunStepDetailsToolCallsFileSearchResultContent + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? type = null, + Object? text = freezed, + }) { + return _then(_$RunStepDetailsToolCallsFileSearchResultContentImpl( + type: null == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as String, + text: freezed == text + ? _value.text + : text // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$RunStepDetailsToolCallsFileSearchResultContentImpl + extends _RunStepDetailsToolCallsFileSearchResultContent { + const _$RunStepDetailsToolCallsFileSearchResultContentImpl( + {this.type = 'text', @JsonKey(includeIfNull: false) this.text}) + : super._(); + + factory _$RunStepDetailsToolCallsFileSearchResultContentImpl.fromJson( + Map json) => + _$$RunStepDetailsToolCallsFileSearchResultContentImplFromJson(json); + + /// The type of the content. + @override + @JsonKey() + final String type; + + /// The text content of the file. + @override + @JsonKey(includeIfNull: false) + final String? text; + + @override + String toString() { + return 'RunStepDetailsToolCallsFileSearchResultContent(type: $type, text: $text)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$RunStepDetailsToolCallsFileSearchResultContentImpl && + (identical(other.type, type) || other.type == type) && + (identical(other.text, text) || other.text == text)); + } + + @JsonKey(includeFromJson: false, includeToJson: false) + @override + int get hashCode => Object.hash(runtimeType, type, text); + + /// Create a copy of RunStepDetailsToolCallsFileSearchResultContent + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$RunStepDetailsToolCallsFileSearchResultContentImplCopyWith< + _$RunStepDetailsToolCallsFileSearchResultContentImpl> + get copyWith => + __$$RunStepDetailsToolCallsFileSearchResultContentImplCopyWithImpl< + _$RunStepDetailsToolCallsFileSearchResultContentImpl>( + this, _$identity); + + @override + Map toJson() { + return _$$RunStepDetailsToolCallsFileSearchResultContentImplToJson( + this, + ); + } +} + +abstract class _RunStepDetailsToolCallsFileSearchResultContent + extends RunStepDetailsToolCallsFileSearchResultContent { + const factory _RunStepDetailsToolCallsFileSearchResultContent( + {final String type, + @JsonKey(includeIfNull: false) final String? text}) = + _$RunStepDetailsToolCallsFileSearchResultContentImpl; + const _RunStepDetailsToolCallsFileSearchResultContent._() : super._(); + + factory _RunStepDetailsToolCallsFileSearchResultContent.fromJson( + Map json) = + _$RunStepDetailsToolCallsFileSearchResultContentImpl.fromJson; + + /// The type of the content. + @override + String get type; + + /// The text content of the file. + @override + @JsonKey(includeIfNull: false) + String? get text; + + /// Create a copy of RunStepDetailsToolCallsFileSearchResultContent + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$RunStepDetailsToolCallsFileSearchResultContentImplCopyWith< + _$RunStepDetailsToolCallsFileSearchResultContentImpl> + get copyWith => throw _privateConstructorUsedError; +} + RunStepCompletionUsage _$RunStepCompletionUsageFromJson( Map json) { return _RunStepCompletionUsage.fromJson(json); @@ -57987,11 +59172,20 @@ 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](https://platform.openai.com/docs/assistants/tools/file-search/number-of-chunks-returned) for more information. + /// Note that the file search tool may output fewer than `max_num_results` results. See the + /// [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search/customizing-file-search-settings) + /// for more information. @JsonKey(name: 'max_num_results', includeIfNull: false) int? get maxNumResults => throw _privateConstructorUsedError; + /// The ranking options for the file search. + /// + /// See the [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search/customizing-file-search-settings) + /// for more information. + @JsonKey(name: 'ranking_options', includeIfNull: false) + FileSearchRankingOptions? get rankingOptions => + throw _privateConstructorUsedError; + /// Serializes this AssistantToolsFileSearchFileSearch to a JSON map. Map toJson() => throw _privateConstructorUsedError; @@ -58013,7 +59207,11 @@ abstract class $AssistantToolsFileSearchFileSearchCopyWith<$Res> { @useResult $Res call( {@JsonKey(name: 'max_num_results', includeIfNull: false) - int? maxNumResults}); + int? maxNumResults, + @JsonKey(name: 'ranking_options', includeIfNull: false) + FileSearchRankingOptions? rankingOptions}); + + $FileSearchRankingOptionsCopyWith<$Res>? get rankingOptions; } /// @nodoc @@ -58033,14 +59231,34 @@ class _$AssistantToolsFileSearchFileSearchCopyWithImpl<$Res, @override $Res call({ Object? maxNumResults = freezed, + Object? rankingOptions = freezed, }) { return _then(_value.copyWith( maxNumResults: freezed == maxNumResults ? _value.maxNumResults : maxNumResults // ignore: cast_nullable_to_non_nullable as int?, + rankingOptions: freezed == rankingOptions + ? _value.rankingOptions + : rankingOptions // ignore: cast_nullable_to_non_nullable + as FileSearchRankingOptions?, ) as $Val); } + + /// Create a copy of AssistantToolsFileSearchFileSearch + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $FileSearchRankingOptionsCopyWith<$Res>? get rankingOptions { + if (_value.rankingOptions == null) { + return null; + } + + return $FileSearchRankingOptionsCopyWith<$Res>(_value.rankingOptions!, + (value) { + return _then(_value.copyWith(rankingOptions: value) as $Val); + }); + } } /// @nodoc @@ -58054,7 +59272,12 @@ abstract class _$$AssistantToolsFileSearchFileSearchImplCopyWith<$Res> @useResult $Res call( {@JsonKey(name: 'max_num_results', includeIfNull: false) - int? maxNumResults}); + int? maxNumResults, + @JsonKey(name: 'ranking_options', includeIfNull: false) + FileSearchRankingOptions? rankingOptions}); + + @override + $FileSearchRankingOptionsCopyWith<$Res>? get rankingOptions; } /// @nodoc @@ -58073,12 +59296,17 @@ class __$$AssistantToolsFileSearchFileSearchImplCopyWithImpl<$Res> @override $Res call({ Object? maxNumResults = freezed, + Object? rankingOptions = freezed, }) { return _then(_$AssistantToolsFileSearchFileSearchImpl( maxNumResults: freezed == maxNumResults ? _value.maxNumResults : maxNumResults // ignore: cast_nullable_to_non_nullable as int?, + rankingOptions: freezed == rankingOptions + ? _value.rankingOptions + : rankingOptions // ignore: cast_nullable_to_non_nullable + as FileSearchRankingOptions?, )); } } @@ -58089,7 +59317,9 @@ class _$AssistantToolsFileSearchFileSearchImpl extends _AssistantToolsFileSearchFileSearch { const _$AssistantToolsFileSearchFileSearchImpl( {@JsonKey(name: 'max_num_results', includeIfNull: false) - this.maxNumResults}) + this.maxNumResults, + @JsonKey(name: 'ranking_options', includeIfNull: false) + this.rankingOptions}) : super._(); factory _$AssistantToolsFileSearchFileSearchImpl.fromJson( @@ -58099,15 +59329,24 @@ class _$AssistantToolsFileSearchFileSearchImpl /// 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](https://platform.openai.com/docs/assistants/tools/file-search/number-of-chunks-returned) for more information. + /// Note that the file search tool may output fewer than `max_num_results` results. See the + /// [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search/customizing-file-search-settings) + /// for more information. @override @JsonKey(name: 'max_num_results', includeIfNull: false) final int? maxNumResults; + /// The ranking options for the file search. + /// + /// See the [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search/customizing-file-search-settings) + /// for more information. + @override + @JsonKey(name: 'ranking_options', includeIfNull: false) + final FileSearchRankingOptions? rankingOptions; + @override String toString() { - return 'AssistantToolsFileSearchFileSearch(maxNumResults: $maxNumResults)'; + return 'AssistantToolsFileSearchFileSearch(maxNumResults: $maxNumResults, rankingOptions: $rankingOptions)'; } @override @@ -58116,12 +59355,14 @@ class _$AssistantToolsFileSearchFileSearchImpl (other.runtimeType == runtimeType && other is _$AssistantToolsFileSearchFileSearchImpl && (identical(other.maxNumResults, maxNumResults) || - other.maxNumResults == maxNumResults)); + other.maxNumResults == maxNumResults) && + (identical(other.rankingOptions, rankingOptions) || + other.rankingOptions == rankingOptions)); } @JsonKey(includeFromJson: false, includeToJson: false) @override - int get hashCode => Object.hash(runtimeType, maxNumResults); + int get hashCode => Object.hash(runtimeType, maxNumResults, rankingOptions); /// Create a copy of AssistantToolsFileSearchFileSearch /// with the given fields replaced by the non-null parameter values. @@ -58144,8 +59385,11 @@ class _$AssistantToolsFileSearchFileSearchImpl abstract class _AssistantToolsFileSearchFileSearch extends AssistantToolsFileSearchFileSearch { const factory _AssistantToolsFileSearchFileSearch( - {@JsonKey(name: 'max_num_results', includeIfNull: false) - final int? maxNumResults}) = _$AssistantToolsFileSearchFileSearchImpl; + {@JsonKey(name: 'max_num_results', includeIfNull: false) + final int? maxNumResults, + @JsonKey(name: 'ranking_options', includeIfNull: false) + final FileSearchRankingOptions? rankingOptions}) = + _$AssistantToolsFileSearchFileSearchImpl; const _AssistantToolsFileSearchFileSearch._() : super._(); factory _AssistantToolsFileSearchFileSearch.fromJson( @@ -58155,12 +59399,21 @@ abstract class _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](https://platform.openai.com/docs/assistants/tools/file-search/number-of-chunks-returned) for more information. + /// Note that the file search tool may output fewer than `max_num_results` results. See the + /// [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search/customizing-file-search-settings) + /// for more information. @override @JsonKey(name: 'max_num_results', includeIfNull: false) int? get maxNumResults; + /// The ranking options for the file search. + /// + /// See the [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search/customizing-file-search-settings) + /// for more information. + @override + @JsonKey(name: 'ranking_options', includeIfNull: false) + FileSearchRankingOptions? get rankingOptions; + /// Create a copy of AssistantToolsFileSearchFileSearch /// with the given fields replaced by the non-null parameter values. @override @@ -63844,8 +65097,11 @@ mixin _$RunStepDetailsToolCalls { @JsonKey(name: 'code_interpreter') RunStepDetailsToolCallsCodeObjectCodeInterpreter codeInterpreter) codeInterpreter, - required TResult Function(String id, String type, - @JsonKey(name: 'file_search') Map fileSearch) + required TResult Function( + String id, + String type, + @JsonKey(name: 'file_search') + RunStepDetailsToolCallsFileSearch fileSearch) fileSearch, required TResult Function( String id, String type, RunStepDetailsToolCallsFunction function) @@ -63860,8 +65116,11 @@ mixin _$RunStepDetailsToolCalls { @JsonKey(name: 'code_interpreter') RunStepDetailsToolCallsCodeObjectCodeInterpreter codeInterpreter)? codeInterpreter, - TResult? Function(String id, String type, - @JsonKey(name: 'file_search') Map fileSearch)? + TResult? Function( + String id, + String type, + @JsonKey(name: 'file_search') + RunStepDetailsToolCallsFileSearch fileSearch)? fileSearch, TResult? Function( String id, String type, RunStepDetailsToolCallsFunction function)? @@ -63876,8 +65135,11 @@ mixin _$RunStepDetailsToolCalls { @JsonKey(name: 'code_interpreter') RunStepDetailsToolCallsCodeObjectCodeInterpreter codeInterpreter)? codeInterpreter, - TResult Function(String id, String type, - @JsonKey(name: 'file_search') Map fileSearch)? + TResult Function( + String id, + String type, + @JsonKey(name: 'file_search') + RunStepDetailsToolCallsFileSearch fileSearch)? fileSearch, TResult Function( String id, String type, RunStepDetailsToolCallsFunction function)? @@ -64096,8 +65358,11 @@ class _$RunStepDetailsToolCallsCodeObjectImpl @JsonKey(name: 'code_interpreter') RunStepDetailsToolCallsCodeObjectCodeInterpreter codeInterpreter) codeInterpreter, - required TResult Function(String id, String type, - @JsonKey(name: 'file_search') Map fileSearch) + required TResult Function( + String id, + String type, + @JsonKey(name: 'file_search') + RunStepDetailsToolCallsFileSearch fileSearch) fileSearch, required TResult Function( String id, String type, RunStepDetailsToolCallsFunction function) @@ -64115,8 +65380,11 @@ class _$RunStepDetailsToolCallsCodeObjectImpl @JsonKey(name: 'code_interpreter') RunStepDetailsToolCallsCodeObjectCodeInterpreter codeInterpreter)? codeInterpreter, - TResult? Function(String id, String type, - @JsonKey(name: 'file_search') Map fileSearch)? + TResult? Function( + String id, + String type, + @JsonKey(name: 'file_search') + RunStepDetailsToolCallsFileSearch fileSearch)? fileSearch, TResult? Function( String id, String type, RunStepDetailsToolCallsFunction function)? @@ -64134,8 +65402,11 @@ class _$RunStepDetailsToolCallsCodeObjectImpl @JsonKey(name: 'code_interpreter') RunStepDetailsToolCallsCodeObjectCodeInterpreter codeInterpreter)? codeInterpreter, - TResult Function(String id, String type, - @JsonKey(name: 'file_search') Map fileSearch)? + TResult Function( + String id, + String type, + @JsonKey(name: 'file_search') + RunStepDetailsToolCallsFileSearch fileSearch)? fileSearch, TResult Function( String id, String type, RunStepDetailsToolCallsFunction function)? @@ -64241,7 +65512,10 @@ abstract class _$$RunStepDetailsToolCallsFileSearchObjectImplCopyWith<$Res> $Res call( {String id, String type, - @JsonKey(name: 'file_search') Map fileSearch}); + @JsonKey(name: 'file_search') + RunStepDetailsToolCallsFileSearch fileSearch}); + + $RunStepDetailsToolCallsFileSearchCopyWith<$Res> get fileSearch; } /// @nodoc @@ -64273,11 +65547,22 @@ class __$$RunStepDetailsToolCallsFileSearchObjectImplCopyWithImpl<$Res> : type // ignore: cast_nullable_to_non_nullable as String, fileSearch: null == fileSearch - ? _value._fileSearch + ? _value.fileSearch : fileSearch // ignore: cast_nullable_to_non_nullable - as Map, + as RunStepDetailsToolCallsFileSearch, )); } + + /// Create a copy of RunStepDetailsToolCalls + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $RunStepDetailsToolCallsFileSearchCopyWith<$Res> get fileSearch { + return $RunStepDetailsToolCallsFileSearchCopyWith<$Res>(_value.fileSearch, + (value) { + return _then(_value.copyWith(fileSearch: value)); + }); + } } /// @nodoc @@ -64287,10 +65572,8 @@ class _$RunStepDetailsToolCallsFileSearchObjectImpl const _$RunStepDetailsToolCallsFileSearchObjectImpl( {required this.id, required this.type, - @JsonKey(name: 'file_search') - required final Map fileSearch}) - : _fileSearch = fileSearch, - super._(); + @JsonKey(name: 'file_search') required this.fileSearch}) + : super._(); factory _$RunStepDetailsToolCallsFileSearchObjectImpl.fromJson( Map json) => @@ -64304,17 +65587,10 @@ class _$RunStepDetailsToolCallsFileSearchObjectImpl @override final String type; - /// For now, this is always going to be an empty object. - final Map _fileSearch; - - /// For now, this is always going to be an empty object. + /// The definition of the file search that was called. @override @JsonKey(name: 'file_search') - Map get fileSearch { - if (_fileSearch is EqualUnmodifiableMapView) return _fileSearch; - // ignore: implicit_dynamic_type - return EqualUnmodifiableMapView(_fileSearch); - } + final RunStepDetailsToolCallsFileSearch fileSearch; @override String toString() { @@ -64328,14 +65604,13 @@ class _$RunStepDetailsToolCallsFileSearchObjectImpl other is _$RunStepDetailsToolCallsFileSearchObjectImpl && (identical(other.id, id) || other.id == id) && (identical(other.type, type) || other.type == type) && - const DeepCollectionEquality() - .equals(other._fileSearch, _fileSearch)); + (identical(other.fileSearch, fileSearch) || + other.fileSearch == fileSearch)); } @JsonKey(includeFromJson: false, includeToJson: false) @override - int get hashCode => Object.hash( - runtimeType, id, type, const DeepCollectionEquality().hash(_fileSearch)); + int get hashCode => Object.hash(runtimeType, id, type, fileSearch); /// Create a copy of RunStepDetailsToolCalls /// with the given fields replaced by the non-null parameter values. @@ -64357,8 +65632,11 @@ class _$RunStepDetailsToolCallsFileSearchObjectImpl @JsonKey(name: 'code_interpreter') RunStepDetailsToolCallsCodeObjectCodeInterpreter codeInterpreter) codeInterpreter, - required TResult Function(String id, String type, - @JsonKey(name: 'file_search') Map fileSearch) + required TResult Function( + String id, + String type, + @JsonKey(name: 'file_search') + RunStepDetailsToolCallsFileSearch fileSearch) fileSearch, required TResult Function( String id, String type, RunStepDetailsToolCallsFunction function) @@ -64376,8 +65654,11 @@ class _$RunStepDetailsToolCallsFileSearchObjectImpl @JsonKey(name: 'code_interpreter') RunStepDetailsToolCallsCodeObjectCodeInterpreter codeInterpreter)? codeInterpreter, - TResult? Function(String id, String type, - @JsonKey(name: 'file_search') Map fileSearch)? + TResult? Function( + String id, + String type, + @JsonKey(name: 'file_search') + RunStepDetailsToolCallsFileSearch fileSearch)? fileSearch, TResult? Function( String id, String type, RunStepDetailsToolCallsFunction function)? @@ -64395,8 +65676,11 @@ class _$RunStepDetailsToolCallsFileSearchObjectImpl @JsonKey(name: 'code_interpreter') RunStepDetailsToolCallsCodeObjectCodeInterpreter codeInterpreter)? codeInterpreter, - TResult Function(String id, String type, - @JsonKey(name: 'file_search') Map fileSearch)? + TResult Function( + String id, + String type, + @JsonKey(name: 'file_search') + RunStepDetailsToolCallsFileSearch fileSearch)? fileSearch, TResult Function( String id, String type, RunStepDetailsToolCallsFunction function)? @@ -64461,7 +65745,7 @@ abstract class RunStepDetailsToolCallsFileSearchObject {required final String id, required final String type, @JsonKey(name: 'file_search') - required final Map fileSearch}) = + required final RunStepDetailsToolCallsFileSearch fileSearch}) = _$RunStepDetailsToolCallsFileSearchObjectImpl; const RunStepDetailsToolCallsFileSearchObject._() : super._(); @@ -64477,9 +65761,9 @@ abstract class RunStepDetailsToolCallsFileSearchObject @override String get type; - /// For now, this is always going to be an empty object. + /// The definition of the file search that was called. @JsonKey(name: 'file_search') - Map get fileSearch; + RunStepDetailsToolCallsFileSearch get fileSearch; /// Create a copy of RunStepDetailsToolCalls /// with the given fields replaced by the non-null parameter values. @@ -64614,8 +65898,11 @@ class _$RunStepDetailsToolCallsFunctionObjectImpl @JsonKey(name: 'code_interpreter') RunStepDetailsToolCallsCodeObjectCodeInterpreter codeInterpreter) codeInterpreter, - required TResult Function(String id, String type, - @JsonKey(name: 'file_search') Map fileSearch) + required TResult Function( + String id, + String type, + @JsonKey(name: 'file_search') + RunStepDetailsToolCallsFileSearch fileSearch) fileSearch, required TResult Function( String id, String type, RunStepDetailsToolCallsFunction function) @@ -64633,8 +65920,11 @@ class _$RunStepDetailsToolCallsFunctionObjectImpl @JsonKey(name: 'code_interpreter') RunStepDetailsToolCallsCodeObjectCodeInterpreter codeInterpreter)? codeInterpreter, - TResult? Function(String id, String type, - @JsonKey(name: 'file_search') Map fileSearch)? + TResult? Function( + String id, + String type, + @JsonKey(name: 'file_search') + RunStepDetailsToolCallsFileSearch fileSearch)? fileSearch, TResult? Function( String id, String type, RunStepDetailsToolCallsFunction function)? @@ -64652,8 +65942,11 @@ class _$RunStepDetailsToolCallsFunctionObjectImpl @JsonKey(name: 'code_interpreter') RunStepDetailsToolCallsCodeObjectCodeInterpreter codeInterpreter)? codeInterpreter, - TResult Function(String id, String type, - @JsonKey(name: 'file_search') Map fileSearch)? + TResult Function( + String id, + String type, + @JsonKey(name: 'file_search') + RunStepDetailsToolCallsFileSearch fileSearch)? fileSearch, TResult Function( String id, String type, RunStepDetailsToolCallsFunction function)? 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 d03e9a18..3ffb5c36 100644 --- a/packages/openai_dart/lib/src/generated/schema/schema.g.dart +++ b/packages/openai_dart/lib/src/generated/schema/schema.g.dart @@ -2516,6 +2516,34 @@ Map _$$ListAssistantsResponseImplToJson( 'has_more': instance.hasMore, }; +_$FileSearchRankingOptionsImpl _$$FileSearchRankingOptionsImplFromJson( + Map json) => + _$FileSearchRankingOptionsImpl( + ranker: $enumDecodeNullable(_$FileSearchRankerEnumMap, json['ranker'], + unknownValue: JsonKey.nullForUndefinedEnumValue), + scoreThreshold: (json['score_threshold'] as num?)?.toDouble(), + ); + +Map _$$FileSearchRankingOptionsImplToJson( + _$FileSearchRankingOptionsImpl instance) { + final val = {}; + + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull('ranker', _$FileSearchRankerEnumMap[instance.ranker]); + writeNotNull('score_threshold', instance.scoreThreshold); + return val; +} + +const _$FileSearchRankerEnumMap = { + FileSearchRanker.auto: 'auto', + FileSearchRanker.default20240821: 'default_2024_08_21', +}; + _$AssistantsNamedToolChoiceImpl _$$AssistantsNamedToolChoiceImplFromJson( Map json) => _$AssistantsNamedToolChoiceImpl( @@ -4280,6 +4308,109 @@ Map return val; } +_$RunStepDetailsToolCallsFileSearchImpl + _$$RunStepDetailsToolCallsFileSearchImplFromJson( + Map json) => + _$RunStepDetailsToolCallsFileSearchImpl( + rankingOptions: json['ranking_options'] == null + ? null + : RunStepDetailsToolCallsFileSearchRankingOptionsObject.fromJson( + json['ranking_options'] as Map), + results: (json['results'] as List?) + ?.map((e) => + RunStepDetailsToolCallsFileSearchResultObject.fromJson( + e as Map)) + .toList(), + ); + +Map _$$RunStepDetailsToolCallsFileSearchImplToJson( + _$RunStepDetailsToolCallsFileSearchImpl instance) { + final val = {}; + + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull('ranking_options', instance.rankingOptions?.toJson()); + writeNotNull('results', instance.results?.map((e) => e.toJson()).toList()); + return val; +} + +_$RunStepDetailsToolCallsFileSearchRankingOptionsObjectImpl + _$$RunStepDetailsToolCallsFileSearchRankingOptionsObjectImplFromJson( + Map json) => + _$RunStepDetailsToolCallsFileSearchRankingOptionsObjectImpl( + ranker: $enumDecode(_$FileSearchRankerEnumMap, json['ranker']), + scoreThreshold: (json['score_threshold'] as num).toDouble(), + ); + +Map _$$RunStepDetailsToolCallsFileSearchRankingOptionsObjectImplToJson( + _$RunStepDetailsToolCallsFileSearchRankingOptionsObjectImpl instance) => + { + 'ranker': _$FileSearchRankerEnumMap[instance.ranker]!, + 'score_threshold': instance.scoreThreshold, + }; + +_$RunStepDetailsToolCallsFileSearchResultObjectImpl + _$$RunStepDetailsToolCallsFileSearchResultObjectImplFromJson( + Map json) => + _$RunStepDetailsToolCallsFileSearchResultObjectImpl( + fileId: json['file_id'] as String, + fileName: json['file_name'] as String, + score: (json['score'] as num).toDouble(), + content: (json['content'] as List?) + ?.map((e) => + RunStepDetailsToolCallsFileSearchResultContent.fromJson( + e as Map)) + .toList(), + ); + +Map _$$RunStepDetailsToolCallsFileSearchResultObjectImplToJson( + _$RunStepDetailsToolCallsFileSearchResultObjectImpl instance) { + final val = { + 'file_id': instance.fileId, + 'file_name': instance.fileName, + 'score': instance.score, + }; + + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull('content', instance.content?.map((e) => e.toJson()).toList()); + return val; +} + +_$RunStepDetailsToolCallsFileSearchResultContentImpl + _$$RunStepDetailsToolCallsFileSearchResultContentImplFromJson( + Map json) => + _$RunStepDetailsToolCallsFileSearchResultContentImpl( + type: json['type'] as String? ?? 'text', + text: json['text'] as String?, + ); + +Map + _$$RunStepDetailsToolCallsFileSearchResultContentImplToJson( + _$RunStepDetailsToolCallsFileSearchResultContentImpl instance) { + final val = { + 'type': instance.type, + }; + + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull('text', instance.text); + return val; +} + _$RunStepCompletionUsageImpl _$$RunStepCompletionUsageImplFromJson( Map json) => _$RunStepCompletionUsageImpl( @@ -5302,6 +5433,10 @@ _$AssistantToolsFileSearchFileSearchImpl Map json) => _$AssistantToolsFileSearchFileSearchImpl( maxNumResults: (json['max_num_results'] as num?)?.toInt(), + rankingOptions: json['ranking_options'] == null + ? null + : FileSearchRankingOptions.fromJson( + json['ranking_options'] as Map), ); Map _$$AssistantToolsFileSearchFileSearchImplToJson( @@ -5315,6 +5450,7 @@ Map _$$AssistantToolsFileSearchFileSearchImplToJson( } writeNotNull('max_num_results', instance.maxNumResults); + writeNotNull('ranking_options', instance.rankingOptions?.toJson()); return val; } @@ -5754,7 +5890,8 @@ _$RunStepDetailsToolCallsFileSearchObjectImpl _$RunStepDetailsToolCallsFileSearchObjectImpl( id: json['id'] as String, type: json['type'] as String, - fileSearch: json['file_search'] as Map, + fileSearch: RunStepDetailsToolCallsFileSearch.fromJson( + json['file_search'] as Map), ); Map _$$RunStepDetailsToolCallsFileSearchObjectImplToJson( @@ -5762,7 +5899,7 @@ Map _$$RunStepDetailsToolCallsFileSearchObjectImplToJson( { 'id': instance.id, 'type': instance.type, - 'file_search': instance.fileSearch, + 'file_search': instance.fileSearch.toJson(), }; _$RunStepDetailsToolCallsFunctionObjectImpl diff --git a/packages/openai_dart/oas/openapi_curated.yaml b/packages/openai_dart/oas/openapi_curated.yaml index 9c474cec..4fc465f5 100644 --- a/packages/openai_dart/oas/openapi_curated.yaml +++ b/packages/openai_dart/oas/openapi_curated.yaml @@ -796,6 +796,16 @@ paths: schema: type: string description: The ID of the thread to run. + - name: include + in: query + description: &include_param_description | + A list of additional fields to include in the response. Currently the only supported value is + `step_details.tool_calls[*].file_search.results[*].content` to fetch the file search result content. + + See the [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search/customizing-file-search-settings) + for more information. + schema: + type: string requestBody: required: true content: @@ -968,6 +978,11 @@ paths: description: *pagination_before_param_description schema: type: string + - name: include + in: query + description: *include_param_description + schema: + type: string responses: "200": description: OK @@ -1000,6 +1015,11 @@ paths: schema: type: string description: The ID of the run step to retrieve. + - name: include + in: query + description: *include_param_description + schema: + type: string responses: "200": description: OK @@ -3879,10 +3899,32 @@ components: 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](https://platform.openai.com/docs/assistants/tools/file-search/number-of-chunks-returned) for more information. + Note that the file search tool may output fewer than `max_num_results` results. See the + [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search/customizing-file-search-settings) + for more information. + ranking_options: + $ref: "#/components/schemas/FileSearchRankingOptions" required: - type + FileSearchRankingOptions: + type: object + description: | + The ranking options for the file search. + + See the [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search/customizing-file-search-settings) + for more information. + properties: + ranker: + $ref: "#/components/schemas/FileSearchRanker" + score_threshold: + type: number + description: The score threshold for the file search. All values must be a floating point number between 0 and 1. + minimum: 0 + maximum: 1 + FileSearchRanker: + type: string + description: The ranker to use for the file search. If not specified will use the `auto` ranker. + enum: [ "auto", "default_2024_08_21" ] AssistantToolsFunction: type: object description: Function tool @@ -5653,13 +5695,74 @@ components: type: string description: The type of tool call. This is always going to be `file_search` for this type of tool call. file_search: - type: object - description: For now, this is always going to be an empty object. - additionalProperties: true + $ref: "#/components/schemas/RunStepDetailsToolCallsFileSearch" required: - id - type - file_search + RunStepDetailsToolCallsFileSearch: + type: object + description: The definition of the file search that was called. + properties: + ranking_options: + $ref: "#/components/schemas/RunStepDetailsToolCallsFileSearchRankingOptionsObject" + results: + type: array + description: The results of the file search. + items: + $ref: "#/components/schemas/RunStepDetailsToolCallsFileSearchResultObject" + RunStepDetailsToolCallsFileSearchRankingOptionsObject: + type: object + description: The ranking options for the file search. + properties: + ranker: + $ref: "#/components/schemas/FileSearchRanker" + score_threshold: + type: number + description: | + The score threshold for the file search. All values must be a floating point number between 0 and 1. + minimum: 0 + maximum: 1 + required: + - ranker + - score_threshold + RunStepDetailsToolCallsFileSearchResultObject: + type: object + description: A result instance of the file search. + properties: + file_id: + type: string + description: The ID of the file that result was found in. + file_name: + type: string + description: The name of the file that result was found in. + score: + type: number + description: The score of the result. All values must be a floating point number between 0 and 1. + minimum: 0 + maximum: 1 + content: + type: array + description: | + The content of the result that was found. The content is only included if requested via the include + query parameter. + items: + $ref: "#/components/schemas/RunStepDetailsToolCallsFileSearchResultContent" + required: + - file_id + - file_name + - score + RunStepDetailsToolCallsFileSearchResultContent: + type: object + description: The content of the result that was found. + properties: + type: + type: string + description: The type of the content. + default: text + text: + type: string + description: The text content of the file. RunStepDeltaStepDetailsToolCallsFileSearchObject: type: object description: File search tool call @@ -6298,7 +6401,7 @@ components: - data RunStepStreamEvent: type: object - description: Occurs when a new [run step](https://platform.openai.com/docs/api-reference/runs/step-object) changes state. + description: Occurs when a new [run step](https://platform.openai.com/docs/api-reference/run-steps/step-object) changes state. properties: event: $ref: "#/components/schemas/EventType" @@ -6309,7 +6412,7 @@ components: - data RunStepStreamDeltaEvent: type: object - description: Occurs when a new [run step](https://platform.openai.com/docs/api-reference/runs/step-object) changes state. + description: Occurs when a new [run step](https://platform.openai.com/docs/api-reference/run-steps/step-object) changes state. properties: event: $ref: "#/components/schemas/EventType" diff --git a/packages/openai_dart/oas/openapi_official.yaml b/packages/openai_dart/oas/openapi_official.yaml index 02653404..de7cd98a 100644 --- a/packages/openai_dart/oas/openapi_official.yaml +++ b/packages/openai_dart/oas/openapi_official.yaml @@ -4682,6 +4682,17 @@ paths: schema: type: string description: The ID of the thread to run. + - name: include[] + in: query + description: &include_param_description | + A list of additional fields to include in the response. Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the file search result content. + + See the [file search tool documentation](/docs/assistants/tools/file-search/customizing-file-search-settings) for more information. + schema: + type: array + items: + type: string + enum: [ "step_details.tool_calls[*].file_search.results[*].content" ] requestBody: required: true content: @@ -5642,6 +5653,14 @@ paths: description: *pagination_before_param_description schema: type: string + - name: include[] + in: query + description: *include_param_description + schema: + type: array + items: + type: string + enum: [ "step_details.tool_calls[*].file_search.results[*].content" ] responses: "200": description: OK @@ -5653,7 +5672,7 @@ paths: name: List run steps group: threads beta: true - returns: A list of [run step](/docs/api-reference/runs/step-object) objects. + returns: A list of [run step](/docs/api-reference/run-steps/step-object) objects. examples: request: curl: | @@ -5745,6 +5764,14 @@ paths: schema: type: string description: The ID of the run step to retrieve. + - name: include[] + in: query + description: *include_param_description + schema: + type: array + items: + type: string + enum: [ "step_details.tool_calls[*].file_search.results[*].content" ] responses: "200": description: OK @@ -5756,7 +5783,7 @@ paths: name: Retrieve run step group: threads beta: true - returns: The [run step](/docs/api-reference/runs/step-object) object matching the specified ID. + returns: The [run step](/docs/api-reference/run-steps/step-object) object matching the specified ID. examples: request: curl: | @@ -10803,10 +10830,30 @@ components: 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. + 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/customizing-file-search-settings) for more information. + ranking_options: + $ref: "#/components/schemas/FileSearchRankingOptions" required: - type + FileSearchRankingOptions: + title: File search tool call ranking options + type: object + description: | + The ranking options for the file search. + + See the [file search tool documentation](/docs/assistants/tools/file-search/customizing-file-search-settings) for more information. + properties: + ranker: + type: string + description: The ranker to use for the file search. If not specified will use the `auto` ranker. + enum: [ "auto", "default_2024_08_21" ] + score_threshold: + type: number + description: The score threshold for the file search. All values must be a floating point number between 0 and 1. + minimum: 0 + maximum: 1 + AssistantToolsFileSearchTypeOnly: type: object title: FileSearch tool @@ -12769,11 +12816,72 @@ components: type: object description: For now, this is always going to be an empty object. x-oaiTypeLabel: map + properties: + ranking_options: + $ref: "#/components/schemas/RunStepDetailsToolCallsFileSearchRankingOptionsObject" + results: + type: array + description: The results of the file search. + items: + $ref: "#/components/schemas/RunStepDetailsToolCallsFileSearchResultObject" required: - id - type - file_search + RunStepDetailsToolCallsFileSearchRankingOptionsObject: + title: File search tool call ranking options + type: object + description: The ranking options for the file search. + properties: + ranker: + type: string + description: The ranker used for the file search. + enum: [ "default_2024_08_21" ] + score_threshold: + type: number + description: The score threshold for the file search. All values must be a floating point number between 0 and 1. + minimum: 0 + maximum: 1 + required: + - ranker + - score_threshold + + RunStepDetailsToolCallsFileSearchResultObject: + title: File search tool call result + type: object + description: A result instance of the file search. + x-oaiTypeLabel: map + properties: + file_id: + type: string + description: The ID of the file that result was found in. + file_name: + type: string + description: The name of the file that result was found in. + score: + type: number + description: The score of the result. All values must be a floating point number between 0 and 1. + minimum: 0 + maximum: 1 + content: + type: array + description: The content of the result that was found. The content is only included if requested via the include query parameter. + items: + type: object + properties: + type: + type: string + description: The type of the content. + enum: [ "text" ] + text: + type: string + description: The text content of the file. + required: + - file_id + - file_name + - score + RunStepDeltaStepDetailsToolCallsFileSearchObject: title: File search tool call type: object @@ -13560,9 +13668,9 @@ components: required: - event - data - description: Occurs when a [run step](/docs/api-reference/runs/step-object) is created. + description: Occurs when a [run step](/docs/api-reference/run-steps/step-object) is created. x-oaiMeta: - dataDescription: "`data` is a [run step](/docs/api-reference/runs/step-object)" + dataDescription: "`data` is a [run step](/docs/api-reference/run-steps/step-object)" - type: object properties: event: @@ -13573,9 +13681,9 @@ components: required: - event - data - description: Occurs when a [run step](/docs/api-reference/runs/step-object) moves to an `in_progress` state. + description: Occurs when a [run step](/docs/api-reference/run-steps/step-object) moves to an `in_progress` state. x-oaiMeta: - dataDescription: "`data` is a [run step](/docs/api-reference/runs/step-object)" + dataDescription: "`data` is a [run step](/docs/api-reference/run-steps/step-object)" - type: object properties: event: @@ -13586,7 +13694,7 @@ components: required: - event - data - description: Occurs when parts of a [run step](/docs/api-reference/runs/step-object) are being streamed. + description: Occurs when parts of a [run step](/docs/api-reference/run-steps/step-object) are being streamed. x-oaiMeta: dataDescription: "`data` is a [run step delta](/docs/api-reference/assistants-streaming/run-step-delta-object)" - type: object @@ -13599,9 +13707,9 @@ components: required: - event - data - description: Occurs when a [run step](/docs/api-reference/runs/step-object) is completed. + description: Occurs when a [run step](/docs/api-reference/run-steps/step-object) is completed. x-oaiMeta: - dataDescription: "`data` is a [run step](/docs/api-reference/runs/step-object)" + dataDescription: "`data` is a [run step](/docs/api-reference/run-steps/step-object)" - type: object properties: event: @@ -13612,9 +13720,9 @@ components: required: - event - data - description: Occurs when a [run step](/docs/api-reference/runs/step-object) fails. + description: Occurs when a [run step](/docs/api-reference/run-steps/step-object) fails. x-oaiMeta: - dataDescription: "`data` is a [run step](/docs/api-reference/runs/step-object)" + dataDescription: "`data` is a [run step](/docs/api-reference/run-steps/step-object)" - type: object properties: event: @@ -13625,9 +13733,9 @@ components: required: - event - data - description: Occurs when a [run step](/docs/api-reference/runs/step-object) is cancelled. + description: Occurs when a [run step](/docs/api-reference/run-steps/step-object) is cancelled. x-oaiMeta: - dataDescription: "`data` is a [run step](/docs/api-reference/runs/step-object)" + dataDescription: "`data` is a [run step](/docs/api-reference/run-steps/step-object)" - type: object properties: event: @@ -13638,9 +13746,9 @@ components: required: - event - data - description: Occurs when a [run step](/docs/api-reference/runs/step-object) expires. + description: Occurs when a [run step](/docs/api-reference/run-steps/step-object) expires. x-oaiMeta: - dataDescription: "`data` is a [run step](/docs/api-reference/runs/step-object)" + dataDescription: "`data` is a [run step](/docs/api-reference/run-steps/step-object)" MessageStreamEvent: oneOf: diff --git a/packages/openai_dart/pubspec.yaml b/packages/openai_dart/pubspec.yaml index 91e131b4..f98e6d9a 100644 --- a/packages/openai_dart/pubspec.yaml +++ b/packages/openai_dart/pubspec.yaml @@ -1,5 +1,5 @@ name: openai_dart -description: Dart client for the OpenAI API. Supports completions (GPT-3.5 Turbo), chat (GPT-4o, etc.), embeddings (Embedding v3), images (DALL·E 3), assistants v2 (threads, runs, vector stores, etc.) batch, fine-tuning, etc. +description: Dart client for the OpenAI API. Supports chat (GPT-4o, etc.), completions, embeddings, images (DALL·E 3), assistants (threads, runs, vector stores, etc.), batch, fine-tuning, etc. version: 0.4.1 repository: https://github.com/davidmigloz/langchain_dart/tree/main/packages/openai_dart issue_tracker: https://github.com/davidmigloz/langchain_dart/issues?q=label:p:openai_dart