From 7342a772b47a33a0cbe1f8be7f45a301a24f3bee Mon Sep 17 00:00:00 2001 From: David Miguel Date: Tue, 2 Apr 2024 20:00:54 +0200 Subject: [PATCH] feat: Support generateContent for tuned model in googleai_dart client --- packages/googleai_dart/README.md | 31 +- .../lib/src/generated/client.dart | 243 +- .../src/generated/schema/citation_source.dart | 10 +- .../schema/create_tuned_model_metadata.dart | 2 +- .../schema/embed_content_request.dart | 12 +- .../generated/schema/generation_config.dart | 36 +- .../schema/list_models_response.dart | 10 +- .../schema/list_operations_response.dart | 10 +- .../lib/src/generated/schema/model.dart | 20 +- .../lib/src/generated/schema/schema.dart | 42 +- .../src/generated/schema/schema.freezed.dart | 6961 +++++++++-------- .../lib/src/generated/schema/schema.g.dart | 722 +- .../lib/src/generated/schema/status.dart | 10 +- .../googleai_dart/oas/googleai_discovery.json | 1190 +++ .../oas/googleai_openapi_curated.yaml | 1307 ++-- .../oas/googleai_openapi_official.yaml | 1581 ++-- packages/googleai_dart/oas/main.dart | 2 + .../test/generate_content_test.dart | 1 + 18 files changed, 6745 insertions(+), 5445 deletions(-) create mode 100644 packages/googleai_dart/oas/googleai_discovery.json diff --git a/packages/googleai_dart/README.md b/packages/googleai_dart/README.md index db53b45f..5765c7ff 100644 --- a/packages/googleai_dart/README.md +++ b/packages/googleai_dart/README.md @@ -17,11 +17,10 @@ Unofficial Dart client for [Google AI](https://ai.google.dev) for Developers (Ge **Supported endpoints:** -- Generate content (with streaming support) +- Generate content (with streaming and tuned model support) +- Embed content (with batch support) - Count tokens -- Embed content - Models info -- Tuned models operations - Operations ## Table of contents @@ -33,6 +32,7 @@ Unofficial Dart client for [Google AI](https://ai.google.dev) for Developers (Ge + [Text-and-image input](#text-and-image-input) + [Multi-turn conversations (chat)](#multi-turn-conversations-chat) + [Streaming generated content](#streaming-generated-content) + + [Tuned model](#tuned-model) * [Count tokens](#count-tokens) * [Embedding](#embedding) * [Model info](#model-info) @@ -168,7 +168,7 @@ print(res.candidates?.first.content?.parts?.first.text); By default, `generateContent` returns a response after completing the entire generation process. You can achieve faster interactions by not waiting for the entire result, and instead use `streamGenerateContent` to handle partial results as they become available. ```dart -final stream = await client.streamGenerateContent( +final stream = client.streamGenerateContent( modelId: 'gemini-pro', request: const GenerateContentRequest( contents: [ @@ -190,6 +190,19 @@ stream.listen((final res) P ) ``` +#### Tuned model + +Use the `generateContentTunedModel` method to generate content using a tuned model: + +```dart +final res = await client.generateContentTunedModel( + tunedModelId: 'my-tuned-model', + request: GenerateContentRequest( + //... + ), +); +``` + ### Count tokens When using long prompts, it might be useful to count tokens before sending any content to the model. @@ -254,6 +267,16 @@ print(res); // Model(name: models/gemini-pro, displayName: Gemini Pro, description: The best model... ``` +### Operations + +The following methods are available to manage operations: + +- `listOperations()` +- `deleteOperation(operationId: operationId)` +- `listTunedModelOperations(tunedModelId: tunedModelId)` +- `getTunedModelOperation(tunedModelId: tunedModelId, operationId: operationId)` +- `cancelTunedModelOperation(tunedModelId: tunedModelId, operationId: operationId)` + ## Advance Usage ### Default HTTP client diff --git a/packages/googleai_dart/lib/src/generated/client.dart b/packages/googleai_dart/lib/src/generated/client.dart index ebf48164..7b77dc19 100644 --- a/packages/googleai_dart/lib/src/generated/client.dart +++ b/packages/googleai_dart/lib/src/generated/client.dart @@ -60,7 +60,7 @@ class GoogleAIClientException implements Exception { /// Client for Generative Language API (v.v1) /// -/// The Gemini API allows developers to build generative AI applications using the Gemini model. Large Language Models (LLMs) are a powerful, versatile type of machine learning model that enables computers to comprehend and generate natural language through a series of prompts. The Gemini API is based on Google's next generation LLM, Gemini. It excels at a variety of different tasks like code generation, reasoning, and writing. You can use the Gemini API to build generative AI applications for use cases like content generation, dialogue agents, summarization and classification systems, and more. +/// The Gemini API allows developers to build generative AI applications using Gemini models. Gemini is our most capable model, built from the ground up to be multimodal. It can generalize and seamlessly understand, operate across, and combine different types of information. including language, images, audio, video, and code. You can use the Gemini API for use cases like reasoning across text and images, content generation, dialogue agents, summarization and classification systems, and more. class GoogleAIClient { /// Creates a new GoogleAIClient instance. /// @@ -357,96 +357,56 @@ class GoogleAIClient { } // ------------------------------------------ - // METHOD: cancelTunedModelOperation - // ------------------------------------------ - - /// Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`. Clients can use Operations.GetOperation or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an Operation.error value with a google.rpc.Status.code of 1, corresponding to `Code.CANCELLED`. - /// - /// `tunedModelId`: The id of the tuned model. - /// - /// `operationId`: The id of the operation to cancel. - /// - /// `request`: The request message for Operations.CancelOperation. - /// - /// `POST` `https://generativelanguage.googleapis.com/v1/tunedModels/{tunedModelId}/operations/{operationId}:cancel` - Future cancelTunedModelOperation({ - required String tunedModelId, - required String operationId, - CancelOperationRequest? request, - }) async { - final r = await makeRequest( - baseUrl: 'https://generativelanguage.googleapis.com/v1', - path: '/tunedModels/$tunedModelId/operations/$operationId:cancel', - method: HttpMethod.post, - isMultipart: false, - requestType: 'application/json', - responseType: 'application/json', - body: request, - ); - return Empty.fromJson(_jsonDecode(r)); - } - - // ------------------------------------------ - // METHOD: listTunedModelOperations + // METHOD: listModels // ------------------------------------------ - /// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`. - /// - /// `tunedModelId`: The id of the tuned model. - /// - /// `pageSize`: The standard list page size. - /// - /// `filter`: The filters to apply. + /// Lists models available through the API. /// /// `pageToken`: The token identifying which page to start with. /// - /// `GET` `https://generativelanguage.googleapis.com/v1/tunedModels/{tunedModelId}/operations` - Future listTunedModelOperations({ - required String tunedModelId, - int? pageSize, - String? filter, + /// `pageSize`: The list page size. + /// + /// `GET` `https://generativelanguage.googleapis.com/v1/models` + Future listModels({ String? pageToken, + int? pageSize, }) async { final r = await makeRequest( baseUrl: 'https://generativelanguage.googleapis.com/v1', - path: '/tunedModels/$tunedModelId/operations', + path: '/models', method: HttpMethod.get, isMultipart: false, requestType: '', responseType: 'application/json', queryParams: { - if (pageSize != null) 'pageSize': pageSize, - if (filter != null) 'filter': filter, if (pageToken != null) 'pageToken': pageToken, + if (pageSize != null) 'pageSize': pageSize, }, ); - return ListOperationsResponse.fromJson(_jsonDecode(r)); + return ListModelsResponse.fromJson(_jsonDecode(r)); } // ------------------------------------------ - // METHOD: getTunedModelOperations + // METHOD: getModel // ------------------------------------------ - /// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service. - /// - /// `tunedModelId`: The id of the tuned model. + /// Gets information about a specific Model. /// - /// `operationId`: The id of the operation to get. + /// `modelId`: The id of the model to get. /// - /// `GET` `https://generativelanguage.googleapis.com/v1/tunedModels/{tunedModelId}/operations/{operationId}` - Future getTunedModelOperations({ - required String tunedModelId, - required String operationId, + /// `GET` `https://generativelanguage.googleapis.com/v1/models/{modelId}` + Future getModel({ + required String modelId, }) async { final r = await makeRequest( baseUrl: 'https://generativelanguage.googleapis.com/v1', - path: '/tunedModels/$tunedModelId/operations/$operationId', + path: '/models/$modelId', method: HttpMethod.get, isMultipart: false, requestType: '', responseType: 'application/json', ); - return Operation.fromJson(_jsonDecode(r)); + return Model.fromJson(_jsonDecode(r)); } // ------------------------------------------ @@ -476,6 +436,60 @@ class GoogleAIClient { return GenerateContentResponse.fromJson(_jsonDecode(r)); } + // ------------------------------------------ + // METHOD: embedContent + // ------------------------------------------ + + /// Generates an embedding from the model given an input `Content`. + /// + /// `modelId`: The id of the model to use. + /// + /// `request`: Request containing the `Content` for the model to embed. + /// + /// `POST` `https://generativelanguage.googleapis.com/v1/models/{modelId}:embedContent` + Future embedContent({ + String modelId = 'embedding-001', + EmbedContentRequest? request, + }) async { + final r = await makeRequest( + baseUrl: 'https://generativelanguage.googleapis.com/v1', + path: '/models/$modelId:embedContent', + method: HttpMethod.post, + isMultipart: false, + requestType: 'application/json', + responseType: 'application/json', + body: request, + ); + return EmbedContentResponse.fromJson(_jsonDecode(r)); + } + + // ------------------------------------------ + // METHOD: batchEmbedContents + // ------------------------------------------ + + /// Generates multiple embeddings from the model given input text in a synchronous call. + /// + /// `modelId`: The id of the model to use. + /// + /// `request`: Batch request to get embeddings from the model for a list of prompts. + /// + /// `POST` `https://generativelanguage.googleapis.com/v1/models/{modelId}:batchEmbedContents` + Future batchEmbedContents({ + String modelId = 'embedding-001', + BatchEmbedContentsRequest? request, + }) async { + final r = await makeRequest( + baseUrl: 'https://generativelanguage.googleapis.com/v1', + path: '/models/$modelId:batchEmbedContents', + method: HttpMethod.post, + isMultipart: false, + requestType: 'application/json', + responseType: 'application/json', + body: request, + ); + return BatchEmbedContentsResponse.fromJson(_jsonDecode(r)); + } + // ------------------------------------------ // METHOD: countTokens // ------------------------------------------ @@ -504,110 +518,123 @@ class GoogleAIClient { } // ------------------------------------------ - // METHOD: listModels + // METHOD: generateContentTunedModel // ------------------------------------------ - /// Lists models available through the API. + /// Generates a response from the model given an input `GenerateContentRequest`. /// - /// `pageToken`: The token identifying which page to start with. + /// `tunedModelId`: The id of the tuned model. /// - /// `pageSize`: The list page size. + /// `request`: Request to generate a completion from the model. /// - /// `GET` `https://generativelanguage.googleapis.com/v1/models` - Future listModels({ - String? pageToken, - int? pageSize, + /// `POST` `https://generativelanguage.googleapis.com/v1/tunedModels/{tunedModelId}:generateContent` + Future generateContentTunedModel({ + required String tunedModelId, + GenerateContentRequest? request, }) async { final r = await makeRequest( baseUrl: 'https://generativelanguage.googleapis.com/v1', - path: '/models', - method: HttpMethod.get, + path: '/tunedModels/$tunedModelId:generateContent', + method: HttpMethod.post, isMultipart: false, - requestType: '', + requestType: 'application/json', responseType: 'application/json', - queryParams: { - if (pageToken != null) 'pageToken': pageToken, - if (pageSize != null) 'pageSize': pageSize, - }, + body: request, ); - return ListModelsResponse.fromJson(_jsonDecode(r)); + return GenerateContentResponse.fromJson(_jsonDecode(r)); } // ------------------------------------------ - // METHOD: getModel + // METHOD: listTunedModelOperations // ------------------------------------------ - /// Gets information about a specific Model. + /// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`. /// - /// `modelId`: The id of the model to get. + /// `tunedModelId`: The id of the tuned model. /// - /// `GET` `https://generativelanguage.googleapis.com/v1/models/{modelId}` - Future getModel({ - required String modelId, + /// `pageSize`: The standard list page size. + /// + /// `filter`: The filters to apply. + /// + /// `pageToken`: The token identifying which page to start with. + /// + /// `GET` `https://generativelanguage.googleapis.com/v1/tunedModels/{tunedModelId}/operations` + Future listTunedModelOperations({ + required String tunedModelId, + int? pageSize, + String? filter, + String? pageToken, }) async { final r = await makeRequest( baseUrl: 'https://generativelanguage.googleapis.com/v1', - path: '/models/$modelId', + path: '/tunedModels/$tunedModelId/operations', method: HttpMethod.get, isMultipart: false, requestType: '', responseType: 'application/json', + queryParams: { + if (pageSize != null) 'pageSize': pageSize, + if (filter != null) 'filter': filter, + if (pageToken != null) 'pageToken': pageToken, + }, ); - return Model.fromJson(_jsonDecode(r)); + return ListOperationsResponse.fromJson(_jsonDecode(r)); } // ------------------------------------------ - // METHOD: batchEmbedContents + // METHOD: getTunedModelOperation // ------------------------------------------ - /// Generates multiple embeddings from the model given input text in a synchronous call. + /// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service. /// - /// `modelId`: The id of the model to use. + /// `tunedModelId`: The id of the tuned model. /// - /// `request`: Batch request to get embeddings from the model for a list of prompts. + /// `operationId`: The id of the operation to get. /// - /// `POST` `https://generativelanguage.googleapis.com/v1/models/{modelId}:batchEmbedContents` - Future batchEmbedContents({ - String modelId = 'embedding-001', - BatchEmbedContentsRequest? request, + /// `GET` `https://generativelanguage.googleapis.com/v1/tunedModels/{tunedModelId}/operations/{operationId}` + Future getTunedModelOperation({ + required String tunedModelId, + required String operationId, }) async { final r = await makeRequest( baseUrl: 'https://generativelanguage.googleapis.com/v1', - path: '/models/$modelId:batchEmbedContents', - method: HttpMethod.post, + path: '/tunedModels/$tunedModelId/operations/$operationId', + method: HttpMethod.get, isMultipart: false, - requestType: 'application/json', + requestType: '', responseType: 'application/json', - body: request, ); - return BatchEmbedContentsResponse.fromJson(_jsonDecode(r)); + return Operation.fromJson(_jsonDecode(r)); } // ------------------------------------------ - // METHOD: embedContent + // METHOD: cancelTunedModelOperation // ------------------------------------------ - /// Generates an embedding from the model given an input `Content`. + /// Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`. Clients can use Operations.GetOperation or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an Operation.error value with a google.rpc.Status.code of 1, corresponding to `Code.CANCELLED`. /// - /// `modelId`: The id of the model to use. + /// `tunedModelId`: The id of the tuned model. /// - /// `request`: Request containing the `Content` for the model to embed. + /// `operationId`: The id of the operation to cancel. /// - /// `POST` `https://generativelanguage.googleapis.com/v1/models/{modelId}:embedContent` - Future embedContent({ - String modelId = 'embedding-001', - EmbedContentRequest? request, + /// `request`: The request message for Operations.CancelOperation. + /// + /// `POST` `https://generativelanguage.googleapis.com/v1/tunedModels/{tunedModelId}/operations/{operationId}:cancel` + Future cancelTunedModelOperation({ + required String tunedModelId, + required String operationId, + CancelOperationRequest? request, }) async { final r = await makeRequest( baseUrl: 'https://generativelanguage.googleapis.com/v1', - path: '/models/$modelId:embedContent', + path: '/tunedModels/$tunedModelId/operations/$operationId:cancel', method: HttpMethod.post, isMultipart: false, requestType: 'application/json', responseType: 'application/json', body: request, ); - return EmbedContentResponse.fromJson(_jsonDecode(r)); + return Empty.fromJson(_jsonDecode(r)); } // ------------------------------------------ @@ -645,7 +672,7 @@ class GoogleAIClient { } // ------------------------------------------ - // METHOD: deleteOperations + // METHOD: deleteOperation // ------------------------------------------ /// Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`. @@ -653,7 +680,7 @@ class GoogleAIClient { /// `operationId`: The id of the operation to delete. /// /// `DELETE` `https://generativelanguage.googleapis.com/v1/operations/{operationId}` - Future deleteOperations({ + Future deleteOperation({ required String operationId, }) async { final r = await makeRequest( diff --git a/packages/googleai_dart/lib/src/generated/schema/citation_source.dart b/packages/googleai_dart/lib/src/generated/schema/citation_source.dart index 3c4e7085..e84906e0 100644 --- a/packages/googleai_dart/lib/src/generated/schema/citation_source.dart +++ b/packages/googleai_dart/lib/src/generated/schema/citation_source.dart @@ -15,15 +15,15 @@ class CitationSource with _$CitationSource { /// Factory constructor for CitationSource const factory CitationSource({ - /// Optional. End of the attributed segment, exclusive. - @JsonKey(includeIfNull: false) int? endIndex, - /// Optional. License for the GitHub project that is attributed as a source for segment. License info is required for code citations. @JsonKey(includeIfNull: false) String? license, /// Optional. URI that is attributed as a source for a portion of the text. @JsonKey(includeIfNull: false) String? uri, + /// Optional. End of the attributed segment, exclusive. + @JsonKey(includeIfNull: false) int? endIndex, + /// Optional. Start of segment of the response that is attributed to this source. Index indicates the start of the segment, measured in bytes. @JsonKey(includeIfNull: false) int? startIndex, }) = _CitationSource; @@ -34,9 +34,9 @@ class CitationSource with _$CitationSource { /// List of all property names of schema static const List propertyNames = [ - 'endIndex', 'license', 'uri', + 'endIndex', 'startIndex' ]; @@ -48,9 +48,9 @@ class CitationSource with _$CitationSource { /// Map representation of object (not serialized) Map toMap() { return { - 'endIndex': endIndex, 'license': license, 'uri': uri, + 'endIndex': endIndex, 'startIndex': startIndex, }; } diff --git a/packages/googleai_dart/lib/src/generated/schema/create_tuned_model_metadata.dart b/packages/googleai_dart/lib/src/generated/schema/create_tuned_model_metadata.dart index 454beabd..a2b6fd06 100644 --- a/packages/googleai_dart/lib/src/generated/schema/create_tuned_model_metadata.dart +++ b/packages/googleai_dart/lib/src/generated/schema/create_tuned_model_metadata.dart @@ -8,7 +8,7 @@ part of google_a_i_schema; // CLASS: CreateTunedModelMetadata // ========================================== -/// Metadata about the state and progress of creating a tuned model returned from the long-running operation +/// Metadata about the state and progress of creating a tuned model returned from the long-running operation. @freezed class CreateTunedModelMetadata with _$CreateTunedModelMetadata { const CreateTunedModelMetadata._(); diff --git a/packages/googleai_dart/lib/src/generated/schema/embed_content_request.dart b/packages/googleai_dart/lib/src/generated/schema/embed_content_request.dart index e8c5de26..99c2ed13 100644 --- a/packages/googleai_dart/lib/src/generated/schema/embed_content_request.dart +++ b/packages/googleai_dart/lib/src/generated/schema/embed_content_request.dart @@ -15,6 +15,9 @@ class EmbedContentRequest with _$EmbedContentRequest { /// Factory constructor for EmbedContentRequest const factory EmbedContentRequest({ + /// Optional. An optional title for the text. Only applicable when TaskType is `RETRIEVAL_DOCUMENT`. Note: Specifying a `title` for `RETRIEVAL_DOCUMENT` provides better quality embeddings for retrieval. + @JsonKey(includeIfNull: false) String? title, + /// Required. The content to embed. Only the `parts.text` fields will be counted. @JsonKey(includeIfNull: false) Content? content, @@ -27,9 +30,6 @@ class EmbedContentRequest with _$EmbedContentRequest { /// Required. The model's resource name. This serves as an ID for the Model to use. This name should match a model name returned by the `ListModels` method. Format: `models/{model}` @JsonKey(includeIfNull: false) String? model, - - /// Optional. An optional title for the text. Only applicable when TaskType is `RETRIEVAL_DOCUMENT`. - @JsonKey(includeIfNull: false) String? title, }) = _EmbedContentRequest; /// Object construction from a JSON representation @@ -38,10 +38,10 @@ class EmbedContentRequest with _$EmbedContentRequest { /// List of all property names of schema static const List propertyNames = [ + 'title', 'content', 'taskType', - 'model', - 'title' + 'model' ]; /// Perform validations on the schema property values @@ -52,10 +52,10 @@ class EmbedContentRequest with _$EmbedContentRequest { /// Map representation of object (not serialized) Map toMap() { return { + 'title': title, 'content': content, 'taskType': taskType, 'model': model, - 'title': title, }; } } diff --git a/packages/googleai_dart/lib/src/generated/schema/generation_config.dart b/packages/googleai_dart/lib/src/generated/schema/generation_config.dart index 6dc60dc2..ff4dd833 100644 --- a/packages/googleai_dart/lib/src/generated/schema/generation_config.dart +++ b/packages/googleai_dart/lib/src/generated/schema/generation_config.dart @@ -15,23 +15,23 @@ class GenerationConfig with _$GenerationConfig { /// Factory constructor for GenerationConfig const factory GenerationConfig({ - /// Optional. The maximum cumulative probability of tokens to consider when sampling. The model uses combined Top-k and nucleus sampling. Tokens are sorted based on their assigned probabilities so that only the most likely tokens are considered. Top-k sampling directly limits the maximum number of tokens to consider, while Nucleus sampling limits number of tokens based on the cumulative probability. Note: The default value varies by model, see the `Model.top_p` attribute of the `Model` returned the `getModel` function. - @JsonKey(includeIfNull: false) double? topP, + /// Optional. Controls the randomness of the output. Note: The default value varies by model, see the `Model.temperature` attribute of the `Model` returned from the `getModel` function. Values can range from [0.0, infinity). + @JsonKey(includeIfNull: false) double? temperature, + + /// Optional. The set of character sequences (up to 5) that will stop output generation. If specified, the API will stop at the first appearance of a stop sequence. The stop sequence will not be included as part of the response. + @JsonKey(includeIfNull: false) List? stopSequences, - /// Optional. The maximum number of tokens to consider when sampling. The model uses combined Top-k and nucleus sampling. Top-k sampling considers the set of `top_k` most probable tokens. Defaults to 40. Note: The default value varies by model, see the `Model.top_k` attribute of the `Model` returned the `getModel` function. + /// Optional. The maximum number of tokens to consider when sampling. The model uses combined Top-k and nucleus sampling. Top-k sampling considers the set of `top_k` most probable tokens. Note: The default value varies by model, see the `Model.top_k` attribute of the `Model` returned from the `getModel` function. @JsonKey(includeIfNull: false) int? topK, - /// Optional. Number of generated responses to return. This value must be between [1, 8], inclusive. If unset, this will default to 1. + /// Optional. The maximum cumulative probability of tokens to consider when sampling. The model uses combined Top-k and nucleus sampling. Tokens are sorted based on their assigned probabilities so that only the most likely tokens are considered. Top-k sampling directly limits the maximum number of tokens to consider, while Nucleus sampling limits number of tokens based on the cumulative probability. Note: The default value varies by model, see the `Model.top_p` attribute of the `Model` returned from the `getModel` function. + @JsonKey(includeIfNull: false) double? topP, + + /// Optional. Number of generated responses to return. Currently, this value can only be set to 1. If unset, this will default to 1. @JsonKey(includeIfNull: false) int? candidateCount, - /// Optional. The maximum number of tokens to include in a candidate. If unset, this will default to output_token_limit specified in the `Model` specification. + /// Optional. The maximum number of tokens to include in a candidate. Note: The default value varies by model, see the `Model.output_token_limit` attribute of the `Model` returned from the `getModel` function. @JsonKey(includeIfNull: false) int? maxOutputTokens, - - /// Optional. Controls the randomness of the output. Note: The default value varies by model, see the `Model.temperature` attribute of the `Model` returned the `getModel` function. Values can range from [0.0,1.0], inclusive. A value closer to 1.0 will produce responses that are more varied and creative, while a value closer to 0.0 will typically result in more straightforward responses from the model. - @JsonKey(includeIfNull: false) double? temperature, - - /// Optional. The set of character sequences (up to 5) that will stop output generation. If specified, the API will stop at the first appearance of a stop sequence. The stop sequence will not be included as part of the response. - @JsonKey(includeIfNull: false) List? stopSequences, }) = _GenerationConfig; /// Object construction from a JSON representation @@ -40,12 +40,12 @@ class GenerationConfig with _$GenerationConfig { /// List of all property names of schema static const List propertyNames = [ - 'topP', + 'temperature', + 'stopSequences', 'topK', + 'topP', 'candidateCount', - 'maxOutputTokens', - 'temperature', - 'stopSequences' + 'maxOutputTokens' ]; /// Perform validations on the schema property values @@ -56,12 +56,12 @@ class GenerationConfig with _$GenerationConfig { /// Map representation of object (not serialized) Map toMap() { return { - 'topP': topP, + 'temperature': temperature, + 'stopSequences': stopSequences, 'topK': topK, + 'topP': topP, 'candidateCount': candidateCount, 'maxOutputTokens': maxOutputTokens, - 'temperature': temperature, - 'stopSequences': stopSequences, }; } } diff --git a/packages/googleai_dart/lib/src/generated/schema/list_models_response.dart b/packages/googleai_dart/lib/src/generated/schema/list_models_response.dart index 390b31c7..2c53ef25 100644 --- a/packages/googleai_dart/lib/src/generated/schema/list_models_response.dart +++ b/packages/googleai_dart/lib/src/generated/schema/list_models_response.dart @@ -15,11 +15,11 @@ class ListModelsResponse with _$ListModelsResponse { /// Factory constructor for ListModelsResponse const factory ListModelsResponse({ - /// A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no more pages. - @JsonKey(includeIfNull: false) String? nextPageToken, - /// The returned Models. @JsonKey(includeIfNull: false) List? models, + + /// A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no more pages. + @JsonKey(includeIfNull: false) String? nextPageToken, }) = _ListModelsResponse; /// Object construction from a JSON representation @@ -27,7 +27,7 @@ class ListModelsResponse with _$ListModelsResponse { _$ListModelsResponseFromJson(json); /// List of all property names of schema - static const List propertyNames = ['nextPageToken', 'models']; + static const List propertyNames = ['models', 'nextPageToken']; /// Perform validations on the schema property values String? validateSchema() { @@ -37,8 +37,8 @@ class ListModelsResponse with _$ListModelsResponse { /// Map representation of object (not serialized) Map toMap() { return { - 'nextPageToken': nextPageToken, 'models': models, + 'nextPageToken': nextPageToken, }; } } diff --git a/packages/googleai_dart/lib/src/generated/schema/list_operations_response.dart b/packages/googleai_dart/lib/src/generated/schema/list_operations_response.dart index 577e54ce..7055b663 100644 --- a/packages/googleai_dart/lib/src/generated/schema/list_operations_response.dart +++ b/packages/googleai_dart/lib/src/generated/schema/list_operations_response.dart @@ -15,11 +15,11 @@ class ListOperationsResponse with _$ListOperationsResponse { /// Factory constructor for ListOperationsResponse const factory ListOperationsResponse({ - /// The standard List next-page token. - @JsonKey(includeIfNull: false) String? nextPageToken, - /// A list of operations that matches the specified filter in the request. @JsonKey(includeIfNull: false) List? operations, + + /// The standard List next-page token. + @JsonKey(includeIfNull: false) String? nextPageToken, }) = _ListOperationsResponse; /// Object construction from a JSON representation @@ -27,7 +27,7 @@ class ListOperationsResponse with _$ListOperationsResponse { _$ListOperationsResponseFromJson(json); /// List of all property names of schema - static const List propertyNames = ['nextPageToken', 'operations']; + static const List propertyNames = ['operations', 'nextPageToken']; /// Perform validations on the schema property values String? validateSchema() { @@ -37,8 +37,8 @@ class ListOperationsResponse with _$ListOperationsResponse { /// Map representation of object (not serialized) Map toMap() { return { - 'nextPageToken': nextPageToken, 'operations': operations, + 'nextPageToken': nextPageToken, }; } } diff --git a/packages/googleai_dart/lib/src/generated/schema/model.dart b/packages/googleai_dart/lib/src/generated/schema/model.dart index e75d7d2d..8d7a7422 100644 --- a/packages/googleai_dart/lib/src/generated/schema/model.dart +++ b/packages/googleai_dart/lib/src/generated/schema/model.dart @@ -24,21 +24,21 @@ class Model with _$Model { /// A short description of the model. @JsonKey(includeIfNull: false) String? description, - /// For Top-k sampling. Top-k sampling considers the set of `top_k` most probable tokens. This value specifies default to be used by the backend while making the call to the model. - @JsonKey(includeIfNull: false) int? topK, - /// Required. The version number of the model. This represents the major version @JsonKey(includeIfNull: false) String? version, + /// Required. The name of the base model, pass this to the generation request. Examples: * `chat-bison` + @JsonKey(includeIfNull: false) String? baseModelId, + /// Controls the randomness of the output. Values can range over `[0.0,1.0]`, inclusive. A value closer to `1.0` will produce responses that are more varied, while a value closer to `0.0` will typically result in less surprising responses from the model. This value specifies default to be used by the backend while making the call to the model. @JsonKey(includeIfNull: false) double? temperature, + /// For Top-k sampling. Top-k sampling considers the set of `top_k` most probable tokens. This value specifies default to be used by the backend while making the call to the model. + @JsonKey(includeIfNull: false) int? topK, + /// For Nucleus sampling. Nucleus sampling considers the smallest set of tokens whose probability sum is at least `top_p`. This value specifies default to be used by the backend while making the call to the model. @JsonKey(includeIfNull: false) double? topP, - /// Required. The name of the base model, pass this to the generation request. Examples: * `chat-bison` - @JsonKey(includeIfNull: false) String? baseModelId, - /// Maximum number of input tokens allowed for this model. @JsonKey(includeIfNull: false) int? inputTokenLimit, @@ -57,11 +57,11 @@ class Model with _$Model { 'name', 'displayName', 'description', - 'topK', 'version', + 'baseModelId', 'temperature', + 'topK', 'topP', - 'baseModelId', 'inputTokenLimit', 'outputTokenLimit', 'supportedGenerationMethods' @@ -78,11 +78,11 @@ class Model with _$Model { 'name': name, 'displayName': displayName, 'description': description, - 'topK': topK, 'version': version, + 'baseModelId': baseModelId, 'temperature': temperature, + 'topK': topK, 'topP': topP, - 'baseModelId': baseModelId, 'inputTokenLimit': inputTokenLimit, 'outputTokenLimit': outputTokenLimit, 'supportedGenerationMethods': supportedGenerationMethods, diff --git a/packages/googleai_dart/lib/src/generated/schema/schema.dart b/packages/googleai_dart/lib/src/generated/schema/schema.dart index f094b362..c5725173 100644 --- a/packages/googleai_dart/lib/src/generated/schema/schema.dart +++ b/packages/googleai_dart/lib/src/generated/schema/schema.dart @@ -10,31 +10,31 @@ import 'package:freezed_annotation/freezed_annotation.dart'; part 'schema.g.dart'; part 'schema.freezed.dart'; -part 'tuning_snapshot.dart'; +part 'batch_embed_contents_response.dart'; +part 'candidate.dart'; part 'create_tuned_model_metadata.dart'; -part 'generation_config.dart'; -part 'list_operations_response.dart'; -part 'model.dart'; +part 'batch_embed_contents_request.dart'; part 'safety_rating.dart'; part 'part.dart'; -part 'empty.dart'; -part 'generate_content_request.dart'; -part 'embed_content_response.dart'; -part 'content.dart'; -part 'cancel_operation_request.dart'; -part 'embed_content_request.dart'; -part 'list_models_response.dart'; -part 'batch_embed_contents_request.dart'; -part 'content_embedding.dart'; -part 'prompt_feedback.dart'; part 'operation.dart'; -part 'generate_content_response.dart'; +part 'status.dart'; +part 'citation_metadata.dart'; part 'safety_setting.dart'; -part 'candidate.dart'; -part 'count_tokens_response.dart'; +part 'citation_source.dart'; +part 'generation_config.dart'; part 'count_tokens_request.dart'; -part 'batch_embed_contents_response.dart'; -part 'citation_metadata.dart'; +part 'tuning_snapshot.dart'; part 'blob.dart'; -part 'citation_source.dart'; -part 'status.dart'; +part 'list_models_response.dart'; +part 'content_embedding.dart'; +part 'prompt_feedback.dart'; +part 'embed_content_request.dart'; +part 'list_operations_response.dart'; +part 'empty.dart'; +part 'content.dart'; +part 'cancel_operation_request.dart'; +part 'embed_content_response.dart'; +part 'count_tokens_response.dart'; +part 'generate_content_response.dart'; +part 'model.dart'; +part 'generate_content_request.dart'; diff --git a/packages/googleai_dart/lib/src/generated/schema/schema.freezed.dart b/packages/googleai_dart/lib/src/generated/schema/schema.freezed.dart index 591ab229..f12fe04a 100644 --- a/packages/googleai_dart/lib/src/generated/schema/schema.freezed.dart +++ b/packages/googleai_dart/lib/src/generated/schema/schema.freezed.dart @@ -14,51 +14,39 @@ T _$identity(T value) => value; final _privateConstructorUsedError = UnsupportedError( 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); -TuningSnapshot _$TuningSnapshotFromJson(Map json) { - return _TuningSnapshot.fromJson(json); +BatchEmbedContentsResponse _$BatchEmbedContentsResponseFromJson( + Map json) { + return _BatchEmbedContentsResponse.fromJson(json); } /// @nodoc -mixin _$TuningSnapshot { - /// Output only. The tuning step. - @JsonKey(includeIfNull: false) - int? get step => throw _privateConstructorUsedError; - - /// Output only. The timestamp when this metric was computed. - @JsonKey(includeIfNull: false) - String? get computeTime => throw _privateConstructorUsedError; - - /// Output only. The epoch this step was part of. - @JsonKey(includeIfNull: false) - int? get epoch => throw _privateConstructorUsedError; - - /// Output only. The mean loss of the training examples for this step. +mixin _$BatchEmbedContentsResponse { + /// Output only. The embeddings for each request, in the same order as provided in the batch request. @JsonKey(includeIfNull: false) - double? get meanLoss => throw _privateConstructorUsedError; + List? get embeddings => throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) - $TuningSnapshotCopyWith get copyWith => - throw _privateConstructorUsedError; + $BatchEmbedContentsResponseCopyWith + get copyWith => throw _privateConstructorUsedError; } /// @nodoc -abstract class $TuningSnapshotCopyWith<$Res> { - factory $TuningSnapshotCopyWith( - TuningSnapshot value, $Res Function(TuningSnapshot) then) = - _$TuningSnapshotCopyWithImpl<$Res, TuningSnapshot>; +abstract class $BatchEmbedContentsResponseCopyWith<$Res> { + factory $BatchEmbedContentsResponseCopyWith(BatchEmbedContentsResponse value, + $Res Function(BatchEmbedContentsResponse) then) = + _$BatchEmbedContentsResponseCopyWithImpl<$Res, + BatchEmbedContentsResponse>; @useResult $Res call( - {@JsonKey(includeIfNull: false) int? step, - @JsonKey(includeIfNull: false) String? computeTime, - @JsonKey(includeIfNull: false) int? epoch, - @JsonKey(includeIfNull: false) double? meanLoss}); + {@JsonKey(includeIfNull: false) List? embeddings}); } /// @nodoc -class _$TuningSnapshotCopyWithImpl<$Res, $Val extends TuningSnapshot> - implements $TuningSnapshotCopyWith<$Res> { - _$TuningSnapshotCopyWithImpl(this._value, this._then); +class _$BatchEmbedContentsResponseCopyWithImpl<$Res, + $Val extends BatchEmbedContentsResponse> + implements $BatchEmbedContentsResponseCopyWith<$Res> { + _$BatchEmbedContentsResponseCopyWithImpl(this._value, this._then); // ignore: unused_field final $Val _value; @@ -68,245 +56,196 @@ class _$TuningSnapshotCopyWithImpl<$Res, $Val extends TuningSnapshot> @pragma('vm:prefer-inline') @override $Res call({ - Object? step = freezed, - Object? computeTime = freezed, - Object? epoch = freezed, - Object? meanLoss = freezed, + Object? embeddings = freezed, }) { return _then(_value.copyWith( - step: freezed == step - ? _value.step - : step // ignore: cast_nullable_to_non_nullable - as int?, - computeTime: freezed == computeTime - ? _value.computeTime - : computeTime // ignore: cast_nullable_to_non_nullable - as String?, - epoch: freezed == epoch - ? _value.epoch - : epoch // ignore: cast_nullable_to_non_nullable - as int?, - meanLoss: freezed == meanLoss - ? _value.meanLoss - : meanLoss // ignore: cast_nullable_to_non_nullable - as double?, + embeddings: freezed == embeddings + ? _value.embeddings + : embeddings // ignore: cast_nullable_to_non_nullable + as List?, ) as $Val); } } /// @nodoc -abstract class _$$TuningSnapshotImplCopyWith<$Res> - implements $TuningSnapshotCopyWith<$Res> { - factory _$$TuningSnapshotImplCopyWith(_$TuningSnapshotImpl value, - $Res Function(_$TuningSnapshotImpl) then) = - __$$TuningSnapshotImplCopyWithImpl<$Res>; +abstract class _$$BatchEmbedContentsResponseImplCopyWith<$Res> + implements $BatchEmbedContentsResponseCopyWith<$Res> { + factory _$$BatchEmbedContentsResponseImplCopyWith( + _$BatchEmbedContentsResponseImpl value, + $Res Function(_$BatchEmbedContentsResponseImpl) then) = + __$$BatchEmbedContentsResponseImplCopyWithImpl<$Res>; @override @useResult $Res call( - {@JsonKey(includeIfNull: false) int? step, - @JsonKey(includeIfNull: false) String? computeTime, - @JsonKey(includeIfNull: false) int? epoch, - @JsonKey(includeIfNull: false) double? meanLoss}); + {@JsonKey(includeIfNull: false) List? embeddings}); } /// @nodoc -class __$$TuningSnapshotImplCopyWithImpl<$Res> - extends _$TuningSnapshotCopyWithImpl<$Res, _$TuningSnapshotImpl> - implements _$$TuningSnapshotImplCopyWith<$Res> { - __$$TuningSnapshotImplCopyWithImpl( - _$TuningSnapshotImpl _value, $Res Function(_$TuningSnapshotImpl) _then) +class __$$BatchEmbedContentsResponseImplCopyWithImpl<$Res> + extends _$BatchEmbedContentsResponseCopyWithImpl<$Res, + _$BatchEmbedContentsResponseImpl> + implements _$$BatchEmbedContentsResponseImplCopyWith<$Res> { + __$$BatchEmbedContentsResponseImplCopyWithImpl( + _$BatchEmbedContentsResponseImpl _value, + $Res Function(_$BatchEmbedContentsResponseImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @override $Res call({ - Object? step = freezed, - Object? computeTime = freezed, - Object? epoch = freezed, - Object? meanLoss = freezed, + Object? embeddings = freezed, }) { - return _then(_$TuningSnapshotImpl( - step: freezed == step - ? _value.step - : step // ignore: cast_nullable_to_non_nullable - as int?, - computeTime: freezed == computeTime - ? _value.computeTime - : computeTime // ignore: cast_nullable_to_non_nullable - as String?, - epoch: freezed == epoch - ? _value.epoch - : epoch // ignore: cast_nullable_to_non_nullable - as int?, - meanLoss: freezed == meanLoss - ? _value.meanLoss - : meanLoss // ignore: cast_nullable_to_non_nullable - as double?, + return _then(_$BatchEmbedContentsResponseImpl( + embeddings: freezed == embeddings + ? _value._embeddings + : embeddings // ignore: cast_nullable_to_non_nullable + as List?, )); } } /// @nodoc @JsonSerializable() -class _$TuningSnapshotImpl extends _TuningSnapshot { - const _$TuningSnapshotImpl( - {@JsonKey(includeIfNull: false) this.step, - @JsonKey(includeIfNull: false) this.computeTime, - @JsonKey(includeIfNull: false) this.epoch, - @JsonKey(includeIfNull: false) this.meanLoss}) - : super._(); - - factory _$TuningSnapshotImpl.fromJson(Map json) => - _$$TuningSnapshotImplFromJson(json); - - /// Output only. The tuning step. - @override - @JsonKey(includeIfNull: false) - final int? step; +class _$BatchEmbedContentsResponseImpl extends _BatchEmbedContentsResponse { + const _$BatchEmbedContentsResponseImpl( + {@JsonKey(includeIfNull: false) final List? embeddings}) + : _embeddings = embeddings, + super._(); - /// Output only. The timestamp when this metric was computed. - @override - @JsonKey(includeIfNull: false) - final String? computeTime; + factory _$BatchEmbedContentsResponseImpl.fromJson( + Map json) => + _$$BatchEmbedContentsResponseImplFromJson(json); - /// Output only. The epoch this step was part of. - @override - @JsonKey(includeIfNull: false) - final int? epoch; + /// Output only. The embeddings for each request, in the same order as provided in the batch request. + final List? _embeddings; - /// Output only. The mean loss of the training examples for this step. + /// Output only. The embeddings for each request, in the same order as provided in the batch request. @override @JsonKey(includeIfNull: false) - final double? meanLoss; + List? get embeddings { + final value = _embeddings; + if (value == null) return null; + if (_embeddings is EqualUnmodifiableListView) return _embeddings; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(value); + } @override String toString() { - return 'TuningSnapshot(step: $step, computeTime: $computeTime, epoch: $epoch, meanLoss: $meanLoss)'; + return 'BatchEmbedContentsResponse(embeddings: $embeddings)'; } @override bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$TuningSnapshotImpl && - (identical(other.step, step) || other.step == step) && - (identical(other.computeTime, computeTime) || - other.computeTime == computeTime) && - (identical(other.epoch, epoch) || other.epoch == epoch) && - (identical(other.meanLoss, meanLoss) || - other.meanLoss == meanLoss)); + other is _$BatchEmbedContentsResponseImpl && + const DeepCollectionEquality() + .equals(other._embeddings, _embeddings)); } @JsonKey(ignore: true) @override - int get hashCode => - Object.hash(runtimeType, step, computeTime, epoch, meanLoss); + int get hashCode => Object.hash( + runtimeType, const DeepCollectionEquality().hash(_embeddings)); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$TuningSnapshotImplCopyWith<_$TuningSnapshotImpl> get copyWith => - __$$TuningSnapshotImplCopyWithImpl<_$TuningSnapshotImpl>( - this, _$identity); + _$$BatchEmbedContentsResponseImplCopyWith<_$BatchEmbedContentsResponseImpl> + get copyWith => __$$BatchEmbedContentsResponseImplCopyWithImpl< + _$BatchEmbedContentsResponseImpl>(this, _$identity); @override Map toJson() { - return _$$TuningSnapshotImplToJson( + return _$$BatchEmbedContentsResponseImplToJson( this, ); } } -abstract class _TuningSnapshot extends TuningSnapshot { - const factory _TuningSnapshot( - {@JsonKey(includeIfNull: false) final int? step, - @JsonKey(includeIfNull: false) final String? computeTime, - @JsonKey(includeIfNull: false) final int? epoch, - @JsonKey(includeIfNull: false) final double? meanLoss}) = - _$TuningSnapshotImpl; - const _TuningSnapshot._() : super._(); - - factory _TuningSnapshot.fromJson(Map json) = - _$TuningSnapshotImpl.fromJson; - - @override - - /// Output only. The tuning step. - @JsonKey(includeIfNull: false) - int? get step; - @override +abstract class _BatchEmbedContentsResponse extends BatchEmbedContentsResponse { + const factory _BatchEmbedContentsResponse( + {@JsonKey(includeIfNull: false) + final List? embeddings}) = + _$BatchEmbedContentsResponseImpl; + const _BatchEmbedContentsResponse._() : super._(); - /// Output only. The timestamp when this metric was computed. - @JsonKey(includeIfNull: false) - String? get computeTime; - @override + factory _BatchEmbedContentsResponse.fromJson(Map json) = + _$BatchEmbedContentsResponseImpl.fromJson; - /// Output only. The epoch this step was part of. - @JsonKey(includeIfNull: false) - int? get epoch; @override - /// Output only. The mean loss of the training examples for this step. + /// Output only. The embeddings for each request, in the same order as provided in the batch request. @JsonKey(includeIfNull: false) - double? get meanLoss; + List? get embeddings; @override @JsonKey(ignore: true) - _$$TuningSnapshotImplCopyWith<_$TuningSnapshotImpl> get copyWith => - throw _privateConstructorUsedError; + _$$BatchEmbedContentsResponseImplCopyWith<_$BatchEmbedContentsResponseImpl> + get copyWith => throw _privateConstructorUsedError; } -CreateTunedModelMetadata _$CreateTunedModelMetadataFromJson( - Map json) { - return _CreateTunedModelMetadata.fromJson(json); +Candidate _$CandidateFromJson(Map json) { + return _Candidate.fromJson(json); } /// @nodoc -mixin _$CreateTunedModelMetadata { - /// The total number of tuning steps. +mixin _$Candidate { + /// Output only. Generated content returned from the model. @JsonKey(includeIfNull: false) - int? get totalSteps => throw _privateConstructorUsedError; + Content? get content => throw _privateConstructorUsedError; - /// Name of the tuned model associated with the tuning operation. - @JsonKey(includeIfNull: false) - String? get tunedModel => throw _privateConstructorUsedError; + /// Optional. Output only. The reason why the model stopped generating tokens. If empty, the model has not stopped generating the tokens. + @JsonKey( + includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + CandidateFinishReason? get finishReason => throw _privateConstructorUsedError; - /// The number of steps completed. + /// Output only. Citation information for model-generated candidate. This field may be populated with recitation information for any text included in the `content`. These are passages that are "recited" from copyrighted material in the foundational LLM's training data. @JsonKey(includeIfNull: false) - int? get completedSteps => throw _privateConstructorUsedError; + CitationMetadata? get citationMetadata => throw _privateConstructorUsedError; - /// Metrics collected during tuning. + /// Output only. Index of the candidate in the list of candidates. @JsonKey(includeIfNull: false) - List? get snapshots => throw _privateConstructorUsedError; + int? get index => throw _privateConstructorUsedError; - /// The completed percentage for the tuning operation. + /// Output only. Token count for this candidate. @JsonKey(includeIfNull: false) - double? get completedPercent => throw _privateConstructorUsedError; + int? get tokenCount => throw _privateConstructorUsedError; + + /// List of ratings for the safety of a response candidate. There is at most one rating per category. + @JsonKey(includeIfNull: false) + List? get safetyRatings => throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) - $CreateTunedModelMetadataCopyWith get copyWith => + $CandidateCopyWith get copyWith => throw _privateConstructorUsedError; } /// @nodoc -abstract class $CreateTunedModelMetadataCopyWith<$Res> { - factory $CreateTunedModelMetadataCopyWith(CreateTunedModelMetadata value, - $Res Function(CreateTunedModelMetadata) then) = - _$CreateTunedModelMetadataCopyWithImpl<$Res, CreateTunedModelMetadata>; +abstract class $CandidateCopyWith<$Res> { + factory $CandidateCopyWith(Candidate value, $Res Function(Candidate) then) = + _$CandidateCopyWithImpl<$Res, Candidate>; @useResult $Res call( - {@JsonKey(includeIfNull: false) int? totalSteps, - @JsonKey(includeIfNull: false) String? tunedModel, - @JsonKey(includeIfNull: false) int? completedSteps, - @JsonKey(includeIfNull: false) List? snapshots, - @JsonKey(includeIfNull: false) double? completedPercent}); + {@JsonKey(includeIfNull: false) Content? content, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + CandidateFinishReason? finishReason, + @JsonKey(includeIfNull: false) CitationMetadata? citationMetadata, + @JsonKey(includeIfNull: false) int? index, + @JsonKey(includeIfNull: false) int? tokenCount, + @JsonKey(includeIfNull: false) List? safetyRatings}); + + $ContentCopyWith<$Res>? get content; + $CitationMetadataCopyWith<$Res>? get citationMetadata; } /// @nodoc -class _$CreateTunedModelMetadataCopyWithImpl<$Res, - $Val extends CreateTunedModelMetadata> - implements $CreateTunedModelMetadataCopyWith<$Res> { - _$CreateTunedModelMetadataCopyWithImpl(this._value, this._then); +class _$CandidateCopyWithImpl<$Res, $Val extends Candidate> + implements $CandidateCopyWith<$Res> { + _$CandidateCopyWithImpl(this._value, this._then); // ignore: unused_field final $Val _value; @@ -316,293 +255,350 @@ class _$CreateTunedModelMetadataCopyWithImpl<$Res, @pragma('vm:prefer-inline') @override $Res call({ - Object? totalSteps = freezed, - Object? tunedModel = freezed, - Object? completedSteps = freezed, - Object? snapshots = freezed, - Object? completedPercent = freezed, + Object? content = freezed, + Object? finishReason = freezed, + Object? citationMetadata = freezed, + Object? index = freezed, + Object? tokenCount = freezed, + Object? safetyRatings = freezed, }) { return _then(_value.copyWith( - totalSteps: freezed == totalSteps - ? _value.totalSteps - : totalSteps // ignore: cast_nullable_to_non_nullable + content: freezed == content + ? _value.content + : content // ignore: cast_nullable_to_non_nullable + as Content?, + finishReason: freezed == finishReason + ? _value.finishReason + : finishReason // ignore: cast_nullable_to_non_nullable + as CandidateFinishReason?, + citationMetadata: freezed == citationMetadata + ? _value.citationMetadata + : citationMetadata // ignore: cast_nullable_to_non_nullable + as CitationMetadata?, + index: freezed == index + ? _value.index + : index // ignore: cast_nullable_to_non_nullable as int?, - tunedModel: freezed == tunedModel - ? _value.tunedModel - : tunedModel // ignore: cast_nullable_to_non_nullable - as String?, - completedSteps: freezed == completedSteps - ? _value.completedSteps - : completedSteps // ignore: cast_nullable_to_non_nullable + tokenCount: freezed == tokenCount + ? _value.tokenCount + : tokenCount // ignore: cast_nullable_to_non_nullable as int?, - snapshots: freezed == snapshots - ? _value.snapshots - : snapshots // ignore: cast_nullable_to_non_nullable - as List?, - completedPercent: freezed == completedPercent - ? _value.completedPercent - : completedPercent // ignore: cast_nullable_to_non_nullable - as double?, + safetyRatings: freezed == safetyRatings + ? _value.safetyRatings + : safetyRatings // ignore: cast_nullable_to_non_nullable + as List?, ) as $Val); } + + @override + @pragma('vm:prefer-inline') + $ContentCopyWith<$Res>? get content { + if (_value.content == null) { + return null; + } + + return $ContentCopyWith<$Res>(_value.content!, (value) { + return _then(_value.copyWith(content: value) as $Val); + }); + } + + @override + @pragma('vm:prefer-inline') + $CitationMetadataCopyWith<$Res>? get citationMetadata { + if (_value.citationMetadata == null) { + return null; + } + + return $CitationMetadataCopyWith<$Res>(_value.citationMetadata!, (value) { + return _then(_value.copyWith(citationMetadata: value) as $Val); + }); + } } /// @nodoc -abstract class _$$CreateTunedModelMetadataImplCopyWith<$Res> - implements $CreateTunedModelMetadataCopyWith<$Res> { - factory _$$CreateTunedModelMetadataImplCopyWith( - _$CreateTunedModelMetadataImpl value, - $Res Function(_$CreateTunedModelMetadataImpl) then) = - __$$CreateTunedModelMetadataImplCopyWithImpl<$Res>; +abstract class _$$CandidateImplCopyWith<$Res> + implements $CandidateCopyWith<$Res> { + factory _$$CandidateImplCopyWith( + _$CandidateImpl value, $Res Function(_$CandidateImpl) then) = + __$$CandidateImplCopyWithImpl<$Res>; @override @useResult $Res call( - {@JsonKey(includeIfNull: false) int? totalSteps, - @JsonKey(includeIfNull: false) String? tunedModel, - @JsonKey(includeIfNull: false) int? completedSteps, - @JsonKey(includeIfNull: false) List? snapshots, - @JsonKey(includeIfNull: false) double? completedPercent}); + {@JsonKey(includeIfNull: false) Content? content, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + CandidateFinishReason? finishReason, + @JsonKey(includeIfNull: false) CitationMetadata? citationMetadata, + @JsonKey(includeIfNull: false) int? index, + @JsonKey(includeIfNull: false) int? tokenCount, + @JsonKey(includeIfNull: false) List? safetyRatings}); + + @override + $ContentCopyWith<$Res>? get content; + @override + $CitationMetadataCopyWith<$Res>? get citationMetadata; } /// @nodoc -class __$$CreateTunedModelMetadataImplCopyWithImpl<$Res> - extends _$CreateTunedModelMetadataCopyWithImpl<$Res, - _$CreateTunedModelMetadataImpl> - implements _$$CreateTunedModelMetadataImplCopyWith<$Res> { - __$$CreateTunedModelMetadataImplCopyWithImpl( - _$CreateTunedModelMetadataImpl _value, - $Res Function(_$CreateTunedModelMetadataImpl) _then) +class __$$CandidateImplCopyWithImpl<$Res> + extends _$CandidateCopyWithImpl<$Res, _$CandidateImpl> + implements _$$CandidateImplCopyWith<$Res> { + __$$CandidateImplCopyWithImpl( + _$CandidateImpl _value, $Res Function(_$CandidateImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @override $Res call({ - Object? totalSteps = freezed, - Object? tunedModel = freezed, - Object? completedSteps = freezed, - Object? snapshots = freezed, - Object? completedPercent = freezed, + Object? content = freezed, + Object? finishReason = freezed, + Object? citationMetadata = freezed, + Object? index = freezed, + Object? tokenCount = freezed, + Object? safetyRatings = freezed, }) { - return _then(_$CreateTunedModelMetadataImpl( - totalSteps: freezed == totalSteps - ? _value.totalSteps - : totalSteps // ignore: cast_nullable_to_non_nullable + return _then(_$CandidateImpl( + content: freezed == content + ? _value.content + : content // ignore: cast_nullable_to_non_nullable + as Content?, + finishReason: freezed == finishReason + ? _value.finishReason + : finishReason // ignore: cast_nullable_to_non_nullable + as CandidateFinishReason?, + citationMetadata: freezed == citationMetadata + ? _value.citationMetadata + : citationMetadata // ignore: cast_nullable_to_non_nullable + as CitationMetadata?, + index: freezed == index + ? _value.index + : index // ignore: cast_nullable_to_non_nullable as int?, - tunedModel: freezed == tunedModel - ? _value.tunedModel - : tunedModel // ignore: cast_nullable_to_non_nullable - as String?, - completedSteps: freezed == completedSteps - ? _value.completedSteps - : completedSteps // ignore: cast_nullable_to_non_nullable + tokenCount: freezed == tokenCount + ? _value.tokenCount + : tokenCount // ignore: cast_nullable_to_non_nullable as int?, - snapshots: freezed == snapshots - ? _value._snapshots - : snapshots // ignore: cast_nullable_to_non_nullable - as List?, - completedPercent: freezed == completedPercent - ? _value.completedPercent - : completedPercent // ignore: cast_nullable_to_non_nullable - as double?, + safetyRatings: freezed == safetyRatings + ? _value._safetyRatings + : safetyRatings // ignore: cast_nullable_to_non_nullable + as List?, )); } } /// @nodoc @JsonSerializable() -class _$CreateTunedModelMetadataImpl extends _CreateTunedModelMetadata { - const _$CreateTunedModelMetadataImpl( - {@JsonKey(includeIfNull: false) this.totalSteps, - @JsonKey(includeIfNull: false) this.tunedModel, - @JsonKey(includeIfNull: false) this.completedSteps, - @JsonKey(includeIfNull: false) final List? snapshots, - @JsonKey(includeIfNull: false) this.completedPercent}) - : _snapshots = snapshots, +class _$CandidateImpl extends _Candidate { + const _$CandidateImpl( + {@JsonKey(includeIfNull: false) this.content, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + this.finishReason, + @JsonKey(includeIfNull: false) this.citationMetadata, + @JsonKey(includeIfNull: false) this.index, + @JsonKey(includeIfNull: false) this.tokenCount, + @JsonKey(includeIfNull: false) final List? safetyRatings}) + : _safetyRatings = safetyRatings, super._(); - factory _$CreateTunedModelMetadataImpl.fromJson(Map json) => - _$$CreateTunedModelMetadataImplFromJson(json); + factory _$CandidateImpl.fromJson(Map json) => + _$$CandidateImplFromJson(json); - /// The total number of tuning steps. + /// Output only. Generated content returned from the model. @override @JsonKey(includeIfNull: false) - final int? totalSteps; + final Content? content; - /// Name of the tuned model associated with the tuning operation. + /// Optional. Output only. The reason why the model stopped generating tokens. If empty, the model has not stopped generating the tokens. @override - @JsonKey(includeIfNull: false) - final String? tunedModel; + @JsonKey( + includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + final CandidateFinishReason? finishReason; - /// The number of steps completed. + /// Output only. Citation information for model-generated candidate. This field may be populated with recitation information for any text included in the `content`. These are passages that are "recited" from copyrighted material in the foundational LLM's training data. @override @JsonKey(includeIfNull: false) - final int? completedSteps; + final CitationMetadata? citationMetadata; - /// Metrics collected during tuning. - final List? _snapshots; + /// Output only. Index of the candidate in the list of candidates. + @override + @JsonKey(includeIfNull: false) + final int? index; - /// Metrics collected during tuning. + /// Output only. Token count for this candidate. @override @JsonKey(includeIfNull: false) - List? get snapshots { - final value = _snapshots; + final int? tokenCount; + + /// List of ratings for the safety of a response candidate. There is at most one rating per category. + final List? _safetyRatings; + + /// List of ratings for the safety of a response candidate. There is at most one rating per category. + @override + @JsonKey(includeIfNull: false) + List? get safetyRatings { + final value = _safetyRatings; if (value == null) return null; - if (_snapshots is EqualUnmodifiableListView) return _snapshots; + if (_safetyRatings is EqualUnmodifiableListView) return _safetyRatings; // ignore: implicit_dynamic_type return EqualUnmodifiableListView(value); } - /// The completed percentage for the tuning operation. - @override - @JsonKey(includeIfNull: false) - final double? completedPercent; - @override String toString() { - return 'CreateTunedModelMetadata(totalSteps: $totalSteps, tunedModel: $tunedModel, completedSteps: $completedSteps, snapshots: $snapshots, completedPercent: $completedPercent)'; + return 'Candidate(content: $content, finishReason: $finishReason, citationMetadata: $citationMetadata, index: $index, tokenCount: $tokenCount, safetyRatings: $safetyRatings)'; } @override bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$CreateTunedModelMetadataImpl && - (identical(other.totalSteps, totalSteps) || - other.totalSteps == totalSteps) && - (identical(other.tunedModel, tunedModel) || - other.tunedModel == tunedModel) && - (identical(other.completedSteps, completedSteps) || - other.completedSteps == completedSteps) && + other is _$CandidateImpl && + (identical(other.content, content) || other.content == content) && + (identical(other.finishReason, finishReason) || + other.finishReason == finishReason) && + (identical(other.citationMetadata, citationMetadata) || + other.citationMetadata == citationMetadata) && + (identical(other.index, index) || other.index == index) && + (identical(other.tokenCount, tokenCount) || + other.tokenCount == tokenCount) && const DeepCollectionEquality() - .equals(other._snapshots, _snapshots) && - (identical(other.completedPercent, completedPercent) || - other.completedPercent == completedPercent)); + .equals(other._safetyRatings, _safetyRatings)); } @JsonKey(ignore: true) @override int get hashCode => Object.hash( runtimeType, - totalSteps, - tunedModel, - completedSteps, - const DeepCollectionEquality().hash(_snapshots), - completedPercent); + content, + finishReason, + citationMetadata, + index, + tokenCount, + const DeepCollectionEquality().hash(_safetyRatings)); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$CreateTunedModelMetadataImplCopyWith<_$CreateTunedModelMetadataImpl> - get copyWith => __$$CreateTunedModelMetadataImplCopyWithImpl< - _$CreateTunedModelMetadataImpl>(this, _$identity); + _$$CandidateImplCopyWith<_$CandidateImpl> get copyWith => + __$$CandidateImplCopyWithImpl<_$CandidateImpl>(this, _$identity); @override Map toJson() { - return _$$CreateTunedModelMetadataImplToJson( + return _$$CandidateImplToJson( this, ); } } -abstract class _CreateTunedModelMetadata extends CreateTunedModelMetadata { - const factory _CreateTunedModelMetadata( - {@JsonKey(includeIfNull: false) final int? totalSteps, - @JsonKey(includeIfNull: false) final String? tunedModel, - @JsonKey(includeIfNull: false) final int? completedSteps, - @JsonKey(includeIfNull: false) final List? snapshots, - @JsonKey(includeIfNull: false) final double? completedPercent}) = - _$CreateTunedModelMetadataImpl; - const _CreateTunedModelMetadata._() : super._(); +abstract class _Candidate extends Candidate { + const factory _Candidate( + {@JsonKey(includeIfNull: false) final Content? content, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + final CandidateFinishReason? finishReason, + @JsonKey(includeIfNull: false) final CitationMetadata? citationMetadata, + @JsonKey(includeIfNull: false) final int? index, + @JsonKey(includeIfNull: false) final int? tokenCount, + @JsonKey(includeIfNull: false) + final List? safetyRatings}) = _$CandidateImpl; + const _Candidate._() : super._(); - factory _CreateTunedModelMetadata.fromJson(Map json) = - _$CreateTunedModelMetadataImpl.fromJson; + factory _Candidate.fromJson(Map json) = + _$CandidateImpl.fromJson; @override - /// The total number of tuning steps. + /// Output only. Generated content returned from the model. @JsonKey(includeIfNull: false) - int? get totalSteps; + Content? get content; @override - /// Name of the tuned model associated with the tuning operation. + /// Optional. Output only. The reason why the model stopped generating tokens. If empty, the model has not stopped generating the tokens. + @JsonKey( + includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + CandidateFinishReason? get finishReason; + @override + + /// Output only. Citation information for model-generated candidate. This field may be populated with recitation information for any text included in the `content`. These are passages that are "recited" from copyrighted material in the foundational LLM's training data. @JsonKey(includeIfNull: false) - String? get tunedModel; + CitationMetadata? get citationMetadata; @override - /// The number of steps completed. + /// Output only. Index of the candidate in the list of candidates. @JsonKey(includeIfNull: false) - int? get completedSteps; + int? get index; @override - /// Metrics collected during tuning. + /// Output only. Token count for this candidate. @JsonKey(includeIfNull: false) - List? get snapshots; + int? get tokenCount; @override - /// The completed percentage for the tuning operation. + /// List of ratings for the safety of a response candidate. There is at most one rating per category. @JsonKey(includeIfNull: false) - double? get completedPercent; + List? get safetyRatings; @override @JsonKey(ignore: true) - _$$CreateTunedModelMetadataImplCopyWith<_$CreateTunedModelMetadataImpl> - get copyWith => throw _privateConstructorUsedError; + _$$CandidateImplCopyWith<_$CandidateImpl> get copyWith => + throw _privateConstructorUsedError; } -GenerationConfig _$GenerationConfigFromJson(Map json) { - return _GenerationConfig.fromJson(json); +CreateTunedModelMetadata _$CreateTunedModelMetadataFromJson( + Map json) { + return _CreateTunedModelMetadata.fromJson(json); } /// @nodoc -mixin _$GenerationConfig { - /// Optional. The maximum cumulative probability of tokens to consider when sampling. The model uses combined Top-k and nucleus sampling. Tokens are sorted based on their assigned probabilities so that only the most likely tokens are considered. Top-k sampling directly limits the maximum number of tokens to consider, while Nucleus sampling limits number of tokens based on the cumulative probability. Note: The default value varies by model, see the `Model.top_p` attribute of the `Model` returned the `getModel` function. - @JsonKey(includeIfNull: false) - double? get topP => throw _privateConstructorUsedError; - - /// Optional. The maximum number of tokens to consider when sampling. The model uses combined Top-k and nucleus sampling. Top-k sampling considers the set of `top_k` most probable tokens. Defaults to 40. Note: The default value varies by model, see the `Model.top_k` attribute of the `Model` returned the `getModel` function. +mixin _$CreateTunedModelMetadata { + /// The total number of tuning steps. @JsonKey(includeIfNull: false) - int? get topK => throw _privateConstructorUsedError; + int? get totalSteps => throw _privateConstructorUsedError; - /// Optional. Number of generated responses to return. This value must be between [1, 8], inclusive. If unset, this will default to 1. + /// Name of the tuned model associated with the tuning operation. @JsonKey(includeIfNull: false) - int? get candidateCount => throw _privateConstructorUsedError; + String? get tunedModel => throw _privateConstructorUsedError; - /// Optional. The maximum number of tokens to include in a candidate. If unset, this will default to output_token_limit specified in the `Model` specification. + /// The number of steps completed. @JsonKey(includeIfNull: false) - int? get maxOutputTokens => throw _privateConstructorUsedError; + int? get completedSteps => throw _privateConstructorUsedError; - /// Optional. Controls the randomness of the output. Note: The default value varies by model, see the `Model.temperature` attribute of the `Model` returned the `getModel` function. Values can range from [0.0,1.0], inclusive. A value closer to 1.0 will produce responses that are more varied and creative, while a value closer to 0.0 will typically result in more straightforward responses from the model. + /// Metrics collected during tuning. @JsonKey(includeIfNull: false) - double? get temperature => throw _privateConstructorUsedError; + List? get snapshots => throw _privateConstructorUsedError; - /// Optional. The set of character sequences (up to 5) that will stop output generation. If specified, the API will stop at the first appearance of a stop sequence. The stop sequence will not be included as part of the response. + /// The completed percentage for the tuning operation. @JsonKey(includeIfNull: false) - List? get stopSequences => throw _privateConstructorUsedError; + double? get completedPercent => throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) - $GenerationConfigCopyWith get copyWith => + $CreateTunedModelMetadataCopyWith get copyWith => throw _privateConstructorUsedError; } /// @nodoc -abstract class $GenerationConfigCopyWith<$Res> { - factory $GenerationConfigCopyWith( - GenerationConfig value, $Res Function(GenerationConfig) then) = - _$GenerationConfigCopyWithImpl<$Res, GenerationConfig>; +abstract class $CreateTunedModelMetadataCopyWith<$Res> { + factory $CreateTunedModelMetadataCopyWith(CreateTunedModelMetadata value, + $Res Function(CreateTunedModelMetadata) then) = + _$CreateTunedModelMetadataCopyWithImpl<$Res, CreateTunedModelMetadata>; @useResult $Res call( - {@JsonKey(includeIfNull: false) double? topP, - @JsonKey(includeIfNull: false) int? topK, - @JsonKey(includeIfNull: false) int? candidateCount, - @JsonKey(includeIfNull: false) int? maxOutputTokens, - @JsonKey(includeIfNull: false) double? temperature, - @JsonKey(includeIfNull: false) List? stopSequences}); + {@JsonKey(includeIfNull: false) int? totalSteps, + @JsonKey(includeIfNull: false) String? tunedModel, + @JsonKey(includeIfNull: false) int? completedSteps, + @JsonKey(includeIfNull: false) List? snapshots, + @JsonKey(includeIfNull: false) double? completedPercent}); } /// @nodoc -class _$GenerationConfigCopyWithImpl<$Res, $Val extends GenerationConfig> - implements $GenerationConfigCopyWith<$Res> { - _$GenerationConfigCopyWithImpl(this._value, this._then); +class _$CreateTunedModelMetadataCopyWithImpl<$Res, + $Val extends CreateTunedModelMetadata> + implements $CreateTunedModelMetadataCopyWith<$Res> { + _$CreateTunedModelMetadataCopyWithImpl(this._value, this._then); // ignore: unused_field final $Val _value; @@ -612,296 +608,270 @@ class _$GenerationConfigCopyWithImpl<$Res, $Val extends GenerationConfig> @pragma('vm:prefer-inline') @override $Res call({ - Object? topP = freezed, - Object? topK = freezed, - Object? candidateCount = freezed, - Object? maxOutputTokens = freezed, - Object? temperature = freezed, - Object? stopSequences = freezed, + Object? totalSteps = freezed, + Object? tunedModel = freezed, + Object? completedSteps = freezed, + Object? snapshots = freezed, + Object? completedPercent = freezed, }) { return _then(_value.copyWith( - topP: freezed == topP - ? _value.topP - : topP // ignore: cast_nullable_to_non_nullable - as double?, - topK: freezed == topK - ? _value.topK - : topK // ignore: cast_nullable_to_non_nullable - as int?, - candidateCount: freezed == candidateCount - ? _value.candidateCount - : candidateCount // ignore: cast_nullable_to_non_nullable + totalSteps: freezed == totalSteps + ? _value.totalSteps + : totalSteps // ignore: cast_nullable_to_non_nullable as int?, - maxOutputTokens: freezed == maxOutputTokens - ? _value.maxOutputTokens - : maxOutputTokens // ignore: cast_nullable_to_non_nullable + tunedModel: freezed == tunedModel + ? _value.tunedModel + : tunedModel // ignore: cast_nullable_to_non_nullable + as String?, + completedSteps: freezed == completedSteps + ? _value.completedSteps + : completedSteps // ignore: cast_nullable_to_non_nullable as int?, - temperature: freezed == temperature - ? _value.temperature - : temperature // ignore: cast_nullable_to_non_nullable + snapshots: freezed == snapshots + ? _value.snapshots + : snapshots // ignore: cast_nullable_to_non_nullable + as List?, + completedPercent: freezed == completedPercent + ? _value.completedPercent + : completedPercent // ignore: cast_nullable_to_non_nullable as double?, - stopSequences: freezed == stopSequences - ? _value.stopSequences - : stopSequences // ignore: cast_nullable_to_non_nullable - as List?, ) as $Val); } } /// @nodoc -abstract class _$$GenerationConfigImplCopyWith<$Res> - implements $GenerationConfigCopyWith<$Res> { - factory _$$GenerationConfigImplCopyWith(_$GenerationConfigImpl value, - $Res Function(_$GenerationConfigImpl) then) = - __$$GenerationConfigImplCopyWithImpl<$Res>; +abstract class _$$CreateTunedModelMetadataImplCopyWith<$Res> + implements $CreateTunedModelMetadataCopyWith<$Res> { + factory _$$CreateTunedModelMetadataImplCopyWith( + _$CreateTunedModelMetadataImpl value, + $Res Function(_$CreateTunedModelMetadataImpl) then) = + __$$CreateTunedModelMetadataImplCopyWithImpl<$Res>; @override @useResult $Res call( - {@JsonKey(includeIfNull: false) double? topP, - @JsonKey(includeIfNull: false) int? topK, - @JsonKey(includeIfNull: false) int? candidateCount, - @JsonKey(includeIfNull: false) int? maxOutputTokens, - @JsonKey(includeIfNull: false) double? temperature, - @JsonKey(includeIfNull: false) List? stopSequences}); + {@JsonKey(includeIfNull: false) int? totalSteps, + @JsonKey(includeIfNull: false) String? tunedModel, + @JsonKey(includeIfNull: false) int? completedSteps, + @JsonKey(includeIfNull: false) List? snapshots, + @JsonKey(includeIfNull: false) double? completedPercent}); } /// @nodoc -class __$$GenerationConfigImplCopyWithImpl<$Res> - extends _$GenerationConfigCopyWithImpl<$Res, _$GenerationConfigImpl> - implements _$$GenerationConfigImplCopyWith<$Res> { - __$$GenerationConfigImplCopyWithImpl(_$GenerationConfigImpl _value, - $Res Function(_$GenerationConfigImpl) _then) +class __$$CreateTunedModelMetadataImplCopyWithImpl<$Res> + extends _$CreateTunedModelMetadataCopyWithImpl<$Res, + _$CreateTunedModelMetadataImpl> + implements _$$CreateTunedModelMetadataImplCopyWith<$Res> { + __$$CreateTunedModelMetadataImplCopyWithImpl( + _$CreateTunedModelMetadataImpl _value, + $Res Function(_$CreateTunedModelMetadataImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @override $Res call({ - Object? topP = freezed, - Object? topK = freezed, - Object? candidateCount = freezed, - Object? maxOutputTokens = freezed, - Object? temperature = freezed, - Object? stopSequences = freezed, + Object? totalSteps = freezed, + Object? tunedModel = freezed, + Object? completedSteps = freezed, + Object? snapshots = freezed, + Object? completedPercent = freezed, }) { - return _then(_$GenerationConfigImpl( - topP: freezed == topP - ? _value.topP - : topP // ignore: cast_nullable_to_non_nullable - as double?, - topK: freezed == topK - ? _value.topK - : topK // ignore: cast_nullable_to_non_nullable - as int?, - candidateCount: freezed == candidateCount - ? _value.candidateCount - : candidateCount // ignore: cast_nullable_to_non_nullable + return _then(_$CreateTunedModelMetadataImpl( + totalSteps: freezed == totalSteps + ? _value.totalSteps + : totalSteps // ignore: cast_nullable_to_non_nullable as int?, - maxOutputTokens: freezed == maxOutputTokens - ? _value.maxOutputTokens - : maxOutputTokens // ignore: cast_nullable_to_non_nullable + tunedModel: freezed == tunedModel + ? _value.tunedModel + : tunedModel // ignore: cast_nullable_to_non_nullable + as String?, + completedSteps: freezed == completedSteps + ? _value.completedSteps + : completedSteps // ignore: cast_nullable_to_non_nullable as int?, - temperature: freezed == temperature - ? _value.temperature - : temperature // ignore: cast_nullable_to_non_nullable + snapshots: freezed == snapshots + ? _value._snapshots + : snapshots // ignore: cast_nullable_to_non_nullable + as List?, + completedPercent: freezed == completedPercent + ? _value.completedPercent + : completedPercent // ignore: cast_nullable_to_non_nullable as double?, - stopSequences: freezed == stopSequences - ? _value._stopSequences - : stopSequences // ignore: cast_nullable_to_non_nullable - as List?, )); } } /// @nodoc @JsonSerializable() -class _$GenerationConfigImpl extends _GenerationConfig { - const _$GenerationConfigImpl( - {@JsonKey(includeIfNull: false) this.topP, - @JsonKey(includeIfNull: false) this.topK, - @JsonKey(includeIfNull: false) this.candidateCount, - @JsonKey(includeIfNull: false) this.maxOutputTokens, - @JsonKey(includeIfNull: false) this.temperature, - @JsonKey(includeIfNull: false) final List? stopSequences}) - : _stopSequences = stopSequences, +class _$CreateTunedModelMetadataImpl extends _CreateTunedModelMetadata { + const _$CreateTunedModelMetadataImpl( + {@JsonKey(includeIfNull: false) this.totalSteps, + @JsonKey(includeIfNull: false) this.tunedModel, + @JsonKey(includeIfNull: false) this.completedSteps, + @JsonKey(includeIfNull: false) final List? snapshots, + @JsonKey(includeIfNull: false) this.completedPercent}) + : _snapshots = snapshots, super._(); - factory _$GenerationConfigImpl.fromJson(Map json) => - _$$GenerationConfigImplFromJson(json); - - /// Optional. The maximum cumulative probability of tokens to consider when sampling. The model uses combined Top-k and nucleus sampling. Tokens are sorted based on their assigned probabilities so that only the most likely tokens are considered. Top-k sampling directly limits the maximum number of tokens to consider, while Nucleus sampling limits number of tokens based on the cumulative probability. Note: The default value varies by model, see the `Model.top_p` attribute of the `Model` returned the `getModel` function. - @override - @JsonKey(includeIfNull: false) - final double? topP; - - /// Optional. The maximum number of tokens to consider when sampling. The model uses combined Top-k and nucleus sampling. Top-k sampling considers the set of `top_k` most probable tokens. Defaults to 40. Note: The default value varies by model, see the `Model.top_k` attribute of the `Model` returned the `getModel` function. - @override - @JsonKey(includeIfNull: false) - final int? topK; + factory _$CreateTunedModelMetadataImpl.fromJson(Map json) => + _$$CreateTunedModelMetadataImplFromJson(json); - /// Optional. Number of generated responses to return. This value must be between [1, 8], inclusive. If unset, this will default to 1. + /// The total number of tuning steps. @override @JsonKey(includeIfNull: false) - final int? candidateCount; + final int? totalSteps; - /// Optional. The maximum number of tokens to include in a candidate. If unset, this will default to output_token_limit specified in the `Model` specification. + /// Name of the tuned model associated with the tuning operation. @override @JsonKey(includeIfNull: false) - final int? maxOutputTokens; + final String? tunedModel; - /// Optional. Controls the randomness of the output. Note: The default value varies by model, see the `Model.temperature` attribute of the `Model` returned the `getModel` function. Values can range from [0.0,1.0], inclusive. A value closer to 1.0 will produce responses that are more varied and creative, while a value closer to 0.0 will typically result in more straightforward responses from the model. + /// The number of steps completed. @override @JsonKey(includeIfNull: false) - final double? temperature; + final int? completedSteps; - /// Optional. The set of character sequences (up to 5) that will stop output generation. If specified, the API will stop at the first appearance of a stop sequence. The stop sequence will not be included as part of the response. - final List? _stopSequences; + /// Metrics collected during tuning. + final List? _snapshots; - /// Optional. The set of character sequences (up to 5) that will stop output generation. If specified, the API will stop at the first appearance of a stop sequence. The stop sequence will not be included as part of the response. + /// Metrics collected during tuning. @override @JsonKey(includeIfNull: false) - List? get stopSequences { - final value = _stopSequences; + List? get snapshots { + final value = _snapshots; if (value == null) return null; - if (_stopSequences is EqualUnmodifiableListView) return _stopSequences; + if (_snapshots is EqualUnmodifiableListView) return _snapshots; // ignore: implicit_dynamic_type return EqualUnmodifiableListView(value); } + /// The completed percentage for the tuning operation. + @override + @JsonKey(includeIfNull: false) + final double? completedPercent; + @override String toString() { - return 'GenerationConfig(topP: $topP, topK: $topK, candidateCount: $candidateCount, maxOutputTokens: $maxOutputTokens, temperature: $temperature, stopSequences: $stopSequences)'; + return 'CreateTunedModelMetadata(totalSteps: $totalSteps, tunedModel: $tunedModel, completedSteps: $completedSteps, snapshots: $snapshots, completedPercent: $completedPercent)'; } @override bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$GenerationConfigImpl && - (identical(other.topP, topP) || other.topP == topP) && - (identical(other.topK, topK) || other.topK == topK) && - (identical(other.candidateCount, candidateCount) || - other.candidateCount == candidateCount) && - (identical(other.maxOutputTokens, maxOutputTokens) || - other.maxOutputTokens == maxOutputTokens) && - (identical(other.temperature, temperature) || - other.temperature == temperature) && + other is _$CreateTunedModelMetadataImpl && + (identical(other.totalSteps, totalSteps) || + other.totalSteps == totalSteps) && + (identical(other.tunedModel, tunedModel) || + other.tunedModel == tunedModel) && + (identical(other.completedSteps, completedSteps) || + other.completedSteps == completedSteps) && const DeepCollectionEquality() - .equals(other._stopSequences, _stopSequences)); + .equals(other._snapshots, _snapshots) && + (identical(other.completedPercent, completedPercent) || + other.completedPercent == completedPercent)); } @JsonKey(ignore: true) @override int get hashCode => Object.hash( runtimeType, - topP, - topK, - candidateCount, - maxOutputTokens, - temperature, - const DeepCollectionEquality().hash(_stopSequences)); + totalSteps, + tunedModel, + completedSteps, + const DeepCollectionEquality().hash(_snapshots), + completedPercent); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$GenerationConfigImplCopyWith<_$GenerationConfigImpl> get copyWith => - __$$GenerationConfigImplCopyWithImpl<_$GenerationConfigImpl>( - this, _$identity); + _$$CreateTunedModelMetadataImplCopyWith<_$CreateTunedModelMetadataImpl> + get copyWith => __$$CreateTunedModelMetadataImplCopyWithImpl< + _$CreateTunedModelMetadataImpl>(this, _$identity); @override Map toJson() { - return _$$GenerationConfigImplToJson( + return _$$CreateTunedModelMetadataImplToJson( this, ); } } -abstract class _GenerationConfig extends GenerationConfig { - const factory _GenerationConfig( - {@JsonKey(includeIfNull: false) final double? topP, - @JsonKey(includeIfNull: false) final int? topK, - @JsonKey(includeIfNull: false) final int? candidateCount, - @JsonKey(includeIfNull: false) final int? maxOutputTokens, - @JsonKey(includeIfNull: false) final double? temperature, - @JsonKey(includeIfNull: false) final List? stopSequences}) = - _$GenerationConfigImpl; - const _GenerationConfig._() : super._(); - - factory _GenerationConfig.fromJson(Map json) = - _$GenerationConfigImpl.fromJson; +abstract class _CreateTunedModelMetadata extends CreateTunedModelMetadata { + const factory _CreateTunedModelMetadata( + {@JsonKey(includeIfNull: false) final int? totalSteps, + @JsonKey(includeIfNull: false) final String? tunedModel, + @JsonKey(includeIfNull: false) final int? completedSteps, + @JsonKey(includeIfNull: false) final List? snapshots, + @JsonKey(includeIfNull: false) final double? completedPercent}) = + _$CreateTunedModelMetadataImpl; + const _CreateTunedModelMetadata._() : super._(); - @override + factory _CreateTunedModelMetadata.fromJson(Map json) = + _$CreateTunedModelMetadataImpl.fromJson; - /// Optional. The maximum cumulative probability of tokens to consider when sampling. The model uses combined Top-k and nucleus sampling. Tokens are sorted based on their assigned probabilities so that only the most likely tokens are considered. Top-k sampling directly limits the maximum number of tokens to consider, while Nucleus sampling limits number of tokens based on the cumulative probability. Note: The default value varies by model, see the `Model.top_p` attribute of the `Model` returned the `getModel` function. - @JsonKey(includeIfNull: false) - double? get topP; @override - /// Optional. The maximum number of tokens to consider when sampling. The model uses combined Top-k and nucleus sampling. Top-k sampling considers the set of `top_k` most probable tokens. Defaults to 40. Note: The default value varies by model, see the `Model.top_k` attribute of the `Model` returned the `getModel` function. + /// The total number of tuning steps. @JsonKey(includeIfNull: false) - int? get topK; + int? get totalSteps; @override - /// Optional. Number of generated responses to return. This value must be between [1, 8], inclusive. If unset, this will default to 1. + /// Name of the tuned model associated with the tuning operation. @JsonKey(includeIfNull: false) - int? get candidateCount; + String? get tunedModel; @override - /// Optional. The maximum number of tokens to include in a candidate. If unset, this will default to output_token_limit specified in the `Model` specification. + /// The number of steps completed. @JsonKey(includeIfNull: false) - int? get maxOutputTokens; + int? get completedSteps; @override - /// Optional. Controls the randomness of the output. Note: The default value varies by model, see the `Model.temperature` attribute of the `Model` returned the `getModel` function. Values can range from [0.0,1.0], inclusive. A value closer to 1.0 will produce responses that are more varied and creative, while a value closer to 0.0 will typically result in more straightforward responses from the model. + /// Metrics collected during tuning. @JsonKey(includeIfNull: false) - double? get temperature; + List? get snapshots; @override - /// Optional. The set of character sequences (up to 5) that will stop output generation. If specified, the API will stop at the first appearance of a stop sequence. The stop sequence will not be included as part of the response. + /// The completed percentage for the tuning operation. @JsonKey(includeIfNull: false) - List? get stopSequences; + double? get completedPercent; @override @JsonKey(ignore: true) - _$$GenerationConfigImplCopyWith<_$GenerationConfigImpl> get copyWith => - throw _privateConstructorUsedError; + _$$CreateTunedModelMetadataImplCopyWith<_$CreateTunedModelMetadataImpl> + get copyWith => throw _privateConstructorUsedError; } -ListOperationsResponse _$ListOperationsResponseFromJson( +BatchEmbedContentsRequest _$BatchEmbedContentsRequestFromJson( Map json) { - return _ListOperationsResponse.fromJson(json); + return _BatchEmbedContentsRequest.fromJson(json); } /// @nodoc -mixin _$ListOperationsResponse { - /// The standard List next-page token. - @JsonKey(includeIfNull: false) - String? get nextPageToken => throw _privateConstructorUsedError; - - /// A list of operations that matches the specified filter in the request. +mixin _$BatchEmbedContentsRequest { + /// Required. Embed requests for the batch. The model in each of these requests must match the model specified `BatchEmbedContentsRequest.model`. @JsonKey(includeIfNull: false) - List? get operations => throw _privateConstructorUsedError; + List? get requests => throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) - $ListOperationsResponseCopyWith get copyWith => + $BatchEmbedContentsRequestCopyWith get copyWith => throw _privateConstructorUsedError; } /// @nodoc -abstract class $ListOperationsResponseCopyWith<$Res> { - factory $ListOperationsResponseCopyWith(ListOperationsResponse value, - $Res Function(ListOperationsResponse) then) = - _$ListOperationsResponseCopyWithImpl<$Res, ListOperationsResponse>; +abstract class $BatchEmbedContentsRequestCopyWith<$Res> { + factory $BatchEmbedContentsRequestCopyWith(BatchEmbedContentsRequest value, + $Res Function(BatchEmbedContentsRequest) then) = + _$BatchEmbedContentsRequestCopyWithImpl<$Res, BatchEmbedContentsRequest>; @useResult $Res call( - {@JsonKey(includeIfNull: false) String? nextPageToken, - @JsonKey(includeIfNull: false) List? operations}); + {@JsonKey(includeIfNull: false) List? requests}); } /// @nodoc -class _$ListOperationsResponseCopyWithImpl<$Res, - $Val extends ListOperationsResponse> - implements $ListOperationsResponseCopyWith<$Res> { - _$ListOperationsResponseCopyWithImpl(this._value, this._then); +class _$BatchEmbedContentsRequestCopyWithImpl<$Res, + $Val extends BatchEmbedContentsRequest> + implements $BatchEmbedContentsRequestCopyWith<$Res> { + _$BatchEmbedContentsRequestCopyWithImpl(this._value, this._then); // ignore: unused_field final $Val _value; @@ -911,237 +881,183 @@ class _$ListOperationsResponseCopyWithImpl<$Res, @pragma('vm:prefer-inline') @override $Res call({ - Object? nextPageToken = freezed, - Object? operations = freezed, + Object? requests = freezed, }) { return _then(_value.copyWith( - nextPageToken: freezed == nextPageToken - ? _value.nextPageToken - : nextPageToken // ignore: cast_nullable_to_non_nullable - as String?, - operations: freezed == operations - ? _value.operations - : operations // ignore: cast_nullable_to_non_nullable - as List?, + requests: freezed == requests + ? _value.requests + : requests // ignore: cast_nullable_to_non_nullable + as List?, ) as $Val); } } /// @nodoc -abstract class _$$ListOperationsResponseImplCopyWith<$Res> - implements $ListOperationsResponseCopyWith<$Res> { - factory _$$ListOperationsResponseImplCopyWith( - _$ListOperationsResponseImpl value, - $Res Function(_$ListOperationsResponseImpl) then) = - __$$ListOperationsResponseImplCopyWithImpl<$Res>; +abstract class _$$BatchEmbedContentsRequestImplCopyWith<$Res> + implements $BatchEmbedContentsRequestCopyWith<$Res> { + factory _$$BatchEmbedContentsRequestImplCopyWith( + _$BatchEmbedContentsRequestImpl value, + $Res Function(_$BatchEmbedContentsRequestImpl) then) = + __$$BatchEmbedContentsRequestImplCopyWithImpl<$Res>; @override @useResult $Res call( - {@JsonKey(includeIfNull: false) String? nextPageToken, - @JsonKey(includeIfNull: false) List? operations}); + {@JsonKey(includeIfNull: false) List? requests}); } /// @nodoc -class __$$ListOperationsResponseImplCopyWithImpl<$Res> - extends _$ListOperationsResponseCopyWithImpl<$Res, - _$ListOperationsResponseImpl> - implements _$$ListOperationsResponseImplCopyWith<$Res> { - __$$ListOperationsResponseImplCopyWithImpl( - _$ListOperationsResponseImpl _value, - $Res Function(_$ListOperationsResponseImpl) _then) +class __$$BatchEmbedContentsRequestImplCopyWithImpl<$Res> + extends _$BatchEmbedContentsRequestCopyWithImpl<$Res, + _$BatchEmbedContentsRequestImpl> + implements _$$BatchEmbedContentsRequestImplCopyWith<$Res> { + __$$BatchEmbedContentsRequestImplCopyWithImpl( + _$BatchEmbedContentsRequestImpl _value, + $Res Function(_$BatchEmbedContentsRequestImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @override $Res call({ - Object? nextPageToken = freezed, - Object? operations = freezed, + Object? requests = freezed, }) { - return _then(_$ListOperationsResponseImpl( - nextPageToken: freezed == nextPageToken - ? _value.nextPageToken - : nextPageToken // ignore: cast_nullable_to_non_nullable - as String?, - operations: freezed == operations - ? _value._operations - : operations // ignore: cast_nullable_to_non_nullable - as List?, + return _then(_$BatchEmbedContentsRequestImpl( + requests: freezed == requests + ? _value._requests + : requests // ignore: cast_nullable_to_non_nullable + as List?, )); } } /// @nodoc @JsonSerializable() -class _$ListOperationsResponseImpl extends _ListOperationsResponse { - const _$ListOperationsResponseImpl( - {@JsonKey(includeIfNull: false) this.nextPageToken, - @JsonKey(includeIfNull: false) final List? operations}) - : _operations = operations, +class _$BatchEmbedContentsRequestImpl extends _BatchEmbedContentsRequest { + const _$BatchEmbedContentsRequestImpl( + {@JsonKey(includeIfNull: false) + final List? requests}) + : _requests = requests, super._(); - factory _$ListOperationsResponseImpl.fromJson(Map json) => - _$$ListOperationsResponseImplFromJson(json); - - /// The standard List next-page token. - @override - @JsonKey(includeIfNull: false) - final String? nextPageToken; + factory _$BatchEmbedContentsRequestImpl.fromJson(Map json) => + _$$BatchEmbedContentsRequestImplFromJson(json); - /// A list of operations that matches the specified filter in the request. - final List? _operations; + /// Required. Embed requests for the batch. The model in each of these requests must match the model specified `BatchEmbedContentsRequest.model`. + final List? _requests; - /// A list of operations that matches the specified filter in the request. + /// Required. Embed requests for the batch. The model in each of these requests must match the model specified `BatchEmbedContentsRequest.model`. @override @JsonKey(includeIfNull: false) - List? get operations { - final value = _operations; + List? get requests { + final value = _requests; if (value == null) return null; - if (_operations is EqualUnmodifiableListView) return _operations; + if (_requests is EqualUnmodifiableListView) return _requests; // ignore: implicit_dynamic_type return EqualUnmodifiableListView(value); } @override String toString() { - return 'ListOperationsResponse(nextPageToken: $nextPageToken, operations: $operations)'; + return 'BatchEmbedContentsRequest(requests: $requests)'; } @override bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$ListOperationsResponseImpl && - (identical(other.nextPageToken, nextPageToken) || - other.nextPageToken == nextPageToken) && - const DeepCollectionEquality() - .equals(other._operations, _operations)); + other is _$BatchEmbedContentsRequestImpl && + const DeepCollectionEquality().equals(other._requests, _requests)); } @JsonKey(ignore: true) @override - int get hashCode => Object.hash(runtimeType, nextPageToken, - const DeepCollectionEquality().hash(_operations)); + int get hashCode => + Object.hash(runtimeType, const DeepCollectionEquality().hash(_requests)); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$ListOperationsResponseImplCopyWith<_$ListOperationsResponseImpl> - get copyWith => __$$ListOperationsResponseImplCopyWithImpl< - _$ListOperationsResponseImpl>(this, _$identity); + _$$BatchEmbedContentsRequestImplCopyWith<_$BatchEmbedContentsRequestImpl> + get copyWith => __$$BatchEmbedContentsRequestImplCopyWithImpl< + _$BatchEmbedContentsRequestImpl>(this, _$identity); @override Map toJson() { - return _$$ListOperationsResponseImplToJson( + return _$$BatchEmbedContentsRequestImplToJson( this, ); } } -abstract class _ListOperationsResponse extends ListOperationsResponse { - const factory _ListOperationsResponse( - {@JsonKey(includeIfNull: false) final String? nextPageToken, - @JsonKey(includeIfNull: false) final List? operations}) = - _$ListOperationsResponseImpl; - const _ListOperationsResponse._() : super._(); - - factory _ListOperationsResponse.fromJson(Map json) = - _$ListOperationsResponseImpl.fromJson; +abstract class _BatchEmbedContentsRequest extends BatchEmbedContentsRequest { + const factory _BatchEmbedContentsRequest( + {@JsonKey(includeIfNull: false) + final List? requests}) = + _$BatchEmbedContentsRequestImpl; + const _BatchEmbedContentsRequest._() : super._(); - @override + factory _BatchEmbedContentsRequest.fromJson(Map json) = + _$BatchEmbedContentsRequestImpl.fromJson; - /// The standard List next-page token. - @JsonKey(includeIfNull: false) - String? get nextPageToken; @override - /// A list of operations that matches the specified filter in the request. + /// Required. Embed requests for the batch. The model in each of these requests must match the model specified `BatchEmbedContentsRequest.model`. @JsonKey(includeIfNull: false) - List? get operations; + List? get requests; @override @JsonKey(ignore: true) - _$$ListOperationsResponseImplCopyWith<_$ListOperationsResponseImpl> + _$$BatchEmbedContentsRequestImplCopyWith<_$BatchEmbedContentsRequestImpl> get copyWith => throw _privateConstructorUsedError; } -Model _$ModelFromJson(Map json) { - return _Model.fromJson(json); +SafetyRating _$SafetyRatingFromJson(Map json) { + return _SafetyRating.fromJson(json); } /// @nodoc -mixin _$Model { - /// Required. The resource name of the `Model`. Format: `models/{model}` with a `{model}` naming convention of: * "{base_model_id}-{version}" Examples: * `models/chat-bison-001` - @JsonKey(includeIfNull: false) - String? get name => throw _privateConstructorUsedError; - - /// The human-readable name of the model. E.g. "Chat Bison". The name can be up to 128 characters long and can consist of any UTF-8 characters. - @JsonKey(includeIfNull: false) - String? get displayName => throw _privateConstructorUsedError; - - /// A short description of the model. - @JsonKey(includeIfNull: false) - String? get description => throw _privateConstructorUsedError; - - /// For Top-k sampling. Top-k sampling considers the set of `top_k` most probable tokens. This value specifies default to be used by the backend while making the call to the model. - @JsonKey(includeIfNull: false) - int? get topK => throw _privateConstructorUsedError; - - /// Required. The version number of the model. This represents the major version - @JsonKey(includeIfNull: false) - String? get version => throw _privateConstructorUsedError; - - /// Controls the randomness of the output. Values can range over `[0.0,1.0]`, inclusive. A value closer to `1.0` will produce responses that are more varied, while a value closer to `0.0` will typically result in less surprising responses from the model. This value specifies default to be used by the backend while making the call to the model. - @JsonKey(includeIfNull: false) - double? get temperature => throw _privateConstructorUsedError; - - /// For Nucleus sampling. Nucleus sampling considers the smallest set of tokens whose probability sum is at least `top_p`. This value specifies default to be used by the backend while making the call to the model. - @JsonKey(includeIfNull: false) - double? get topP => throw _privateConstructorUsedError; - - /// Required. The name of the base model, pass this to the generation request. Examples: * `chat-bison` - @JsonKey(includeIfNull: false) - String? get baseModelId => throw _privateConstructorUsedError; - - /// Maximum number of input tokens allowed for this model. - @JsonKey(includeIfNull: false) - int? get inputTokenLimit => throw _privateConstructorUsedError; +mixin _$SafetyRating { + /// Required. The category for this rating. + @JsonKey( + includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + SafetyRatingCategory? get category => throw _privateConstructorUsedError; - /// Maximum number of output tokens available for this model. - @JsonKey(includeIfNull: false) - int? get outputTokenLimit => throw _privateConstructorUsedError; + /// Required. The probability of harm for this content. + @JsonKey( + includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + SafetyRatingProbability? get probability => + throw _privateConstructorUsedError; - /// The model's supported generation methods. The method names are defined as Pascal case strings, such as `generateMessage` which correspond to API methods. + /// Was this content blocked because of this rating? @JsonKey(includeIfNull: false) - List? get supportedGenerationMethods => - throw _privateConstructorUsedError; + bool? get blocked => throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) - $ModelCopyWith get copyWith => throw _privateConstructorUsedError; + $SafetyRatingCopyWith get copyWith => + throw _privateConstructorUsedError; } /// @nodoc -abstract class $ModelCopyWith<$Res> { - factory $ModelCopyWith(Model value, $Res Function(Model) then) = - _$ModelCopyWithImpl<$Res, Model>; +abstract class $SafetyRatingCopyWith<$Res> { + factory $SafetyRatingCopyWith( + SafetyRating value, $Res Function(SafetyRating) then) = + _$SafetyRatingCopyWithImpl<$Res, SafetyRating>; @useResult $Res call( - {@JsonKey(includeIfNull: false) String? name, - @JsonKey(includeIfNull: false) String? displayName, - @JsonKey(includeIfNull: false) String? description, - @JsonKey(includeIfNull: false) int? topK, - @JsonKey(includeIfNull: false) String? version, - @JsonKey(includeIfNull: false) double? temperature, - @JsonKey(includeIfNull: false) double? topP, - @JsonKey(includeIfNull: false) String? baseModelId, - @JsonKey(includeIfNull: false) int? inputTokenLimit, - @JsonKey(includeIfNull: false) int? outputTokenLimit, - @JsonKey(includeIfNull: false) List? supportedGenerationMethods}); + {@JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + SafetyRatingCategory? category, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + SafetyRatingProbability? probability, + @JsonKey(includeIfNull: false) bool? blocked}); } /// @nodoc -class _$ModelCopyWithImpl<$Res, $Val extends Model> - implements $ModelCopyWith<$Res> { - _$ModelCopyWithImpl(this._value, this._then); +class _$SafetyRatingCopyWithImpl<$Res, $Val extends SafetyRating> + implements $SafetyRatingCopyWith<$Res> { + _$SafetyRatingCopyWithImpl(this._value, this._then); // ignore: unused_field final $Val _value; @@ -1151,462 +1067,23 @@ class _$ModelCopyWithImpl<$Res, $Val extends Model> @pragma('vm:prefer-inline') @override $Res call({ - Object? name = freezed, - Object? displayName = freezed, - Object? description = freezed, - Object? topK = freezed, - Object? version = freezed, - Object? temperature = freezed, - Object? topP = freezed, - Object? baseModelId = freezed, - Object? inputTokenLimit = freezed, - Object? outputTokenLimit = freezed, - Object? supportedGenerationMethods = freezed, + Object? category = freezed, + Object? probability = freezed, + Object? blocked = freezed, }) { return _then(_value.copyWith( - name: freezed == name - ? _value.name - : name // ignore: cast_nullable_to_non_nullable - as String?, - displayName: freezed == displayName - ? _value.displayName - : displayName // ignore: cast_nullable_to_non_nullable - as String?, - description: freezed == description - ? _value.description - : description // ignore: cast_nullable_to_non_nullable - as String?, - topK: freezed == topK - ? _value.topK - : topK // ignore: cast_nullable_to_non_nullable - as int?, - version: freezed == version - ? _value.version - : version // ignore: cast_nullable_to_non_nullable - as String?, - temperature: freezed == temperature - ? _value.temperature - : temperature // ignore: cast_nullable_to_non_nullable - as double?, - topP: freezed == topP - ? _value.topP - : topP // ignore: cast_nullable_to_non_nullable - as double?, - baseModelId: freezed == baseModelId - ? _value.baseModelId - : baseModelId // ignore: cast_nullable_to_non_nullable - as String?, - inputTokenLimit: freezed == inputTokenLimit - ? _value.inputTokenLimit - : inputTokenLimit // ignore: cast_nullable_to_non_nullable - as int?, - outputTokenLimit: freezed == outputTokenLimit - ? _value.outputTokenLimit - : outputTokenLimit // ignore: cast_nullable_to_non_nullable - as int?, - supportedGenerationMethods: freezed == supportedGenerationMethods - ? _value.supportedGenerationMethods - : supportedGenerationMethods // ignore: cast_nullable_to_non_nullable - as List?, - ) as $Val); - } -} - -/// @nodoc -abstract class _$$ModelImplCopyWith<$Res> implements $ModelCopyWith<$Res> { - factory _$$ModelImplCopyWith( - _$ModelImpl value, $Res Function(_$ModelImpl) then) = - __$$ModelImplCopyWithImpl<$Res>; - @override - @useResult - $Res call( - {@JsonKey(includeIfNull: false) String? name, - @JsonKey(includeIfNull: false) String? displayName, - @JsonKey(includeIfNull: false) String? description, - @JsonKey(includeIfNull: false) int? topK, - @JsonKey(includeIfNull: false) String? version, - @JsonKey(includeIfNull: false) double? temperature, - @JsonKey(includeIfNull: false) double? topP, - @JsonKey(includeIfNull: false) String? baseModelId, - @JsonKey(includeIfNull: false) int? inputTokenLimit, - @JsonKey(includeIfNull: false) int? outputTokenLimit, - @JsonKey(includeIfNull: false) List? supportedGenerationMethods}); -} - -/// @nodoc -class __$$ModelImplCopyWithImpl<$Res> - extends _$ModelCopyWithImpl<$Res, _$ModelImpl> - implements _$$ModelImplCopyWith<$Res> { - __$$ModelImplCopyWithImpl( - _$ModelImpl _value, $Res Function(_$ModelImpl) _then) - : super(_value, _then); - - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? name = freezed, - Object? displayName = freezed, - Object? description = freezed, - Object? topK = freezed, - Object? version = freezed, - Object? temperature = freezed, - Object? topP = freezed, - Object? baseModelId = freezed, - Object? inputTokenLimit = freezed, - Object? outputTokenLimit = freezed, - Object? supportedGenerationMethods = freezed, - }) { - return _then(_$ModelImpl( - name: freezed == name - ? _value.name - : name // ignore: cast_nullable_to_non_nullable - as String?, - displayName: freezed == displayName - ? _value.displayName - : displayName // ignore: cast_nullable_to_non_nullable - as String?, - description: freezed == description - ? _value.description - : description // ignore: cast_nullable_to_non_nullable - as String?, - topK: freezed == topK - ? _value.topK - : topK // ignore: cast_nullable_to_non_nullable - as int?, - version: freezed == version - ? _value.version - : version // ignore: cast_nullable_to_non_nullable - as String?, - temperature: freezed == temperature - ? _value.temperature - : temperature // ignore: cast_nullable_to_non_nullable - as double?, - topP: freezed == topP - ? _value.topP - : topP // ignore: cast_nullable_to_non_nullable - as double?, - baseModelId: freezed == baseModelId - ? _value.baseModelId - : baseModelId // ignore: cast_nullable_to_non_nullable - as String?, - inputTokenLimit: freezed == inputTokenLimit - ? _value.inputTokenLimit - : inputTokenLimit // ignore: cast_nullable_to_non_nullable - as int?, - outputTokenLimit: freezed == outputTokenLimit - ? _value.outputTokenLimit - : outputTokenLimit // ignore: cast_nullable_to_non_nullable - as int?, - supportedGenerationMethods: freezed == supportedGenerationMethods - ? _value._supportedGenerationMethods - : supportedGenerationMethods // ignore: cast_nullable_to_non_nullable - as List?, - )); - } -} - -/// @nodoc -@JsonSerializable() -class _$ModelImpl extends _Model { - const _$ModelImpl( - {@JsonKey(includeIfNull: false) this.name, - @JsonKey(includeIfNull: false) this.displayName, - @JsonKey(includeIfNull: false) this.description, - @JsonKey(includeIfNull: false) this.topK, - @JsonKey(includeIfNull: false) this.version, - @JsonKey(includeIfNull: false) this.temperature, - @JsonKey(includeIfNull: false) this.topP, - @JsonKey(includeIfNull: false) this.baseModelId, - @JsonKey(includeIfNull: false) this.inputTokenLimit, - @JsonKey(includeIfNull: false) this.outputTokenLimit, - @JsonKey(includeIfNull: false) - final List? supportedGenerationMethods}) - : _supportedGenerationMethods = supportedGenerationMethods, - super._(); - - factory _$ModelImpl.fromJson(Map json) => - _$$ModelImplFromJson(json); - - /// Required. The resource name of the `Model`. Format: `models/{model}` with a `{model}` naming convention of: * "{base_model_id}-{version}" Examples: * `models/chat-bison-001` - @override - @JsonKey(includeIfNull: false) - final String? name; - - /// The human-readable name of the model. E.g. "Chat Bison". The name can be up to 128 characters long and can consist of any UTF-8 characters. - @override - @JsonKey(includeIfNull: false) - final String? displayName; - - /// A short description of the model. - @override - @JsonKey(includeIfNull: false) - final String? description; - - /// For Top-k sampling. Top-k sampling considers the set of `top_k` most probable tokens. This value specifies default to be used by the backend while making the call to the model. - @override - @JsonKey(includeIfNull: false) - final int? topK; - - /// Required. The version number of the model. This represents the major version - @override - @JsonKey(includeIfNull: false) - final String? version; - - /// Controls the randomness of the output. Values can range over `[0.0,1.0]`, inclusive. A value closer to `1.0` will produce responses that are more varied, while a value closer to `0.0` will typically result in less surprising responses from the model. This value specifies default to be used by the backend while making the call to the model. - @override - @JsonKey(includeIfNull: false) - final double? temperature; - - /// For Nucleus sampling. Nucleus sampling considers the smallest set of tokens whose probability sum is at least `top_p`. This value specifies default to be used by the backend while making the call to the model. - @override - @JsonKey(includeIfNull: false) - final double? topP; - - /// Required. The name of the base model, pass this to the generation request. Examples: * `chat-bison` - @override - @JsonKey(includeIfNull: false) - final String? baseModelId; - - /// Maximum number of input tokens allowed for this model. - @override - @JsonKey(includeIfNull: false) - final int? inputTokenLimit; - - /// Maximum number of output tokens available for this model. - @override - @JsonKey(includeIfNull: false) - final int? outputTokenLimit; - - /// The model's supported generation methods. The method names are defined as Pascal case strings, such as `generateMessage` which correspond to API methods. - final List? _supportedGenerationMethods; - - /// The model's supported generation methods. The method names are defined as Pascal case strings, such as `generateMessage` which correspond to API methods. - @override - @JsonKey(includeIfNull: false) - List? get supportedGenerationMethods { - final value = _supportedGenerationMethods; - if (value == null) return null; - if (_supportedGenerationMethods is EqualUnmodifiableListView) - return _supportedGenerationMethods; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(value); - } - - @override - String toString() { - return 'Model(name: $name, displayName: $displayName, description: $description, topK: $topK, version: $version, temperature: $temperature, topP: $topP, baseModelId: $baseModelId, inputTokenLimit: $inputTokenLimit, outputTokenLimit: $outputTokenLimit, supportedGenerationMethods: $supportedGenerationMethods)'; - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$ModelImpl && - (identical(other.name, name) || other.name == name) && - (identical(other.displayName, displayName) || - other.displayName == displayName) && - (identical(other.description, description) || - other.description == description) && - (identical(other.topK, topK) || other.topK == topK) && - (identical(other.version, version) || other.version == version) && - (identical(other.temperature, temperature) || - other.temperature == temperature) && - (identical(other.topP, topP) || other.topP == topP) && - (identical(other.baseModelId, baseModelId) || - other.baseModelId == baseModelId) && - (identical(other.inputTokenLimit, inputTokenLimit) || - other.inputTokenLimit == inputTokenLimit) && - (identical(other.outputTokenLimit, outputTokenLimit) || - other.outputTokenLimit == outputTokenLimit) && - const DeepCollectionEquality().equals( - other._supportedGenerationMethods, - _supportedGenerationMethods)); - } - - @JsonKey(ignore: true) - @override - int get hashCode => Object.hash( - runtimeType, - name, - displayName, - description, - topK, - version, - temperature, - topP, - baseModelId, - inputTokenLimit, - outputTokenLimit, - const DeepCollectionEquality().hash(_supportedGenerationMethods)); - - @JsonKey(ignore: true) - @override - @pragma('vm:prefer-inline') - _$$ModelImplCopyWith<_$ModelImpl> get copyWith => - __$$ModelImplCopyWithImpl<_$ModelImpl>(this, _$identity); - - @override - Map toJson() { - return _$$ModelImplToJson( - this, - ); - } -} - -abstract class _Model extends Model { - const factory _Model( - {@JsonKey(includeIfNull: false) final String? name, - @JsonKey(includeIfNull: false) final String? displayName, - @JsonKey(includeIfNull: false) final String? description, - @JsonKey(includeIfNull: false) final int? topK, - @JsonKey(includeIfNull: false) final String? version, - @JsonKey(includeIfNull: false) final double? temperature, - @JsonKey(includeIfNull: false) final double? topP, - @JsonKey(includeIfNull: false) final String? baseModelId, - @JsonKey(includeIfNull: false) final int? inputTokenLimit, - @JsonKey(includeIfNull: false) final int? outputTokenLimit, - @JsonKey(includeIfNull: false) - final List? supportedGenerationMethods}) = _$ModelImpl; - const _Model._() : super._(); - - factory _Model.fromJson(Map json) = _$ModelImpl.fromJson; - - @override - - /// Required. The resource name of the `Model`. Format: `models/{model}` with a `{model}` naming convention of: * "{base_model_id}-{version}" Examples: * `models/chat-bison-001` - @JsonKey(includeIfNull: false) - String? get name; - @override - - /// The human-readable name of the model. E.g. "Chat Bison". The name can be up to 128 characters long and can consist of any UTF-8 characters. - @JsonKey(includeIfNull: false) - String? get displayName; - @override - - /// A short description of the model. - @JsonKey(includeIfNull: false) - String? get description; - @override - - /// For Top-k sampling. Top-k sampling considers the set of `top_k` most probable tokens. This value specifies default to be used by the backend while making the call to the model. - @JsonKey(includeIfNull: false) - int? get topK; - @override - - /// Required. The version number of the model. This represents the major version - @JsonKey(includeIfNull: false) - String? get version; - @override - - /// Controls the randomness of the output. Values can range over `[0.0,1.0]`, inclusive. A value closer to `1.0` will produce responses that are more varied, while a value closer to `0.0` will typically result in less surprising responses from the model. This value specifies default to be used by the backend while making the call to the model. - @JsonKey(includeIfNull: false) - double? get temperature; - @override - - /// For Nucleus sampling. Nucleus sampling considers the smallest set of tokens whose probability sum is at least `top_p`. This value specifies default to be used by the backend while making the call to the model. - @JsonKey(includeIfNull: false) - double? get topP; - @override - - /// Required. The name of the base model, pass this to the generation request. Examples: * `chat-bison` - @JsonKey(includeIfNull: false) - String? get baseModelId; - @override - - /// Maximum number of input tokens allowed for this model. - @JsonKey(includeIfNull: false) - int? get inputTokenLimit; - @override - - /// Maximum number of output tokens available for this model. - @JsonKey(includeIfNull: false) - int? get outputTokenLimit; - @override - - /// The model's supported generation methods. The method names are defined as Pascal case strings, such as `generateMessage` which correspond to API methods. - @JsonKey(includeIfNull: false) - List? get supportedGenerationMethods; - @override - @JsonKey(ignore: true) - _$$ModelImplCopyWith<_$ModelImpl> get copyWith => - throw _privateConstructorUsedError; -} - -SafetyRating _$SafetyRatingFromJson(Map json) { - return _SafetyRating.fromJson(json); -} - -/// @nodoc -mixin _$SafetyRating { - /// Required. The category for this rating. - @JsonKey( - includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue) - SafetyRatingCategory? get category => throw _privateConstructorUsedError; - - /// Required. The probability of harm for this content. - @JsonKey( - includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue) - SafetyRatingProbability? get probability => - throw _privateConstructorUsedError; - - /// Was this content blocked because of this rating? - @JsonKey(includeIfNull: false) - bool? get blocked => throw _privateConstructorUsedError; - - Map toJson() => throw _privateConstructorUsedError; - @JsonKey(ignore: true) - $SafetyRatingCopyWith get copyWith => - throw _privateConstructorUsedError; -} - -/// @nodoc -abstract class $SafetyRatingCopyWith<$Res> { - factory $SafetyRatingCopyWith( - SafetyRating value, $Res Function(SafetyRating) then) = - _$SafetyRatingCopyWithImpl<$Res, SafetyRating>; - @useResult - $Res call( - {@JsonKey( - includeIfNull: false, - unknownEnumValue: JsonKey.nullForUndefinedEnumValue) - SafetyRatingCategory? category, - @JsonKey( - includeIfNull: false, - unknownEnumValue: JsonKey.nullForUndefinedEnumValue) - SafetyRatingProbability? probability, - @JsonKey(includeIfNull: false) bool? blocked}); -} - -/// @nodoc -class _$SafetyRatingCopyWithImpl<$Res, $Val extends SafetyRating> - implements $SafetyRatingCopyWith<$Res> { - _$SafetyRatingCopyWithImpl(this._value, this._then); - - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; - - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? category = freezed, - Object? probability = freezed, - Object? blocked = freezed, - }) { - return _then(_value.copyWith( - category: freezed == category - ? _value.category - : category // ignore: cast_nullable_to_non_nullable - as SafetyRatingCategory?, - probability: freezed == probability - ? _value.probability - : probability // ignore: cast_nullable_to_non_nullable - as SafetyRatingProbability?, - blocked: freezed == blocked - ? _value.blocked - : blocked // ignore: cast_nullable_to_non_nullable - as bool?, + category: freezed == category + ? _value.category + : category // ignore: cast_nullable_to_non_nullable + as SafetyRatingCategory?, + probability: freezed == probability + ? _value.probability + : probability // ignore: cast_nullable_to_non_nullable + as SafetyRatingProbability?, + blocked: freezed == blocked + ? _value.blocked + : blocked // ignore: cast_nullable_to_non_nullable + as bool?, ) as $Val); } } @@ -1845,248 +1322,469 @@ class _$PartCopyWithImpl<$Res, $Val extends Part> } /// @nodoc -abstract class _$$PartImplCopyWith<$Res> implements $PartCopyWith<$Res> { - factory _$$PartImplCopyWith( - _$PartImpl value, $Res Function(_$PartImpl) then) = - __$$PartImplCopyWithImpl<$Res>; +abstract class _$$PartImplCopyWith<$Res> implements $PartCopyWith<$Res> { + factory _$$PartImplCopyWith( + _$PartImpl value, $Res Function(_$PartImpl) then) = + __$$PartImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {@JsonKey(includeIfNull: false) Blob? inlineData, + @JsonKey(includeIfNull: false) String? text}); + + @override + $BlobCopyWith<$Res>? get inlineData; +} + +/// @nodoc +class __$$PartImplCopyWithImpl<$Res> + extends _$PartCopyWithImpl<$Res, _$PartImpl> + implements _$$PartImplCopyWith<$Res> { + __$$PartImplCopyWithImpl(_$PartImpl _value, $Res Function(_$PartImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? inlineData = freezed, + Object? text = freezed, + }) { + return _then(_$PartImpl( + inlineData: freezed == inlineData + ? _value.inlineData + : inlineData // ignore: cast_nullable_to_non_nullable + as Blob?, + text: freezed == text + ? _value.text + : text // ignore: cast_nullable_to_non_nullable + as String?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$PartImpl extends _Part { + const _$PartImpl( + {@JsonKey(includeIfNull: false) this.inlineData, + @JsonKey(includeIfNull: false) this.text}) + : super._(); + + factory _$PartImpl.fromJson(Map json) => + _$$PartImplFromJson(json); + + /// Inline media bytes. + @override + @JsonKey(includeIfNull: false) + final Blob? inlineData; + + /// Inline text. + @override + @JsonKey(includeIfNull: false) + final String? text; + + @override + String toString() { + return 'Part(inlineData: $inlineData, text: $text)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$PartImpl && + (identical(other.inlineData, inlineData) || + other.inlineData == inlineData) && + (identical(other.text, text) || other.text == text)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, inlineData, text); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$PartImplCopyWith<_$PartImpl> get copyWith => + __$$PartImplCopyWithImpl<_$PartImpl>(this, _$identity); + + @override + Map toJson() { + return _$$PartImplToJson( + this, + ); + } +} + +abstract class _Part extends Part { + const factory _Part( + {@JsonKey(includeIfNull: false) final Blob? inlineData, + @JsonKey(includeIfNull: false) final String? text}) = _$PartImpl; + const _Part._() : super._(); + + factory _Part.fromJson(Map json) = _$PartImpl.fromJson; + + @override + + /// Inline media bytes. + @JsonKey(includeIfNull: false) + Blob? get inlineData; + @override + + /// Inline text. + @JsonKey(includeIfNull: false) + String? get text; + @override + @JsonKey(ignore: true) + _$$PartImplCopyWith<_$PartImpl> get copyWith => + throw _privateConstructorUsedError; +} + +Operation _$OperationFromJson(Map json) { + return _Operation.fromJson(json); +} + +/// @nodoc +mixin _$Operation { + /// The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should be a resource name ending with `operations/{unique_id}`. + @JsonKey(includeIfNull: false) + String? get name => throw _privateConstructorUsedError; + + /// The normal, successful response of the operation. If the original method returns no data on success, such as `Delete`, the response is `google.protobuf.Empty`. If the original method is standard `Get`/`Create`/`Update`, the response should be the resource. For other methods, the response should have the type `XxxResponse`, where `Xxx` is the original method name. For example, if the original method name is `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`. + @JsonKey(includeIfNull: false) + Map? get response => throw _privateConstructorUsedError; + + /// If the value is `false`, it means the operation is still in progress. If `true`, the operation is completed, and either `error` or `response` is available. + @JsonKey(includeIfNull: false) + bool? get done => throw _privateConstructorUsedError; + + /// Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any. + @JsonKey(includeIfNull: false) + Map? get metadata => throw _privateConstructorUsedError; + + /// The error result of the operation in case of failure or cancellation. + @JsonKey(includeIfNull: false) + Status? get error => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $OperationCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $OperationCopyWith<$Res> { + factory $OperationCopyWith(Operation value, $Res Function(Operation) then) = + _$OperationCopyWithImpl<$Res, Operation>; + @useResult + $Res call( + {@JsonKey(includeIfNull: false) String? name, + @JsonKey(includeIfNull: false) Map? response, + @JsonKey(includeIfNull: false) bool? done, + @JsonKey(includeIfNull: false) Map? metadata, + @JsonKey(includeIfNull: false) Status? error}); + + $StatusCopyWith<$Res>? get error; +} + +/// @nodoc +class _$OperationCopyWithImpl<$Res, $Val extends Operation> + implements $OperationCopyWith<$Res> { + _$OperationCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? name = freezed, + Object? response = freezed, + Object? done = freezed, + Object? metadata = freezed, + Object? error = freezed, + }) { + return _then(_value.copyWith( + name: freezed == name + ? _value.name + : name // ignore: cast_nullable_to_non_nullable + as String?, + response: freezed == response + ? _value.response + : response // ignore: cast_nullable_to_non_nullable + as Map?, + done: freezed == done + ? _value.done + : done // ignore: cast_nullable_to_non_nullable + as bool?, + metadata: freezed == metadata + ? _value.metadata + : metadata // ignore: cast_nullable_to_non_nullable + as Map?, + error: freezed == error + ? _value.error + : error // ignore: cast_nullable_to_non_nullable + as Status?, + ) as $Val); + } + + @override + @pragma('vm:prefer-inline') + $StatusCopyWith<$Res>? get error { + if (_value.error == null) { + return null; + } + + return $StatusCopyWith<$Res>(_value.error!, (value) { + return _then(_value.copyWith(error: value) as $Val); + }); + } +} + +/// @nodoc +abstract class _$$OperationImplCopyWith<$Res> + implements $OperationCopyWith<$Res> { + factory _$$OperationImplCopyWith( + _$OperationImpl value, $Res Function(_$OperationImpl) then) = + __$$OperationImplCopyWithImpl<$Res>; @override @useResult $Res call( - {@JsonKey(includeIfNull: false) Blob? inlineData, - @JsonKey(includeIfNull: false) String? text}); + {@JsonKey(includeIfNull: false) String? name, + @JsonKey(includeIfNull: false) Map? response, + @JsonKey(includeIfNull: false) bool? done, + @JsonKey(includeIfNull: false) Map? metadata, + @JsonKey(includeIfNull: false) Status? error}); @override - $BlobCopyWith<$Res>? get inlineData; + $StatusCopyWith<$Res>? get error; } /// @nodoc -class __$$PartImplCopyWithImpl<$Res> - extends _$PartCopyWithImpl<$Res, _$PartImpl> - implements _$$PartImplCopyWith<$Res> { - __$$PartImplCopyWithImpl(_$PartImpl _value, $Res Function(_$PartImpl) _then) +class __$$OperationImplCopyWithImpl<$Res> + extends _$OperationCopyWithImpl<$Res, _$OperationImpl> + implements _$$OperationImplCopyWith<$Res> { + __$$OperationImplCopyWithImpl( + _$OperationImpl _value, $Res Function(_$OperationImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @override $Res call({ - Object? inlineData = freezed, - Object? text = freezed, + Object? name = freezed, + Object? response = freezed, + Object? done = freezed, + Object? metadata = freezed, + Object? error = freezed, }) { - return _then(_$PartImpl( - inlineData: freezed == inlineData - ? _value.inlineData - : inlineData // ignore: cast_nullable_to_non_nullable - as Blob?, - text: freezed == text - ? _value.text - : text // ignore: cast_nullable_to_non_nullable + return _then(_$OperationImpl( + name: freezed == name + ? _value.name + : name // ignore: cast_nullable_to_non_nullable as String?, + response: freezed == response + ? _value._response + : response // ignore: cast_nullable_to_non_nullable + as Map?, + done: freezed == done + ? _value.done + : done // ignore: cast_nullable_to_non_nullable + as bool?, + metadata: freezed == metadata + ? _value._metadata + : metadata // ignore: cast_nullable_to_non_nullable + as Map?, + error: freezed == error + ? _value.error + : error // ignore: cast_nullable_to_non_nullable + as Status?, )); } } /// @nodoc @JsonSerializable() -class _$PartImpl extends _Part { - const _$PartImpl( - {@JsonKey(includeIfNull: false) this.inlineData, - @JsonKey(includeIfNull: false) this.text}) - : super._(); +class _$OperationImpl extends _Operation { + const _$OperationImpl( + {@JsonKey(includeIfNull: false) this.name, + @JsonKey(includeIfNull: false) final Map? response, + @JsonKey(includeIfNull: false) this.done, + @JsonKey(includeIfNull: false) final Map? metadata, + @JsonKey(includeIfNull: false) this.error}) + : _response = response, + _metadata = metadata, + super._(); - factory _$PartImpl.fromJson(Map json) => - _$$PartImplFromJson(json); + factory _$OperationImpl.fromJson(Map json) => + _$$OperationImplFromJson(json); - /// Inline media bytes. + /// The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should be a resource name ending with `operations/{unique_id}`. @override @JsonKey(includeIfNull: false) - final Blob? inlineData; + final String? name; - /// Inline text. + /// The normal, successful response of the operation. If the original method returns no data on success, such as `Delete`, the response is `google.protobuf.Empty`. If the original method is standard `Get`/`Create`/`Update`, the response should be the resource. For other methods, the response should have the type `XxxResponse`, where `Xxx` is the original method name. For example, if the original method name is `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`. + final Map? _response; + + /// The normal, successful response of the operation. If the original method returns no data on success, such as `Delete`, the response is `google.protobuf.Empty`. If the original method is standard `Get`/`Create`/`Update`, the response should be the resource. For other methods, the response should have the type `XxxResponse`, where `Xxx` is the original method name. For example, if the original method name is `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`. @override @JsonKey(includeIfNull: false) - final String? text; + Map? get response { + final value = _response; + if (value == null) return null; + if (_response is EqualUnmodifiableMapView) return _response; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(value); + } + + /// If the value is `false`, it means the operation is still in progress. If `true`, the operation is completed, and either `error` or `response` is available. + @override + @JsonKey(includeIfNull: false) + final bool? done; + + /// Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any. + final Map? _metadata; + + /// Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any. + @override + @JsonKey(includeIfNull: false) + Map? get metadata { + final value = _metadata; + if (value == null) return null; + if (_metadata is EqualUnmodifiableMapView) return _metadata; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(value); + } + + /// The error result of the operation in case of failure or cancellation. + @override + @JsonKey(includeIfNull: false) + final Status? error; @override String toString() { - return 'Part(inlineData: $inlineData, text: $text)'; + return 'Operation(name: $name, response: $response, done: $done, metadata: $metadata, error: $error)'; } @override bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$PartImpl && - (identical(other.inlineData, inlineData) || - other.inlineData == inlineData) && - (identical(other.text, text) || other.text == text)); + other is _$OperationImpl && + (identical(other.name, name) || other.name == name) && + const DeepCollectionEquality().equals(other._response, _response) && + (identical(other.done, done) || other.done == done) && + const DeepCollectionEquality().equals(other._metadata, _metadata) && + (identical(other.error, error) || other.error == error)); } @JsonKey(ignore: true) @override - int get hashCode => Object.hash(runtimeType, inlineData, text); + int get hashCode => Object.hash( + runtimeType, + name, + const DeepCollectionEquality().hash(_response), + done, + const DeepCollectionEquality().hash(_metadata), + error); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$PartImplCopyWith<_$PartImpl> get copyWith => - __$$PartImplCopyWithImpl<_$PartImpl>(this, _$identity); + _$$OperationImplCopyWith<_$OperationImpl> get copyWith => + __$$OperationImplCopyWithImpl<_$OperationImpl>(this, _$identity); @override Map toJson() { - return _$$PartImplToJson( + return _$$OperationImplToJson( this, ); } } -abstract class _Part extends Part { - const factory _Part( - {@JsonKey(includeIfNull: false) final Blob? inlineData, - @JsonKey(includeIfNull: false) final String? text}) = _$PartImpl; - const _Part._() : super._(); +abstract class _Operation extends Operation { + const factory _Operation( + {@JsonKey(includeIfNull: false) final String? name, + @JsonKey(includeIfNull: false) final Map? response, + @JsonKey(includeIfNull: false) final bool? done, + @JsonKey(includeIfNull: false) final Map? metadata, + @JsonKey(includeIfNull: false) final Status? error}) = _$OperationImpl; + const _Operation._() : super._(); - factory _Part.fromJson(Map json) = _$PartImpl.fromJson; + factory _Operation.fromJson(Map json) = + _$OperationImpl.fromJson; @override - /// Inline media bytes. + /// The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should be a resource name ending with `operations/{unique_id}`. @JsonKey(includeIfNull: false) - Blob? get inlineData; + String? get name; @override - /// Inline text. + /// The normal, successful response of the operation. If the original method returns no data on success, such as `Delete`, the response is `google.protobuf.Empty`. If the original method is standard `Get`/`Create`/`Update`, the response should be the resource. For other methods, the response should have the type `XxxResponse`, where `Xxx` is the original method name. For example, if the original method name is `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`. @JsonKey(includeIfNull: false) - String? get text; - @override - @JsonKey(ignore: true) - _$$PartImplCopyWith<_$PartImpl> get copyWith => - throw _privateConstructorUsedError; -} - -Empty _$EmptyFromJson(Map json) { - return _Empty.fromJson(json); -} - -/// @nodoc -mixin _$Empty { - Map toJson() => throw _privateConstructorUsedError; -} - -/// @nodoc -abstract class $EmptyCopyWith<$Res> { - factory $EmptyCopyWith(Empty value, $Res Function(Empty) then) = - _$EmptyCopyWithImpl<$Res, Empty>; -} - -/// @nodoc -class _$EmptyCopyWithImpl<$Res, $Val extends Empty> - implements $EmptyCopyWith<$Res> { - _$EmptyCopyWithImpl(this._value, this._then); - - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; -} - -/// @nodoc -abstract class _$$EmptyImplCopyWith<$Res> { - factory _$$EmptyImplCopyWith( - _$EmptyImpl value, $Res Function(_$EmptyImpl) then) = - __$$EmptyImplCopyWithImpl<$Res>; -} - -/// @nodoc -class __$$EmptyImplCopyWithImpl<$Res> - extends _$EmptyCopyWithImpl<$Res, _$EmptyImpl> - implements _$$EmptyImplCopyWith<$Res> { - __$$EmptyImplCopyWithImpl( - _$EmptyImpl _value, $Res Function(_$EmptyImpl) _then) - : super(_value, _then); -} - -/// @nodoc -@JsonSerializable() -class _$EmptyImpl extends _Empty { - const _$EmptyImpl() : super._(); - - factory _$EmptyImpl.fromJson(Map json) => - _$$EmptyImplFromJson(json); - - @override - String toString() { - return 'Empty()'; - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && other is _$EmptyImpl); - } - - @JsonKey(ignore: true) + Map? get response; @override - int get hashCode => runtimeType.hashCode; + /// If the value is `false`, it means the operation is still in progress. If `true`, the operation is completed, and either `error` or `response` is available. + @JsonKey(includeIfNull: false) + bool? get done; @override - Map toJson() { - return _$$EmptyImplToJson( - this, - ); - } -} - -abstract class _Empty extends Empty { - const factory _Empty() = _$EmptyImpl; - const _Empty._() : super._(); - factory _Empty.fromJson(Map json) = _$EmptyImpl.fromJson; + /// Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any. + @JsonKey(includeIfNull: false) + Map? get metadata; + @override + + /// The error result of the operation in case of failure or cancellation. + @JsonKey(includeIfNull: false) + Status? get error; + @override + @JsonKey(ignore: true) + _$$OperationImplCopyWith<_$OperationImpl> get copyWith => + throw _privateConstructorUsedError; } -GenerateContentRequest _$GenerateContentRequestFromJson( - Map json) { - return _GenerateContentRequest.fromJson(json); +Status _$StatusFromJson(Map json) { + return _Status.fromJson(json); } /// @nodoc -mixin _$GenerateContentRequest { - /// Optional. Configuration options for model generation and outputs. +mixin _$Status { + /// The status code, which should be an enum value of google.rpc.Code. @JsonKey(includeIfNull: false) - GenerationConfig? get generationConfig => throw _privateConstructorUsedError; + int? get code => throw _privateConstructorUsedError; - /// Required. The content of the current conversation with the model. For single-turn queries, this is a single instance. For multi-turn queries, this is a repeated field that contains conversation history + latest request. + /// A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client. @JsonKey(includeIfNull: false) - List? get contents => throw _privateConstructorUsedError; + String? get message => throw _privateConstructorUsedError; - /// Optional. A list of unique `SafetySetting` instances for blocking unsafe content. This will be enforced on the `GenerateContentRequest.contents` and `GenerateContentResponse.candidates`. There should not be more than one setting for each `SafetyCategory` type. The API will block any contents and responses that fail to meet the thresholds set by these settings. This list overrides the default settings for each `SafetyCategory` specified in the safety_settings. If there is no `SafetySetting` for a given `SafetyCategory` provided in the list, the API will use the default safety setting for that category. Harm categories HARM_CATEGORY_HATE_SPEECH, HARM_CATEGORY_SEXUALLY_EXPLICIT, HARM_CATEGORY_DANGEROUS_CONTENT, HARM_CATEGORY_HARASSMENT are supported. + /// A list of messages that carry the error details. There is a common set of message types for APIs to use. @JsonKey(includeIfNull: false) - List? get safetySettings => throw _privateConstructorUsedError; + List>? get details => throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) - $GenerateContentRequestCopyWith get copyWith => - throw _privateConstructorUsedError; + $StatusCopyWith get copyWith => throw _privateConstructorUsedError; } /// @nodoc -abstract class $GenerateContentRequestCopyWith<$Res> { - factory $GenerateContentRequestCopyWith(GenerateContentRequest value, - $Res Function(GenerateContentRequest) then) = - _$GenerateContentRequestCopyWithImpl<$Res, GenerateContentRequest>; +abstract class $StatusCopyWith<$Res> { + factory $StatusCopyWith(Status value, $Res Function(Status) then) = + _$StatusCopyWithImpl<$Res, Status>; @useResult $Res call( - {@JsonKey(includeIfNull: false) GenerationConfig? generationConfig, - @JsonKey(includeIfNull: false) List? contents, - @JsonKey(includeIfNull: false) List? safetySettings}); - - $GenerationConfigCopyWith<$Res>? get generationConfig; + {@JsonKey(includeIfNull: false) int? code, + @JsonKey(includeIfNull: false) String? message, + @JsonKey(includeIfNull: false) List>? details}); } /// @nodoc -class _$GenerateContentRequestCopyWithImpl<$Res, - $Val extends GenerateContentRequest> - implements $GenerateContentRequestCopyWith<$Res> { - _$GenerateContentRequestCopyWithImpl(this._value, this._then); +class _$StatusCopyWithImpl<$Res, $Val extends Status> + implements $StatusCopyWith<$Res> { + _$StatusCopyWithImpl(this._value, this._then); // ignore: unused_field final $Val _value; @@ -2096,243 +1794,205 @@ class _$GenerateContentRequestCopyWithImpl<$Res, @pragma('vm:prefer-inline') @override $Res call({ - Object? generationConfig = freezed, - Object? contents = freezed, - Object? safetySettings = freezed, + Object? code = freezed, + Object? message = freezed, + Object? details = freezed, }) { return _then(_value.copyWith( - generationConfig: freezed == generationConfig - ? _value.generationConfig - : generationConfig // ignore: cast_nullable_to_non_nullable - as GenerationConfig?, - contents: freezed == contents - ? _value.contents - : contents // ignore: cast_nullable_to_non_nullable - as List?, - safetySettings: freezed == safetySettings - ? _value.safetySettings - : safetySettings // ignore: cast_nullable_to_non_nullable - as List?, + code: freezed == code + ? _value.code + : code // ignore: cast_nullable_to_non_nullable + as int?, + message: freezed == message + ? _value.message + : message // ignore: cast_nullable_to_non_nullable + as String?, + details: freezed == details + ? _value.details + : details // ignore: cast_nullable_to_non_nullable + as List>?, ) as $Val); } - - @override - @pragma('vm:prefer-inline') - $GenerationConfigCopyWith<$Res>? get generationConfig { - if (_value.generationConfig == null) { - return null; - } - - return $GenerationConfigCopyWith<$Res>(_value.generationConfig!, (value) { - return _then(_value.copyWith(generationConfig: value) as $Val); - }); - } } /// @nodoc -abstract class _$$GenerateContentRequestImplCopyWith<$Res> - implements $GenerateContentRequestCopyWith<$Res> { - factory _$$GenerateContentRequestImplCopyWith( - _$GenerateContentRequestImpl value, - $Res Function(_$GenerateContentRequestImpl) then) = - __$$GenerateContentRequestImplCopyWithImpl<$Res>; +abstract class _$$StatusImplCopyWith<$Res> implements $StatusCopyWith<$Res> { + factory _$$StatusImplCopyWith( + _$StatusImpl value, $Res Function(_$StatusImpl) then) = + __$$StatusImplCopyWithImpl<$Res>; @override @useResult $Res call( - {@JsonKey(includeIfNull: false) GenerationConfig? generationConfig, - @JsonKey(includeIfNull: false) List? contents, - @JsonKey(includeIfNull: false) List? safetySettings}); - - @override - $GenerationConfigCopyWith<$Res>? get generationConfig; + {@JsonKey(includeIfNull: false) int? code, + @JsonKey(includeIfNull: false) String? message, + @JsonKey(includeIfNull: false) List>? details}); } /// @nodoc -class __$$GenerateContentRequestImplCopyWithImpl<$Res> - extends _$GenerateContentRequestCopyWithImpl<$Res, - _$GenerateContentRequestImpl> - implements _$$GenerateContentRequestImplCopyWith<$Res> { - __$$GenerateContentRequestImplCopyWithImpl( - _$GenerateContentRequestImpl _value, - $Res Function(_$GenerateContentRequestImpl) _then) +class __$$StatusImplCopyWithImpl<$Res> + extends _$StatusCopyWithImpl<$Res, _$StatusImpl> + implements _$$StatusImplCopyWith<$Res> { + __$$StatusImplCopyWithImpl( + _$StatusImpl _value, $Res Function(_$StatusImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @override $Res call({ - Object? generationConfig = freezed, - Object? contents = freezed, - Object? safetySettings = freezed, + Object? code = freezed, + Object? message = freezed, + Object? details = freezed, }) { - return _then(_$GenerateContentRequestImpl( - generationConfig: freezed == generationConfig - ? _value.generationConfig - : generationConfig // ignore: cast_nullable_to_non_nullable - as GenerationConfig?, - contents: freezed == contents - ? _value._contents - : contents // ignore: cast_nullable_to_non_nullable - as List?, - safetySettings: freezed == safetySettings - ? _value._safetySettings - : safetySettings // ignore: cast_nullable_to_non_nullable - as List?, + return _then(_$StatusImpl( + code: freezed == code + ? _value.code + : code // ignore: cast_nullable_to_non_nullable + as int?, + message: freezed == message + ? _value.message + : message // ignore: cast_nullable_to_non_nullable + as String?, + details: freezed == details + ? _value._details + : details // ignore: cast_nullable_to_non_nullable + as List>?, )); } } /// @nodoc @JsonSerializable() -class _$GenerateContentRequestImpl extends _GenerateContentRequest { - const _$GenerateContentRequestImpl( - {@JsonKey(includeIfNull: false) this.generationConfig, - @JsonKey(includeIfNull: false) final List? contents, - @JsonKey(includeIfNull: false) final List? safetySettings}) - : _contents = contents, - _safetySettings = safetySettings, +class _$StatusImpl extends _Status { + const _$StatusImpl( + {@JsonKey(includeIfNull: false) this.code, + @JsonKey(includeIfNull: false) this.message, + @JsonKey(includeIfNull: false) final List>? details}) + : _details = details, super._(); - factory _$GenerateContentRequestImpl.fromJson(Map json) => - _$$GenerateContentRequestImplFromJson(json); + factory _$StatusImpl.fromJson(Map json) => + _$$StatusImplFromJson(json); - /// Optional. Configuration options for model generation and outputs. + /// The status code, which should be an enum value of google.rpc.Code. @override @JsonKey(includeIfNull: false) - final GenerationConfig? generationConfig; - - /// Required. The content of the current conversation with the model. For single-turn queries, this is a single instance. For multi-turn queries, this is a repeated field that contains conversation history + latest request. - final List? _contents; + final int? code; - /// Required. The content of the current conversation with the model. For single-turn queries, this is a single instance. For multi-turn queries, this is a repeated field that contains conversation history + latest request. + /// A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client. @override @JsonKey(includeIfNull: false) - List? get contents { - final value = _contents; - if (value == null) return null; - if (_contents is EqualUnmodifiableListView) return _contents; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(value); - } + final String? message; - /// Optional. A list of unique `SafetySetting` instances for blocking unsafe content. This will be enforced on the `GenerateContentRequest.contents` and `GenerateContentResponse.candidates`. There should not be more than one setting for each `SafetyCategory` type. The API will block any contents and responses that fail to meet the thresholds set by these settings. This list overrides the default settings for each `SafetyCategory` specified in the safety_settings. If there is no `SafetySetting` for a given `SafetyCategory` provided in the list, the API will use the default safety setting for that category. Harm categories HARM_CATEGORY_HATE_SPEECH, HARM_CATEGORY_SEXUALLY_EXPLICIT, HARM_CATEGORY_DANGEROUS_CONTENT, HARM_CATEGORY_HARASSMENT are supported. - final List? _safetySettings; + /// A list of messages that carry the error details. There is a common set of message types for APIs to use. + final List>? _details; - /// Optional. A list of unique `SafetySetting` instances for blocking unsafe content. This will be enforced on the `GenerateContentRequest.contents` and `GenerateContentResponse.candidates`. There should not be more than one setting for each `SafetyCategory` type. The API will block any contents and responses that fail to meet the thresholds set by these settings. This list overrides the default settings for each `SafetyCategory` specified in the safety_settings. If there is no `SafetySetting` for a given `SafetyCategory` provided in the list, the API will use the default safety setting for that category. Harm categories HARM_CATEGORY_HATE_SPEECH, HARM_CATEGORY_SEXUALLY_EXPLICIT, HARM_CATEGORY_DANGEROUS_CONTENT, HARM_CATEGORY_HARASSMENT are supported. + /// A list of messages that carry the error details. There is a common set of message types for APIs to use. @override @JsonKey(includeIfNull: false) - List? get safetySettings { - final value = _safetySettings; + List>? get details { + final value = _details; if (value == null) return null; - if (_safetySettings is EqualUnmodifiableListView) return _safetySettings; + if (_details is EqualUnmodifiableListView) return _details; // ignore: implicit_dynamic_type return EqualUnmodifiableListView(value); } @override String toString() { - return 'GenerateContentRequest(generationConfig: $generationConfig, contents: $contents, safetySettings: $safetySettings)'; + return 'Status(code: $code, message: $message, details: $details)'; } @override bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$GenerateContentRequestImpl && - (identical(other.generationConfig, generationConfig) || - other.generationConfig == generationConfig) && - const DeepCollectionEquality().equals(other._contents, _contents) && - const DeepCollectionEquality() - .equals(other._safetySettings, _safetySettings)); + other is _$StatusImpl && + (identical(other.code, code) || other.code == code) && + (identical(other.message, message) || other.message == message) && + const DeepCollectionEquality().equals(other._details, _details)); } @JsonKey(ignore: true) @override - int get hashCode => Object.hash( - runtimeType, - generationConfig, - const DeepCollectionEquality().hash(_contents), - const DeepCollectionEquality().hash(_safetySettings)); + int get hashCode => Object.hash(runtimeType, code, message, + const DeepCollectionEquality().hash(_details)); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$GenerateContentRequestImplCopyWith<_$GenerateContentRequestImpl> - get copyWith => __$$GenerateContentRequestImplCopyWithImpl< - _$GenerateContentRequestImpl>(this, _$identity); + _$$StatusImplCopyWith<_$StatusImpl> get copyWith => + __$$StatusImplCopyWithImpl<_$StatusImpl>(this, _$identity); @override Map toJson() { - return _$$GenerateContentRequestImplToJson( + return _$$StatusImplToJson( this, ); } } -abstract class _GenerateContentRequest extends GenerateContentRequest { - const factory _GenerateContentRequest( - {@JsonKey(includeIfNull: false) final GenerationConfig? generationConfig, - @JsonKey(includeIfNull: false) final List? contents, +abstract class _Status extends Status { + const factory _Status( + {@JsonKey(includeIfNull: false) final int? code, + @JsonKey(includeIfNull: false) final String? message, @JsonKey(includeIfNull: false) - final List? - safetySettings}) = _$GenerateContentRequestImpl; - const _GenerateContentRequest._() : super._(); + final List>? details}) = _$StatusImpl; + const _Status._() : super._(); - factory _GenerateContentRequest.fromJson(Map json) = - _$GenerateContentRequestImpl.fromJson; + factory _Status.fromJson(Map json) = _$StatusImpl.fromJson; @override - /// Optional. Configuration options for model generation and outputs. + /// The status code, which should be an enum value of google.rpc.Code. @JsonKey(includeIfNull: false) - GenerationConfig? get generationConfig; + int? get code; @override - /// Required. The content of the current conversation with the model. For single-turn queries, this is a single instance. For multi-turn queries, this is a repeated field that contains conversation history + latest request. + /// A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client. @JsonKey(includeIfNull: false) - List? get contents; + String? get message; @override - /// Optional. A list of unique `SafetySetting` instances for blocking unsafe content. This will be enforced on the `GenerateContentRequest.contents` and `GenerateContentResponse.candidates`. There should not be more than one setting for each `SafetyCategory` type. The API will block any contents and responses that fail to meet the thresholds set by these settings. This list overrides the default settings for each `SafetyCategory` specified in the safety_settings. If there is no `SafetySetting` for a given `SafetyCategory` provided in the list, the API will use the default safety setting for that category. Harm categories HARM_CATEGORY_HATE_SPEECH, HARM_CATEGORY_SEXUALLY_EXPLICIT, HARM_CATEGORY_DANGEROUS_CONTENT, HARM_CATEGORY_HARASSMENT are supported. + /// A list of messages that carry the error details. There is a common set of message types for APIs to use. @JsonKey(includeIfNull: false) - List? get safetySettings; + List>? get details; @override @JsonKey(ignore: true) - _$$GenerateContentRequestImplCopyWith<_$GenerateContentRequestImpl> - get copyWith => throw _privateConstructorUsedError; + _$$StatusImplCopyWith<_$StatusImpl> get copyWith => + throw _privateConstructorUsedError; } -EmbedContentResponse _$EmbedContentResponseFromJson(Map json) { - return _EmbedContentResponse.fromJson(json); +CitationMetadata _$CitationMetadataFromJson(Map json) { + return _CitationMetadata.fromJson(json); } -/// @nodoc -mixin _$EmbedContentResponse { - /// Output only. The embedding generated from the input content. +/// @nodoc +mixin _$CitationMetadata { + /// Citations to sources for a specific response. @JsonKey(includeIfNull: false) - ContentEmbedding? get embedding => throw _privateConstructorUsedError; + List? get citationSources => + throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) - $EmbedContentResponseCopyWith get copyWith => + $CitationMetadataCopyWith get copyWith => throw _privateConstructorUsedError; } /// @nodoc -abstract class $EmbedContentResponseCopyWith<$Res> { - factory $EmbedContentResponseCopyWith(EmbedContentResponse value, - $Res Function(EmbedContentResponse) then) = - _$EmbedContentResponseCopyWithImpl<$Res, EmbedContentResponse>; +abstract class $CitationMetadataCopyWith<$Res> { + factory $CitationMetadataCopyWith( + CitationMetadata value, $Res Function(CitationMetadata) then) = + _$CitationMetadataCopyWithImpl<$Res, CitationMetadata>; @useResult - $Res call({@JsonKey(includeIfNull: false) ContentEmbedding? embedding}); - - $ContentEmbeddingCopyWith<$Res>? get embedding; + $Res call( + {@JsonKey(includeIfNull: false) List? citationSources}); } /// @nodoc -class _$EmbedContentResponseCopyWithImpl<$Res, - $Val extends EmbedContentResponse> - implements $EmbedContentResponseCopyWith<$Res> { - _$EmbedContentResponseCopyWithImpl(this._value, this._then); +class _$CitationMetadataCopyWithImpl<$Res, $Val extends CitationMetadata> + implements $CitationMetadataCopyWith<$Res> { + _$CitationMetadataCopyWithImpl(this._value, this._then); // ignore: unused_field final $Val _value; @@ -2342,167 +2002,174 @@ class _$EmbedContentResponseCopyWithImpl<$Res, @pragma('vm:prefer-inline') @override $Res call({ - Object? embedding = freezed, + Object? citationSources = freezed, }) { return _then(_value.copyWith( - embedding: freezed == embedding - ? _value.embedding - : embedding // ignore: cast_nullable_to_non_nullable - as ContentEmbedding?, + citationSources: freezed == citationSources + ? _value.citationSources + : citationSources // ignore: cast_nullable_to_non_nullable + as List?, ) as $Val); } - - @override - @pragma('vm:prefer-inline') - $ContentEmbeddingCopyWith<$Res>? get embedding { - if (_value.embedding == null) { - return null; - } - - return $ContentEmbeddingCopyWith<$Res>(_value.embedding!, (value) { - return _then(_value.copyWith(embedding: value) as $Val); - }); - } } /// @nodoc -abstract class _$$EmbedContentResponseImplCopyWith<$Res> - implements $EmbedContentResponseCopyWith<$Res> { - factory _$$EmbedContentResponseImplCopyWith(_$EmbedContentResponseImpl value, - $Res Function(_$EmbedContentResponseImpl) then) = - __$$EmbedContentResponseImplCopyWithImpl<$Res>; +abstract class _$$CitationMetadataImplCopyWith<$Res> + implements $CitationMetadataCopyWith<$Res> { + factory _$$CitationMetadataImplCopyWith(_$CitationMetadataImpl value, + $Res Function(_$CitationMetadataImpl) then) = + __$$CitationMetadataImplCopyWithImpl<$Res>; @override @useResult - $Res call({@JsonKey(includeIfNull: false) ContentEmbedding? embedding}); - - @override - $ContentEmbeddingCopyWith<$Res>? get embedding; + $Res call( + {@JsonKey(includeIfNull: false) List? citationSources}); } /// @nodoc -class __$$EmbedContentResponseImplCopyWithImpl<$Res> - extends _$EmbedContentResponseCopyWithImpl<$Res, _$EmbedContentResponseImpl> - implements _$$EmbedContentResponseImplCopyWith<$Res> { - __$$EmbedContentResponseImplCopyWithImpl(_$EmbedContentResponseImpl _value, - $Res Function(_$EmbedContentResponseImpl) _then) +class __$$CitationMetadataImplCopyWithImpl<$Res> + extends _$CitationMetadataCopyWithImpl<$Res, _$CitationMetadataImpl> + implements _$$CitationMetadataImplCopyWith<$Res> { + __$$CitationMetadataImplCopyWithImpl(_$CitationMetadataImpl _value, + $Res Function(_$CitationMetadataImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @override $Res call({ - Object? embedding = freezed, + Object? citationSources = freezed, }) { - return _then(_$EmbedContentResponseImpl( - embedding: freezed == embedding - ? _value.embedding - : embedding // ignore: cast_nullable_to_non_nullable - as ContentEmbedding?, + return _then(_$CitationMetadataImpl( + citationSources: freezed == citationSources + ? _value._citationSources + : citationSources // ignore: cast_nullable_to_non_nullable + as List?, )); } } /// @nodoc @JsonSerializable() -class _$EmbedContentResponseImpl extends _EmbedContentResponse { - const _$EmbedContentResponseImpl( - {@JsonKey(includeIfNull: false) this.embedding}) - : super._(); +class _$CitationMetadataImpl extends _CitationMetadata { + const _$CitationMetadataImpl( + {@JsonKey(includeIfNull: false) + final List? citationSources}) + : _citationSources = citationSources, + super._(); - factory _$EmbedContentResponseImpl.fromJson(Map json) => - _$$EmbedContentResponseImplFromJson(json); + factory _$CitationMetadataImpl.fromJson(Map json) => + _$$CitationMetadataImplFromJson(json); - /// Output only. The embedding generated from the input content. + /// Citations to sources for a specific response. + final List? _citationSources; + + /// Citations to sources for a specific response. @override @JsonKey(includeIfNull: false) - final ContentEmbedding? embedding; + List? get citationSources { + final value = _citationSources; + if (value == null) return null; + if (_citationSources is EqualUnmodifiableListView) return _citationSources; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(value); + } @override String toString() { - return 'EmbedContentResponse(embedding: $embedding)'; + return 'CitationMetadata(citationSources: $citationSources)'; } @override bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$EmbedContentResponseImpl && - (identical(other.embedding, embedding) || - other.embedding == embedding)); + other is _$CitationMetadataImpl && + const DeepCollectionEquality() + .equals(other._citationSources, _citationSources)); } @JsonKey(ignore: true) @override - int get hashCode => Object.hash(runtimeType, embedding); + int get hashCode => Object.hash( + runtimeType, const DeepCollectionEquality().hash(_citationSources)); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$EmbedContentResponseImplCopyWith<_$EmbedContentResponseImpl> - get copyWith => - __$$EmbedContentResponseImplCopyWithImpl<_$EmbedContentResponseImpl>( - this, _$identity); + _$$CitationMetadataImplCopyWith<_$CitationMetadataImpl> get copyWith => + __$$CitationMetadataImplCopyWithImpl<_$CitationMetadataImpl>( + this, _$identity); @override Map toJson() { - return _$$EmbedContentResponseImplToJson( + return _$$CitationMetadataImplToJson( this, ); } } -abstract class _EmbedContentResponse extends EmbedContentResponse { - const factory _EmbedContentResponse( - {@JsonKey(includeIfNull: false) final ContentEmbedding? embedding}) = - _$EmbedContentResponseImpl; - const _EmbedContentResponse._() : super._(); +abstract class _CitationMetadata extends CitationMetadata { + const factory _CitationMetadata( + {@JsonKey(includeIfNull: false) + final List? citationSources}) = _$CitationMetadataImpl; + const _CitationMetadata._() : super._(); - factory _EmbedContentResponse.fromJson(Map json) = - _$EmbedContentResponseImpl.fromJson; + factory _CitationMetadata.fromJson(Map json) = + _$CitationMetadataImpl.fromJson; @override - /// Output only. The embedding generated from the input content. + /// Citations to sources for a specific response. @JsonKey(includeIfNull: false) - ContentEmbedding? get embedding; + List? get citationSources; @override @JsonKey(ignore: true) - _$$EmbedContentResponseImplCopyWith<_$EmbedContentResponseImpl> - get copyWith => throw _privateConstructorUsedError; + _$$CitationMetadataImplCopyWith<_$CitationMetadataImpl> get copyWith => + throw _privateConstructorUsedError; } -Content _$ContentFromJson(Map json) { - return _Content.fromJson(json); +SafetySetting _$SafetySettingFromJson(Map json) { + return _SafetySetting.fromJson(json); } /// @nodoc -mixin _$Content { - /// Optional. The producer of the content. Must be either 'user' or 'model'. Useful to set for multi-turn conversations, otherwise can be left blank or unset. - @JsonKey(includeIfNull: false) - String? get role => throw _privateConstructorUsedError; +mixin _$SafetySetting { + /// Required. The category for this setting. + @JsonKey( + includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + SafetySettingCategory? get category => throw _privateConstructorUsedError; - /// Ordered `Parts` that constitute a single message. Parts may have different MIME types. - @JsonKey(includeIfNull: false) - List? get parts => throw _privateConstructorUsedError; + /// Required. Controls the probability threshold at which harm is blocked. + @JsonKey( + includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + SafetySettingThreshold? get threshold => throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) - $ContentCopyWith get copyWith => throw _privateConstructorUsedError; + $SafetySettingCopyWith get copyWith => + throw _privateConstructorUsedError; } /// @nodoc -abstract class $ContentCopyWith<$Res> { - factory $ContentCopyWith(Content value, $Res Function(Content) then) = - _$ContentCopyWithImpl<$Res, Content>; +abstract class $SafetySettingCopyWith<$Res> { + factory $SafetySettingCopyWith( + SafetySetting value, $Res Function(SafetySetting) then) = + _$SafetySettingCopyWithImpl<$Res, SafetySetting>; @useResult $Res call( - {@JsonKey(includeIfNull: false) String? role, - @JsonKey(includeIfNull: false) List? parts}); + {@JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + SafetySettingCategory? category, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + SafetySettingThreshold? threshold}); } /// @nodoc -class _$ContentCopyWithImpl<$Res, $Val extends Content> - implements $ContentCopyWith<$Res> { - _$ContentCopyWithImpl(this._value, this._then); +class _$SafetySettingCopyWithImpl<$Res, $Val extends SafetySetting> + implements $SafetySettingCopyWith<$Res> { + _$SafetySettingCopyWithImpl(this._value, this._then); // ignore: unused_field final $Val _value; @@ -2512,289 +2179,460 @@ class _$ContentCopyWithImpl<$Res, $Val extends Content> @pragma('vm:prefer-inline') @override $Res call({ - Object? role = freezed, - Object? parts = freezed, + Object? category = freezed, + Object? threshold = freezed, }) { return _then(_value.copyWith( - role: freezed == role - ? _value.role - : role // ignore: cast_nullable_to_non_nullable - as String?, - parts: freezed == parts - ? _value.parts - : parts // ignore: cast_nullable_to_non_nullable - as List?, + category: freezed == category + ? _value.category + : category // ignore: cast_nullable_to_non_nullable + as SafetySettingCategory?, + threshold: freezed == threshold + ? _value.threshold + : threshold // ignore: cast_nullable_to_non_nullable + as SafetySettingThreshold?, ) as $Val); } } /// @nodoc -abstract class _$$ContentImplCopyWith<$Res> implements $ContentCopyWith<$Res> { - factory _$$ContentImplCopyWith( - _$ContentImpl value, $Res Function(_$ContentImpl) then) = - __$$ContentImplCopyWithImpl<$Res>; +abstract class _$$SafetySettingImplCopyWith<$Res> + implements $SafetySettingCopyWith<$Res> { + factory _$$SafetySettingImplCopyWith( + _$SafetySettingImpl value, $Res Function(_$SafetySettingImpl) then) = + __$$SafetySettingImplCopyWithImpl<$Res>; @override @useResult $Res call( - {@JsonKey(includeIfNull: false) String? role, - @JsonKey(includeIfNull: false) List? parts}); + {@JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + SafetySettingCategory? category, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + SafetySettingThreshold? threshold}); } /// @nodoc -class __$$ContentImplCopyWithImpl<$Res> - extends _$ContentCopyWithImpl<$Res, _$ContentImpl> - implements _$$ContentImplCopyWith<$Res> { - __$$ContentImplCopyWithImpl( - _$ContentImpl _value, $Res Function(_$ContentImpl) _then) +class __$$SafetySettingImplCopyWithImpl<$Res> + extends _$SafetySettingCopyWithImpl<$Res, _$SafetySettingImpl> + implements _$$SafetySettingImplCopyWith<$Res> { + __$$SafetySettingImplCopyWithImpl( + _$SafetySettingImpl _value, $Res Function(_$SafetySettingImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @override $Res call({ - Object? role = freezed, - Object? parts = freezed, + Object? category = freezed, + Object? threshold = freezed, }) { - return _then(_$ContentImpl( - role: freezed == role - ? _value.role - : role // ignore: cast_nullable_to_non_nullable - as String?, - parts: freezed == parts - ? _value._parts - : parts // ignore: cast_nullable_to_non_nullable - as List?, + return _then(_$SafetySettingImpl( + category: freezed == category + ? _value.category + : category // ignore: cast_nullable_to_non_nullable + as SafetySettingCategory?, + threshold: freezed == threshold + ? _value.threshold + : threshold // ignore: cast_nullable_to_non_nullable + as SafetySettingThreshold?, )); } } /// @nodoc @JsonSerializable() -class _$ContentImpl extends _Content { - const _$ContentImpl( - {@JsonKey(includeIfNull: false) this.role, - @JsonKey(includeIfNull: false) final List? parts}) - : _parts = parts, - super._(); +class _$SafetySettingImpl extends _SafetySetting { + const _$SafetySettingImpl( + {@JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + this.category, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + this.threshold}) + : super._(); - factory _$ContentImpl.fromJson(Map json) => - _$$ContentImplFromJson(json); + factory _$SafetySettingImpl.fromJson(Map json) => + _$$SafetySettingImplFromJson(json); - /// Optional. The producer of the content. Must be either 'user' or 'model'. Useful to set for multi-turn conversations, otherwise can be left blank or unset. + /// Required. The category for this setting. @override - @JsonKey(includeIfNull: false) - final String? role; - - /// Ordered `Parts` that constitute a single message. Parts may have different MIME types. - final List? _parts; + @JsonKey( + includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + final SafetySettingCategory? category; - /// Ordered `Parts` that constitute a single message. Parts may have different MIME types. + /// Required. Controls the probability threshold at which harm is blocked. @override - @JsonKey(includeIfNull: false) - List? get parts { - final value = _parts; - if (value == null) return null; - if (_parts is EqualUnmodifiableListView) return _parts; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(value); - } + @JsonKey( + includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + final SafetySettingThreshold? threshold; @override String toString() { - return 'Content(role: $role, parts: $parts)'; + return 'SafetySetting(category: $category, threshold: $threshold)'; } @override bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$ContentImpl && - (identical(other.role, role) || other.role == role) && - const DeepCollectionEquality().equals(other._parts, _parts)); + other is _$SafetySettingImpl && + (identical(other.category, category) || + other.category == category) && + (identical(other.threshold, threshold) || + other.threshold == threshold)); } @JsonKey(ignore: true) @override - int get hashCode => Object.hash( - runtimeType, role, const DeepCollectionEquality().hash(_parts)); + int get hashCode => Object.hash(runtimeType, category, threshold); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$ContentImplCopyWith<_$ContentImpl> get copyWith => - __$$ContentImplCopyWithImpl<_$ContentImpl>(this, _$identity); + _$$SafetySettingImplCopyWith<_$SafetySettingImpl> get copyWith => + __$$SafetySettingImplCopyWithImpl<_$SafetySettingImpl>(this, _$identity); @override Map toJson() { - return _$$ContentImplToJson( + return _$$SafetySettingImplToJson( this, ); } } -abstract class _Content extends Content { - const factory _Content( - {@JsonKey(includeIfNull: false) final String? role, - @JsonKey(includeIfNull: false) final List? parts}) = _$ContentImpl; - const _Content._() : super._(); +abstract class _SafetySetting extends SafetySetting { + const factory _SafetySetting( + {@JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + final SafetySettingCategory? category, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + final SafetySettingThreshold? threshold}) = _$SafetySettingImpl; + const _SafetySetting._() : super._(); - factory _Content.fromJson(Map json) = _$ContentImpl.fromJson; + factory _SafetySetting.fromJson(Map json) = + _$SafetySettingImpl.fromJson; @override - /// Optional. The producer of the content. Must be either 'user' or 'model'. Useful to set for multi-turn conversations, otherwise can be left blank or unset. - @JsonKey(includeIfNull: false) - String? get role; + /// Required. The category for this setting. + @JsonKey( + includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + SafetySettingCategory? get category; @override - /// Ordered `Parts` that constitute a single message. Parts may have different MIME types. - @JsonKey(includeIfNull: false) - List? get parts; + /// Required. Controls the probability threshold at which harm is blocked. + @JsonKey( + includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + SafetySettingThreshold? get threshold; @override @JsonKey(ignore: true) - _$$ContentImplCopyWith<_$ContentImpl> get copyWith => + _$$SafetySettingImplCopyWith<_$SafetySettingImpl> get copyWith => throw _privateConstructorUsedError; } -CancelOperationRequest _$CancelOperationRequestFromJson( - Map json) { - return _CancelOperationRequest.fromJson(json); +CitationSource _$CitationSourceFromJson(Map json) { + return _CitationSource.fromJson(json); } /// @nodoc -mixin _$CancelOperationRequest { +mixin _$CitationSource { + /// Optional. License for the GitHub project that is attributed as a source for segment. License info is required for code citations. + @JsonKey(includeIfNull: false) + String? get license => throw _privateConstructorUsedError; + + /// Optional. URI that is attributed as a source for a portion of the text. + @JsonKey(includeIfNull: false) + String? get uri => throw _privateConstructorUsedError; + + /// Optional. End of the attributed segment, exclusive. + @JsonKey(includeIfNull: false) + int? get endIndex => throw _privateConstructorUsedError; + + /// Optional. Start of segment of the response that is attributed to this source. Index indicates the start of the segment, measured in bytes. + @JsonKey(includeIfNull: false) + int? get startIndex => throw _privateConstructorUsedError; + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $CitationSourceCopyWith get copyWith => + throw _privateConstructorUsedError; } /// @nodoc -abstract class $CancelOperationRequestCopyWith<$Res> { - factory $CancelOperationRequestCopyWith(CancelOperationRequest value, - $Res Function(CancelOperationRequest) then) = - _$CancelOperationRequestCopyWithImpl<$Res, CancelOperationRequest>; +abstract class $CitationSourceCopyWith<$Res> { + factory $CitationSourceCopyWith( + CitationSource value, $Res Function(CitationSource) then) = + _$CitationSourceCopyWithImpl<$Res, CitationSource>; + @useResult + $Res call( + {@JsonKey(includeIfNull: false) String? license, + @JsonKey(includeIfNull: false) String? uri, + @JsonKey(includeIfNull: false) int? endIndex, + @JsonKey(includeIfNull: false) int? startIndex}); } /// @nodoc -class _$CancelOperationRequestCopyWithImpl<$Res, - $Val extends CancelOperationRequest> - implements $CancelOperationRequestCopyWith<$Res> { - _$CancelOperationRequestCopyWithImpl(this._value, this._then); +class _$CitationSourceCopyWithImpl<$Res, $Val extends CitationSource> + implements $CitationSourceCopyWith<$Res> { + _$CitationSourceCopyWithImpl(this._value, this._then); // ignore: unused_field final $Val _value; // ignore: unused_field final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? license = freezed, + Object? uri = freezed, + Object? endIndex = freezed, + Object? startIndex = freezed, + }) { + return _then(_value.copyWith( + license: freezed == license + ? _value.license + : license // ignore: cast_nullable_to_non_nullable + as String?, + uri: freezed == uri + ? _value.uri + : uri // ignore: cast_nullable_to_non_nullable + as String?, + endIndex: freezed == endIndex + ? _value.endIndex + : endIndex // ignore: cast_nullable_to_non_nullable + as int?, + startIndex: freezed == startIndex + ? _value.startIndex + : startIndex // ignore: cast_nullable_to_non_nullable + as int?, + ) as $Val); + } } /// @nodoc -abstract class _$$CancelOperationRequestImplCopyWith<$Res> { - factory _$$CancelOperationRequestImplCopyWith( - _$CancelOperationRequestImpl value, - $Res Function(_$CancelOperationRequestImpl) then) = - __$$CancelOperationRequestImplCopyWithImpl<$Res>; +abstract class _$$CitationSourceImplCopyWith<$Res> + implements $CitationSourceCopyWith<$Res> { + factory _$$CitationSourceImplCopyWith(_$CitationSourceImpl value, + $Res Function(_$CitationSourceImpl) then) = + __$$CitationSourceImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {@JsonKey(includeIfNull: false) String? license, + @JsonKey(includeIfNull: false) String? uri, + @JsonKey(includeIfNull: false) int? endIndex, + @JsonKey(includeIfNull: false) int? startIndex}); } /// @nodoc -class __$$CancelOperationRequestImplCopyWithImpl<$Res> - extends _$CancelOperationRequestCopyWithImpl<$Res, - _$CancelOperationRequestImpl> - implements _$$CancelOperationRequestImplCopyWith<$Res> { - __$$CancelOperationRequestImplCopyWithImpl( - _$CancelOperationRequestImpl _value, - $Res Function(_$CancelOperationRequestImpl) _then) +class __$$CitationSourceImplCopyWithImpl<$Res> + extends _$CitationSourceCopyWithImpl<$Res, _$CitationSourceImpl> + implements _$$CitationSourceImplCopyWith<$Res> { + __$$CitationSourceImplCopyWithImpl( + _$CitationSourceImpl _value, $Res Function(_$CitationSourceImpl) _then) : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? license = freezed, + Object? uri = freezed, + Object? endIndex = freezed, + Object? startIndex = freezed, + }) { + return _then(_$CitationSourceImpl( + license: freezed == license + ? _value.license + : license // ignore: cast_nullable_to_non_nullable + as String?, + uri: freezed == uri + ? _value.uri + : uri // ignore: cast_nullable_to_non_nullable + as String?, + endIndex: freezed == endIndex + ? _value.endIndex + : endIndex // ignore: cast_nullable_to_non_nullable + as int?, + startIndex: freezed == startIndex + ? _value.startIndex + : startIndex // ignore: cast_nullable_to_non_nullable + as int?, + )); + } } -/// @nodoc -@JsonSerializable() -class _$CancelOperationRequestImpl extends _CancelOperationRequest { - const _$CancelOperationRequestImpl() : super._(); +/// @nodoc +@JsonSerializable() +class _$CitationSourceImpl extends _CitationSource { + const _$CitationSourceImpl( + {@JsonKey(includeIfNull: false) this.license, + @JsonKey(includeIfNull: false) this.uri, + @JsonKey(includeIfNull: false) this.endIndex, + @JsonKey(includeIfNull: false) this.startIndex}) + : super._(); + + factory _$CitationSourceImpl.fromJson(Map json) => + _$$CitationSourceImplFromJson(json); + + /// Optional. License for the GitHub project that is attributed as a source for segment. License info is required for code citations. + @override + @JsonKey(includeIfNull: false) + final String? license; + + /// Optional. URI that is attributed as a source for a portion of the text. + @override + @JsonKey(includeIfNull: false) + final String? uri; - factory _$CancelOperationRequestImpl.fromJson(Map json) => - _$$CancelOperationRequestImplFromJson(json); + /// Optional. End of the attributed segment, exclusive. + @override + @JsonKey(includeIfNull: false) + final int? endIndex; + + /// Optional. Start of segment of the response that is attributed to this source. Index indicates the start of the segment, measured in bytes. + @override + @JsonKey(includeIfNull: false) + final int? startIndex; @override String toString() { - return 'CancelOperationRequest()'; + return 'CitationSource(license: $license, uri: $uri, endIndex: $endIndex, startIndex: $startIndex)'; } @override bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$CancelOperationRequestImpl); + other is _$CitationSourceImpl && + (identical(other.license, license) || other.license == license) && + (identical(other.uri, uri) || other.uri == uri) && + (identical(other.endIndex, endIndex) || + other.endIndex == endIndex) && + (identical(other.startIndex, startIndex) || + other.startIndex == startIndex)); } @JsonKey(ignore: true) @override - int get hashCode => runtimeType.hashCode; + int get hashCode => + Object.hash(runtimeType, license, uri, endIndex, startIndex); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$CitationSourceImplCopyWith<_$CitationSourceImpl> get copyWith => + __$$CitationSourceImplCopyWithImpl<_$CitationSourceImpl>( + this, _$identity); @override Map toJson() { - return _$$CancelOperationRequestImplToJson( + return _$$CitationSourceImplToJson( this, ); } } -abstract class _CancelOperationRequest extends CancelOperationRequest { - const factory _CancelOperationRequest() = _$CancelOperationRequestImpl; - const _CancelOperationRequest._() : super._(); +abstract class _CitationSource extends CitationSource { + const factory _CitationSource( + {@JsonKey(includeIfNull: false) final String? license, + @JsonKey(includeIfNull: false) final String? uri, + @JsonKey(includeIfNull: false) final int? endIndex, + @JsonKey(includeIfNull: false) final int? startIndex}) = + _$CitationSourceImpl; + const _CitationSource._() : super._(); - factory _CancelOperationRequest.fromJson(Map json) = - _$CancelOperationRequestImpl.fromJson; + factory _CitationSource.fromJson(Map json) = + _$CitationSourceImpl.fromJson; + + @override + + /// Optional. License for the GitHub project that is attributed as a source for segment. License info is required for code citations. + @JsonKey(includeIfNull: false) + String? get license; + @override + + /// Optional. URI that is attributed as a source for a portion of the text. + @JsonKey(includeIfNull: false) + String? get uri; + @override + + /// Optional. End of the attributed segment, exclusive. + @JsonKey(includeIfNull: false) + int? get endIndex; + @override + + /// Optional. Start of segment of the response that is attributed to this source. Index indicates the start of the segment, measured in bytes. + @JsonKey(includeIfNull: false) + int? get startIndex; + @override + @JsonKey(ignore: true) + _$$CitationSourceImplCopyWith<_$CitationSourceImpl> get copyWith => + throw _privateConstructorUsedError; } -EmbedContentRequest _$EmbedContentRequestFromJson(Map json) { - return _EmbedContentRequest.fromJson(json); +GenerationConfig _$GenerationConfigFromJson(Map json) { + return _GenerationConfig.fromJson(json); } /// @nodoc -mixin _$EmbedContentRequest { - /// Required. The content to embed. Only the `parts.text` fields will be counted. +mixin _$GenerationConfig { + /// Optional. Controls the randomness of the output. Note: The default value varies by model, see the `Model.temperature` attribute of the `Model` returned from the `getModel` function. Values can range from [0.0, infinity). @JsonKey(includeIfNull: false) - Content? get content => throw _privateConstructorUsedError; + double? get temperature => throw _privateConstructorUsedError; - /// Optional. Optional task type for which the embeddings will be used. Can only be set for `models/embedding-001`. - @JsonKey( - includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue) - EmbedContentRequestTaskType? get taskType => - throw _privateConstructorUsedError; + /// Optional. The set of character sequences (up to 5) that will stop output generation. If specified, the API will stop at the first appearance of a stop sequence. The stop sequence will not be included as part of the response. + @JsonKey(includeIfNull: false) + List? get stopSequences => throw _privateConstructorUsedError; - /// Required. The model's resource name. This serves as an ID for the Model to use. This name should match a model name returned by the `ListModels` method. Format: `models/{model}` + /// Optional. The maximum number of tokens to consider when sampling. The model uses combined Top-k and nucleus sampling. Top-k sampling considers the set of `top_k` most probable tokens. Note: The default value varies by model, see the `Model.top_k` attribute of the `Model` returned from the `getModel` function. @JsonKey(includeIfNull: false) - String? get model => throw _privateConstructorUsedError; + int? get topK => throw _privateConstructorUsedError; - /// Optional. An optional title for the text. Only applicable when TaskType is `RETRIEVAL_DOCUMENT`. + /// Optional. The maximum cumulative probability of tokens to consider when sampling. The model uses combined Top-k and nucleus sampling. Tokens are sorted based on their assigned probabilities so that only the most likely tokens are considered. Top-k sampling directly limits the maximum number of tokens to consider, while Nucleus sampling limits number of tokens based on the cumulative probability. Note: The default value varies by model, see the `Model.top_p` attribute of the `Model` returned from the `getModel` function. @JsonKey(includeIfNull: false) - String? get title => throw _privateConstructorUsedError; + double? get topP => throw _privateConstructorUsedError; + + /// Optional. Number of generated responses to return. Currently, this value can only be set to 1. If unset, this will default to 1. + @JsonKey(includeIfNull: false) + int? get candidateCount => throw _privateConstructorUsedError; + + /// Optional. The maximum number of tokens to include in a candidate. Note: The default value varies by model, see the `Model.output_token_limit` attribute of the `Model` returned from the `getModel` function. + @JsonKey(includeIfNull: false) + int? get maxOutputTokens => throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) - $EmbedContentRequestCopyWith get copyWith => + $GenerationConfigCopyWith get copyWith => throw _privateConstructorUsedError; } /// @nodoc -abstract class $EmbedContentRequestCopyWith<$Res> { - factory $EmbedContentRequestCopyWith( - EmbedContentRequest value, $Res Function(EmbedContentRequest) then) = - _$EmbedContentRequestCopyWithImpl<$Res, EmbedContentRequest>; +abstract class $GenerationConfigCopyWith<$Res> { + factory $GenerationConfigCopyWith( + GenerationConfig value, $Res Function(GenerationConfig) then) = + _$GenerationConfigCopyWithImpl<$Res, GenerationConfig>; @useResult $Res call( - {@JsonKey(includeIfNull: false) Content? content, - @JsonKey( - includeIfNull: false, - unknownEnumValue: JsonKey.nullForUndefinedEnumValue) - EmbedContentRequestTaskType? taskType, - @JsonKey(includeIfNull: false) String? model, - @JsonKey(includeIfNull: false) String? title}); - - $ContentCopyWith<$Res>? get content; + {@JsonKey(includeIfNull: false) double? temperature, + @JsonKey(includeIfNull: false) List? stopSequences, + @JsonKey(includeIfNull: false) int? topK, + @JsonKey(includeIfNull: false) double? topP, + @JsonKey(includeIfNull: false) int? candidateCount, + @JsonKey(includeIfNull: false) int? maxOutputTokens}); } /// @nodoc -class _$EmbedContentRequestCopyWithImpl<$Res, $Val extends EmbedContentRequest> - implements $EmbedContentRequestCopyWith<$Res> { - _$EmbedContentRequestCopyWithImpl(this._value, this._then); +class _$GenerationConfigCopyWithImpl<$Res, $Val extends GenerationConfig> + implements $GenerationConfigCopyWith<$Res> { + _$GenerationConfigCopyWithImpl(this._value, this._then); // ignore: unused_field final $Val _value; @@ -2804,252 +2642,288 @@ class _$EmbedContentRequestCopyWithImpl<$Res, $Val extends EmbedContentRequest> @pragma('vm:prefer-inline') @override $Res call({ - Object? content = freezed, - Object? taskType = freezed, - Object? model = freezed, - Object? title = freezed, + Object? temperature = freezed, + Object? stopSequences = freezed, + Object? topK = freezed, + Object? topP = freezed, + Object? candidateCount = freezed, + Object? maxOutputTokens = freezed, }) { return _then(_value.copyWith( - content: freezed == content - ? _value.content - : content // ignore: cast_nullable_to_non_nullable - as Content?, - taskType: freezed == taskType - ? _value.taskType - : taskType // ignore: cast_nullable_to_non_nullable - as EmbedContentRequestTaskType?, - model: freezed == model - ? _value.model - : model // ignore: cast_nullable_to_non_nullable - as String?, - title: freezed == title - ? _value.title - : title // ignore: cast_nullable_to_non_nullable - as String?, + temperature: freezed == temperature + ? _value.temperature + : temperature // ignore: cast_nullable_to_non_nullable + as double?, + stopSequences: freezed == stopSequences + ? _value.stopSequences + : stopSequences // ignore: cast_nullable_to_non_nullable + as List?, + topK: freezed == topK + ? _value.topK + : topK // ignore: cast_nullable_to_non_nullable + as int?, + topP: freezed == topP + ? _value.topP + : topP // ignore: cast_nullable_to_non_nullable + as double?, + candidateCount: freezed == candidateCount + ? _value.candidateCount + : candidateCount // ignore: cast_nullable_to_non_nullable + as int?, + maxOutputTokens: freezed == maxOutputTokens + ? _value.maxOutputTokens + : maxOutputTokens // ignore: cast_nullable_to_non_nullable + as int?, ) as $Val); } - - @override - @pragma('vm:prefer-inline') - $ContentCopyWith<$Res>? get content { - if (_value.content == null) { - return null; - } - - return $ContentCopyWith<$Res>(_value.content!, (value) { - return _then(_value.copyWith(content: value) as $Val); - }); - } } /// @nodoc -abstract class _$$EmbedContentRequestImplCopyWith<$Res> - implements $EmbedContentRequestCopyWith<$Res> { - factory _$$EmbedContentRequestImplCopyWith(_$EmbedContentRequestImpl value, - $Res Function(_$EmbedContentRequestImpl) then) = - __$$EmbedContentRequestImplCopyWithImpl<$Res>; +abstract class _$$GenerationConfigImplCopyWith<$Res> + implements $GenerationConfigCopyWith<$Res> { + factory _$$GenerationConfigImplCopyWith(_$GenerationConfigImpl value, + $Res Function(_$GenerationConfigImpl) then) = + __$$GenerationConfigImplCopyWithImpl<$Res>; @override @useResult $Res call( - {@JsonKey(includeIfNull: false) Content? content, - @JsonKey( - includeIfNull: false, - unknownEnumValue: JsonKey.nullForUndefinedEnumValue) - EmbedContentRequestTaskType? taskType, - @JsonKey(includeIfNull: false) String? model, - @JsonKey(includeIfNull: false) String? title}); - - @override - $ContentCopyWith<$Res>? get content; + {@JsonKey(includeIfNull: false) double? temperature, + @JsonKey(includeIfNull: false) List? stopSequences, + @JsonKey(includeIfNull: false) int? topK, + @JsonKey(includeIfNull: false) double? topP, + @JsonKey(includeIfNull: false) int? candidateCount, + @JsonKey(includeIfNull: false) int? maxOutputTokens}); } /// @nodoc -class __$$EmbedContentRequestImplCopyWithImpl<$Res> - extends _$EmbedContentRequestCopyWithImpl<$Res, _$EmbedContentRequestImpl> - implements _$$EmbedContentRequestImplCopyWith<$Res> { - __$$EmbedContentRequestImplCopyWithImpl(_$EmbedContentRequestImpl _value, - $Res Function(_$EmbedContentRequestImpl) _then) +class __$$GenerationConfigImplCopyWithImpl<$Res> + extends _$GenerationConfigCopyWithImpl<$Res, _$GenerationConfigImpl> + implements _$$GenerationConfigImplCopyWith<$Res> { + __$$GenerationConfigImplCopyWithImpl(_$GenerationConfigImpl _value, + $Res Function(_$GenerationConfigImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @override $Res call({ - Object? content = freezed, - Object? taskType = freezed, - Object? model = freezed, - Object? title = freezed, + Object? temperature = freezed, + Object? stopSequences = freezed, + Object? topK = freezed, + Object? topP = freezed, + Object? candidateCount = freezed, + Object? maxOutputTokens = freezed, }) { - return _then(_$EmbedContentRequestImpl( - content: freezed == content - ? _value.content - : content // ignore: cast_nullable_to_non_nullable - as Content?, - taskType: freezed == taskType - ? _value.taskType - : taskType // ignore: cast_nullable_to_non_nullable - as EmbedContentRequestTaskType?, - model: freezed == model - ? _value.model - : model // ignore: cast_nullable_to_non_nullable - as String?, - title: freezed == title - ? _value.title - : title // ignore: cast_nullable_to_non_nullable - as String?, + return _then(_$GenerationConfigImpl( + temperature: freezed == temperature + ? _value.temperature + : temperature // ignore: cast_nullable_to_non_nullable + as double?, + stopSequences: freezed == stopSequences + ? _value._stopSequences + : stopSequences // ignore: cast_nullable_to_non_nullable + as List?, + topK: freezed == topK + ? _value.topK + : topK // ignore: cast_nullable_to_non_nullable + as int?, + topP: freezed == topP + ? _value.topP + : topP // ignore: cast_nullable_to_non_nullable + as double?, + candidateCount: freezed == candidateCount + ? _value.candidateCount + : candidateCount // ignore: cast_nullable_to_non_nullable + as int?, + maxOutputTokens: freezed == maxOutputTokens + ? _value.maxOutputTokens + : maxOutputTokens // ignore: cast_nullable_to_non_nullable + as int?, )); } } /// @nodoc @JsonSerializable() -class _$EmbedContentRequestImpl extends _EmbedContentRequest { - const _$EmbedContentRequestImpl( - {@JsonKey(includeIfNull: false) this.content, - @JsonKey( - includeIfNull: false, - unknownEnumValue: JsonKey.nullForUndefinedEnumValue) - this.taskType, - @JsonKey(includeIfNull: false) this.model, - @JsonKey(includeIfNull: false) this.title}) - : super._(); +class _$GenerationConfigImpl extends _GenerationConfig { + const _$GenerationConfigImpl( + {@JsonKey(includeIfNull: false) this.temperature, + @JsonKey(includeIfNull: false) final List? stopSequences, + @JsonKey(includeIfNull: false) this.topK, + @JsonKey(includeIfNull: false) this.topP, + @JsonKey(includeIfNull: false) this.candidateCount, + @JsonKey(includeIfNull: false) this.maxOutputTokens}) + : _stopSequences = stopSequences, + super._(); - factory _$EmbedContentRequestImpl.fromJson(Map json) => - _$$EmbedContentRequestImplFromJson(json); + factory _$GenerationConfigImpl.fromJson(Map json) => + _$$GenerationConfigImplFromJson(json); - /// Required. The content to embed. Only the `parts.text` fields will be counted. + /// Optional. Controls the randomness of the output. Note: The default value varies by model, see the `Model.temperature` attribute of the `Model` returned from the `getModel` function. Values can range from [0.0, infinity). @override @JsonKey(includeIfNull: false) - final Content? content; + final double? temperature; - /// Optional. Optional task type for which the embeddings will be used. Can only be set for `models/embedding-001`. + /// Optional. The set of character sequences (up to 5) that will stop output generation. If specified, the API will stop at the first appearance of a stop sequence. The stop sequence will not be included as part of the response. + final List? _stopSequences; + + /// Optional. The set of character sequences (up to 5) that will stop output generation. If specified, the API will stop at the first appearance of a stop sequence. The stop sequence will not be included as part of the response. @override - @JsonKey( - includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue) - final EmbedContentRequestTaskType? taskType; + @JsonKey(includeIfNull: false) + List? get stopSequences { + final value = _stopSequences; + if (value == null) return null; + if (_stopSequences is EqualUnmodifiableListView) return _stopSequences; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(value); + } - /// Required. The model's resource name. This serves as an ID for the Model to use. This name should match a model name returned by the `ListModels` method. Format: `models/{model}` + /// Optional. The maximum number of tokens to consider when sampling. The model uses combined Top-k and nucleus sampling. Top-k sampling considers the set of `top_k` most probable tokens. Note: The default value varies by model, see the `Model.top_k` attribute of the `Model` returned from the `getModel` function. @override @JsonKey(includeIfNull: false) - final String? model; + final int? topK; - /// Optional. An optional title for the text. Only applicable when TaskType is `RETRIEVAL_DOCUMENT`. + /// Optional. The maximum cumulative probability of tokens to consider when sampling. The model uses combined Top-k and nucleus sampling. Tokens are sorted based on their assigned probabilities so that only the most likely tokens are considered. Top-k sampling directly limits the maximum number of tokens to consider, while Nucleus sampling limits number of tokens based on the cumulative probability. Note: The default value varies by model, see the `Model.top_p` attribute of the `Model` returned from the `getModel` function. @override @JsonKey(includeIfNull: false) - final String? title; + final double? topP; + + /// Optional. Number of generated responses to return. Currently, this value can only be set to 1. If unset, this will default to 1. + @override + @JsonKey(includeIfNull: false) + final int? candidateCount; + + /// Optional. The maximum number of tokens to include in a candidate. Note: The default value varies by model, see the `Model.output_token_limit` attribute of the `Model` returned from the `getModel` function. + @override + @JsonKey(includeIfNull: false) + final int? maxOutputTokens; @override String toString() { - return 'EmbedContentRequest(content: $content, taskType: $taskType, model: $model, title: $title)'; + return 'GenerationConfig(temperature: $temperature, stopSequences: $stopSequences, topK: $topK, topP: $topP, candidateCount: $candidateCount, maxOutputTokens: $maxOutputTokens)'; } @override bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$EmbedContentRequestImpl && - (identical(other.content, content) || other.content == content) && - (identical(other.taskType, taskType) || - other.taskType == taskType) && - (identical(other.model, model) || other.model == model) && - (identical(other.title, title) || other.title == title)); + other is _$GenerationConfigImpl && + (identical(other.temperature, temperature) || + other.temperature == temperature) && + const DeepCollectionEquality() + .equals(other._stopSequences, _stopSequences) && + (identical(other.topK, topK) || other.topK == topK) && + (identical(other.topP, topP) || other.topP == topP) && + (identical(other.candidateCount, candidateCount) || + other.candidateCount == candidateCount) && + (identical(other.maxOutputTokens, maxOutputTokens) || + other.maxOutputTokens == maxOutputTokens)); } @JsonKey(ignore: true) @override - int get hashCode => Object.hash(runtimeType, content, taskType, model, title); + int get hashCode => Object.hash( + runtimeType, + temperature, + const DeepCollectionEquality().hash(_stopSequences), + topK, + topP, + candidateCount, + maxOutputTokens); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$EmbedContentRequestImplCopyWith<_$EmbedContentRequestImpl> get copyWith => - __$$EmbedContentRequestImplCopyWithImpl<_$EmbedContentRequestImpl>( + _$$GenerationConfigImplCopyWith<_$GenerationConfigImpl> get copyWith => + __$$GenerationConfigImplCopyWithImpl<_$GenerationConfigImpl>( this, _$identity); @override Map toJson() { - return _$$EmbedContentRequestImplToJson( + return _$$GenerationConfigImplToJson( this, ); } } -abstract class _EmbedContentRequest extends EmbedContentRequest { - const factory _EmbedContentRequest( - {@JsonKey(includeIfNull: false) final Content? content, - @JsonKey( - includeIfNull: false, - unknownEnumValue: JsonKey.nullForUndefinedEnumValue) - final EmbedContentRequestTaskType? taskType, - @JsonKey(includeIfNull: false) final String? model, - @JsonKey(includeIfNull: false) final String? title}) = - _$EmbedContentRequestImpl; - const _EmbedContentRequest._() : super._(); +abstract class _GenerationConfig extends GenerationConfig { + const factory _GenerationConfig( + {@JsonKey(includeIfNull: false) final double? temperature, + @JsonKey(includeIfNull: false) final List? stopSequences, + @JsonKey(includeIfNull: false) final int? topK, + @JsonKey(includeIfNull: false) final double? topP, + @JsonKey(includeIfNull: false) final int? candidateCount, + @JsonKey(includeIfNull: false) final int? maxOutputTokens}) = + _$GenerationConfigImpl; + const _GenerationConfig._() : super._(); - factory _EmbedContentRequest.fromJson(Map json) = - _$EmbedContentRequestImpl.fromJson; + factory _GenerationConfig.fromJson(Map json) = + _$GenerationConfigImpl.fromJson; @override - /// Required. The content to embed. Only the `parts.text` fields will be counted. + /// Optional. Controls the randomness of the output. Note: The default value varies by model, see the `Model.temperature` attribute of the `Model` returned from the `getModel` function. Values can range from [0.0, infinity). @JsonKey(includeIfNull: false) - Content? get content; + double? get temperature; @override - /// Optional. Optional task type for which the embeddings will be used. Can only be set for `models/embedding-001`. - @JsonKey( - includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue) - EmbedContentRequestTaskType? get taskType; + /// Optional. The set of character sequences (up to 5) that will stop output generation. If specified, the API will stop at the first appearance of a stop sequence. The stop sequence will not be included as part of the response. + @JsonKey(includeIfNull: false) + List? get stopSequences; @override - /// Required. The model's resource name. This serves as an ID for the Model to use. This name should match a model name returned by the `ListModels` method. Format: `models/{model}` + /// Optional. The maximum number of tokens to consider when sampling. The model uses combined Top-k and nucleus sampling. Top-k sampling considers the set of `top_k` most probable tokens. Note: The default value varies by model, see the `Model.top_k` attribute of the `Model` returned from the `getModel` function. @JsonKey(includeIfNull: false) - String? get model; + int? get topK; @override - /// Optional. An optional title for the text. Only applicable when TaskType is `RETRIEVAL_DOCUMENT`. + /// Optional. The maximum cumulative probability of tokens to consider when sampling. The model uses combined Top-k and nucleus sampling. Tokens are sorted based on their assigned probabilities so that only the most likely tokens are considered. Top-k sampling directly limits the maximum number of tokens to consider, while Nucleus sampling limits number of tokens based on the cumulative probability. Note: The default value varies by model, see the `Model.top_p` attribute of the `Model` returned from the `getModel` function. @JsonKey(includeIfNull: false) - String? get title; + double? get topP; + @override + + /// Optional. Number of generated responses to return. Currently, this value can only be set to 1. If unset, this will default to 1. + @JsonKey(includeIfNull: false) + int? get candidateCount; + @override + + /// Optional. The maximum number of tokens to include in a candidate. Note: The default value varies by model, see the `Model.output_token_limit` attribute of the `Model` returned from the `getModel` function. + @JsonKey(includeIfNull: false) + int? get maxOutputTokens; @override @JsonKey(ignore: true) - _$$EmbedContentRequestImplCopyWith<_$EmbedContentRequestImpl> get copyWith => + _$$GenerationConfigImplCopyWith<_$GenerationConfigImpl> get copyWith => throw _privateConstructorUsedError; } -ListModelsResponse _$ListModelsResponseFromJson(Map json) { - return _ListModelsResponse.fromJson(json); +CountTokensRequest _$CountTokensRequestFromJson(Map json) { + return _CountTokensRequest.fromJson(json); } /// @nodoc -mixin _$ListModelsResponse { - /// A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no more pages. - @JsonKey(includeIfNull: false) - String? get nextPageToken => throw _privateConstructorUsedError; - - /// The returned Models. +mixin _$CountTokensRequest { + /// Required. The input given to the model as a prompt. @JsonKey(includeIfNull: false) - List? get models => throw _privateConstructorUsedError; + List? get contents => throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) - $ListModelsResponseCopyWith get copyWith => + $CountTokensRequestCopyWith get copyWith => throw _privateConstructorUsedError; } /// @nodoc -abstract class $ListModelsResponseCopyWith<$Res> { - factory $ListModelsResponseCopyWith( - ListModelsResponse value, $Res Function(ListModelsResponse) then) = - _$ListModelsResponseCopyWithImpl<$Res, ListModelsResponse>; +abstract class $CountTokensRequestCopyWith<$Res> { + factory $CountTokensRequestCopyWith( + CountTokensRequest value, $Res Function(CountTokensRequest) then) = + _$CountTokensRequestCopyWithImpl<$Res, CountTokensRequest>; @useResult - $Res call( - {@JsonKey(includeIfNull: false) String? nextPageToken, - @JsonKey(includeIfNull: false) List? models}); + $Res call({@JsonKey(includeIfNull: false) List? contents}); } /// @nodoc -class _$ListModelsResponseCopyWithImpl<$Res, $Val extends ListModelsResponse> - implements $ListModelsResponseCopyWith<$Res> { - _$ListModelsResponseCopyWithImpl(this._value, this._then); +class _$CountTokensRequestCopyWithImpl<$Res, $Val extends CountTokensRequest> + implements $CountTokensRequestCopyWith<$Res> { + _$CountTokensRequestCopyWithImpl(this._value, this._then); // ignore: unused_field final $Val _value; @@ -3059,186 +2933,173 @@ class _$ListModelsResponseCopyWithImpl<$Res, $Val extends ListModelsResponse> @pragma('vm:prefer-inline') @override $Res call({ - Object? nextPageToken = freezed, - Object? models = freezed, + Object? contents = freezed, }) { return _then(_value.copyWith( - nextPageToken: freezed == nextPageToken - ? _value.nextPageToken - : nextPageToken // ignore: cast_nullable_to_non_nullable - as String?, - models: freezed == models - ? _value.models - : models // ignore: cast_nullable_to_non_nullable - as List?, + contents: freezed == contents + ? _value.contents + : contents // ignore: cast_nullable_to_non_nullable + as List?, ) as $Val); } } /// @nodoc -abstract class _$$ListModelsResponseImplCopyWith<$Res> - implements $ListModelsResponseCopyWith<$Res> { - factory _$$ListModelsResponseImplCopyWith(_$ListModelsResponseImpl value, - $Res Function(_$ListModelsResponseImpl) then) = - __$$ListModelsResponseImplCopyWithImpl<$Res>; +abstract class _$$CountTokensRequestImplCopyWith<$Res> + implements $CountTokensRequestCopyWith<$Res> { + factory _$$CountTokensRequestImplCopyWith(_$CountTokensRequestImpl value, + $Res Function(_$CountTokensRequestImpl) then) = + __$$CountTokensRequestImplCopyWithImpl<$Res>; @override @useResult - $Res call( - {@JsonKey(includeIfNull: false) String? nextPageToken, - @JsonKey(includeIfNull: false) List? models}); + $Res call({@JsonKey(includeIfNull: false) List? contents}); } /// @nodoc -class __$$ListModelsResponseImplCopyWithImpl<$Res> - extends _$ListModelsResponseCopyWithImpl<$Res, _$ListModelsResponseImpl> - implements _$$ListModelsResponseImplCopyWith<$Res> { - __$$ListModelsResponseImplCopyWithImpl(_$ListModelsResponseImpl _value, - $Res Function(_$ListModelsResponseImpl) _then) +class __$$CountTokensRequestImplCopyWithImpl<$Res> + extends _$CountTokensRequestCopyWithImpl<$Res, _$CountTokensRequestImpl> + implements _$$CountTokensRequestImplCopyWith<$Res> { + __$$CountTokensRequestImplCopyWithImpl(_$CountTokensRequestImpl _value, + $Res Function(_$CountTokensRequestImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @override $Res call({ - Object? nextPageToken = freezed, - Object? models = freezed, + Object? contents = freezed, }) { - return _then(_$ListModelsResponseImpl( - nextPageToken: freezed == nextPageToken - ? _value.nextPageToken - : nextPageToken // ignore: cast_nullable_to_non_nullable - as String?, - models: freezed == models - ? _value._models - : models // ignore: cast_nullable_to_non_nullable - as List?, + return _then(_$CountTokensRequestImpl( + contents: freezed == contents + ? _value._contents + : contents // ignore: cast_nullable_to_non_nullable + as List?, )); } } /// @nodoc @JsonSerializable() -class _$ListModelsResponseImpl extends _ListModelsResponse { - const _$ListModelsResponseImpl( - {@JsonKey(includeIfNull: false) this.nextPageToken, - @JsonKey(includeIfNull: false) final List? models}) - : _models = models, +class _$CountTokensRequestImpl extends _CountTokensRequest { + const _$CountTokensRequestImpl( + {@JsonKey(includeIfNull: false) final List? contents}) + : _contents = contents, super._(); - factory _$ListModelsResponseImpl.fromJson(Map json) => - _$$ListModelsResponseImplFromJson(json); - - /// A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no more pages. - @override - @JsonKey(includeIfNull: false) - final String? nextPageToken; + factory _$CountTokensRequestImpl.fromJson(Map json) => + _$$CountTokensRequestImplFromJson(json); - /// The returned Models. - final List? _models; + /// Required. The input given to the model as a prompt. + final List? _contents; - /// The returned Models. + /// Required. The input given to the model as a prompt. @override @JsonKey(includeIfNull: false) - List? get models { - final value = _models; + List? get contents { + final value = _contents; if (value == null) return null; - if (_models is EqualUnmodifiableListView) return _models; + if (_contents is EqualUnmodifiableListView) return _contents; // ignore: implicit_dynamic_type return EqualUnmodifiableListView(value); } @override String toString() { - return 'ListModelsResponse(nextPageToken: $nextPageToken, models: $models)'; + return 'CountTokensRequest(contents: $contents)'; } @override bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$ListModelsResponseImpl && - (identical(other.nextPageToken, nextPageToken) || - other.nextPageToken == nextPageToken) && - const DeepCollectionEquality().equals(other._models, _models)); + other is _$CountTokensRequestImpl && + const DeepCollectionEquality().equals(other._contents, _contents)); } @JsonKey(ignore: true) @override - int get hashCode => Object.hash( - runtimeType, nextPageToken, const DeepCollectionEquality().hash(_models)); + int get hashCode => + Object.hash(runtimeType, const DeepCollectionEquality().hash(_contents)); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$ListModelsResponseImplCopyWith<_$ListModelsResponseImpl> get copyWith => - __$$ListModelsResponseImplCopyWithImpl<_$ListModelsResponseImpl>( + _$$CountTokensRequestImplCopyWith<_$CountTokensRequestImpl> get copyWith => + __$$CountTokensRequestImplCopyWithImpl<_$CountTokensRequestImpl>( this, _$identity); @override Map toJson() { - return _$$ListModelsResponseImplToJson( + return _$$CountTokensRequestImplToJson( this, ); } } -abstract class _ListModelsResponse extends ListModelsResponse { - const factory _ListModelsResponse( - {@JsonKey(includeIfNull: false) final String? nextPageToken, - @JsonKey(includeIfNull: false) final List? models}) = - _$ListModelsResponseImpl; - const _ListModelsResponse._() : super._(); - - factory _ListModelsResponse.fromJson(Map json) = - _$ListModelsResponseImpl.fromJson; +abstract class _CountTokensRequest extends CountTokensRequest { + const factory _CountTokensRequest( + {@JsonKey(includeIfNull: false) final List? contents}) = + _$CountTokensRequestImpl; + const _CountTokensRequest._() : super._(); - @override + factory _CountTokensRequest.fromJson(Map json) = + _$CountTokensRequestImpl.fromJson; - /// A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no more pages. - @JsonKey(includeIfNull: false) - String? get nextPageToken; @override - /// The returned Models. + /// Required. The input given to the model as a prompt. @JsonKey(includeIfNull: false) - List? get models; + List? get contents; @override @JsonKey(ignore: true) - _$$ListModelsResponseImplCopyWith<_$ListModelsResponseImpl> get copyWith => + _$$CountTokensRequestImplCopyWith<_$CountTokensRequestImpl> get copyWith => throw _privateConstructorUsedError; } -BatchEmbedContentsRequest _$BatchEmbedContentsRequestFromJson( - Map json) { - return _BatchEmbedContentsRequest.fromJson(json); +TuningSnapshot _$TuningSnapshotFromJson(Map json) { + return _TuningSnapshot.fromJson(json); } /// @nodoc -mixin _$BatchEmbedContentsRequest { - /// Required. Embed requests for the batch. The model in each of these requests must match the model specified `BatchEmbedContentsRequest.model`. +mixin _$TuningSnapshot { + /// Output only. The tuning step. @JsonKey(includeIfNull: false) - List? get requests => throw _privateConstructorUsedError; + int? get step => throw _privateConstructorUsedError; + + /// Output only. The timestamp when this metric was computed. + @JsonKey(includeIfNull: false) + String? get computeTime => throw _privateConstructorUsedError; + + /// Output only. The epoch this step was part of. + @JsonKey(includeIfNull: false) + int? get epoch => throw _privateConstructorUsedError; + + /// Output only. The mean loss of the training examples for this step. + @JsonKey(includeIfNull: false) + double? get meanLoss => throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) - $BatchEmbedContentsRequestCopyWith get copyWith => + $TuningSnapshotCopyWith get copyWith => throw _privateConstructorUsedError; } /// @nodoc -abstract class $BatchEmbedContentsRequestCopyWith<$Res> { - factory $BatchEmbedContentsRequestCopyWith(BatchEmbedContentsRequest value, - $Res Function(BatchEmbedContentsRequest) then) = - _$BatchEmbedContentsRequestCopyWithImpl<$Res, BatchEmbedContentsRequest>; +abstract class $TuningSnapshotCopyWith<$Res> { + factory $TuningSnapshotCopyWith( + TuningSnapshot value, $Res Function(TuningSnapshot) then) = + _$TuningSnapshotCopyWithImpl<$Res, TuningSnapshot>; @useResult $Res call( - {@JsonKey(includeIfNull: false) List? requests}); + {@JsonKey(includeIfNull: false) int? step, + @JsonKey(includeIfNull: false) String? computeTime, + @JsonKey(includeIfNull: false) int? epoch, + @JsonKey(includeIfNull: false) double? meanLoss}); } /// @nodoc -class _$BatchEmbedContentsRequestCopyWithImpl<$Res, - $Val extends BatchEmbedContentsRequest> - implements $BatchEmbedContentsRequestCopyWith<$Res> { - _$BatchEmbedContentsRequestCopyWithImpl(this._value, this._then); +class _$TuningSnapshotCopyWithImpl<$Res, $Val extends TuningSnapshot> + implements $TuningSnapshotCopyWith<$Res> { + _$TuningSnapshotCopyWithImpl(this._value, this._then); // ignore: unused_field final $Val _value; @@ -3248,163 +3109,226 @@ class _$BatchEmbedContentsRequestCopyWithImpl<$Res, @pragma('vm:prefer-inline') @override $Res call({ - Object? requests = freezed, + Object? step = freezed, + Object? computeTime = freezed, + Object? epoch = freezed, + Object? meanLoss = freezed, }) { return _then(_value.copyWith( - requests: freezed == requests - ? _value.requests - : requests // ignore: cast_nullable_to_non_nullable - as List?, + step: freezed == step + ? _value.step + : step // ignore: cast_nullable_to_non_nullable + as int?, + computeTime: freezed == computeTime + ? _value.computeTime + : computeTime // ignore: cast_nullable_to_non_nullable + as String?, + epoch: freezed == epoch + ? _value.epoch + : epoch // ignore: cast_nullable_to_non_nullable + as int?, + meanLoss: freezed == meanLoss + ? _value.meanLoss + : meanLoss // ignore: cast_nullable_to_non_nullable + as double?, ) as $Val); } } /// @nodoc -abstract class _$$BatchEmbedContentsRequestImplCopyWith<$Res> - implements $BatchEmbedContentsRequestCopyWith<$Res> { - factory _$$BatchEmbedContentsRequestImplCopyWith( - _$BatchEmbedContentsRequestImpl value, - $Res Function(_$BatchEmbedContentsRequestImpl) then) = - __$$BatchEmbedContentsRequestImplCopyWithImpl<$Res>; +abstract class _$$TuningSnapshotImplCopyWith<$Res> + implements $TuningSnapshotCopyWith<$Res> { + factory _$$TuningSnapshotImplCopyWith(_$TuningSnapshotImpl value, + $Res Function(_$TuningSnapshotImpl) then) = + __$$TuningSnapshotImplCopyWithImpl<$Res>; @override @useResult $Res call( - {@JsonKey(includeIfNull: false) List? requests}); + {@JsonKey(includeIfNull: false) int? step, + @JsonKey(includeIfNull: false) String? computeTime, + @JsonKey(includeIfNull: false) int? epoch, + @JsonKey(includeIfNull: false) double? meanLoss}); } /// @nodoc -class __$$BatchEmbedContentsRequestImplCopyWithImpl<$Res> - extends _$BatchEmbedContentsRequestCopyWithImpl<$Res, - _$BatchEmbedContentsRequestImpl> - implements _$$BatchEmbedContentsRequestImplCopyWith<$Res> { - __$$BatchEmbedContentsRequestImplCopyWithImpl( - _$BatchEmbedContentsRequestImpl _value, - $Res Function(_$BatchEmbedContentsRequestImpl) _then) +class __$$TuningSnapshotImplCopyWithImpl<$Res> + extends _$TuningSnapshotCopyWithImpl<$Res, _$TuningSnapshotImpl> + implements _$$TuningSnapshotImplCopyWith<$Res> { + __$$TuningSnapshotImplCopyWithImpl( + _$TuningSnapshotImpl _value, $Res Function(_$TuningSnapshotImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @override $Res call({ - Object? requests = freezed, + Object? step = freezed, + Object? computeTime = freezed, + Object? epoch = freezed, + Object? meanLoss = freezed, }) { - return _then(_$BatchEmbedContentsRequestImpl( - requests: freezed == requests - ? _value._requests - : requests // ignore: cast_nullable_to_non_nullable - as List?, + return _then(_$TuningSnapshotImpl( + step: freezed == step + ? _value.step + : step // ignore: cast_nullable_to_non_nullable + as int?, + computeTime: freezed == computeTime + ? _value.computeTime + : computeTime // ignore: cast_nullable_to_non_nullable + as String?, + epoch: freezed == epoch + ? _value.epoch + : epoch // ignore: cast_nullable_to_non_nullable + as int?, + meanLoss: freezed == meanLoss + ? _value.meanLoss + : meanLoss // ignore: cast_nullable_to_non_nullable + as double?, )); } } /// @nodoc @JsonSerializable() -class _$BatchEmbedContentsRequestImpl extends _BatchEmbedContentsRequest { - const _$BatchEmbedContentsRequestImpl( - {@JsonKey(includeIfNull: false) - final List? requests}) - : _requests = requests, - super._(); +class _$TuningSnapshotImpl extends _TuningSnapshot { + const _$TuningSnapshotImpl( + {@JsonKey(includeIfNull: false) this.step, + @JsonKey(includeIfNull: false) this.computeTime, + @JsonKey(includeIfNull: false) this.epoch, + @JsonKey(includeIfNull: false) this.meanLoss}) + : super._(); - factory _$BatchEmbedContentsRequestImpl.fromJson(Map json) => - _$$BatchEmbedContentsRequestImplFromJson(json); + factory _$TuningSnapshotImpl.fromJson(Map json) => + _$$TuningSnapshotImplFromJson(json); - /// Required. Embed requests for the batch. The model in each of these requests must match the model specified `BatchEmbedContentsRequest.model`. - final List? _requests; + /// Output only. The tuning step. + @override + @JsonKey(includeIfNull: false) + final int? step; - /// Required. Embed requests for the batch. The model in each of these requests must match the model specified `BatchEmbedContentsRequest.model`. + /// Output only. The timestamp when this metric was computed. @override @JsonKey(includeIfNull: false) - List? get requests { - final value = _requests; - if (value == null) return null; - if (_requests is EqualUnmodifiableListView) return _requests; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(value); - } + final String? computeTime; + + /// Output only. The epoch this step was part of. + @override + @JsonKey(includeIfNull: false) + final int? epoch; + + /// Output only. The mean loss of the training examples for this step. + @override + @JsonKey(includeIfNull: false) + final double? meanLoss; @override String toString() { - return 'BatchEmbedContentsRequest(requests: $requests)'; + return 'TuningSnapshot(step: $step, computeTime: $computeTime, epoch: $epoch, meanLoss: $meanLoss)'; } @override bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$BatchEmbedContentsRequestImpl && - const DeepCollectionEquality().equals(other._requests, _requests)); + other is _$TuningSnapshotImpl && + (identical(other.step, step) || other.step == step) && + (identical(other.computeTime, computeTime) || + other.computeTime == computeTime) && + (identical(other.epoch, epoch) || other.epoch == epoch) && + (identical(other.meanLoss, meanLoss) || + other.meanLoss == meanLoss)); } @JsonKey(ignore: true) @override int get hashCode => - Object.hash(runtimeType, const DeepCollectionEquality().hash(_requests)); + Object.hash(runtimeType, step, computeTime, epoch, meanLoss); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$BatchEmbedContentsRequestImplCopyWith<_$BatchEmbedContentsRequestImpl> - get copyWith => __$$BatchEmbedContentsRequestImplCopyWithImpl< - _$BatchEmbedContentsRequestImpl>(this, _$identity); + _$$TuningSnapshotImplCopyWith<_$TuningSnapshotImpl> get copyWith => + __$$TuningSnapshotImplCopyWithImpl<_$TuningSnapshotImpl>( + this, _$identity); @override Map toJson() { - return _$$BatchEmbedContentsRequestImplToJson( + return _$$TuningSnapshotImplToJson( this, ); } } -abstract class _BatchEmbedContentsRequest extends BatchEmbedContentsRequest { - const factory _BatchEmbedContentsRequest( - {@JsonKey(includeIfNull: false) - final List? requests}) = - _$BatchEmbedContentsRequestImpl; - const _BatchEmbedContentsRequest._() : super._(); +abstract class _TuningSnapshot extends TuningSnapshot { + const factory _TuningSnapshot( + {@JsonKey(includeIfNull: false) final int? step, + @JsonKey(includeIfNull: false) final String? computeTime, + @JsonKey(includeIfNull: false) final int? epoch, + @JsonKey(includeIfNull: false) final double? meanLoss}) = + _$TuningSnapshotImpl; + const _TuningSnapshot._() : super._(); - factory _BatchEmbedContentsRequest.fromJson(Map json) = - _$BatchEmbedContentsRequestImpl.fromJson; + factory _TuningSnapshot.fromJson(Map json) = + _$TuningSnapshotImpl.fromJson; + + @override + + /// Output only. The tuning step. + @JsonKey(includeIfNull: false) + int? get step; + @override + + /// Output only. The timestamp when this metric was computed. + @JsonKey(includeIfNull: false) + String? get computeTime; + @override + /// Output only. The epoch this step was part of. + @JsonKey(includeIfNull: false) + int? get epoch; @override - /// Required. Embed requests for the batch. The model in each of these requests must match the model specified `BatchEmbedContentsRequest.model`. + /// Output only. The mean loss of the training examples for this step. @JsonKey(includeIfNull: false) - List? get requests; + double? get meanLoss; @override @JsonKey(ignore: true) - _$$BatchEmbedContentsRequestImplCopyWith<_$BatchEmbedContentsRequestImpl> - get copyWith => throw _privateConstructorUsedError; + _$$TuningSnapshotImplCopyWith<_$TuningSnapshotImpl> get copyWith => + throw _privateConstructorUsedError; } -ContentEmbedding _$ContentEmbeddingFromJson(Map json) { - return _ContentEmbedding.fromJson(json); +Blob _$BlobFromJson(Map json) { + return _Blob.fromJson(json); } /// @nodoc -mixin _$ContentEmbedding { - /// The embedding values. +mixin _$Blob { + /// The IANA standard MIME type of the source data. Accepted types include: "image/png", "image/jpeg", "image/heic", "image/heif", "image/webp". @JsonKey(includeIfNull: false) - List? get values => throw _privateConstructorUsedError; + String? get mimeType => throw _privateConstructorUsedError; + + /// Raw bytes for media formats. + @JsonKey(includeIfNull: false) + String? get data => throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) - $ContentEmbeddingCopyWith get copyWith => - throw _privateConstructorUsedError; + $BlobCopyWith get copyWith => throw _privateConstructorUsedError; } /// @nodoc -abstract class $ContentEmbeddingCopyWith<$Res> { - factory $ContentEmbeddingCopyWith( - ContentEmbedding value, $Res Function(ContentEmbedding) then) = - _$ContentEmbeddingCopyWithImpl<$Res, ContentEmbedding>; +abstract class $BlobCopyWith<$Res> { + factory $BlobCopyWith(Blob value, $Res Function(Blob) then) = + _$BlobCopyWithImpl<$Res, Blob>; @useResult - $Res call({@JsonKey(includeIfNull: false) List? values}); + $Res call( + {@JsonKey(includeIfNull: false) String? mimeType, + @JsonKey(includeIfNull: false) String? data}); } /// @nodoc -class _$ContentEmbeddingCopyWithImpl<$Res, $Val extends ContentEmbedding> - implements $ContentEmbeddingCopyWith<$Res> { - _$ContentEmbeddingCopyWithImpl(this._value, this._then); +class _$BlobCopyWithImpl<$Res, $Val extends Blob> + implements $BlobCopyWith<$Res> { + _$BlobCopyWithImpl(this._value, this._then); // ignore: unused_field final $Val _value; @@ -3414,168 +3338,173 @@ class _$ContentEmbeddingCopyWithImpl<$Res, $Val extends ContentEmbedding> @pragma('vm:prefer-inline') @override $Res call({ - Object? values = freezed, + Object? mimeType = freezed, + Object? data = freezed, }) { return _then(_value.copyWith( - values: freezed == values - ? _value.values - : values // ignore: cast_nullable_to_non_nullable - as List?, + mimeType: freezed == mimeType + ? _value.mimeType + : mimeType // ignore: cast_nullable_to_non_nullable + as String?, + data: freezed == data + ? _value.data + : data // ignore: cast_nullable_to_non_nullable + as String?, ) as $Val); } } /// @nodoc -abstract class _$$ContentEmbeddingImplCopyWith<$Res> - implements $ContentEmbeddingCopyWith<$Res> { - factory _$$ContentEmbeddingImplCopyWith(_$ContentEmbeddingImpl value, - $Res Function(_$ContentEmbeddingImpl) then) = - __$$ContentEmbeddingImplCopyWithImpl<$Res>; +abstract class _$$BlobImplCopyWith<$Res> implements $BlobCopyWith<$Res> { + factory _$$BlobImplCopyWith( + _$BlobImpl value, $Res Function(_$BlobImpl) then) = + __$$BlobImplCopyWithImpl<$Res>; @override @useResult - $Res call({@JsonKey(includeIfNull: false) List? values}); + $Res call( + {@JsonKey(includeIfNull: false) String? mimeType, + @JsonKey(includeIfNull: false) String? data}); } /// @nodoc -class __$$ContentEmbeddingImplCopyWithImpl<$Res> - extends _$ContentEmbeddingCopyWithImpl<$Res, _$ContentEmbeddingImpl> - implements _$$ContentEmbeddingImplCopyWith<$Res> { - __$$ContentEmbeddingImplCopyWithImpl(_$ContentEmbeddingImpl _value, - $Res Function(_$ContentEmbeddingImpl) _then) +class __$$BlobImplCopyWithImpl<$Res> + extends _$BlobCopyWithImpl<$Res, _$BlobImpl> + implements _$$BlobImplCopyWith<$Res> { + __$$BlobImplCopyWithImpl(_$BlobImpl _value, $Res Function(_$BlobImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @override $Res call({ - Object? values = freezed, + Object? mimeType = freezed, + Object? data = freezed, }) { - return _then(_$ContentEmbeddingImpl( - values: freezed == values - ? _value._values - : values // ignore: cast_nullable_to_non_nullable - as List?, + return _then(_$BlobImpl( + mimeType: freezed == mimeType + ? _value.mimeType + : mimeType // ignore: cast_nullable_to_non_nullable + as String?, + data: freezed == data + ? _value.data + : data // ignore: cast_nullable_to_non_nullable + as String?, )); } } /// @nodoc @JsonSerializable() -class _$ContentEmbeddingImpl extends _ContentEmbedding { - const _$ContentEmbeddingImpl( - {@JsonKey(includeIfNull: false) final List? values}) - : _values = values, - super._(); +class _$BlobImpl extends _Blob { + const _$BlobImpl( + {@JsonKey(includeIfNull: false) this.mimeType, + @JsonKey(includeIfNull: false) this.data}) + : super._(); - factory _$ContentEmbeddingImpl.fromJson(Map json) => - _$$ContentEmbeddingImplFromJson(json); + factory _$BlobImpl.fromJson(Map json) => + _$$BlobImplFromJson(json); - /// The embedding values. - final List? _values; + /// The IANA standard MIME type of the source data. Accepted types include: "image/png", "image/jpeg", "image/heic", "image/heif", "image/webp". + @override + @JsonKey(includeIfNull: false) + final String? mimeType; - /// The embedding values. + /// Raw bytes for media formats. @override @JsonKey(includeIfNull: false) - List? get values { - final value = _values; - if (value == null) return null; - if (_values is EqualUnmodifiableListView) return _values; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(value); - } + final String? data; @override String toString() { - return 'ContentEmbedding(values: $values)'; + return 'Blob(mimeType: $mimeType, data: $data)'; } @override bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$ContentEmbeddingImpl && - const DeepCollectionEquality().equals(other._values, _values)); + other is _$BlobImpl && + (identical(other.mimeType, mimeType) || + other.mimeType == mimeType) && + (identical(other.data, data) || other.data == data)); } @JsonKey(ignore: true) @override - int get hashCode => - Object.hash(runtimeType, const DeepCollectionEquality().hash(_values)); + int get hashCode => Object.hash(runtimeType, mimeType, data); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$ContentEmbeddingImplCopyWith<_$ContentEmbeddingImpl> get copyWith => - __$$ContentEmbeddingImplCopyWithImpl<_$ContentEmbeddingImpl>( - this, _$identity); + _$$BlobImplCopyWith<_$BlobImpl> get copyWith => + __$$BlobImplCopyWithImpl<_$BlobImpl>(this, _$identity); @override Map toJson() { - return _$$ContentEmbeddingImplToJson( + return _$$BlobImplToJson( this, ); } } -abstract class _ContentEmbedding extends ContentEmbedding { - const factory _ContentEmbedding( - {@JsonKey(includeIfNull: false) final List? values}) = - _$ContentEmbeddingImpl; - const _ContentEmbedding._() : super._(); +abstract class _Blob extends Blob { + const factory _Blob( + {@JsonKey(includeIfNull: false) final String? mimeType, + @JsonKey(includeIfNull: false) final String? data}) = _$BlobImpl; + const _Blob._() : super._(); - factory _ContentEmbedding.fromJson(Map json) = - _$ContentEmbeddingImpl.fromJson; + factory _Blob.fromJson(Map json) = _$BlobImpl.fromJson; @override - /// The embedding values. + /// The IANA standard MIME type of the source data. Accepted types include: "image/png", "image/jpeg", "image/heic", "image/heif", "image/webp". @JsonKey(includeIfNull: false) - List? get values; + String? get mimeType; + @override + + /// Raw bytes for media formats. + @JsonKey(includeIfNull: false) + String? get data; @override @JsonKey(ignore: true) - _$$ContentEmbeddingImplCopyWith<_$ContentEmbeddingImpl> get copyWith => + _$$BlobImplCopyWith<_$BlobImpl> get copyWith => throw _privateConstructorUsedError; } -PromptFeedback _$PromptFeedbackFromJson(Map json) { - return _PromptFeedback.fromJson(json); +ListModelsResponse _$ListModelsResponseFromJson(Map json) { + return _ListModelsResponse.fromJson(json); } /// @nodoc -mixin _$PromptFeedback { - /// Ratings for safety of the prompt. There is at most one rating per category. +mixin _$ListModelsResponse { + /// The returned Models. @JsonKey(includeIfNull: false) - List? get safetyRatings => throw _privateConstructorUsedError; + List? get models => throw _privateConstructorUsedError; - /// Optional. If set, the prompt was blocked and no candidates are returned. Rephrase your prompt. - @JsonKey( - includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue) - PromptFeedbackBlockReason? get blockReason => - throw _privateConstructorUsedError; + /// A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no more pages. + @JsonKey(includeIfNull: false) + String? get nextPageToken => throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) - $PromptFeedbackCopyWith get copyWith => + $ListModelsResponseCopyWith get copyWith => throw _privateConstructorUsedError; } /// @nodoc -abstract class $PromptFeedbackCopyWith<$Res> { - factory $PromptFeedbackCopyWith( - PromptFeedback value, $Res Function(PromptFeedback) then) = - _$PromptFeedbackCopyWithImpl<$Res, PromptFeedback>; +abstract class $ListModelsResponseCopyWith<$Res> { + factory $ListModelsResponseCopyWith( + ListModelsResponse value, $Res Function(ListModelsResponse) then) = + _$ListModelsResponseCopyWithImpl<$Res, ListModelsResponse>; @useResult $Res call( - {@JsonKey(includeIfNull: false) List? safetyRatings, - @JsonKey( - includeIfNull: false, - unknownEnumValue: JsonKey.nullForUndefinedEnumValue) - PromptFeedbackBlockReason? blockReason}); + {@JsonKey(includeIfNull: false) List? models, + @JsonKey(includeIfNull: false) String? nextPageToken}); } /// @nodoc -class _$PromptFeedbackCopyWithImpl<$Res, $Val extends PromptFeedback> - implements $PromptFeedbackCopyWith<$Res> { - _$PromptFeedbackCopyWithImpl(this._value, this._then); +class _$ListModelsResponseCopyWithImpl<$Res, $Val extends ListModelsResponse> + implements $ListModelsResponseCopyWith<$Res> { + _$ListModelsResponseCopyWithImpl(this._value, this._then); // ignore: unused_field final $Val _value; @@ -3585,216 +3514,183 @@ class _$PromptFeedbackCopyWithImpl<$Res, $Val extends PromptFeedback> @pragma('vm:prefer-inline') @override $Res call({ - Object? safetyRatings = freezed, - Object? blockReason = freezed, + Object? models = freezed, + Object? nextPageToken = freezed, }) { return _then(_value.copyWith( - safetyRatings: freezed == safetyRatings - ? _value.safetyRatings - : safetyRatings // ignore: cast_nullable_to_non_nullable - as List?, - blockReason: freezed == blockReason - ? _value.blockReason - : blockReason // ignore: cast_nullable_to_non_nullable - as PromptFeedbackBlockReason?, + models: freezed == models + ? _value.models + : models // ignore: cast_nullable_to_non_nullable + as List?, + nextPageToken: freezed == nextPageToken + ? _value.nextPageToken + : nextPageToken // ignore: cast_nullable_to_non_nullable + as String?, ) as $Val); } } /// @nodoc -abstract class _$$PromptFeedbackImplCopyWith<$Res> - implements $PromptFeedbackCopyWith<$Res> { - factory _$$PromptFeedbackImplCopyWith(_$PromptFeedbackImpl value, - $Res Function(_$PromptFeedbackImpl) then) = - __$$PromptFeedbackImplCopyWithImpl<$Res>; +abstract class _$$ListModelsResponseImplCopyWith<$Res> + implements $ListModelsResponseCopyWith<$Res> { + factory _$$ListModelsResponseImplCopyWith(_$ListModelsResponseImpl value, + $Res Function(_$ListModelsResponseImpl) then) = + __$$ListModelsResponseImplCopyWithImpl<$Res>; @override @useResult $Res call( - {@JsonKey(includeIfNull: false) List? safetyRatings, - @JsonKey( - includeIfNull: false, - unknownEnumValue: JsonKey.nullForUndefinedEnumValue) - PromptFeedbackBlockReason? blockReason}); + {@JsonKey(includeIfNull: false) List? models, + @JsonKey(includeIfNull: false) String? nextPageToken}); } /// @nodoc -class __$$PromptFeedbackImplCopyWithImpl<$Res> - extends _$PromptFeedbackCopyWithImpl<$Res, _$PromptFeedbackImpl> - implements _$$PromptFeedbackImplCopyWith<$Res> { - __$$PromptFeedbackImplCopyWithImpl( - _$PromptFeedbackImpl _value, $Res Function(_$PromptFeedbackImpl) _then) +class __$$ListModelsResponseImplCopyWithImpl<$Res> + extends _$ListModelsResponseCopyWithImpl<$Res, _$ListModelsResponseImpl> + implements _$$ListModelsResponseImplCopyWith<$Res> { + __$$ListModelsResponseImplCopyWithImpl(_$ListModelsResponseImpl _value, + $Res Function(_$ListModelsResponseImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @override $Res call({ - Object? safetyRatings = freezed, - Object? blockReason = freezed, + Object? models = freezed, + Object? nextPageToken = freezed, }) { - return _then(_$PromptFeedbackImpl( - safetyRatings: freezed == safetyRatings - ? _value._safetyRatings - : safetyRatings // ignore: cast_nullable_to_non_nullable - as List?, - blockReason: freezed == blockReason - ? _value.blockReason - : blockReason // ignore: cast_nullable_to_non_nullable - as PromptFeedbackBlockReason?, + return _then(_$ListModelsResponseImpl( + models: freezed == models + ? _value._models + : models // ignore: cast_nullable_to_non_nullable + as List?, + nextPageToken: freezed == nextPageToken + ? _value.nextPageToken + : nextPageToken // ignore: cast_nullable_to_non_nullable + as String?, )); } } /// @nodoc @JsonSerializable() -class _$PromptFeedbackImpl extends _PromptFeedback { - const _$PromptFeedbackImpl( - {@JsonKey(includeIfNull: false) final List? safetyRatings, - @JsonKey( - includeIfNull: false, - unknownEnumValue: JsonKey.nullForUndefinedEnumValue) - this.blockReason}) - : _safetyRatings = safetyRatings, +class _$ListModelsResponseImpl extends _ListModelsResponse { + const _$ListModelsResponseImpl( + {@JsonKey(includeIfNull: false) final List? models, + @JsonKey(includeIfNull: false) this.nextPageToken}) + : _models = models, super._(); - factory _$PromptFeedbackImpl.fromJson(Map json) => - _$$PromptFeedbackImplFromJson(json); + factory _$ListModelsResponseImpl.fromJson(Map json) => + _$$ListModelsResponseImplFromJson(json); - /// Ratings for safety of the prompt. There is at most one rating per category. - final List? _safetyRatings; + /// The returned Models. + final List? _models; - /// Ratings for safety of the prompt. There is at most one rating per category. + /// The returned Models. @override @JsonKey(includeIfNull: false) - List? get safetyRatings { - final value = _safetyRatings; + List? get models { + final value = _models; if (value == null) return null; - if (_safetyRatings is EqualUnmodifiableListView) return _safetyRatings; + if (_models is EqualUnmodifiableListView) return _models; // ignore: implicit_dynamic_type return EqualUnmodifiableListView(value); } - /// Optional. If set, the prompt was blocked and no candidates are returned. Rephrase your prompt. + /// A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no more pages. @override - @JsonKey( - includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue) - final PromptFeedbackBlockReason? blockReason; + @JsonKey(includeIfNull: false) + final String? nextPageToken; @override String toString() { - return 'PromptFeedback(safetyRatings: $safetyRatings, blockReason: $blockReason)'; + return 'ListModelsResponse(models: $models, nextPageToken: $nextPageToken)'; } @override bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$PromptFeedbackImpl && - const DeepCollectionEquality() - .equals(other._safetyRatings, _safetyRatings) && - (identical(other.blockReason, blockReason) || - other.blockReason == blockReason)); + other is _$ListModelsResponseImpl && + const DeepCollectionEquality().equals(other._models, _models) && + (identical(other.nextPageToken, nextPageToken) || + other.nextPageToken == nextPageToken)); } @JsonKey(ignore: true) @override - int get hashCode => Object.hash(runtimeType, - const DeepCollectionEquality().hash(_safetyRatings), blockReason); + int get hashCode => Object.hash( + runtimeType, const DeepCollectionEquality().hash(_models), nextPageToken); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$PromptFeedbackImplCopyWith<_$PromptFeedbackImpl> get copyWith => - __$$PromptFeedbackImplCopyWithImpl<_$PromptFeedbackImpl>( + _$$ListModelsResponseImplCopyWith<_$ListModelsResponseImpl> get copyWith => + __$$ListModelsResponseImplCopyWithImpl<_$ListModelsResponseImpl>( this, _$identity); @override Map toJson() { - return _$$PromptFeedbackImplToJson( + return _$$ListModelsResponseImplToJson( this, ); } } -abstract class _PromptFeedback extends PromptFeedback { - const factory _PromptFeedback( - {@JsonKey(includeIfNull: false) final List? safetyRatings, - @JsonKey( - includeIfNull: false, - unknownEnumValue: JsonKey.nullForUndefinedEnumValue) - final PromptFeedbackBlockReason? blockReason}) = _$PromptFeedbackImpl; - const _PromptFeedback._() : super._(); +abstract class _ListModelsResponse extends ListModelsResponse { + const factory _ListModelsResponse( + {@JsonKey(includeIfNull: false) final List? models, + @JsonKey(includeIfNull: false) final String? nextPageToken}) = + _$ListModelsResponseImpl; + const _ListModelsResponse._() : super._(); - factory _PromptFeedback.fromJson(Map json) = - _$PromptFeedbackImpl.fromJson; + factory _ListModelsResponse.fromJson(Map json) = + _$ListModelsResponseImpl.fromJson; @override - /// Ratings for safety of the prompt. There is at most one rating per category. + /// The returned Models. @JsonKey(includeIfNull: false) - List? get safetyRatings; + List? get models; @override - /// Optional. If set, the prompt was blocked and no candidates are returned. Rephrase your prompt. - @JsonKey( - includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue) - PromptFeedbackBlockReason? get blockReason; + /// A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no more pages. + @JsonKey(includeIfNull: false) + String? get nextPageToken; @override @JsonKey(ignore: true) - _$$PromptFeedbackImplCopyWith<_$PromptFeedbackImpl> get copyWith => + _$$ListModelsResponseImplCopyWith<_$ListModelsResponseImpl> get copyWith => throw _privateConstructorUsedError; } -Operation _$OperationFromJson(Map json) { - return _Operation.fromJson(json); +ContentEmbedding _$ContentEmbeddingFromJson(Map json) { + return _ContentEmbedding.fromJson(json); } /// @nodoc -mixin _$Operation { - /// The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should be a resource name ending with `operations/{unique_id}`. - @JsonKey(includeIfNull: false) - String? get name => throw _privateConstructorUsedError; - - /// The normal, successful response of the operation. If the original method returns no data on success, such as `Delete`, the response is `google.protobuf.Empty`. If the original method is standard `Get`/`Create`/`Update`, the response should be the resource. For other methods, the response should have the type `XxxResponse`, where `Xxx` is the original method name. For example, if the original method name is `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`. - @JsonKey(includeIfNull: false) - Map? get response => throw _privateConstructorUsedError; - - /// If the value is `false`, it means the operation is still in progress. If `true`, the operation is completed, and either `error` or `response` is available. - @JsonKey(includeIfNull: false) - bool? get done => throw _privateConstructorUsedError; - - /// Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any. - @JsonKey(includeIfNull: false) - Map? get metadata => throw _privateConstructorUsedError; - - /// The error result of the operation in case of failure or cancellation. +mixin _$ContentEmbedding { + /// The embedding values. @JsonKey(includeIfNull: false) - Status? get error => throw _privateConstructorUsedError; + List? get values => throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) - $OperationCopyWith get copyWith => + $ContentEmbeddingCopyWith get copyWith => throw _privateConstructorUsedError; } /// @nodoc -abstract class $OperationCopyWith<$Res> { - factory $OperationCopyWith(Operation value, $Res Function(Operation) then) = - _$OperationCopyWithImpl<$Res, Operation>; +abstract class $ContentEmbeddingCopyWith<$Res> { + factory $ContentEmbeddingCopyWith( + ContentEmbedding value, $Res Function(ContentEmbedding) then) = + _$ContentEmbeddingCopyWithImpl<$Res, ContentEmbedding>; @useResult - $Res call( - {@JsonKey(includeIfNull: false) String? name, - @JsonKey(includeIfNull: false) Map? response, - @JsonKey(includeIfNull: false) bool? done, - @JsonKey(includeIfNull: false) Map? metadata, - @JsonKey(includeIfNull: false) Status? error}); - - $StatusCopyWith<$Res>? get error; + $Res call({@JsonKey(includeIfNull: false) List? values}); } /// @nodoc -class _$OperationCopyWithImpl<$Res, $Val extends Operation> - implements $OperationCopyWith<$Res> { - _$OperationCopyWithImpl(this._value, this._then); +class _$ContentEmbeddingCopyWithImpl<$Res, $Val extends ContentEmbedding> + implements $ContentEmbeddingCopyWith<$Res> { + _$ContentEmbeddingCopyWithImpl(this._value, this._then); // ignore: unused_field final $Val _value; @@ -3804,292 +3700,168 @@ class _$OperationCopyWithImpl<$Res, $Val extends Operation> @pragma('vm:prefer-inline') @override $Res call({ - Object? name = freezed, - Object? response = freezed, - Object? done = freezed, - Object? metadata = freezed, - Object? error = freezed, + Object? values = freezed, }) { return _then(_value.copyWith( - name: freezed == name - ? _value.name - : name // ignore: cast_nullable_to_non_nullable - as String?, - response: freezed == response - ? _value.response - : response // ignore: cast_nullable_to_non_nullable - as Map?, - done: freezed == done - ? _value.done - : done // ignore: cast_nullable_to_non_nullable - as bool?, - metadata: freezed == metadata - ? _value.metadata - : metadata // ignore: cast_nullable_to_non_nullable - as Map?, - error: freezed == error - ? _value.error - : error // ignore: cast_nullable_to_non_nullable - as Status?, + values: freezed == values + ? _value.values + : values // ignore: cast_nullable_to_non_nullable + as List?, ) as $Val); } - - @override - @pragma('vm:prefer-inline') - $StatusCopyWith<$Res>? get error { - if (_value.error == null) { - return null; - } - - return $StatusCopyWith<$Res>(_value.error!, (value) { - return _then(_value.copyWith(error: value) as $Val); - }); - } } /// @nodoc -abstract class _$$OperationImplCopyWith<$Res> - implements $OperationCopyWith<$Res> { - factory _$$OperationImplCopyWith( - _$OperationImpl value, $Res Function(_$OperationImpl) then) = - __$$OperationImplCopyWithImpl<$Res>; +abstract class _$$ContentEmbeddingImplCopyWith<$Res> + implements $ContentEmbeddingCopyWith<$Res> { + factory _$$ContentEmbeddingImplCopyWith(_$ContentEmbeddingImpl value, + $Res Function(_$ContentEmbeddingImpl) then) = + __$$ContentEmbeddingImplCopyWithImpl<$Res>; @override @useResult - $Res call( - {@JsonKey(includeIfNull: false) String? name, - @JsonKey(includeIfNull: false) Map? response, - @JsonKey(includeIfNull: false) bool? done, - @JsonKey(includeIfNull: false) Map? metadata, - @JsonKey(includeIfNull: false) Status? error}); - - @override - $StatusCopyWith<$Res>? get error; + $Res call({@JsonKey(includeIfNull: false) List? values}); } /// @nodoc -class __$$OperationImplCopyWithImpl<$Res> - extends _$OperationCopyWithImpl<$Res, _$OperationImpl> - implements _$$OperationImplCopyWith<$Res> { - __$$OperationImplCopyWithImpl( - _$OperationImpl _value, $Res Function(_$OperationImpl) _then) - : super(_value, _then); - - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? name = freezed, - Object? response = freezed, - Object? done = freezed, - Object? metadata = freezed, - Object? error = freezed, - }) { - return _then(_$OperationImpl( - name: freezed == name - ? _value.name - : name // ignore: cast_nullable_to_non_nullable - as String?, - response: freezed == response - ? _value._response - : response // ignore: cast_nullable_to_non_nullable - as Map?, - done: freezed == done - ? _value.done - : done // ignore: cast_nullable_to_non_nullable - as bool?, - metadata: freezed == metadata - ? _value._metadata - : metadata // ignore: cast_nullable_to_non_nullable - as Map?, - error: freezed == error - ? _value.error - : error // ignore: cast_nullable_to_non_nullable - as Status?, +class __$$ContentEmbeddingImplCopyWithImpl<$Res> + extends _$ContentEmbeddingCopyWithImpl<$Res, _$ContentEmbeddingImpl> + implements _$$ContentEmbeddingImplCopyWith<$Res> { + __$$ContentEmbeddingImplCopyWithImpl(_$ContentEmbeddingImpl _value, + $Res Function(_$ContentEmbeddingImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? values = freezed, + }) { + return _then(_$ContentEmbeddingImpl( + values: freezed == values + ? _value._values + : values // ignore: cast_nullable_to_non_nullable + as List?, )); } } /// @nodoc @JsonSerializable() -class _$OperationImpl extends _Operation { - const _$OperationImpl( - {@JsonKey(includeIfNull: false) this.name, - @JsonKey(includeIfNull: false) final Map? response, - @JsonKey(includeIfNull: false) this.done, - @JsonKey(includeIfNull: false) final Map? metadata, - @JsonKey(includeIfNull: false) this.error}) - : _response = response, - _metadata = metadata, +class _$ContentEmbeddingImpl extends _ContentEmbedding { + const _$ContentEmbeddingImpl( + {@JsonKey(includeIfNull: false) final List? values}) + : _values = values, super._(); - factory _$OperationImpl.fromJson(Map json) => - _$$OperationImplFromJson(json); - - /// The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should be a resource name ending with `operations/{unique_id}`. - @override - @JsonKey(includeIfNull: false) - final String? name; - - /// The normal, successful response of the operation. If the original method returns no data on success, such as `Delete`, the response is `google.protobuf.Empty`. If the original method is standard `Get`/`Create`/`Update`, the response should be the resource. For other methods, the response should have the type `XxxResponse`, where `Xxx` is the original method name. For example, if the original method name is `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`. - final Map? _response; - - /// The normal, successful response of the operation. If the original method returns no data on success, such as `Delete`, the response is `google.protobuf.Empty`. If the original method is standard `Get`/`Create`/`Update`, the response should be the resource. For other methods, the response should have the type `XxxResponse`, where `Xxx` is the original method name. For example, if the original method name is `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`. - @override - @JsonKey(includeIfNull: false) - Map? get response { - final value = _response; - if (value == null) return null; - if (_response is EqualUnmodifiableMapView) return _response; - // ignore: implicit_dynamic_type - return EqualUnmodifiableMapView(value); - } - - /// If the value is `false`, it means the operation is still in progress. If `true`, the operation is completed, and either `error` or `response` is available. - @override - @JsonKey(includeIfNull: false) - final bool? done; + factory _$ContentEmbeddingImpl.fromJson(Map json) => + _$$ContentEmbeddingImplFromJson(json); - /// Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any. - final Map? _metadata; + /// The embedding values. + final List? _values; - /// Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any. + /// The embedding values. @override @JsonKey(includeIfNull: false) - Map? get metadata { - final value = _metadata; + List? get values { + final value = _values; if (value == null) return null; - if (_metadata is EqualUnmodifiableMapView) return _metadata; + if (_values is EqualUnmodifiableListView) return _values; // ignore: implicit_dynamic_type - return EqualUnmodifiableMapView(value); + return EqualUnmodifiableListView(value); } - /// The error result of the operation in case of failure or cancellation. - @override - @JsonKey(includeIfNull: false) - final Status? error; - @override String toString() { - return 'Operation(name: $name, response: $response, done: $done, metadata: $metadata, error: $error)'; + return 'ContentEmbedding(values: $values)'; } @override bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$OperationImpl && - (identical(other.name, name) || other.name == name) && - const DeepCollectionEquality().equals(other._response, _response) && - (identical(other.done, done) || other.done == done) && - const DeepCollectionEquality().equals(other._metadata, _metadata) && - (identical(other.error, error) || other.error == error)); + other is _$ContentEmbeddingImpl && + const DeepCollectionEquality().equals(other._values, _values)); } @JsonKey(ignore: true) @override - int get hashCode => Object.hash( - runtimeType, - name, - const DeepCollectionEquality().hash(_response), - done, - const DeepCollectionEquality().hash(_metadata), - error); + int get hashCode => + Object.hash(runtimeType, const DeepCollectionEquality().hash(_values)); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$OperationImplCopyWith<_$OperationImpl> get copyWith => - __$$OperationImplCopyWithImpl<_$OperationImpl>(this, _$identity); + _$$ContentEmbeddingImplCopyWith<_$ContentEmbeddingImpl> get copyWith => + __$$ContentEmbeddingImplCopyWithImpl<_$ContentEmbeddingImpl>( + this, _$identity); @override Map toJson() { - return _$$OperationImplToJson( + return _$$ContentEmbeddingImplToJson( this, ); } } -abstract class _Operation extends Operation { - const factory _Operation( - {@JsonKey(includeIfNull: false) final String? name, - @JsonKey(includeIfNull: false) final Map? response, - @JsonKey(includeIfNull: false) final bool? done, - @JsonKey(includeIfNull: false) final Map? metadata, - @JsonKey(includeIfNull: false) final Status? error}) = _$OperationImpl; - const _Operation._() : super._(); - - factory _Operation.fromJson(Map json) = - _$OperationImpl.fromJson; - - @override - - /// The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should be a resource name ending with `operations/{unique_id}`. - @JsonKey(includeIfNull: false) - String? get name; - @override - - /// The normal, successful response of the operation. If the original method returns no data on success, such as `Delete`, the response is `google.protobuf.Empty`. If the original method is standard `Get`/`Create`/`Update`, the response should be the resource. For other methods, the response should have the type `XxxResponse`, where `Xxx` is the original method name. For example, if the original method name is `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`. - @JsonKey(includeIfNull: false) - Map? get response; - @override +abstract class _ContentEmbedding extends ContentEmbedding { + const factory _ContentEmbedding( + {@JsonKey(includeIfNull: false) final List? values}) = + _$ContentEmbeddingImpl; + const _ContentEmbedding._() : super._(); - /// If the value is `false`, it means the operation is still in progress. If `true`, the operation is completed, and either `error` or `response` is available. - @JsonKey(includeIfNull: false) - bool? get done; - @override + factory _ContentEmbedding.fromJson(Map json) = + _$ContentEmbeddingImpl.fromJson; - /// Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any. - @JsonKey(includeIfNull: false) - Map? get metadata; @override - /// The error result of the operation in case of failure or cancellation. + /// The embedding values. @JsonKey(includeIfNull: false) - Status? get error; + List? get values; @override @JsonKey(ignore: true) - _$$OperationImplCopyWith<_$OperationImpl> get copyWith => + _$$ContentEmbeddingImplCopyWith<_$ContentEmbeddingImpl> get copyWith => throw _privateConstructorUsedError; } -GenerateContentResponse _$GenerateContentResponseFromJson( - Map json) { - return _GenerateContentResponse.fromJson(json); +PromptFeedback _$PromptFeedbackFromJson(Map json) { + return _PromptFeedback.fromJson(json); } /// @nodoc -mixin _$GenerateContentResponse { - /// Returns the prompt's feedback related to the content filters. +mixin _$PromptFeedback { + /// Ratings for safety of the prompt. There is at most one rating per category. @JsonKey(includeIfNull: false) - PromptFeedback? get promptFeedback => throw _privateConstructorUsedError; + List? get safetyRatings => throw _privateConstructorUsedError; - /// Candidate responses from the model. - @JsonKey(includeIfNull: false) - List? get candidates => throw _privateConstructorUsedError; + /// Optional. If set, the prompt was blocked and no candidates are returned. Rephrase your prompt. + @JsonKey( + includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + PromptFeedbackBlockReason? get blockReason => + throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) - $GenerateContentResponseCopyWith get copyWith => + $PromptFeedbackCopyWith get copyWith => throw _privateConstructorUsedError; } /// @nodoc -abstract class $GenerateContentResponseCopyWith<$Res> { - factory $GenerateContentResponseCopyWith(GenerateContentResponse value, - $Res Function(GenerateContentResponse) then) = - _$GenerateContentResponseCopyWithImpl<$Res, GenerateContentResponse>; +abstract class $PromptFeedbackCopyWith<$Res> { + factory $PromptFeedbackCopyWith( + PromptFeedback value, $Res Function(PromptFeedback) then) = + _$PromptFeedbackCopyWithImpl<$Res, PromptFeedback>; @useResult $Res call( - {@JsonKey(includeIfNull: false) PromptFeedback? promptFeedback, - @JsonKey(includeIfNull: false) List? candidates}); - - $PromptFeedbackCopyWith<$Res>? get promptFeedback; + {@JsonKey(includeIfNull: false) List? safetyRatings, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + PromptFeedbackBlockReason? blockReason}); } /// @nodoc -class _$GenerateContentResponseCopyWithImpl<$Res, - $Val extends GenerateContentResponse> - implements $GenerateContentResponseCopyWith<$Res> { - _$GenerateContentResponseCopyWithImpl(this._value, this._then); +class _$PromptFeedbackCopyWithImpl<$Res, $Val extends PromptFeedback> + implements $PromptFeedbackCopyWith<$Res> { + _$PromptFeedbackCopyWithImpl(this._value, this._then); // ignore: unused_field final $Val _value; @@ -4099,216 +3871,217 @@ class _$GenerateContentResponseCopyWithImpl<$Res, @pragma('vm:prefer-inline') @override $Res call({ - Object? promptFeedback = freezed, - Object? candidates = freezed, + Object? safetyRatings = freezed, + Object? blockReason = freezed, }) { return _then(_value.copyWith( - promptFeedback: freezed == promptFeedback - ? _value.promptFeedback - : promptFeedback // ignore: cast_nullable_to_non_nullable - as PromptFeedback?, - candidates: freezed == candidates - ? _value.candidates - : candidates // ignore: cast_nullable_to_non_nullable - as List?, + safetyRatings: freezed == safetyRatings + ? _value.safetyRatings + : safetyRatings // ignore: cast_nullable_to_non_nullable + as List?, + blockReason: freezed == blockReason + ? _value.blockReason + : blockReason // ignore: cast_nullable_to_non_nullable + as PromptFeedbackBlockReason?, ) as $Val); } - - @override - @pragma('vm:prefer-inline') - $PromptFeedbackCopyWith<$Res>? get promptFeedback { - if (_value.promptFeedback == null) { - return null; - } - - return $PromptFeedbackCopyWith<$Res>(_value.promptFeedback!, (value) { - return _then(_value.copyWith(promptFeedback: value) as $Val); - }); - } } /// @nodoc -abstract class _$$GenerateContentResponseImplCopyWith<$Res> - implements $GenerateContentResponseCopyWith<$Res> { - factory _$$GenerateContentResponseImplCopyWith( - _$GenerateContentResponseImpl value, - $Res Function(_$GenerateContentResponseImpl) then) = - __$$GenerateContentResponseImplCopyWithImpl<$Res>; +abstract class _$$PromptFeedbackImplCopyWith<$Res> + implements $PromptFeedbackCopyWith<$Res> { + factory _$$PromptFeedbackImplCopyWith(_$PromptFeedbackImpl value, + $Res Function(_$PromptFeedbackImpl) then) = + __$$PromptFeedbackImplCopyWithImpl<$Res>; @override @useResult $Res call( - {@JsonKey(includeIfNull: false) PromptFeedback? promptFeedback, - @JsonKey(includeIfNull: false) List? candidates}); - - @override - $PromptFeedbackCopyWith<$Res>? get promptFeedback; + {@JsonKey(includeIfNull: false) List? safetyRatings, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + PromptFeedbackBlockReason? blockReason}); } /// @nodoc -class __$$GenerateContentResponseImplCopyWithImpl<$Res> - extends _$GenerateContentResponseCopyWithImpl<$Res, - _$GenerateContentResponseImpl> - implements _$$GenerateContentResponseImplCopyWith<$Res> { - __$$GenerateContentResponseImplCopyWithImpl( - _$GenerateContentResponseImpl _value, - $Res Function(_$GenerateContentResponseImpl) _then) +class __$$PromptFeedbackImplCopyWithImpl<$Res> + extends _$PromptFeedbackCopyWithImpl<$Res, _$PromptFeedbackImpl> + implements _$$PromptFeedbackImplCopyWith<$Res> { + __$$PromptFeedbackImplCopyWithImpl( + _$PromptFeedbackImpl _value, $Res Function(_$PromptFeedbackImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @override $Res call({ - Object? promptFeedback = freezed, - Object? candidates = freezed, + Object? safetyRatings = freezed, + Object? blockReason = freezed, }) { - return _then(_$GenerateContentResponseImpl( - promptFeedback: freezed == promptFeedback - ? _value.promptFeedback - : promptFeedback // ignore: cast_nullable_to_non_nullable - as PromptFeedback?, - candidates: freezed == candidates - ? _value._candidates - : candidates // ignore: cast_nullable_to_non_nullable - as List?, + return _then(_$PromptFeedbackImpl( + safetyRatings: freezed == safetyRatings + ? _value._safetyRatings + : safetyRatings // ignore: cast_nullable_to_non_nullable + as List?, + blockReason: freezed == blockReason + ? _value.blockReason + : blockReason // ignore: cast_nullable_to_non_nullable + as PromptFeedbackBlockReason?, )); } } /// @nodoc @JsonSerializable() -class _$GenerateContentResponseImpl extends _GenerateContentResponse { - const _$GenerateContentResponseImpl( - {@JsonKey(includeIfNull: false) this.promptFeedback, - @JsonKey(includeIfNull: false) final List? candidates}) - : _candidates = candidates, +class _$PromptFeedbackImpl extends _PromptFeedback { + const _$PromptFeedbackImpl( + {@JsonKey(includeIfNull: false) final List? safetyRatings, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + this.blockReason}) + : _safetyRatings = safetyRatings, super._(); - factory _$GenerateContentResponseImpl.fromJson(Map json) => - _$$GenerateContentResponseImplFromJson(json); - - /// Returns the prompt's feedback related to the content filters. - @override - @JsonKey(includeIfNull: false) - final PromptFeedback? promptFeedback; + factory _$PromptFeedbackImpl.fromJson(Map json) => + _$$PromptFeedbackImplFromJson(json); - /// Candidate responses from the model. - final List? _candidates; + /// Ratings for safety of the prompt. There is at most one rating per category. + final List? _safetyRatings; - /// Candidate responses from the model. + /// Ratings for safety of the prompt. There is at most one rating per category. @override @JsonKey(includeIfNull: false) - List? get candidates { - final value = _candidates; + List? get safetyRatings { + final value = _safetyRatings; if (value == null) return null; - if (_candidates is EqualUnmodifiableListView) return _candidates; + if (_safetyRatings is EqualUnmodifiableListView) return _safetyRatings; // ignore: implicit_dynamic_type return EqualUnmodifiableListView(value); } + /// Optional. If set, the prompt was blocked and no candidates are returned. Rephrase your prompt. + @override + @JsonKey( + includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + final PromptFeedbackBlockReason? blockReason; + @override String toString() { - return 'GenerateContentResponse(promptFeedback: $promptFeedback, candidates: $candidates)'; + return 'PromptFeedback(safetyRatings: $safetyRatings, blockReason: $blockReason)'; } @override bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$GenerateContentResponseImpl && - (identical(other.promptFeedback, promptFeedback) || - other.promptFeedback == promptFeedback) && + other is _$PromptFeedbackImpl && const DeepCollectionEquality() - .equals(other._candidates, _candidates)); + .equals(other._safetyRatings, _safetyRatings) && + (identical(other.blockReason, blockReason) || + other.blockReason == blockReason)); } @JsonKey(ignore: true) @override - int get hashCode => Object.hash(runtimeType, promptFeedback, - const DeepCollectionEquality().hash(_candidates)); + int get hashCode => Object.hash(runtimeType, + const DeepCollectionEquality().hash(_safetyRatings), blockReason); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$GenerateContentResponseImplCopyWith<_$GenerateContentResponseImpl> - get copyWith => __$$GenerateContentResponseImplCopyWithImpl< - _$GenerateContentResponseImpl>(this, _$identity); + _$$PromptFeedbackImplCopyWith<_$PromptFeedbackImpl> get copyWith => + __$$PromptFeedbackImplCopyWithImpl<_$PromptFeedbackImpl>( + this, _$identity); @override Map toJson() { - return _$$GenerateContentResponseImplToJson( + return _$$PromptFeedbackImplToJson( this, ); } } -abstract class _GenerateContentResponse extends GenerateContentResponse { - const factory _GenerateContentResponse( - {@JsonKey(includeIfNull: false) final PromptFeedback? promptFeedback, - @JsonKey(includeIfNull: false) final List? candidates}) = - _$GenerateContentResponseImpl; - const _GenerateContentResponse._() : super._(); +abstract class _PromptFeedback extends PromptFeedback { + const factory _PromptFeedback( + {@JsonKey(includeIfNull: false) final List? safetyRatings, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + final PromptFeedbackBlockReason? blockReason}) = _$PromptFeedbackImpl; + const _PromptFeedback._() : super._(); - factory _GenerateContentResponse.fromJson(Map json) = - _$GenerateContentResponseImpl.fromJson; + factory _PromptFeedback.fromJson(Map json) = + _$PromptFeedbackImpl.fromJson; @override - /// Returns the prompt's feedback related to the content filters. + /// Ratings for safety of the prompt. There is at most one rating per category. @JsonKey(includeIfNull: false) - PromptFeedback? get promptFeedback; + List? get safetyRatings; @override - /// Candidate responses from the model. - @JsonKey(includeIfNull: false) - List? get candidates; + /// Optional. If set, the prompt was blocked and no candidates are returned. Rephrase your prompt. + @JsonKey( + includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + PromptFeedbackBlockReason? get blockReason; @override @JsonKey(ignore: true) - _$$GenerateContentResponseImplCopyWith<_$GenerateContentResponseImpl> - get copyWith => throw _privateConstructorUsedError; + _$$PromptFeedbackImplCopyWith<_$PromptFeedbackImpl> get copyWith => + throw _privateConstructorUsedError; } -SafetySetting _$SafetySettingFromJson(Map json) { - return _SafetySetting.fromJson(json); +EmbedContentRequest _$EmbedContentRequestFromJson(Map json) { + return _EmbedContentRequest.fromJson(json); } /// @nodoc -mixin _$SafetySetting { - /// Required. The category for this setting. - @JsonKey( - includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue) - SafetySettingCategory? get category => throw _privateConstructorUsedError; +mixin _$EmbedContentRequest { + /// Optional. An optional title for the text. Only applicable when TaskType is `RETRIEVAL_DOCUMENT`. Note: Specifying a `title` for `RETRIEVAL_DOCUMENT` provides better quality embeddings for retrieval. + @JsonKey(includeIfNull: false) + String? get title => throw _privateConstructorUsedError; - /// Required. Controls the probability threshold at which harm is blocked. + /// Required. The content to embed. Only the `parts.text` fields will be counted. + @JsonKey(includeIfNull: false) + Content? get content => throw _privateConstructorUsedError; + + /// Optional. Optional task type for which the embeddings will be used. Can only be set for `models/embedding-001`. @JsonKey( includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue) - SafetySettingThreshold? get threshold => throw _privateConstructorUsedError; + EmbedContentRequestTaskType? get taskType => + throw _privateConstructorUsedError; + + /// Required. The model's resource name. This serves as an ID for the Model to use. This name should match a model name returned by the `ListModels` method. Format: `models/{model}` + @JsonKey(includeIfNull: false) + String? get model => throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) - $SafetySettingCopyWith get copyWith => + $EmbedContentRequestCopyWith get copyWith => throw _privateConstructorUsedError; } /// @nodoc -abstract class $SafetySettingCopyWith<$Res> { - factory $SafetySettingCopyWith( - SafetySetting value, $Res Function(SafetySetting) then) = - _$SafetySettingCopyWithImpl<$Res, SafetySetting>; +abstract class $EmbedContentRequestCopyWith<$Res> { + factory $EmbedContentRequestCopyWith( + EmbedContentRequest value, $Res Function(EmbedContentRequest) then) = + _$EmbedContentRequestCopyWithImpl<$Res, EmbedContentRequest>; @useResult $Res call( - {@JsonKey( - includeIfNull: false, - unknownEnumValue: JsonKey.nullForUndefinedEnumValue) - SafetySettingCategory? category, + {@JsonKey(includeIfNull: false) String? title, + @JsonKey(includeIfNull: false) Content? content, @JsonKey( includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue) - SafetySettingThreshold? threshold}); + EmbedContentRequestTaskType? taskType, + @JsonKey(includeIfNull: false) String? model}); + + $ContentCopyWith<$Res>? get content; } /// @nodoc -class _$SafetySettingCopyWithImpl<$Res, $Val extends SafetySetting> - implements $SafetySettingCopyWith<$Res> { - _$SafetySettingCopyWithImpl(this._value, this._then); +class _$EmbedContentRequestCopyWithImpl<$Res, $Val extends EmbedContentRequest> + implements $EmbedContentRequestCopyWith<$Res> { + _$EmbedContentRequestCopyWithImpl(this._value, this._then); // ignore: unused_field final $Val _value; @@ -4318,225 +4091,254 @@ class _$SafetySettingCopyWithImpl<$Res, $Val extends SafetySetting> @pragma('vm:prefer-inline') @override $Res call({ - Object? category = freezed, - Object? threshold = freezed, + Object? title = freezed, + Object? content = freezed, + Object? taskType = freezed, + Object? model = freezed, }) { return _then(_value.copyWith( - category: freezed == category - ? _value.category - : category // ignore: cast_nullable_to_non_nullable - as SafetySettingCategory?, - threshold: freezed == threshold - ? _value.threshold - : threshold // ignore: cast_nullable_to_non_nullable - as SafetySettingThreshold?, + title: freezed == title + ? _value.title + : title // ignore: cast_nullable_to_non_nullable + as String?, + content: freezed == content + ? _value.content + : content // ignore: cast_nullable_to_non_nullable + as Content?, + taskType: freezed == taskType + ? _value.taskType + : taskType // ignore: cast_nullable_to_non_nullable + as EmbedContentRequestTaskType?, + model: freezed == model + ? _value.model + : model // ignore: cast_nullable_to_non_nullable + as String?, ) as $Val); } + + @override + @pragma('vm:prefer-inline') + $ContentCopyWith<$Res>? get content { + if (_value.content == null) { + return null; + } + + return $ContentCopyWith<$Res>(_value.content!, (value) { + return _then(_value.copyWith(content: value) as $Val); + }); + } } /// @nodoc -abstract class _$$SafetySettingImplCopyWith<$Res> - implements $SafetySettingCopyWith<$Res> { - factory _$$SafetySettingImplCopyWith( - _$SafetySettingImpl value, $Res Function(_$SafetySettingImpl) then) = - __$$SafetySettingImplCopyWithImpl<$Res>; +abstract class _$$EmbedContentRequestImplCopyWith<$Res> + implements $EmbedContentRequestCopyWith<$Res> { + factory _$$EmbedContentRequestImplCopyWith(_$EmbedContentRequestImpl value, + $Res Function(_$EmbedContentRequestImpl) then) = + __$$EmbedContentRequestImplCopyWithImpl<$Res>; @override @useResult $Res call( - {@JsonKey( - includeIfNull: false, - unknownEnumValue: JsonKey.nullForUndefinedEnumValue) - SafetySettingCategory? category, + {@JsonKey(includeIfNull: false) String? title, + @JsonKey(includeIfNull: false) Content? content, @JsonKey( includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue) - SafetySettingThreshold? threshold}); + EmbedContentRequestTaskType? taskType, + @JsonKey(includeIfNull: false) String? model}); + + @override + $ContentCopyWith<$Res>? get content; } /// @nodoc -class __$$SafetySettingImplCopyWithImpl<$Res> - extends _$SafetySettingCopyWithImpl<$Res, _$SafetySettingImpl> - implements _$$SafetySettingImplCopyWith<$Res> { - __$$SafetySettingImplCopyWithImpl( - _$SafetySettingImpl _value, $Res Function(_$SafetySettingImpl) _then) +class __$$EmbedContentRequestImplCopyWithImpl<$Res> + extends _$EmbedContentRequestCopyWithImpl<$Res, _$EmbedContentRequestImpl> + implements _$$EmbedContentRequestImplCopyWith<$Res> { + __$$EmbedContentRequestImplCopyWithImpl(_$EmbedContentRequestImpl _value, + $Res Function(_$EmbedContentRequestImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @override $Res call({ - Object? category = freezed, - Object? threshold = freezed, + Object? title = freezed, + Object? content = freezed, + Object? taskType = freezed, + Object? model = freezed, }) { - return _then(_$SafetySettingImpl( - category: freezed == category - ? _value.category - : category // ignore: cast_nullable_to_non_nullable - as SafetySettingCategory?, - threshold: freezed == threshold - ? _value.threshold - : threshold // ignore: cast_nullable_to_non_nullable - as SafetySettingThreshold?, + return _then(_$EmbedContentRequestImpl( + title: freezed == title + ? _value.title + : title // ignore: cast_nullable_to_non_nullable + as String?, + content: freezed == content + ? _value.content + : content // ignore: cast_nullable_to_non_nullable + as Content?, + taskType: freezed == taskType + ? _value.taskType + : taskType // ignore: cast_nullable_to_non_nullable + as EmbedContentRequestTaskType?, + model: freezed == model + ? _value.model + : model // ignore: cast_nullable_to_non_nullable + as String?, )); } } /// @nodoc @JsonSerializable() -class _$SafetySettingImpl extends _SafetySetting { - const _$SafetySettingImpl( - {@JsonKey( - includeIfNull: false, - unknownEnumValue: JsonKey.nullForUndefinedEnumValue) - this.category, +class _$EmbedContentRequestImpl extends _EmbedContentRequest { + const _$EmbedContentRequestImpl( + {@JsonKey(includeIfNull: false) this.title, + @JsonKey(includeIfNull: false) this.content, @JsonKey( includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue) - this.threshold}) + this.taskType, + @JsonKey(includeIfNull: false) this.model}) : super._(); - factory _$SafetySettingImpl.fromJson(Map json) => - _$$SafetySettingImplFromJson(json); + factory _$EmbedContentRequestImpl.fromJson(Map json) => + _$$EmbedContentRequestImplFromJson(json); - /// Required. The category for this setting. + /// Optional. An optional title for the text. Only applicable when TaskType is `RETRIEVAL_DOCUMENT`. Note: Specifying a `title` for `RETRIEVAL_DOCUMENT` provides better quality embeddings for retrieval. @override - @JsonKey( - includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue) - final SafetySettingCategory? category; + @JsonKey(includeIfNull: false) + final String? title; - /// Required. Controls the probability threshold at which harm is blocked. + /// Required. The content to embed. Only the `parts.text` fields will be counted. + @override + @JsonKey(includeIfNull: false) + final Content? content; + + /// Optional. Optional task type for which the embeddings will be used. Can only be set for `models/embedding-001`. @override @JsonKey( includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue) - final SafetySettingThreshold? threshold; + final EmbedContentRequestTaskType? taskType; + + /// Required. The model's resource name. This serves as an ID for the Model to use. This name should match a model name returned by the `ListModels` method. Format: `models/{model}` + @override + @JsonKey(includeIfNull: false) + final String? model; @override String toString() { - return 'SafetySetting(category: $category, threshold: $threshold)'; + return 'EmbedContentRequest(title: $title, content: $content, taskType: $taskType, model: $model)'; } @override bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$SafetySettingImpl && - (identical(other.category, category) || - other.category == category) && - (identical(other.threshold, threshold) || - other.threshold == threshold)); + other is _$EmbedContentRequestImpl && + (identical(other.title, title) || other.title == title) && + (identical(other.content, content) || other.content == content) && + (identical(other.taskType, taskType) || + other.taskType == taskType) && + (identical(other.model, model) || other.model == model)); } @JsonKey(ignore: true) @override - int get hashCode => Object.hash(runtimeType, category, threshold); + int get hashCode => Object.hash(runtimeType, title, content, taskType, model); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$SafetySettingImplCopyWith<_$SafetySettingImpl> get copyWith => - __$$SafetySettingImplCopyWithImpl<_$SafetySettingImpl>(this, _$identity); + _$$EmbedContentRequestImplCopyWith<_$EmbedContentRequestImpl> get copyWith => + __$$EmbedContentRequestImplCopyWithImpl<_$EmbedContentRequestImpl>( + this, _$identity); @override Map toJson() { - return _$$SafetySettingImplToJson( + return _$$EmbedContentRequestImplToJson( this, ); } } -abstract class _SafetySetting extends SafetySetting { - const factory _SafetySetting( - {@JsonKey( - includeIfNull: false, - unknownEnumValue: JsonKey.nullForUndefinedEnumValue) - final SafetySettingCategory? category, - @JsonKey( - includeIfNull: false, - unknownEnumValue: JsonKey.nullForUndefinedEnumValue) - final SafetySettingThreshold? threshold}) = _$SafetySettingImpl; - const _SafetySetting._() : super._(); +abstract class _EmbedContentRequest extends EmbedContentRequest { + const factory _EmbedContentRequest( + {@JsonKey(includeIfNull: false) final String? title, + @JsonKey(includeIfNull: false) final Content? content, + @JsonKey( + includeIfNull: false, + unknownEnumValue: JsonKey.nullForUndefinedEnumValue) + final EmbedContentRequestTaskType? taskType, + @JsonKey(includeIfNull: false) final String? model}) = + _$EmbedContentRequestImpl; + const _EmbedContentRequest._() : super._(); - factory _SafetySetting.fromJson(Map json) = - _$SafetySettingImpl.fromJson; + factory _EmbedContentRequest.fromJson(Map json) = + _$EmbedContentRequestImpl.fromJson; @override - /// Required. The category for this setting. - @JsonKey( - includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue) - SafetySettingCategory? get category; + /// Optional. An optional title for the text. Only applicable when TaskType is `RETRIEVAL_DOCUMENT`. Note: Specifying a `title` for `RETRIEVAL_DOCUMENT` provides better quality embeddings for retrieval. + @JsonKey(includeIfNull: false) + String? get title; @override - /// Required. Controls the probability threshold at which harm is blocked. + /// Required. The content to embed. Only the `parts.text` fields will be counted. + @JsonKey(includeIfNull: false) + Content? get content; + @override + + /// Optional. Optional task type for which the embeddings will be used. Can only be set for `models/embedding-001`. @JsonKey( includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue) - SafetySettingThreshold? get threshold; + EmbedContentRequestTaskType? get taskType; + @override + + /// Required. The model's resource name. This serves as an ID for the Model to use. This name should match a model name returned by the `ListModels` method. Format: `models/{model}` + @JsonKey(includeIfNull: false) + String? get model; @override @JsonKey(ignore: true) - _$$SafetySettingImplCopyWith<_$SafetySettingImpl> get copyWith => + _$$EmbedContentRequestImplCopyWith<_$EmbedContentRequestImpl> get copyWith => throw _privateConstructorUsedError; } -Candidate _$CandidateFromJson(Map json) { - return _Candidate.fromJson(json); +ListOperationsResponse _$ListOperationsResponseFromJson( + Map json) { + return _ListOperationsResponse.fromJson(json); } /// @nodoc -mixin _$Candidate { - /// Output only. Generated content returned from the model. - @JsonKey(includeIfNull: false) - Content? get content => throw _privateConstructorUsedError; - - /// Optional. Output only. The reason why the model stopped generating tokens. If empty, the model has not stopped generating the tokens. - @JsonKey( - includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue) - CandidateFinishReason? get finishReason => throw _privateConstructorUsedError; - - /// Output only. Citation information for model-generated candidate. This field may be populated with recitation information for any text included in the `content`. These are passages that are "recited" from copyrighted material in the foundational LLM's training data. - @JsonKey(includeIfNull: false) - CitationMetadata? get citationMetadata => throw _privateConstructorUsedError; - - /// Output only. Index of the candidate in the list of candidates. - @JsonKey(includeIfNull: false) - int? get index => throw _privateConstructorUsedError; - - /// Output only. Token count for this candidate. +mixin _$ListOperationsResponse { + /// A list of operations that matches the specified filter in the request. @JsonKey(includeIfNull: false) - int? get tokenCount => throw _privateConstructorUsedError; + List? get operations => throw _privateConstructorUsedError; - /// List of ratings for the safety of a response candidate. There is at most one rating per category. + /// The standard List next-page token. @JsonKey(includeIfNull: false) - List? get safetyRatings => throw _privateConstructorUsedError; + String? get nextPageToken => throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) - $CandidateCopyWith get copyWith => + $ListOperationsResponseCopyWith get copyWith => throw _privateConstructorUsedError; } /// @nodoc -abstract class $CandidateCopyWith<$Res> { - factory $CandidateCopyWith(Candidate value, $Res Function(Candidate) then) = - _$CandidateCopyWithImpl<$Res, Candidate>; +abstract class $ListOperationsResponseCopyWith<$Res> { + factory $ListOperationsResponseCopyWith(ListOperationsResponse value, + $Res Function(ListOperationsResponse) then) = + _$ListOperationsResponseCopyWithImpl<$Res, ListOperationsResponse>; @useResult $Res call( - {@JsonKey(includeIfNull: false) Content? content, - @JsonKey( - includeIfNull: false, - unknownEnumValue: JsonKey.nullForUndefinedEnumValue) - CandidateFinishReason? finishReason, - @JsonKey(includeIfNull: false) CitationMetadata? citationMetadata, - @JsonKey(includeIfNull: false) int? index, - @JsonKey(includeIfNull: false) int? tokenCount, - @JsonKey(includeIfNull: false) List? safetyRatings}); - - $ContentCopyWith<$Res>? get content; - $CitationMetadataCopyWith<$Res>? get citationMetadata; + {@JsonKey(includeIfNull: false) List? operations, + @JsonKey(includeIfNull: false) String? nextPageToken}); } /// @nodoc -class _$CandidateCopyWithImpl<$Res, $Val extends Candidate> - implements $CandidateCopyWith<$Res> { - _$CandidateCopyWithImpl(this._value, this._then); +class _$ListOperationsResponseCopyWithImpl<$Res, + $Val extends ListOperationsResponse> + implements $ListOperationsResponseCopyWith<$Res> { + _$ListOperationsResponseCopyWithImpl(this._value, this._then); // ignore: unused_field final $Val _value; @@ -4546,327 +4348,271 @@ class _$CandidateCopyWithImpl<$Res, $Val extends Candidate> @pragma('vm:prefer-inline') @override $Res call({ - Object? content = freezed, - Object? finishReason = freezed, - Object? citationMetadata = freezed, - Object? index = freezed, - Object? tokenCount = freezed, - Object? safetyRatings = freezed, + Object? operations = freezed, + Object? nextPageToken = freezed, }) { return _then(_value.copyWith( - content: freezed == content - ? _value.content - : content // ignore: cast_nullable_to_non_nullable - as Content?, - finishReason: freezed == finishReason - ? _value.finishReason - : finishReason // ignore: cast_nullable_to_non_nullable - as CandidateFinishReason?, - citationMetadata: freezed == citationMetadata - ? _value.citationMetadata - : citationMetadata // ignore: cast_nullable_to_non_nullable - as CitationMetadata?, - index: freezed == index - ? _value.index - : index // ignore: cast_nullable_to_non_nullable - as int?, - tokenCount: freezed == tokenCount - ? _value.tokenCount - : tokenCount // ignore: cast_nullable_to_non_nullable - as int?, - safetyRatings: freezed == safetyRatings - ? _value.safetyRatings - : safetyRatings // ignore: cast_nullable_to_non_nullable - as List?, + operations: freezed == operations + ? _value.operations + : operations // ignore: cast_nullable_to_non_nullable + as List?, + nextPageToken: freezed == nextPageToken + ? _value.nextPageToken + : nextPageToken // ignore: cast_nullable_to_non_nullable + as String?, ) as $Val); } - - @override - @pragma('vm:prefer-inline') - $ContentCopyWith<$Res>? get content { - if (_value.content == null) { - return null; - } - - return $ContentCopyWith<$Res>(_value.content!, (value) { - return _then(_value.copyWith(content: value) as $Val); - }); - } - - @override - @pragma('vm:prefer-inline') - $CitationMetadataCopyWith<$Res>? get citationMetadata { - if (_value.citationMetadata == null) { - return null; - } - - return $CitationMetadataCopyWith<$Res>(_value.citationMetadata!, (value) { - return _then(_value.copyWith(citationMetadata: value) as $Val); - }); - } } /// @nodoc -abstract class _$$CandidateImplCopyWith<$Res> - implements $CandidateCopyWith<$Res> { - factory _$$CandidateImplCopyWith( - _$CandidateImpl value, $Res Function(_$CandidateImpl) then) = - __$$CandidateImplCopyWithImpl<$Res>; +abstract class _$$ListOperationsResponseImplCopyWith<$Res> + implements $ListOperationsResponseCopyWith<$Res> { + factory _$$ListOperationsResponseImplCopyWith( + _$ListOperationsResponseImpl value, + $Res Function(_$ListOperationsResponseImpl) then) = + __$$ListOperationsResponseImplCopyWithImpl<$Res>; @override @useResult - $Res call( - {@JsonKey(includeIfNull: false) Content? content, - @JsonKey( - includeIfNull: false, - unknownEnumValue: JsonKey.nullForUndefinedEnumValue) - CandidateFinishReason? finishReason, - @JsonKey(includeIfNull: false) CitationMetadata? citationMetadata, - @JsonKey(includeIfNull: false) int? index, - @JsonKey(includeIfNull: false) int? tokenCount, - @JsonKey(includeIfNull: false) List? safetyRatings}); - - @override - $ContentCopyWith<$Res>? get content; - @override - $CitationMetadataCopyWith<$Res>? get citationMetadata; + $Res call( + {@JsonKey(includeIfNull: false) List? operations, + @JsonKey(includeIfNull: false) String? nextPageToken}); } /// @nodoc -class __$$CandidateImplCopyWithImpl<$Res> - extends _$CandidateCopyWithImpl<$Res, _$CandidateImpl> - implements _$$CandidateImplCopyWith<$Res> { - __$$CandidateImplCopyWithImpl( - _$CandidateImpl _value, $Res Function(_$CandidateImpl) _then) +class __$$ListOperationsResponseImplCopyWithImpl<$Res> + extends _$ListOperationsResponseCopyWithImpl<$Res, + _$ListOperationsResponseImpl> + implements _$$ListOperationsResponseImplCopyWith<$Res> { + __$$ListOperationsResponseImplCopyWithImpl( + _$ListOperationsResponseImpl _value, + $Res Function(_$ListOperationsResponseImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @override $Res call({ - Object? content = freezed, - Object? finishReason = freezed, - Object? citationMetadata = freezed, - Object? index = freezed, - Object? tokenCount = freezed, - Object? safetyRatings = freezed, + Object? operations = freezed, + Object? nextPageToken = freezed, }) { - return _then(_$CandidateImpl( - content: freezed == content - ? _value.content - : content // ignore: cast_nullable_to_non_nullable - as Content?, - finishReason: freezed == finishReason - ? _value.finishReason - : finishReason // ignore: cast_nullable_to_non_nullable - as CandidateFinishReason?, - citationMetadata: freezed == citationMetadata - ? _value.citationMetadata - : citationMetadata // ignore: cast_nullable_to_non_nullable - as CitationMetadata?, - index: freezed == index - ? _value.index - : index // ignore: cast_nullable_to_non_nullable - as int?, - tokenCount: freezed == tokenCount - ? _value.tokenCount - : tokenCount // ignore: cast_nullable_to_non_nullable - as int?, - safetyRatings: freezed == safetyRatings - ? _value._safetyRatings - : safetyRatings // ignore: cast_nullable_to_non_nullable - as List?, + return _then(_$ListOperationsResponseImpl( + operations: freezed == operations + ? _value._operations + : operations // ignore: cast_nullable_to_non_nullable + as List?, + nextPageToken: freezed == nextPageToken + ? _value.nextPageToken + : nextPageToken // ignore: cast_nullable_to_non_nullable + as String?, )); } } /// @nodoc @JsonSerializable() -class _$CandidateImpl extends _Candidate { - const _$CandidateImpl( - {@JsonKey(includeIfNull: false) this.content, - @JsonKey( - includeIfNull: false, - unknownEnumValue: JsonKey.nullForUndefinedEnumValue) - this.finishReason, - @JsonKey(includeIfNull: false) this.citationMetadata, - @JsonKey(includeIfNull: false) this.index, - @JsonKey(includeIfNull: false) this.tokenCount, - @JsonKey(includeIfNull: false) final List? safetyRatings}) - : _safetyRatings = safetyRatings, +class _$ListOperationsResponseImpl extends _ListOperationsResponse { + const _$ListOperationsResponseImpl( + {@JsonKey(includeIfNull: false) final List? operations, + @JsonKey(includeIfNull: false) this.nextPageToken}) + : _operations = operations, super._(); - factory _$CandidateImpl.fromJson(Map json) => - _$$CandidateImplFromJson(json); - - /// Output only. Generated content returned from the model. - @override - @JsonKey(includeIfNull: false) - final Content? content; - - /// Optional. Output only. The reason why the model stopped generating tokens. If empty, the model has not stopped generating the tokens. - @override - @JsonKey( - includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue) - final CandidateFinishReason? finishReason; - - /// Output only. Citation information for model-generated candidate. This field may be populated with recitation information for any text included in the `content`. These are passages that are "recited" from copyrighted material in the foundational LLM's training data. - @override - @JsonKey(includeIfNull: false) - final CitationMetadata? citationMetadata; - - /// Output only. Index of the candidate in the list of candidates. - @override - @JsonKey(includeIfNull: false) - final int? index; - - /// Output only. Token count for this candidate. - @override - @JsonKey(includeIfNull: false) - final int? tokenCount; + factory _$ListOperationsResponseImpl.fromJson(Map json) => + _$$ListOperationsResponseImplFromJson(json); - /// List of ratings for the safety of a response candidate. There is at most one rating per category. - final List? _safetyRatings; + /// A list of operations that matches the specified filter in the request. + final List? _operations; - /// List of ratings for the safety of a response candidate. There is at most one rating per category. + /// A list of operations that matches the specified filter in the request. @override @JsonKey(includeIfNull: false) - List? get safetyRatings { - final value = _safetyRatings; + List? get operations { + final value = _operations; if (value == null) return null; - if (_safetyRatings is EqualUnmodifiableListView) return _safetyRatings; + if (_operations is EqualUnmodifiableListView) return _operations; // ignore: implicit_dynamic_type return EqualUnmodifiableListView(value); } + /// The standard List next-page token. + @override + @JsonKey(includeIfNull: false) + final String? nextPageToken; + @override String toString() { - return 'Candidate(content: $content, finishReason: $finishReason, citationMetadata: $citationMetadata, index: $index, tokenCount: $tokenCount, safetyRatings: $safetyRatings)'; + return 'ListOperationsResponse(operations: $operations, nextPageToken: $nextPageToken)'; } @override bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$CandidateImpl && - (identical(other.content, content) || other.content == content) && - (identical(other.finishReason, finishReason) || - other.finishReason == finishReason) && - (identical(other.citationMetadata, citationMetadata) || - other.citationMetadata == citationMetadata) && - (identical(other.index, index) || other.index == index) && - (identical(other.tokenCount, tokenCount) || - other.tokenCount == tokenCount) && + other is _$ListOperationsResponseImpl && const DeepCollectionEquality() - .equals(other._safetyRatings, _safetyRatings)); + .equals(other._operations, _operations) && + (identical(other.nextPageToken, nextPageToken) || + other.nextPageToken == nextPageToken)); } @JsonKey(ignore: true) @override - int get hashCode => Object.hash( - runtimeType, - content, - finishReason, - citationMetadata, - index, - tokenCount, - const DeepCollectionEquality().hash(_safetyRatings)); + int get hashCode => Object.hash(runtimeType, + const DeepCollectionEquality().hash(_operations), nextPageToken); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$CandidateImplCopyWith<_$CandidateImpl> get copyWith => - __$$CandidateImplCopyWithImpl<_$CandidateImpl>(this, _$identity); + _$$ListOperationsResponseImplCopyWith<_$ListOperationsResponseImpl> + get copyWith => __$$ListOperationsResponseImplCopyWithImpl< + _$ListOperationsResponseImpl>(this, _$identity); @override Map toJson() { - return _$$CandidateImplToJson( + return _$$ListOperationsResponseImplToJson( this, ); } } -abstract class _Candidate extends Candidate { - const factory _Candidate( - {@JsonKey(includeIfNull: false) final Content? content, - @JsonKey( - includeIfNull: false, - unknownEnumValue: JsonKey.nullForUndefinedEnumValue) - final CandidateFinishReason? finishReason, - @JsonKey(includeIfNull: false) final CitationMetadata? citationMetadata, - @JsonKey(includeIfNull: false) final int? index, - @JsonKey(includeIfNull: false) final int? tokenCount, - @JsonKey(includeIfNull: false) - final List? safetyRatings}) = _$CandidateImpl; - const _Candidate._() : super._(); +abstract class _ListOperationsResponse extends ListOperationsResponse { + const factory _ListOperationsResponse( + {@JsonKey(includeIfNull: false) final List? operations, + @JsonKey(includeIfNull: false) final String? nextPageToken}) = + _$ListOperationsResponseImpl; + const _ListOperationsResponse._() : super._(); - factory _Candidate.fromJson(Map json) = - _$CandidateImpl.fromJson; + factory _ListOperationsResponse.fromJson(Map json) = + _$ListOperationsResponseImpl.fromJson; @override - /// Output only. Generated content returned from the model. + /// A list of operations that matches the specified filter in the request. @JsonKey(includeIfNull: false) - Content? get content; + List? get operations; @override - /// Optional. Output only. The reason why the model stopped generating tokens. If empty, the model has not stopped generating the tokens. - @JsonKey( - includeIfNull: false, unknownEnumValue: JsonKey.nullForUndefinedEnumValue) - CandidateFinishReason? get finishReason; + /// The standard List next-page token. + @JsonKey(includeIfNull: false) + String? get nextPageToken; @override + @JsonKey(ignore: true) + _$$ListOperationsResponseImplCopyWith<_$ListOperationsResponseImpl> + get copyWith => throw _privateConstructorUsedError; +} + +Empty _$EmptyFromJson(Map json) { + return _Empty.fromJson(json); +} + +/// @nodoc +mixin _$Empty { + Map toJson() => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $EmptyCopyWith<$Res> { + factory $EmptyCopyWith(Empty value, $Res Function(Empty) then) = + _$EmptyCopyWithImpl<$Res, Empty>; +} + +/// @nodoc +class _$EmptyCopyWithImpl<$Res, $Val extends Empty> + implements $EmptyCopyWith<$Res> { + _$EmptyCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; +} + +/// @nodoc +abstract class _$$EmptyImplCopyWith<$Res> { + factory _$$EmptyImplCopyWith( + _$EmptyImpl value, $Res Function(_$EmptyImpl) then) = + __$$EmptyImplCopyWithImpl<$Res>; +} + +/// @nodoc +class __$$EmptyImplCopyWithImpl<$Res> + extends _$EmptyCopyWithImpl<$Res, _$EmptyImpl> + implements _$$EmptyImplCopyWith<$Res> { + __$$EmptyImplCopyWithImpl( + _$EmptyImpl _value, $Res Function(_$EmptyImpl) _then) + : super(_value, _then); +} + +/// @nodoc +@JsonSerializable() +class _$EmptyImpl extends _Empty { + const _$EmptyImpl() : super._(); + + factory _$EmptyImpl.fromJson(Map json) => + _$$EmptyImplFromJson(json); - /// Output only. Citation information for model-generated candidate. This field may be populated with recitation information for any text included in the `content`. These are passages that are "recited" from copyrighted material in the foundational LLM's training data. - @JsonKey(includeIfNull: false) - CitationMetadata? get citationMetadata; @override + String toString() { + return 'Empty()'; + } - /// Output only. Index of the candidate in the list of candidates. - @JsonKey(includeIfNull: false) - int? get index; @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && other is _$EmptyImpl); + } + + @JsonKey(ignore: true) + @override + int get hashCode => runtimeType.hashCode; - /// Output only. Token count for this candidate. - @JsonKey(includeIfNull: false) - int? get tokenCount; @override + Map toJson() { + return _$$EmptyImplToJson( + this, + ); + } +} - /// List of ratings for the safety of a response candidate. There is at most one rating per category. - @JsonKey(includeIfNull: false) - List? get safetyRatings; - @override - @JsonKey(ignore: true) - _$$CandidateImplCopyWith<_$CandidateImpl> get copyWith => - throw _privateConstructorUsedError; +abstract class _Empty extends Empty { + const factory _Empty() = _$EmptyImpl; + const _Empty._() : super._(); + + factory _Empty.fromJson(Map json) = _$EmptyImpl.fromJson; } -CountTokensResponse _$CountTokensResponseFromJson(Map json) { - return _CountTokensResponse.fromJson(json); +Content _$ContentFromJson(Map json) { + return _Content.fromJson(json); } /// @nodoc -mixin _$CountTokensResponse { - /// The number of tokens that the `model` tokenizes the `prompt` into. Always non-negative. +mixin _$Content { + /// Optional. The producer of the content. Must be either 'user' or 'model'. Useful to set for multi-turn conversations, otherwise can be left blank or unset. @JsonKey(includeIfNull: false) - int? get totalTokens => throw _privateConstructorUsedError; + String? get role => throw _privateConstructorUsedError; + + /// Ordered `Parts` that constitute a single message. Parts may have different MIME types. + @JsonKey(includeIfNull: false) + List? get parts => throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) - $CountTokensResponseCopyWith get copyWith => - throw _privateConstructorUsedError; + $ContentCopyWith get copyWith => throw _privateConstructorUsedError; } /// @nodoc -abstract class $CountTokensResponseCopyWith<$Res> { - factory $CountTokensResponseCopyWith( - CountTokensResponse value, $Res Function(CountTokensResponse) then) = - _$CountTokensResponseCopyWithImpl<$Res, CountTokensResponse>; +abstract class $ContentCopyWith<$Res> { + factory $ContentCopyWith(Content value, $Res Function(Content) then) = + _$ContentCopyWithImpl<$Res, Content>; @useResult - $Res call({@JsonKey(includeIfNull: false) int? totalTokens}); + $Res call( + {@JsonKey(includeIfNull: false) String? role, + @JsonKey(includeIfNull: false) List? parts}); } /// @nodoc -class _$CountTokensResponseCopyWithImpl<$Res, $Val extends CountTokensResponse> - implements $CountTokensResponseCopyWith<$Res> { - _$CountTokensResponseCopyWithImpl(this._value, this._then); +class _$ContentCopyWithImpl<$Res, $Val extends Content> + implements $ContentCopyWith<$Res> { + _$ContentCopyWithImpl(this._value, this._then); // ignore: unused_field final $Val _value; @@ -4876,311 +4622,269 @@ class _$CountTokensResponseCopyWithImpl<$Res, $Val extends CountTokensResponse> @pragma('vm:prefer-inline') @override $Res call({ - Object? totalTokens = freezed, + Object? role = freezed, + Object? parts = freezed, }) { return _then(_value.copyWith( - totalTokens: freezed == totalTokens - ? _value.totalTokens - : totalTokens // ignore: cast_nullable_to_non_nullable - as int?, + role: freezed == role + ? _value.role + : role // ignore: cast_nullable_to_non_nullable + as String?, + parts: freezed == parts + ? _value.parts + : parts // ignore: cast_nullable_to_non_nullable + as List?, ) as $Val); } } /// @nodoc -abstract class _$$CountTokensResponseImplCopyWith<$Res> - implements $CountTokensResponseCopyWith<$Res> { - factory _$$CountTokensResponseImplCopyWith(_$CountTokensResponseImpl value, - $Res Function(_$CountTokensResponseImpl) then) = - __$$CountTokensResponseImplCopyWithImpl<$Res>; +abstract class _$$ContentImplCopyWith<$Res> implements $ContentCopyWith<$Res> { + factory _$$ContentImplCopyWith( + _$ContentImpl value, $Res Function(_$ContentImpl) then) = + __$$ContentImplCopyWithImpl<$Res>; @override @useResult - $Res call({@JsonKey(includeIfNull: false) int? totalTokens}); + $Res call( + {@JsonKey(includeIfNull: false) String? role, + @JsonKey(includeIfNull: false) List? parts}); } /// @nodoc -class __$$CountTokensResponseImplCopyWithImpl<$Res> - extends _$CountTokensResponseCopyWithImpl<$Res, _$CountTokensResponseImpl> - implements _$$CountTokensResponseImplCopyWith<$Res> { - __$$CountTokensResponseImplCopyWithImpl(_$CountTokensResponseImpl _value, - $Res Function(_$CountTokensResponseImpl) _then) +class __$$ContentImplCopyWithImpl<$Res> + extends _$ContentCopyWithImpl<$Res, _$ContentImpl> + implements _$$ContentImplCopyWith<$Res> { + __$$ContentImplCopyWithImpl( + _$ContentImpl _value, $Res Function(_$ContentImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @override $Res call({ - Object? totalTokens = freezed, + Object? role = freezed, + Object? parts = freezed, }) { - return _then(_$CountTokensResponseImpl( - totalTokens: freezed == totalTokens - ? _value.totalTokens - : totalTokens // ignore: cast_nullable_to_non_nullable - as int?, + return _then(_$ContentImpl( + role: freezed == role + ? _value.role + : role // ignore: cast_nullable_to_non_nullable + as String?, + parts: freezed == parts + ? _value._parts + : parts // ignore: cast_nullable_to_non_nullable + as List?, )); } } /// @nodoc @JsonSerializable() -class _$CountTokensResponseImpl extends _CountTokensResponse { - const _$CountTokensResponseImpl( - {@JsonKey(includeIfNull: false) this.totalTokens}) - : super._(); +class _$ContentImpl extends _Content { + const _$ContentImpl( + {@JsonKey(includeIfNull: false) this.role, + @JsonKey(includeIfNull: false) final List? parts}) + : _parts = parts, + super._(); - factory _$CountTokensResponseImpl.fromJson(Map json) => - _$$CountTokensResponseImplFromJson(json); + factory _$ContentImpl.fromJson(Map json) => + _$$ContentImplFromJson(json); - /// The number of tokens that the `model` tokenizes the `prompt` into. Always non-negative. + /// Optional. The producer of the content. Must be either 'user' or 'model'. Useful to set for multi-turn conversations, otherwise can be left blank or unset. @override @JsonKey(includeIfNull: false) - final int? totalTokens; + final String? role; + + /// Ordered `Parts` that constitute a single message. Parts may have different MIME types. + final List? _parts; + + /// Ordered `Parts` that constitute a single message. Parts may have different MIME types. + @override + @JsonKey(includeIfNull: false) + List? get parts { + final value = _parts; + if (value == null) return null; + if (_parts is EqualUnmodifiableListView) return _parts; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(value); + } @override String toString() { - return 'CountTokensResponse(totalTokens: $totalTokens)'; + return 'Content(role: $role, parts: $parts)'; } @override bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$CountTokensResponseImpl && - (identical(other.totalTokens, totalTokens) || - other.totalTokens == totalTokens)); + other is _$ContentImpl && + (identical(other.role, role) || other.role == role) && + const DeepCollectionEquality().equals(other._parts, _parts)); } @JsonKey(ignore: true) @override - int get hashCode => Object.hash(runtimeType, totalTokens); + int get hashCode => Object.hash( + runtimeType, role, const DeepCollectionEquality().hash(_parts)); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$CountTokensResponseImplCopyWith<_$CountTokensResponseImpl> get copyWith => - __$$CountTokensResponseImplCopyWithImpl<_$CountTokensResponseImpl>( - this, _$identity); + _$$ContentImplCopyWith<_$ContentImpl> get copyWith => + __$$ContentImplCopyWithImpl<_$ContentImpl>(this, _$identity); @override Map toJson() { - return _$$CountTokensResponseImplToJson( + return _$$ContentImplToJson( this, ); } } -abstract class _CountTokensResponse extends CountTokensResponse { - const factory _CountTokensResponse( - {@JsonKey(includeIfNull: false) final int? totalTokens}) = - _$CountTokensResponseImpl; - const _CountTokensResponse._() : super._(); +abstract class _Content extends Content { + const factory _Content( + {@JsonKey(includeIfNull: false) final String? role, + @JsonKey(includeIfNull: false) final List? parts}) = _$ContentImpl; + const _Content._() : super._(); - factory _CountTokensResponse.fromJson(Map json) = - _$CountTokensResponseImpl.fromJson; + factory _Content.fromJson(Map json) = _$ContentImpl.fromJson; @override - /// The number of tokens that the `model` tokenizes the `prompt` into. Always non-negative. + /// Optional. The producer of the content. Must be either 'user' or 'model'. Useful to set for multi-turn conversations, otherwise can be left blank or unset. @JsonKey(includeIfNull: false) - int? get totalTokens; + String? get role; + @override + + /// Ordered `Parts` that constitute a single message. Parts may have different MIME types. + @JsonKey(includeIfNull: false) + List? get parts; @override @JsonKey(ignore: true) - _$$CountTokensResponseImplCopyWith<_$CountTokensResponseImpl> get copyWith => + _$$ContentImplCopyWith<_$ContentImpl> get copyWith => throw _privateConstructorUsedError; } -CountTokensRequest _$CountTokensRequestFromJson(Map json) { - return _CountTokensRequest.fromJson(json); +CancelOperationRequest _$CancelOperationRequestFromJson( + Map json) { + return _CancelOperationRequest.fromJson(json); } /// @nodoc -mixin _$CountTokensRequest { - /// Required. The input given to the model as a prompt. - @JsonKey(includeIfNull: false) - List? get contents => throw _privateConstructorUsedError; - +mixin _$CancelOperationRequest { Map toJson() => throw _privateConstructorUsedError; - @JsonKey(ignore: true) - $CountTokensRequestCopyWith get copyWith => - throw _privateConstructorUsedError; } /// @nodoc -abstract class $CountTokensRequestCopyWith<$Res> { - factory $CountTokensRequestCopyWith( - CountTokensRequest value, $Res Function(CountTokensRequest) then) = - _$CountTokensRequestCopyWithImpl<$Res, CountTokensRequest>; - @useResult - $Res call({@JsonKey(includeIfNull: false) List? contents}); +abstract class $CancelOperationRequestCopyWith<$Res> { + factory $CancelOperationRequestCopyWith(CancelOperationRequest value, + $Res Function(CancelOperationRequest) then) = + _$CancelOperationRequestCopyWithImpl<$Res, CancelOperationRequest>; } /// @nodoc -class _$CountTokensRequestCopyWithImpl<$Res, $Val extends CountTokensRequest> - implements $CountTokensRequestCopyWith<$Res> { - _$CountTokensRequestCopyWithImpl(this._value, this._then); +class _$CancelOperationRequestCopyWithImpl<$Res, + $Val extends CancelOperationRequest> + implements $CancelOperationRequestCopyWith<$Res> { + _$CancelOperationRequestCopyWithImpl(this._value, this._then); // ignore: unused_field final $Val _value; // ignore: unused_field final $Res Function($Val) _then; - - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? contents = freezed, - }) { - return _then(_value.copyWith( - contents: freezed == contents - ? _value.contents - : contents // ignore: cast_nullable_to_non_nullable - as List?, - ) as $Val); - } } /// @nodoc -abstract class _$$CountTokensRequestImplCopyWith<$Res> - implements $CountTokensRequestCopyWith<$Res> { - factory _$$CountTokensRequestImplCopyWith(_$CountTokensRequestImpl value, - $Res Function(_$CountTokensRequestImpl) then) = - __$$CountTokensRequestImplCopyWithImpl<$Res>; - @override - @useResult - $Res call({@JsonKey(includeIfNull: false) List? contents}); +abstract class _$$CancelOperationRequestImplCopyWith<$Res> { + factory _$$CancelOperationRequestImplCopyWith( + _$CancelOperationRequestImpl value, + $Res Function(_$CancelOperationRequestImpl) then) = + __$$CancelOperationRequestImplCopyWithImpl<$Res>; } /// @nodoc -class __$$CountTokensRequestImplCopyWithImpl<$Res> - extends _$CountTokensRequestCopyWithImpl<$Res, _$CountTokensRequestImpl> - implements _$$CountTokensRequestImplCopyWith<$Res> { - __$$CountTokensRequestImplCopyWithImpl(_$CountTokensRequestImpl _value, - $Res Function(_$CountTokensRequestImpl) _then) - : super(_value, _then); - - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? contents = freezed, - }) { - return _then(_$CountTokensRequestImpl( - contents: freezed == contents - ? _value._contents - : contents // ignore: cast_nullable_to_non_nullable - as List?, - )); - } +class __$$CancelOperationRequestImplCopyWithImpl<$Res> + extends _$CancelOperationRequestCopyWithImpl<$Res, + _$CancelOperationRequestImpl> + implements _$$CancelOperationRequestImplCopyWith<$Res> { + __$$CancelOperationRequestImplCopyWithImpl( + _$CancelOperationRequestImpl _value, + $Res Function(_$CancelOperationRequestImpl) _then) + : super(_value, _then); } /// @nodoc @JsonSerializable() -class _$CountTokensRequestImpl extends _CountTokensRequest { - const _$CountTokensRequestImpl( - {@JsonKey(includeIfNull: false) final List? contents}) - : _contents = contents, - super._(); - - factory _$CountTokensRequestImpl.fromJson(Map json) => - _$$CountTokensRequestImplFromJson(json); - - /// Required. The input given to the model as a prompt. - final List? _contents; +class _$CancelOperationRequestImpl extends _CancelOperationRequest { + const _$CancelOperationRequestImpl() : super._(); - /// Required. The input given to the model as a prompt. - @override - @JsonKey(includeIfNull: false) - List? get contents { - final value = _contents; - if (value == null) return null; - if (_contents is EqualUnmodifiableListView) return _contents; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(value); - } + factory _$CancelOperationRequestImpl.fromJson(Map json) => + _$$CancelOperationRequestImplFromJson(json); @override String toString() { - return 'CountTokensRequest(contents: $contents)'; + return 'CancelOperationRequest()'; } @override bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$CountTokensRequestImpl && - const DeepCollectionEquality().equals(other._contents, _contents)); + other is _$CancelOperationRequestImpl); } @JsonKey(ignore: true) @override - int get hashCode => - Object.hash(runtimeType, const DeepCollectionEquality().hash(_contents)); - - @JsonKey(ignore: true) - @override - @pragma('vm:prefer-inline') - _$$CountTokensRequestImplCopyWith<_$CountTokensRequestImpl> get copyWith => - __$$CountTokensRequestImplCopyWithImpl<_$CountTokensRequestImpl>( - this, _$identity); + int get hashCode => runtimeType.hashCode; @override Map toJson() { - return _$$CountTokensRequestImplToJson( + return _$$CancelOperationRequestImplToJson( this, ); } } -abstract class _CountTokensRequest extends CountTokensRequest { - const factory _CountTokensRequest( - {@JsonKey(includeIfNull: false) final List? contents}) = - _$CountTokensRequestImpl; - const _CountTokensRequest._() : super._(); - - factory _CountTokensRequest.fromJson(Map json) = - _$CountTokensRequestImpl.fromJson; - - @override +abstract class _CancelOperationRequest extends CancelOperationRequest { + const factory _CancelOperationRequest() = _$CancelOperationRequestImpl; + const _CancelOperationRequest._() : super._(); - /// Required. The input given to the model as a prompt. - @JsonKey(includeIfNull: false) - List? get contents; - @override - @JsonKey(ignore: true) - _$$CountTokensRequestImplCopyWith<_$CountTokensRequestImpl> get copyWith => - throw _privateConstructorUsedError; + factory _CancelOperationRequest.fromJson(Map json) = + _$CancelOperationRequestImpl.fromJson; } -BatchEmbedContentsResponse _$BatchEmbedContentsResponseFromJson( - Map json) { - return _BatchEmbedContentsResponse.fromJson(json); +EmbedContentResponse _$EmbedContentResponseFromJson(Map json) { + return _EmbedContentResponse.fromJson(json); } /// @nodoc -mixin _$BatchEmbedContentsResponse { - /// Output only. The embeddings for each request, in the same order as provided in the batch request. +mixin _$EmbedContentResponse { + /// Output only. The embedding generated from the input content. @JsonKey(includeIfNull: false) - List? get embeddings => throw _privateConstructorUsedError; + ContentEmbedding? get embedding => throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) - $BatchEmbedContentsResponseCopyWith - get copyWith => throw _privateConstructorUsedError; + $EmbedContentResponseCopyWith get copyWith => + throw _privateConstructorUsedError; } /// @nodoc -abstract class $BatchEmbedContentsResponseCopyWith<$Res> { - factory $BatchEmbedContentsResponseCopyWith(BatchEmbedContentsResponse value, - $Res Function(BatchEmbedContentsResponse) then) = - _$BatchEmbedContentsResponseCopyWithImpl<$Res, - BatchEmbedContentsResponse>; +abstract class $EmbedContentResponseCopyWith<$Res> { + factory $EmbedContentResponseCopyWith(EmbedContentResponse value, + $Res Function(EmbedContentResponse) then) = + _$EmbedContentResponseCopyWithImpl<$Res, EmbedContentResponse>; @useResult - $Res call( - {@JsonKey(includeIfNull: false) List? embeddings}); + $Res call({@JsonKey(includeIfNull: false) ContentEmbedding? embedding}); + + $ContentEmbeddingCopyWith<$Res>? get embedding; } /// @nodoc -class _$BatchEmbedContentsResponseCopyWithImpl<$Res, - $Val extends BatchEmbedContentsResponse> - implements $BatchEmbedContentsResponseCopyWith<$Res> { - _$BatchEmbedContentsResponseCopyWithImpl(this._value, this._then); +class _$EmbedContentResponseCopyWithImpl<$Res, + $Val extends EmbedContentResponse> + implements $EmbedContentResponseCopyWith<$Res> { + _$EmbedContentResponseCopyWithImpl(this._value, this._then); // ignore: unused_field final $Val _value; @@ -5190,166 +4894,163 @@ class _$BatchEmbedContentsResponseCopyWithImpl<$Res, @pragma('vm:prefer-inline') @override $Res call({ - Object? embeddings = freezed, + Object? embedding = freezed, }) { return _then(_value.copyWith( - embeddings: freezed == embeddings - ? _value.embeddings - : embeddings // ignore: cast_nullable_to_non_nullable - as List?, + embedding: freezed == embedding + ? _value.embedding + : embedding // ignore: cast_nullable_to_non_nullable + as ContentEmbedding?, ) as $Val); } + + @override + @pragma('vm:prefer-inline') + $ContentEmbeddingCopyWith<$Res>? get embedding { + if (_value.embedding == null) { + return null; + } + + return $ContentEmbeddingCopyWith<$Res>(_value.embedding!, (value) { + return _then(_value.copyWith(embedding: value) as $Val); + }); + } } /// @nodoc -abstract class _$$BatchEmbedContentsResponseImplCopyWith<$Res> - implements $BatchEmbedContentsResponseCopyWith<$Res> { - factory _$$BatchEmbedContentsResponseImplCopyWith( - _$BatchEmbedContentsResponseImpl value, - $Res Function(_$BatchEmbedContentsResponseImpl) then) = - __$$BatchEmbedContentsResponseImplCopyWithImpl<$Res>; +abstract class _$$EmbedContentResponseImplCopyWith<$Res> + implements $EmbedContentResponseCopyWith<$Res> { + factory _$$EmbedContentResponseImplCopyWith(_$EmbedContentResponseImpl value, + $Res Function(_$EmbedContentResponseImpl) then) = + __$$EmbedContentResponseImplCopyWithImpl<$Res>; @override @useResult - $Res call( - {@JsonKey(includeIfNull: false) List? embeddings}); + $Res call({@JsonKey(includeIfNull: false) ContentEmbedding? embedding}); + + @override + $ContentEmbeddingCopyWith<$Res>? get embedding; } /// @nodoc -class __$$BatchEmbedContentsResponseImplCopyWithImpl<$Res> - extends _$BatchEmbedContentsResponseCopyWithImpl<$Res, - _$BatchEmbedContentsResponseImpl> - implements _$$BatchEmbedContentsResponseImplCopyWith<$Res> { - __$$BatchEmbedContentsResponseImplCopyWithImpl( - _$BatchEmbedContentsResponseImpl _value, - $Res Function(_$BatchEmbedContentsResponseImpl) _then) +class __$$EmbedContentResponseImplCopyWithImpl<$Res> + extends _$EmbedContentResponseCopyWithImpl<$Res, _$EmbedContentResponseImpl> + implements _$$EmbedContentResponseImplCopyWith<$Res> { + __$$EmbedContentResponseImplCopyWithImpl(_$EmbedContentResponseImpl _value, + $Res Function(_$EmbedContentResponseImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @override $Res call({ - Object? embeddings = freezed, + Object? embedding = freezed, }) { - return _then(_$BatchEmbedContentsResponseImpl( - embeddings: freezed == embeddings - ? _value._embeddings - : embeddings // ignore: cast_nullable_to_non_nullable - as List?, + return _then(_$EmbedContentResponseImpl( + embedding: freezed == embedding + ? _value.embedding + : embedding // ignore: cast_nullable_to_non_nullable + as ContentEmbedding?, )); } } /// @nodoc @JsonSerializable() -class _$BatchEmbedContentsResponseImpl extends _BatchEmbedContentsResponse { - const _$BatchEmbedContentsResponseImpl( - {@JsonKey(includeIfNull: false) final List? embeddings}) - : _embeddings = embeddings, - super._(); - - factory _$BatchEmbedContentsResponseImpl.fromJson( - Map json) => - _$$BatchEmbedContentsResponseImplFromJson(json); +class _$EmbedContentResponseImpl extends _EmbedContentResponse { + const _$EmbedContentResponseImpl( + {@JsonKey(includeIfNull: false) this.embedding}) + : super._(); - /// Output only. The embeddings for each request, in the same order as provided in the batch request. - final List? _embeddings; + factory _$EmbedContentResponseImpl.fromJson(Map json) => + _$$EmbedContentResponseImplFromJson(json); - /// Output only. The embeddings for each request, in the same order as provided in the batch request. + /// Output only. The embedding generated from the input content. @override @JsonKey(includeIfNull: false) - List? get embeddings { - final value = _embeddings; - if (value == null) return null; - if (_embeddings is EqualUnmodifiableListView) return _embeddings; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(value); - } + final ContentEmbedding? embedding; @override String toString() { - return 'BatchEmbedContentsResponse(embeddings: $embeddings)'; + return 'EmbedContentResponse(embedding: $embedding)'; } @override bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$BatchEmbedContentsResponseImpl && - const DeepCollectionEquality() - .equals(other._embeddings, _embeddings)); + other is _$EmbedContentResponseImpl && + (identical(other.embedding, embedding) || + other.embedding == embedding)); } @JsonKey(ignore: true) @override - int get hashCode => Object.hash( - runtimeType, const DeepCollectionEquality().hash(_embeddings)); + int get hashCode => Object.hash(runtimeType, embedding); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$BatchEmbedContentsResponseImplCopyWith<_$BatchEmbedContentsResponseImpl> - get copyWith => __$$BatchEmbedContentsResponseImplCopyWithImpl< - _$BatchEmbedContentsResponseImpl>(this, _$identity); + _$$EmbedContentResponseImplCopyWith<_$EmbedContentResponseImpl> + get copyWith => + __$$EmbedContentResponseImplCopyWithImpl<_$EmbedContentResponseImpl>( + this, _$identity); @override Map toJson() { - return _$$BatchEmbedContentsResponseImplToJson( + return _$$EmbedContentResponseImplToJson( this, ); } } -abstract class _BatchEmbedContentsResponse extends BatchEmbedContentsResponse { - const factory _BatchEmbedContentsResponse( - {@JsonKey(includeIfNull: false) - final List? embeddings}) = - _$BatchEmbedContentsResponseImpl; - const _BatchEmbedContentsResponse._() : super._(); +abstract class _EmbedContentResponse extends EmbedContentResponse { + const factory _EmbedContentResponse( + {@JsonKey(includeIfNull: false) final ContentEmbedding? embedding}) = + _$EmbedContentResponseImpl; + const _EmbedContentResponse._() : super._(); - factory _BatchEmbedContentsResponse.fromJson(Map json) = - _$BatchEmbedContentsResponseImpl.fromJson; + factory _EmbedContentResponse.fromJson(Map json) = + _$EmbedContentResponseImpl.fromJson; @override - /// Output only. The embeddings for each request, in the same order as provided in the batch request. + /// Output only. The embedding generated from the input content. @JsonKey(includeIfNull: false) - List? get embeddings; + ContentEmbedding? get embedding; @override @JsonKey(ignore: true) - _$$BatchEmbedContentsResponseImplCopyWith<_$BatchEmbedContentsResponseImpl> + _$$EmbedContentResponseImplCopyWith<_$EmbedContentResponseImpl> get copyWith => throw _privateConstructorUsedError; } -CitationMetadata _$CitationMetadataFromJson(Map json) { - return _CitationMetadata.fromJson(json); +CountTokensResponse _$CountTokensResponseFromJson(Map json) { + return _CountTokensResponse.fromJson(json); } /// @nodoc -mixin _$CitationMetadata { - /// Citations to sources for a specific response. +mixin _$CountTokensResponse { + /// The number of tokens that the `model` tokenizes the `prompt` into. Always non-negative. @JsonKey(includeIfNull: false) - List? get citationSources => - throw _privateConstructorUsedError; + int? get totalTokens => throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) - $CitationMetadataCopyWith get copyWith => + $CountTokensResponseCopyWith get copyWith => throw _privateConstructorUsedError; } /// @nodoc -abstract class $CitationMetadataCopyWith<$Res> { - factory $CitationMetadataCopyWith( - CitationMetadata value, $Res Function(CitationMetadata) then) = - _$CitationMetadataCopyWithImpl<$Res, CitationMetadata>; +abstract class $CountTokensResponseCopyWith<$Res> { + factory $CountTokensResponseCopyWith( + CountTokensResponse value, $Res Function(CountTokensResponse) then) = + _$CountTokensResponseCopyWithImpl<$Res, CountTokensResponse>; @useResult - $Res call( - {@JsonKey(includeIfNull: false) List? citationSources}); + $Res call({@JsonKey(includeIfNull: false) int? totalTokens}); } /// @nodoc -class _$CitationMetadataCopyWithImpl<$Res, $Val extends CitationMetadata> - implements $CitationMetadataCopyWith<$Res> { - _$CitationMetadataCopyWithImpl(this._value, this._then); +class _$CountTokensResponseCopyWithImpl<$Res, $Val extends CountTokensResponse> + implements $CountTokensResponseCopyWith<$Res> { + _$CountTokensResponseCopyWithImpl(this._value, this._then); // ignore: unused_field final $Val _value; @@ -5359,164 +5060,157 @@ class _$CitationMetadataCopyWithImpl<$Res, $Val extends CitationMetadata> @pragma('vm:prefer-inline') @override $Res call({ - Object? citationSources = freezed, + Object? totalTokens = freezed, }) { return _then(_value.copyWith( - citationSources: freezed == citationSources - ? _value.citationSources - : citationSources // ignore: cast_nullable_to_non_nullable - as List?, + totalTokens: freezed == totalTokens + ? _value.totalTokens + : totalTokens // ignore: cast_nullable_to_non_nullable + as int?, ) as $Val); } } /// @nodoc -abstract class _$$CitationMetadataImplCopyWith<$Res> - implements $CitationMetadataCopyWith<$Res> { - factory _$$CitationMetadataImplCopyWith(_$CitationMetadataImpl value, - $Res Function(_$CitationMetadataImpl) then) = - __$$CitationMetadataImplCopyWithImpl<$Res>; +abstract class _$$CountTokensResponseImplCopyWith<$Res> + implements $CountTokensResponseCopyWith<$Res> { + factory _$$CountTokensResponseImplCopyWith(_$CountTokensResponseImpl value, + $Res Function(_$CountTokensResponseImpl) then) = + __$$CountTokensResponseImplCopyWithImpl<$Res>; @override @useResult - $Res call( - {@JsonKey(includeIfNull: false) List? citationSources}); + $Res call({@JsonKey(includeIfNull: false) int? totalTokens}); } /// @nodoc -class __$$CitationMetadataImplCopyWithImpl<$Res> - extends _$CitationMetadataCopyWithImpl<$Res, _$CitationMetadataImpl> - implements _$$CitationMetadataImplCopyWith<$Res> { - __$$CitationMetadataImplCopyWithImpl(_$CitationMetadataImpl _value, - $Res Function(_$CitationMetadataImpl) _then) +class __$$CountTokensResponseImplCopyWithImpl<$Res> + extends _$CountTokensResponseCopyWithImpl<$Res, _$CountTokensResponseImpl> + implements _$$CountTokensResponseImplCopyWith<$Res> { + __$$CountTokensResponseImplCopyWithImpl(_$CountTokensResponseImpl _value, + $Res Function(_$CountTokensResponseImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @override $Res call({ - Object? citationSources = freezed, + Object? totalTokens = freezed, }) { - return _then(_$CitationMetadataImpl( - citationSources: freezed == citationSources - ? _value._citationSources - : citationSources // ignore: cast_nullable_to_non_nullable - as List?, + return _then(_$CountTokensResponseImpl( + totalTokens: freezed == totalTokens + ? _value.totalTokens + : totalTokens // ignore: cast_nullable_to_non_nullable + as int?, )); } } /// @nodoc @JsonSerializable() -class _$CitationMetadataImpl extends _CitationMetadata { - const _$CitationMetadataImpl( - {@JsonKey(includeIfNull: false) - final List? citationSources}) - : _citationSources = citationSources, - super._(); - - factory _$CitationMetadataImpl.fromJson(Map json) => - _$$CitationMetadataImplFromJson(json); +class _$CountTokensResponseImpl extends _CountTokensResponse { + const _$CountTokensResponseImpl( + {@JsonKey(includeIfNull: false) this.totalTokens}) + : super._(); - /// Citations to sources for a specific response. - final List? _citationSources; + factory _$CountTokensResponseImpl.fromJson(Map json) => + _$$CountTokensResponseImplFromJson(json); - /// Citations to sources for a specific response. + /// The number of tokens that the `model` tokenizes the `prompt` into. Always non-negative. @override @JsonKey(includeIfNull: false) - List? get citationSources { - final value = _citationSources; - if (value == null) return null; - if (_citationSources is EqualUnmodifiableListView) return _citationSources; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(value); - } + final int? totalTokens; @override String toString() { - return 'CitationMetadata(citationSources: $citationSources)'; + return 'CountTokensResponse(totalTokens: $totalTokens)'; } @override bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$CitationMetadataImpl && - const DeepCollectionEquality() - .equals(other._citationSources, _citationSources)); + other is _$CountTokensResponseImpl && + (identical(other.totalTokens, totalTokens) || + other.totalTokens == totalTokens)); } @JsonKey(ignore: true) @override - int get hashCode => Object.hash( - runtimeType, const DeepCollectionEquality().hash(_citationSources)); + int get hashCode => Object.hash(runtimeType, totalTokens); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$CitationMetadataImplCopyWith<_$CitationMetadataImpl> get copyWith => - __$$CitationMetadataImplCopyWithImpl<_$CitationMetadataImpl>( + _$$CountTokensResponseImplCopyWith<_$CountTokensResponseImpl> get copyWith => + __$$CountTokensResponseImplCopyWithImpl<_$CountTokensResponseImpl>( this, _$identity); @override Map toJson() { - return _$$CitationMetadataImplToJson( + return _$$CountTokensResponseImplToJson( this, ); } } -abstract class _CitationMetadata extends CitationMetadata { - const factory _CitationMetadata( - {@JsonKey(includeIfNull: false) - final List? citationSources}) = _$CitationMetadataImpl; - const _CitationMetadata._() : super._(); +abstract class _CountTokensResponse extends CountTokensResponse { + const factory _CountTokensResponse( + {@JsonKey(includeIfNull: false) final int? totalTokens}) = + _$CountTokensResponseImpl; + const _CountTokensResponse._() : super._(); - factory _CitationMetadata.fromJson(Map json) = - _$CitationMetadataImpl.fromJson; + factory _CountTokensResponse.fromJson(Map json) = + _$CountTokensResponseImpl.fromJson; @override - /// Citations to sources for a specific response. + /// The number of tokens that the `model` tokenizes the `prompt` into. Always non-negative. @JsonKey(includeIfNull: false) - List? get citationSources; + int? get totalTokens; @override @JsonKey(ignore: true) - _$$CitationMetadataImplCopyWith<_$CitationMetadataImpl> get copyWith => + _$$CountTokensResponseImplCopyWith<_$CountTokensResponseImpl> get copyWith => throw _privateConstructorUsedError; } -Blob _$BlobFromJson(Map json) { - return _Blob.fromJson(json); +GenerateContentResponse _$GenerateContentResponseFromJson( + Map json) { + return _GenerateContentResponse.fromJson(json); } /// @nodoc -mixin _$Blob { - /// The IANA standard MIME type of the source data. Accepted types include: "image/png", "image/jpeg", "image/heic", "image/heif", "image/webp". +mixin _$GenerateContentResponse { + /// Returns the prompt's feedback related to the content filters. @JsonKey(includeIfNull: false) - String? get mimeType => throw _privateConstructorUsedError; + PromptFeedback? get promptFeedback => throw _privateConstructorUsedError; - /// Raw bytes for media formats. + /// Candidate responses from the model. @JsonKey(includeIfNull: false) - String? get data => throw _privateConstructorUsedError; + List? get candidates => throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) - $BlobCopyWith get copyWith => throw _privateConstructorUsedError; + $GenerateContentResponseCopyWith get copyWith => + throw _privateConstructorUsedError; } /// @nodoc -abstract class $BlobCopyWith<$Res> { - factory $BlobCopyWith(Blob value, $Res Function(Blob) then) = - _$BlobCopyWithImpl<$Res, Blob>; +abstract class $GenerateContentResponseCopyWith<$Res> { + factory $GenerateContentResponseCopyWith(GenerateContentResponse value, + $Res Function(GenerateContentResponse) then) = + _$GenerateContentResponseCopyWithImpl<$Res, GenerateContentResponse>; @useResult $Res call( - {@JsonKey(includeIfNull: false) String? mimeType, - @JsonKey(includeIfNull: false) String? data}); + {@JsonKey(includeIfNull: false) PromptFeedback? promptFeedback, + @JsonKey(includeIfNull: false) List? candidates}); + + $PromptFeedbackCopyWith<$Res>? get promptFeedback; } /// @nodoc -class _$BlobCopyWithImpl<$Res, $Val extends Blob> - implements $BlobCopyWith<$Res> { - _$BlobCopyWithImpl(this._value, this._then); +class _$GenerateContentResponseCopyWithImpl<$Res, + $Val extends GenerateContentResponse> + implements $GenerateContentResponseCopyWith<$Res> { + _$GenerateContentResponseCopyWithImpl(this._value, this._then); // ignore: unused_field final $Val _value; @@ -5526,183 +5220,252 @@ class _$BlobCopyWithImpl<$Res, $Val extends Blob> @pragma('vm:prefer-inline') @override $Res call({ - Object? mimeType = freezed, - Object? data = freezed, + Object? promptFeedback = freezed, + Object? candidates = freezed, }) { return _then(_value.copyWith( - mimeType: freezed == mimeType - ? _value.mimeType - : mimeType // ignore: cast_nullable_to_non_nullable - as String?, - data: freezed == data - ? _value.data - : data // ignore: cast_nullable_to_non_nullable - as String?, + promptFeedback: freezed == promptFeedback + ? _value.promptFeedback + : promptFeedback // ignore: cast_nullable_to_non_nullable + as PromptFeedback?, + candidates: freezed == candidates + ? _value.candidates + : candidates // ignore: cast_nullable_to_non_nullable + as List?, ) as $Val); } + + @override + @pragma('vm:prefer-inline') + $PromptFeedbackCopyWith<$Res>? get promptFeedback { + if (_value.promptFeedback == null) { + return null; + } + + return $PromptFeedbackCopyWith<$Res>(_value.promptFeedback!, (value) { + return _then(_value.copyWith(promptFeedback: value) as $Val); + }); + } } /// @nodoc -abstract class _$$BlobImplCopyWith<$Res> implements $BlobCopyWith<$Res> { - factory _$$BlobImplCopyWith( - _$BlobImpl value, $Res Function(_$BlobImpl) then) = - __$$BlobImplCopyWithImpl<$Res>; +abstract class _$$GenerateContentResponseImplCopyWith<$Res> + implements $GenerateContentResponseCopyWith<$Res> { + factory _$$GenerateContentResponseImplCopyWith( + _$GenerateContentResponseImpl value, + $Res Function(_$GenerateContentResponseImpl) then) = + __$$GenerateContentResponseImplCopyWithImpl<$Res>; @override @useResult $Res call( - {@JsonKey(includeIfNull: false) String? mimeType, - @JsonKey(includeIfNull: false) String? data}); + {@JsonKey(includeIfNull: false) PromptFeedback? promptFeedback, + @JsonKey(includeIfNull: false) List? candidates}); + + @override + $PromptFeedbackCopyWith<$Res>? get promptFeedback; } /// @nodoc -class __$$BlobImplCopyWithImpl<$Res> - extends _$BlobCopyWithImpl<$Res, _$BlobImpl> - implements _$$BlobImplCopyWith<$Res> { - __$$BlobImplCopyWithImpl(_$BlobImpl _value, $Res Function(_$BlobImpl) _then) +class __$$GenerateContentResponseImplCopyWithImpl<$Res> + extends _$GenerateContentResponseCopyWithImpl<$Res, + _$GenerateContentResponseImpl> + implements _$$GenerateContentResponseImplCopyWith<$Res> { + __$$GenerateContentResponseImplCopyWithImpl( + _$GenerateContentResponseImpl _value, + $Res Function(_$GenerateContentResponseImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @override $Res call({ - Object? mimeType = freezed, - Object? data = freezed, + Object? promptFeedback = freezed, + Object? candidates = freezed, }) { - return _then(_$BlobImpl( - mimeType: freezed == mimeType - ? _value.mimeType - : mimeType // ignore: cast_nullable_to_non_nullable - as String?, - data: freezed == data - ? _value.data - : data // ignore: cast_nullable_to_non_nullable - as String?, + return _then(_$GenerateContentResponseImpl( + promptFeedback: freezed == promptFeedback + ? _value.promptFeedback + : promptFeedback // ignore: cast_nullable_to_non_nullable + as PromptFeedback?, + candidates: freezed == candidates + ? _value._candidates + : candidates // ignore: cast_nullable_to_non_nullable + as List?, )); } } /// @nodoc @JsonSerializable() -class _$BlobImpl extends _Blob { - const _$BlobImpl( - {@JsonKey(includeIfNull: false) this.mimeType, - @JsonKey(includeIfNull: false) this.data}) - : super._(); +class _$GenerateContentResponseImpl extends _GenerateContentResponse { + const _$GenerateContentResponseImpl( + {@JsonKey(includeIfNull: false) this.promptFeedback, + @JsonKey(includeIfNull: false) final List? candidates}) + : _candidates = candidates, + super._(); - factory _$BlobImpl.fromJson(Map json) => - _$$BlobImplFromJson(json); + factory _$GenerateContentResponseImpl.fromJson(Map json) => + _$$GenerateContentResponseImplFromJson(json); - /// The IANA standard MIME type of the source data. Accepted types include: "image/png", "image/jpeg", "image/heic", "image/heif", "image/webp". + /// Returns the prompt's feedback related to the content filters. @override @JsonKey(includeIfNull: false) - final String? mimeType; + final PromptFeedback? promptFeedback; - /// Raw bytes for media formats. + /// Candidate responses from the model. + final List? _candidates; + + /// Candidate responses from the model. @override @JsonKey(includeIfNull: false) - final String? data; + List? get candidates { + final value = _candidates; + if (value == null) return null; + if (_candidates is EqualUnmodifiableListView) return _candidates; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(value); + } @override String toString() { - return 'Blob(mimeType: $mimeType, data: $data)'; + return 'GenerateContentResponse(promptFeedback: $promptFeedback, candidates: $candidates)'; } @override bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$BlobImpl && - (identical(other.mimeType, mimeType) || - other.mimeType == mimeType) && - (identical(other.data, data) || other.data == data)); + other is _$GenerateContentResponseImpl && + (identical(other.promptFeedback, promptFeedback) || + other.promptFeedback == promptFeedback) && + const DeepCollectionEquality() + .equals(other._candidates, _candidates)); } @JsonKey(ignore: true) @override - int get hashCode => Object.hash(runtimeType, mimeType, data); + int get hashCode => Object.hash(runtimeType, promptFeedback, + const DeepCollectionEquality().hash(_candidates)); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$BlobImplCopyWith<_$BlobImpl> get copyWith => - __$$BlobImplCopyWithImpl<_$BlobImpl>(this, _$identity); + _$$GenerateContentResponseImplCopyWith<_$GenerateContentResponseImpl> + get copyWith => __$$GenerateContentResponseImplCopyWithImpl< + _$GenerateContentResponseImpl>(this, _$identity); @override Map toJson() { - return _$$BlobImplToJson( + return _$$GenerateContentResponseImplToJson( this, ); } } -abstract class _Blob extends Blob { - const factory _Blob( - {@JsonKey(includeIfNull: false) final String? mimeType, - @JsonKey(includeIfNull: false) final String? data}) = _$BlobImpl; - const _Blob._() : super._(); +abstract class _GenerateContentResponse extends GenerateContentResponse { + const factory _GenerateContentResponse( + {@JsonKey(includeIfNull: false) final PromptFeedback? promptFeedback, + @JsonKey(includeIfNull: false) final List? candidates}) = + _$GenerateContentResponseImpl; + const _GenerateContentResponse._() : super._(); - factory _Blob.fromJson(Map json) = _$BlobImpl.fromJson; + factory _GenerateContentResponse.fromJson(Map json) = + _$GenerateContentResponseImpl.fromJson; @override - /// The IANA standard MIME type of the source data. Accepted types include: "image/png", "image/jpeg", "image/heic", "image/heif", "image/webp". + /// Returns the prompt's feedback related to the content filters. @JsonKey(includeIfNull: false) - String? get mimeType; + PromptFeedback? get promptFeedback; @override - /// Raw bytes for media formats. + /// Candidate responses from the model. @JsonKey(includeIfNull: false) - String? get data; + List? get candidates; @override @JsonKey(ignore: true) - _$$BlobImplCopyWith<_$BlobImpl> get copyWith => - throw _privateConstructorUsedError; + _$$GenerateContentResponseImplCopyWith<_$GenerateContentResponseImpl> + get copyWith => throw _privateConstructorUsedError; } -CitationSource _$CitationSourceFromJson(Map json) { - return _CitationSource.fromJson(json); +Model _$ModelFromJson(Map json) { + return _Model.fromJson(json); } /// @nodoc -mixin _$CitationSource { - /// Optional. End of the attributed segment, exclusive. +mixin _$Model { + /// Required. The resource name of the `Model`. Format: `models/{model}` with a `{model}` naming convention of: * "{base_model_id}-{version}" Examples: * `models/chat-bison-001` @JsonKey(includeIfNull: false) - int? get endIndex => throw _privateConstructorUsedError; + String? get name => throw _privateConstructorUsedError; - /// Optional. License for the GitHub project that is attributed as a source for segment. License info is required for code citations. + /// The human-readable name of the model. E.g. "Chat Bison". The name can be up to 128 characters long and can consist of any UTF-8 characters. @JsonKey(includeIfNull: false) - String? get license => throw _privateConstructorUsedError; + String? get displayName => throw _privateConstructorUsedError; - /// Optional. URI that is attributed as a source for a portion of the text. + /// A short description of the model. @JsonKey(includeIfNull: false) - String? get uri => throw _privateConstructorUsedError; + String? get description => throw _privateConstructorUsedError; - /// Optional. Start of segment of the response that is attributed to this source. Index indicates the start of the segment, measured in bytes. + /// Required. The version number of the model. This represents the major version @JsonKey(includeIfNull: false) - int? get startIndex => throw _privateConstructorUsedError; + String? get version => throw _privateConstructorUsedError; + + /// Required. The name of the base model, pass this to the generation request. Examples: * `chat-bison` + @JsonKey(includeIfNull: false) + String? get baseModelId => throw _privateConstructorUsedError; + + /// Controls the randomness of the output. Values can range over `[0.0,1.0]`, inclusive. A value closer to `1.0` will produce responses that are more varied, while a value closer to `0.0` will typically result in less surprising responses from the model. This value specifies default to be used by the backend while making the call to the model. + @JsonKey(includeIfNull: false) + double? get temperature => throw _privateConstructorUsedError; + + /// For Top-k sampling. Top-k sampling considers the set of `top_k` most probable tokens. This value specifies default to be used by the backend while making the call to the model. + @JsonKey(includeIfNull: false) + int? get topK => throw _privateConstructorUsedError; + + /// For Nucleus sampling. Nucleus sampling considers the smallest set of tokens whose probability sum is at least `top_p`. This value specifies default to be used by the backend while making the call to the model. + @JsonKey(includeIfNull: false) + double? get topP => throw _privateConstructorUsedError; + + /// Maximum number of input tokens allowed for this model. + @JsonKey(includeIfNull: false) + int? get inputTokenLimit => throw _privateConstructorUsedError; + + /// Maximum number of output tokens available for this model. + @JsonKey(includeIfNull: false) + int? get outputTokenLimit => throw _privateConstructorUsedError; + + /// The model's supported generation methods. The method names are defined as Pascal case strings, such as `generateMessage` which correspond to API methods. + @JsonKey(includeIfNull: false) + List? get supportedGenerationMethods => + throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) - $CitationSourceCopyWith get copyWith => - throw _privateConstructorUsedError; + $ModelCopyWith get copyWith => throw _privateConstructorUsedError; } /// @nodoc -abstract class $CitationSourceCopyWith<$Res> { - factory $CitationSourceCopyWith( - CitationSource value, $Res Function(CitationSource) then) = - _$CitationSourceCopyWithImpl<$Res, CitationSource>; +abstract class $ModelCopyWith<$Res> { + factory $ModelCopyWith(Model value, $Res Function(Model) then) = + _$ModelCopyWithImpl<$Res, Model>; @useResult $Res call( - {@JsonKey(includeIfNull: false) int? endIndex, - @JsonKey(includeIfNull: false) String? license, - @JsonKey(includeIfNull: false) String? uri, - @JsonKey(includeIfNull: false) int? startIndex}); + {@JsonKey(includeIfNull: false) String? name, + @JsonKey(includeIfNull: false) String? displayName, + @JsonKey(includeIfNull: false) String? description, + @JsonKey(includeIfNull: false) String? version, + @JsonKey(includeIfNull: false) String? baseModelId, + @JsonKey(includeIfNull: false) double? temperature, + @JsonKey(includeIfNull: false) int? topK, + @JsonKey(includeIfNull: false) double? topP, + @JsonKey(includeIfNull: false) int? inputTokenLimit, + @JsonKey(includeIfNull: false) int? outputTokenLimit, + @JsonKey(includeIfNull: false) List? supportedGenerationMethods}); } /// @nodoc -class _$CitationSourceCopyWithImpl<$Res, $Val extends CitationSource> - implements $CitationSourceCopyWith<$Res> { - _$CitationSourceCopyWithImpl(this._value, this._then); +class _$ModelCopyWithImpl<$Res, $Val extends Model> + implements $ModelCopyWith<$Res> { + _$ModelCopyWithImpl(this._value, this._then); // ignore: unused_field final $Val _value; @@ -5712,231 +5475,431 @@ class _$CitationSourceCopyWithImpl<$Res, $Val extends CitationSource> @pragma('vm:prefer-inline') @override $Res call({ - Object? endIndex = freezed, - Object? license = freezed, - Object? uri = freezed, - Object? startIndex = freezed, + Object? name = freezed, + Object? displayName = freezed, + Object? description = freezed, + Object? version = freezed, + Object? baseModelId = freezed, + Object? temperature = freezed, + Object? topK = freezed, + Object? topP = freezed, + Object? inputTokenLimit = freezed, + Object? outputTokenLimit = freezed, + Object? supportedGenerationMethods = freezed, }) { return _then(_value.copyWith( - endIndex: freezed == endIndex - ? _value.endIndex - : endIndex // ignore: cast_nullable_to_non_nullable - as int?, - license: freezed == license - ? _value.license - : license // ignore: cast_nullable_to_non_nullable + name: freezed == name + ? _value.name + : name // ignore: cast_nullable_to_non_nullable as String?, - uri: freezed == uri - ? _value.uri - : uri // ignore: cast_nullable_to_non_nullable + displayName: freezed == displayName + ? _value.displayName + : displayName // ignore: cast_nullable_to_non_nullable as String?, - startIndex: freezed == startIndex - ? _value.startIndex - : startIndex // ignore: cast_nullable_to_non_nullable + description: freezed == description + ? _value.description + : description // ignore: cast_nullable_to_non_nullable + as String?, + version: freezed == version + ? _value.version + : version // ignore: cast_nullable_to_non_nullable + as String?, + baseModelId: freezed == baseModelId + ? _value.baseModelId + : baseModelId // ignore: cast_nullable_to_non_nullable + as String?, + temperature: freezed == temperature + ? _value.temperature + : temperature // ignore: cast_nullable_to_non_nullable + as double?, + topK: freezed == topK + ? _value.topK + : topK // ignore: cast_nullable_to_non_nullable + as int?, + topP: freezed == topP + ? _value.topP + : topP // ignore: cast_nullable_to_non_nullable + as double?, + inputTokenLimit: freezed == inputTokenLimit + ? _value.inputTokenLimit + : inputTokenLimit // ignore: cast_nullable_to_non_nullable + as int?, + outputTokenLimit: freezed == outputTokenLimit + ? _value.outputTokenLimit + : outputTokenLimit // ignore: cast_nullable_to_non_nullable as int?, + supportedGenerationMethods: freezed == supportedGenerationMethods + ? _value.supportedGenerationMethods + : supportedGenerationMethods // ignore: cast_nullable_to_non_nullable + as List?, ) as $Val); } } /// @nodoc -abstract class _$$CitationSourceImplCopyWith<$Res> - implements $CitationSourceCopyWith<$Res> { - factory _$$CitationSourceImplCopyWith(_$CitationSourceImpl value, - $Res Function(_$CitationSourceImpl) then) = - __$$CitationSourceImplCopyWithImpl<$Res>; +abstract class _$$ModelImplCopyWith<$Res> implements $ModelCopyWith<$Res> { + factory _$$ModelImplCopyWith( + _$ModelImpl value, $Res Function(_$ModelImpl) then) = + __$$ModelImplCopyWithImpl<$Res>; @override @useResult $Res call( - {@JsonKey(includeIfNull: false) int? endIndex, - @JsonKey(includeIfNull: false) String? license, - @JsonKey(includeIfNull: false) String? uri, - @JsonKey(includeIfNull: false) int? startIndex}); + {@JsonKey(includeIfNull: false) String? name, + @JsonKey(includeIfNull: false) String? displayName, + @JsonKey(includeIfNull: false) String? description, + @JsonKey(includeIfNull: false) String? version, + @JsonKey(includeIfNull: false) String? baseModelId, + @JsonKey(includeIfNull: false) double? temperature, + @JsonKey(includeIfNull: false) int? topK, + @JsonKey(includeIfNull: false) double? topP, + @JsonKey(includeIfNull: false) int? inputTokenLimit, + @JsonKey(includeIfNull: false) int? outputTokenLimit, + @JsonKey(includeIfNull: false) List? supportedGenerationMethods}); } /// @nodoc -class __$$CitationSourceImplCopyWithImpl<$Res> - extends _$CitationSourceCopyWithImpl<$Res, _$CitationSourceImpl> - implements _$$CitationSourceImplCopyWith<$Res> { - __$$CitationSourceImplCopyWithImpl( - _$CitationSourceImpl _value, $Res Function(_$CitationSourceImpl) _then) +class __$$ModelImplCopyWithImpl<$Res> + extends _$ModelCopyWithImpl<$Res, _$ModelImpl> + implements _$$ModelImplCopyWith<$Res> { + __$$ModelImplCopyWithImpl( + _$ModelImpl _value, $Res Function(_$ModelImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @override $Res call({ - Object? endIndex = freezed, - Object? license = freezed, - Object? uri = freezed, - Object? startIndex = freezed, + Object? name = freezed, + Object? displayName = freezed, + Object? description = freezed, + Object? version = freezed, + Object? baseModelId = freezed, + Object? temperature = freezed, + Object? topK = freezed, + Object? topP = freezed, + Object? inputTokenLimit = freezed, + Object? outputTokenLimit = freezed, + Object? supportedGenerationMethods = freezed, }) { - return _then(_$CitationSourceImpl( - endIndex: freezed == endIndex - ? _value.endIndex - : endIndex // ignore: cast_nullable_to_non_nullable - as int?, - license: freezed == license - ? _value.license - : license // ignore: cast_nullable_to_non_nullable + return _then(_$ModelImpl( + name: freezed == name + ? _value.name + : name // ignore: cast_nullable_to_non_nullable as String?, - uri: freezed == uri - ? _value.uri - : uri // ignore: cast_nullable_to_non_nullable + displayName: freezed == displayName + ? _value.displayName + : displayName // ignore: cast_nullable_to_non_nullable as String?, - startIndex: freezed == startIndex - ? _value.startIndex - : startIndex // ignore: cast_nullable_to_non_nullable + description: freezed == description + ? _value.description + : description // ignore: cast_nullable_to_non_nullable + as String?, + version: freezed == version + ? _value.version + : version // ignore: cast_nullable_to_non_nullable + as String?, + baseModelId: freezed == baseModelId + ? _value.baseModelId + : baseModelId // ignore: cast_nullable_to_non_nullable + as String?, + temperature: freezed == temperature + ? _value.temperature + : temperature // ignore: cast_nullable_to_non_nullable + as double?, + topK: freezed == topK + ? _value.topK + : topK // ignore: cast_nullable_to_non_nullable + as int?, + topP: freezed == topP + ? _value.topP + : topP // ignore: cast_nullable_to_non_nullable + as double?, + inputTokenLimit: freezed == inputTokenLimit + ? _value.inputTokenLimit + : inputTokenLimit // ignore: cast_nullable_to_non_nullable + as int?, + outputTokenLimit: freezed == outputTokenLimit + ? _value.outputTokenLimit + : outputTokenLimit // ignore: cast_nullable_to_non_nullable as int?, + supportedGenerationMethods: freezed == supportedGenerationMethods + ? _value._supportedGenerationMethods + : supportedGenerationMethods // ignore: cast_nullable_to_non_nullable + as List?, )); } } /// @nodoc @JsonSerializable() -class _$CitationSourceImpl extends _CitationSource { - const _$CitationSourceImpl( - {@JsonKey(includeIfNull: false) this.endIndex, - @JsonKey(includeIfNull: false) this.license, - @JsonKey(includeIfNull: false) this.uri, - @JsonKey(includeIfNull: false) this.startIndex}) - : super._(); +class _$ModelImpl extends _Model { + const _$ModelImpl( + {@JsonKey(includeIfNull: false) this.name, + @JsonKey(includeIfNull: false) this.displayName, + @JsonKey(includeIfNull: false) this.description, + @JsonKey(includeIfNull: false) this.version, + @JsonKey(includeIfNull: false) this.baseModelId, + @JsonKey(includeIfNull: false) this.temperature, + @JsonKey(includeIfNull: false) this.topK, + @JsonKey(includeIfNull: false) this.topP, + @JsonKey(includeIfNull: false) this.inputTokenLimit, + @JsonKey(includeIfNull: false) this.outputTokenLimit, + @JsonKey(includeIfNull: false) + final List? supportedGenerationMethods}) + : _supportedGenerationMethods = supportedGenerationMethods, + super._(); - factory _$CitationSourceImpl.fromJson(Map json) => - _$$CitationSourceImplFromJson(json); + factory _$ModelImpl.fromJson(Map json) => + _$$ModelImplFromJson(json); - /// Optional. End of the attributed segment, exclusive. + /// Required. The resource name of the `Model`. Format: `models/{model}` with a `{model}` naming convention of: * "{base_model_id}-{version}" Examples: * `models/chat-bison-001` @override @JsonKey(includeIfNull: false) - final int? endIndex; + final String? name; - /// Optional. License for the GitHub project that is attributed as a source for segment. License info is required for code citations. + /// The human-readable name of the model. E.g. "Chat Bison". The name can be up to 128 characters long and can consist of any UTF-8 characters. @override @JsonKey(includeIfNull: false) - final String? license; + final String? displayName; - /// Optional. URI that is attributed as a source for a portion of the text. + /// A short description of the model. @override @JsonKey(includeIfNull: false) - final String? uri; + final String? description; - /// Optional. Start of segment of the response that is attributed to this source. Index indicates the start of the segment, measured in bytes. + /// Required. The version number of the model. This represents the major version @override @JsonKey(includeIfNull: false) - final int? startIndex; + final String? version; + + /// Required. The name of the base model, pass this to the generation request. Examples: * `chat-bison` + @override + @JsonKey(includeIfNull: false) + final String? baseModelId; + + /// Controls the randomness of the output. Values can range over `[0.0,1.0]`, inclusive. A value closer to `1.0` will produce responses that are more varied, while a value closer to `0.0` will typically result in less surprising responses from the model. This value specifies default to be used by the backend while making the call to the model. + @override + @JsonKey(includeIfNull: false) + final double? temperature; + + /// For Top-k sampling. Top-k sampling considers the set of `top_k` most probable tokens. This value specifies default to be used by the backend while making the call to the model. + @override + @JsonKey(includeIfNull: false) + final int? topK; + + /// For Nucleus sampling. Nucleus sampling considers the smallest set of tokens whose probability sum is at least `top_p`. This value specifies default to be used by the backend while making the call to the model. + @override + @JsonKey(includeIfNull: false) + final double? topP; + + /// Maximum number of input tokens allowed for this model. + @override + @JsonKey(includeIfNull: false) + final int? inputTokenLimit; + + /// Maximum number of output tokens available for this model. + @override + @JsonKey(includeIfNull: false) + final int? outputTokenLimit; + + /// The model's supported generation methods. The method names are defined as Pascal case strings, such as `generateMessage` which correspond to API methods. + final List? _supportedGenerationMethods; + + /// The model's supported generation methods. The method names are defined as Pascal case strings, such as `generateMessage` which correspond to API methods. + @override + @JsonKey(includeIfNull: false) + List? get supportedGenerationMethods { + final value = _supportedGenerationMethods; + if (value == null) return null; + if (_supportedGenerationMethods is EqualUnmodifiableListView) + return _supportedGenerationMethods; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(value); + } @override String toString() { - return 'CitationSource(endIndex: $endIndex, license: $license, uri: $uri, startIndex: $startIndex)'; + return 'Model(name: $name, displayName: $displayName, description: $description, version: $version, baseModelId: $baseModelId, temperature: $temperature, topK: $topK, topP: $topP, inputTokenLimit: $inputTokenLimit, outputTokenLimit: $outputTokenLimit, supportedGenerationMethods: $supportedGenerationMethods)'; } @override bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$CitationSourceImpl && - (identical(other.endIndex, endIndex) || - other.endIndex == endIndex) && - (identical(other.license, license) || other.license == license) && - (identical(other.uri, uri) || other.uri == uri) && - (identical(other.startIndex, startIndex) || - other.startIndex == startIndex)); + other is _$ModelImpl && + (identical(other.name, name) || other.name == name) && + (identical(other.displayName, displayName) || + other.displayName == displayName) && + (identical(other.description, description) || + other.description == description) && + (identical(other.version, version) || other.version == version) && + (identical(other.baseModelId, baseModelId) || + other.baseModelId == baseModelId) && + (identical(other.temperature, temperature) || + other.temperature == temperature) && + (identical(other.topK, topK) || other.topK == topK) && + (identical(other.topP, topP) || other.topP == topP) && + (identical(other.inputTokenLimit, inputTokenLimit) || + other.inputTokenLimit == inputTokenLimit) && + (identical(other.outputTokenLimit, outputTokenLimit) || + other.outputTokenLimit == outputTokenLimit) && + const DeepCollectionEquality().equals( + other._supportedGenerationMethods, + _supportedGenerationMethods)); } @JsonKey(ignore: true) @override - int get hashCode => - Object.hash(runtimeType, endIndex, license, uri, startIndex); + int get hashCode => Object.hash( + runtimeType, + name, + displayName, + description, + version, + baseModelId, + temperature, + topK, + topP, + inputTokenLimit, + outputTokenLimit, + const DeepCollectionEquality().hash(_supportedGenerationMethods)); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$CitationSourceImplCopyWith<_$CitationSourceImpl> get copyWith => - __$$CitationSourceImplCopyWithImpl<_$CitationSourceImpl>( - this, _$identity); + _$$ModelImplCopyWith<_$ModelImpl> get copyWith => + __$$ModelImplCopyWithImpl<_$ModelImpl>(this, _$identity); @override Map toJson() { - return _$$CitationSourceImplToJson( + return _$$ModelImplToJson( this, ); } } -abstract class _CitationSource extends CitationSource { - const factory _CitationSource( - {@JsonKey(includeIfNull: false) final int? endIndex, - @JsonKey(includeIfNull: false) final String? license, - @JsonKey(includeIfNull: false) final String? uri, - @JsonKey(includeIfNull: false) final int? startIndex}) = - _$CitationSourceImpl; - const _CitationSource._() : super._(); +abstract class _Model extends Model { + const factory _Model( + {@JsonKey(includeIfNull: false) final String? name, + @JsonKey(includeIfNull: false) final String? displayName, + @JsonKey(includeIfNull: false) final String? description, + @JsonKey(includeIfNull: false) final String? version, + @JsonKey(includeIfNull: false) final String? baseModelId, + @JsonKey(includeIfNull: false) final double? temperature, + @JsonKey(includeIfNull: false) final int? topK, + @JsonKey(includeIfNull: false) final double? topP, + @JsonKey(includeIfNull: false) final int? inputTokenLimit, + @JsonKey(includeIfNull: false) final int? outputTokenLimit, + @JsonKey(includeIfNull: false) + final List? supportedGenerationMethods}) = _$ModelImpl; + const _Model._() : super._(); - factory _CitationSource.fromJson(Map json) = - _$CitationSourceImpl.fromJson; + factory _Model.fromJson(Map json) = _$ModelImpl.fromJson; @override - /// Optional. End of the attributed segment, exclusive. + /// Required. The resource name of the `Model`. Format: `models/{model}` with a `{model}` naming convention of: * "{base_model_id}-{version}" Examples: * `models/chat-bison-001` @JsonKey(includeIfNull: false) - int? get endIndex; + String? get name; + @override + + /// The human-readable name of the model. E.g. "Chat Bison". The name can be up to 128 characters long and can consist of any UTF-8 characters. + @JsonKey(includeIfNull: false) + String? get displayName; + @override + + /// A short description of the model. + @JsonKey(includeIfNull: false) + String? get description; + @override + + /// Required. The version number of the model. This represents the major version + @JsonKey(includeIfNull: false) + String? get version; + @override + + /// Required. The name of the base model, pass this to the generation request. Examples: * `chat-bison` + @JsonKey(includeIfNull: false) + String? get baseModelId; + @override + + /// Controls the randomness of the output. Values can range over `[0.0,1.0]`, inclusive. A value closer to `1.0` will produce responses that are more varied, while a value closer to `0.0` will typically result in less surprising responses from the model. This value specifies default to be used by the backend while making the call to the model. + @JsonKey(includeIfNull: false) + double? get temperature; + @override + + /// For Top-k sampling. Top-k sampling considers the set of `top_k` most probable tokens. This value specifies default to be used by the backend while making the call to the model. + @JsonKey(includeIfNull: false) + int? get topK; + @override + + /// For Nucleus sampling. Nucleus sampling considers the smallest set of tokens whose probability sum is at least `top_p`. This value specifies default to be used by the backend while making the call to the model. + @JsonKey(includeIfNull: false) + double? get topP; @override - /// Optional. License for the GitHub project that is attributed as a source for segment. License info is required for code citations. + /// Maximum number of input tokens allowed for this model. @JsonKey(includeIfNull: false) - String? get license; + int? get inputTokenLimit; @override - /// Optional. URI that is attributed as a source for a portion of the text. + /// Maximum number of output tokens available for this model. @JsonKey(includeIfNull: false) - String? get uri; + int? get outputTokenLimit; @override - /// Optional. Start of segment of the response that is attributed to this source. Index indicates the start of the segment, measured in bytes. + /// The model's supported generation methods. The method names are defined as Pascal case strings, such as `generateMessage` which correspond to API methods. @JsonKey(includeIfNull: false) - int? get startIndex; + List? get supportedGenerationMethods; @override @JsonKey(ignore: true) - _$$CitationSourceImplCopyWith<_$CitationSourceImpl> get copyWith => + _$$ModelImplCopyWith<_$ModelImpl> get copyWith => throw _privateConstructorUsedError; } -Status _$StatusFromJson(Map json) { - return _Status.fromJson(json); +GenerateContentRequest _$GenerateContentRequestFromJson( + Map json) { + return _GenerateContentRequest.fromJson(json); } /// @nodoc -mixin _$Status { - /// A list of messages that carry the error details. There is a common set of message types for APIs to use. +mixin _$GenerateContentRequest { + /// Optional. Configuration options for model generation and outputs. @JsonKey(includeIfNull: false) - List>? get details => throw _privateConstructorUsedError; + GenerationConfig? get generationConfig => throw _privateConstructorUsedError; - /// The status code, which should be an enum value of google.rpc.Code. + /// Required. The content of the current conversation with the model. For single-turn queries, this is a single instance. For multi-turn queries, this is a repeated field that contains conversation history + latest request. @JsonKey(includeIfNull: false) - int? get code => throw _privateConstructorUsedError; + List? get contents => throw _privateConstructorUsedError; - /// A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client. + /// Optional. A list of unique `SafetySetting` instances for blocking unsafe content. This will be enforced on the `GenerateContentRequest.contents` and `GenerateContentResponse.candidates`. There should not be more than one setting for each `SafetyCategory` type. The API will block any contents and responses that fail to meet the thresholds set by these settings. This list overrides the default settings for each `SafetyCategory` specified in the safety_settings. If there is no `SafetySetting` for a given `SafetyCategory` provided in the list, the API will use the default safety setting for that category. Harm categories HARM_CATEGORY_HATE_SPEECH, HARM_CATEGORY_SEXUALLY_EXPLICIT, HARM_CATEGORY_DANGEROUS_CONTENT, HARM_CATEGORY_HARASSMENT are supported. @JsonKey(includeIfNull: false) - String? get message => throw _privateConstructorUsedError; + List? get safetySettings => throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) - $StatusCopyWith get copyWith => throw _privateConstructorUsedError; + $GenerateContentRequestCopyWith get copyWith => + throw _privateConstructorUsedError; } /// @nodoc -abstract class $StatusCopyWith<$Res> { - factory $StatusCopyWith(Status value, $Res Function(Status) then) = - _$StatusCopyWithImpl<$Res, Status>; +abstract class $GenerateContentRequestCopyWith<$Res> { + factory $GenerateContentRequestCopyWith(GenerateContentRequest value, + $Res Function(GenerateContentRequest) then) = + _$GenerateContentRequestCopyWithImpl<$Res, GenerateContentRequest>; @useResult $Res call( - {@JsonKey(includeIfNull: false) List>? details, - @JsonKey(includeIfNull: false) int? code, - @JsonKey(includeIfNull: false) String? message}); + {@JsonKey(includeIfNull: false) GenerationConfig? generationConfig, + @JsonKey(includeIfNull: false) List? contents, + @JsonKey(includeIfNull: false) List? safetySettings}); + + $GenerationConfigCopyWith<$Res>? get generationConfig; } /// @nodoc -class _$StatusCopyWithImpl<$Res, $Val extends Status> - implements $StatusCopyWith<$Res> { - _$StatusCopyWithImpl(this._value, this._then); +class _$GenerateContentRequestCopyWithImpl<$Res, + $Val extends GenerateContentRequest> + implements $GenerateContentRequestCopyWith<$Res> { + _$GenerateContentRequestCopyWithImpl(this._value, this._then); // ignore: unused_field final $Val _value; @@ -5946,169 +5909,207 @@ class _$StatusCopyWithImpl<$Res, $Val extends Status> @pragma('vm:prefer-inline') @override $Res call({ - Object? details = freezed, - Object? code = freezed, - Object? message = freezed, + Object? generationConfig = freezed, + Object? contents = freezed, + Object? safetySettings = freezed, }) { return _then(_value.copyWith( - details: freezed == details - ? _value.details - : details // ignore: cast_nullable_to_non_nullable - as List>?, - code: freezed == code - ? _value.code - : code // ignore: cast_nullable_to_non_nullable - as int?, - message: freezed == message - ? _value.message - : message // ignore: cast_nullable_to_non_nullable - as String?, + generationConfig: freezed == generationConfig + ? _value.generationConfig + : generationConfig // ignore: cast_nullable_to_non_nullable + as GenerationConfig?, + contents: freezed == contents + ? _value.contents + : contents // ignore: cast_nullable_to_non_nullable + as List?, + safetySettings: freezed == safetySettings + ? _value.safetySettings + : safetySettings // ignore: cast_nullable_to_non_nullable + as List?, ) as $Val); } + + @override + @pragma('vm:prefer-inline') + $GenerationConfigCopyWith<$Res>? get generationConfig { + if (_value.generationConfig == null) { + return null; + } + + return $GenerationConfigCopyWith<$Res>(_value.generationConfig!, (value) { + return _then(_value.copyWith(generationConfig: value) as $Val); + }); + } } /// @nodoc -abstract class _$$StatusImplCopyWith<$Res> implements $StatusCopyWith<$Res> { - factory _$$StatusImplCopyWith( - _$StatusImpl value, $Res Function(_$StatusImpl) then) = - __$$StatusImplCopyWithImpl<$Res>; +abstract class _$$GenerateContentRequestImplCopyWith<$Res> + implements $GenerateContentRequestCopyWith<$Res> { + factory _$$GenerateContentRequestImplCopyWith( + _$GenerateContentRequestImpl value, + $Res Function(_$GenerateContentRequestImpl) then) = + __$$GenerateContentRequestImplCopyWithImpl<$Res>; @override @useResult $Res call( - {@JsonKey(includeIfNull: false) List>? details, - @JsonKey(includeIfNull: false) int? code, - @JsonKey(includeIfNull: false) String? message}); + {@JsonKey(includeIfNull: false) GenerationConfig? generationConfig, + @JsonKey(includeIfNull: false) List? contents, + @JsonKey(includeIfNull: false) List? safetySettings}); + + @override + $GenerationConfigCopyWith<$Res>? get generationConfig; } /// @nodoc -class __$$StatusImplCopyWithImpl<$Res> - extends _$StatusCopyWithImpl<$Res, _$StatusImpl> - implements _$$StatusImplCopyWith<$Res> { - __$$StatusImplCopyWithImpl( - _$StatusImpl _value, $Res Function(_$StatusImpl) _then) +class __$$GenerateContentRequestImplCopyWithImpl<$Res> + extends _$GenerateContentRequestCopyWithImpl<$Res, + _$GenerateContentRequestImpl> + implements _$$GenerateContentRequestImplCopyWith<$Res> { + __$$GenerateContentRequestImplCopyWithImpl( + _$GenerateContentRequestImpl _value, + $Res Function(_$GenerateContentRequestImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @override $Res call({ - Object? details = freezed, - Object? code = freezed, - Object? message = freezed, + Object? generationConfig = freezed, + Object? contents = freezed, + Object? safetySettings = freezed, }) { - return _then(_$StatusImpl( - details: freezed == details - ? _value._details - : details // ignore: cast_nullable_to_non_nullable - as List>?, - code: freezed == code - ? _value.code - : code // ignore: cast_nullable_to_non_nullable - as int?, - message: freezed == message - ? _value.message - : message // ignore: cast_nullable_to_non_nullable - as String?, + return _then(_$GenerateContentRequestImpl( + generationConfig: freezed == generationConfig + ? _value.generationConfig + : generationConfig // ignore: cast_nullable_to_non_nullable + as GenerationConfig?, + contents: freezed == contents + ? _value._contents + : contents // ignore: cast_nullable_to_non_nullable + as List?, + safetySettings: freezed == safetySettings + ? _value._safetySettings + : safetySettings // ignore: cast_nullable_to_non_nullable + as List?, )); } } /// @nodoc @JsonSerializable() -class _$StatusImpl extends _Status { - const _$StatusImpl( - {@JsonKey(includeIfNull: false) final List>? details, - @JsonKey(includeIfNull: false) this.code, - @JsonKey(includeIfNull: false) this.message}) - : _details = details, +class _$GenerateContentRequestImpl extends _GenerateContentRequest { + const _$GenerateContentRequestImpl( + {@JsonKey(includeIfNull: false) this.generationConfig, + @JsonKey(includeIfNull: false) final List? contents, + @JsonKey(includeIfNull: false) final List? safetySettings}) + : _contents = contents, + _safetySettings = safetySettings, super._(); - factory _$StatusImpl.fromJson(Map json) => - _$$StatusImplFromJson(json); + factory _$GenerateContentRequestImpl.fromJson(Map json) => + _$$GenerateContentRequestImplFromJson(json); - /// A list of messages that carry the error details. There is a common set of message types for APIs to use. - final List>? _details; + /// Optional. Configuration options for model generation and outputs. + @override + @JsonKey(includeIfNull: false) + final GenerationConfig? generationConfig; - /// A list of messages that carry the error details. There is a common set of message types for APIs to use. + /// Required. The content of the current conversation with the model. For single-turn queries, this is a single instance. For multi-turn queries, this is a repeated field that contains conversation history + latest request. + final List? _contents; + + /// Required. The content of the current conversation with the model. For single-turn queries, this is a single instance. For multi-turn queries, this is a repeated field that contains conversation history + latest request. @override @JsonKey(includeIfNull: false) - List>? get details { - final value = _details; + List? get contents { + final value = _contents; if (value == null) return null; - if (_details is EqualUnmodifiableListView) return _details; + if (_contents is EqualUnmodifiableListView) return _contents; // ignore: implicit_dynamic_type return EqualUnmodifiableListView(value); } - /// The status code, which should be an enum value of google.rpc.Code. - @override - @JsonKey(includeIfNull: false) - final int? code; + /// Optional. A list of unique `SafetySetting` instances for blocking unsafe content. This will be enforced on the `GenerateContentRequest.contents` and `GenerateContentResponse.candidates`. There should not be more than one setting for each `SafetyCategory` type. The API will block any contents and responses that fail to meet the thresholds set by these settings. This list overrides the default settings for each `SafetyCategory` specified in the safety_settings. If there is no `SafetySetting` for a given `SafetyCategory` provided in the list, the API will use the default safety setting for that category. Harm categories HARM_CATEGORY_HATE_SPEECH, HARM_CATEGORY_SEXUALLY_EXPLICIT, HARM_CATEGORY_DANGEROUS_CONTENT, HARM_CATEGORY_HARASSMENT are supported. + final List? _safetySettings; - /// A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client. + /// Optional. A list of unique `SafetySetting` instances for blocking unsafe content. This will be enforced on the `GenerateContentRequest.contents` and `GenerateContentResponse.candidates`. There should not be more than one setting for each `SafetyCategory` type. The API will block any contents and responses that fail to meet the thresholds set by these settings. This list overrides the default settings for each `SafetyCategory` specified in the safety_settings. If there is no `SafetySetting` for a given `SafetyCategory` provided in the list, the API will use the default safety setting for that category. Harm categories HARM_CATEGORY_HATE_SPEECH, HARM_CATEGORY_SEXUALLY_EXPLICIT, HARM_CATEGORY_DANGEROUS_CONTENT, HARM_CATEGORY_HARASSMENT are supported. @override @JsonKey(includeIfNull: false) - final String? message; + List? get safetySettings { + final value = _safetySettings; + if (value == null) return null; + if (_safetySettings is EqualUnmodifiableListView) return _safetySettings; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(value); + } @override String toString() { - return 'Status(details: $details, code: $code, message: $message)'; + return 'GenerateContentRequest(generationConfig: $generationConfig, contents: $contents, safetySettings: $safetySettings)'; } @override bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$StatusImpl && - const DeepCollectionEquality().equals(other._details, _details) && - (identical(other.code, code) || other.code == code) && - (identical(other.message, message) || other.message == message)); + other is _$GenerateContentRequestImpl && + (identical(other.generationConfig, generationConfig) || + other.generationConfig == generationConfig) && + const DeepCollectionEquality().equals(other._contents, _contents) && + const DeepCollectionEquality() + .equals(other._safetySettings, _safetySettings)); } @JsonKey(ignore: true) @override - int get hashCode => Object.hash(runtimeType, - const DeepCollectionEquality().hash(_details), code, message); + int get hashCode => Object.hash( + runtimeType, + generationConfig, + const DeepCollectionEquality().hash(_contents), + const DeepCollectionEquality().hash(_safetySettings)); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$StatusImplCopyWith<_$StatusImpl> get copyWith => - __$$StatusImplCopyWithImpl<_$StatusImpl>(this, _$identity); + _$$GenerateContentRequestImplCopyWith<_$GenerateContentRequestImpl> + get copyWith => __$$GenerateContentRequestImplCopyWithImpl< + _$GenerateContentRequestImpl>(this, _$identity); @override Map toJson() { - return _$$StatusImplToJson( + return _$$GenerateContentRequestImplToJson( this, ); } } -abstract class _Status extends Status { - const factory _Status( - {@JsonKey(includeIfNull: false) final List>? details, - @JsonKey(includeIfNull: false) final int? code, - @JsonKey(includeIfNull: false) final String? message}) = _$StatusImpl; - const _Status._() : super._(); +abstract class _GenerateContentRequest extends GenerateContentRequest { + const factory _GenerateContentRequest( + {@JsonKey(includeIfNull: false) final GenerationConfig? generationConfig, + @JsonKey(includeIfNull: false) final List? contents, + @JsonKey(includeIfNull: false) + final List? + safetySettings}) = _$GenerateContentRequestImpl; + const _GenerateContentRequest._() : super._(); - factory _Status.fromJson(Map json) = _$StatusImpl.fromJson; + factory _GenerateContentRequest.fromJson(Map json) = + _$GenerateContentRequestImpl.fromJson; @override - /// A list of messages that carry the error details. There is a common set of message types for APIs to use. + /// Optional. Configuration options for model generation and outputs. @JsonKey(includeIfNull: false) - List>? get details; + GenerationConfig? get generationConfig; @override - /// The status code, which should be an enum value of google.rpc.Code. + /// Required. The content of the current conversation with the model. For single-turn queries, this is a single instance. For multi-turn queries, this is a repeated field that contains conversation history + latest request. @JsonKey(includeIfNull: false) - int? get code; + List? get contents; @override - /// A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client. + /// Optional. A list of unique `SafetySetting` instances for blocking unsafe content. This will be enforced on the `GenerateContentRequest.contents` and `GenerateContentResponse.candidates`. There should not be more than one setting for each `SafetyCategory` type. The API will block any contents and responses that fail to meet the thresholds set by these settings. This list overrides the default settings for each `SafetyCategory` specified in the safety_settings. If there is no `SafetySetting` for a given `SafetyCategory` provided in the list, the API will use the default safety setting for that category. Harm categories HARM_CATEGORY_HATE_SPEECH, HARM_CATEGORY_SEXUALLY_EXPLICIT, HARM_CATEGORY_DANGEROUS_CONTENT, HARM_CATEGORY_HARASSMENT are supported. @JsonKey(includeIfNull: false) - String? get message; + List? get safetySettings; @override @JsonKey(ignore: true) - _$$StatusImplCopyWith<_$StatusImpl> get copyWith => - throw _privateConstructorUsedError; + _$$GenerateContentRequestImplCopyWith<_$GenerateContentRequestImpl> + get copyWith => throw _privateConstructorUsedError; } diff --git a/packages/googleai_dart/lib/src/generated/schema/schema.g.dart b/packages/googleai_dart/lib/src/generated/schema/schema.g.dart index 053c36ec..95aa7834 100644 --- a/packages/googleai_dart/lib/src/generated/schema/schema.g.dart +++ b/packages/googleai_dart/lib/src/generated/schema/schema.g.dart @@ -8,45 +8,16 @@ part of 'schema.dart'; // JsonSerializableGenerator // ************************************************************************** -_$TuningSnapshotImpl _$$TuningSnapshotImplFromJson(Map json) => - _$TuningSnapshotImpl( - step: json['step'] as int?, - computeTime: json['computeTime'] as String?, - epoch: json['epoch'] as int?, - meanLoss: (json['meanLoss'] as num?)?.toDouble(), - ); - -Map _$$TuningSnapshotImplToJson( - _$TuningSnapshotImpl instance) { - final val = {}; - - void writeNotNull(String key, dynamic value) { - if (value != null) { - val[key] = value; - } - } - - writeNotNull('step', instance.step); - writeNotNull('computeTime', instance.computeTime); - writeNotNull('epoch', instance.epoch); - writeNotNull('meanLoss', instance.meanLoss); - return val; -} - -_$CreateTunedModelMetadataImpl _$$CreateTunedModelMetadataImplFromJson( +_$BatchEmbedContentsResponseImpl _$$BatchEmbedContentsResponseImplFromJson( Map json) => - _$CreateTunedModelMetadataImpl( - totalSteps: json['totalSteps'] as int?, - tunedModel: json['tunedModel'] as String?, - completedSteps: json['completedSteps'] as int?, - snapshots: (json['snapshots'] as List?) - ?.map((e) => TuningSnapshot.fromJson(e as Map)) + _$BatchEmbedContentsResponseImpl( + embeddings: (json['embeddings'] as List?) + ?.map((e) => ContentEmbedding.fromJson(e as Map)) .toList(), - completedPercent: (json['completedPercent'] as num?)?.toDouble(), ); -Map _$$CreateTunedModelMetadataImplToJson( - _$CreateTunedModelMetadataImpl instance) { +Map _$$BatchEmbedContentsResponseImplToJson( + _$BatchEmbedContentsResponseImpl instance) { final val = {}; void writeNotNull(String key, dynamic value) { @@ -55,30 +26,31 @@ Map _$$CreateTunedModelMetadataImplToJson( } } - writeNotNull('totalSteps', instance.totalSteps); - writeNotNull('tunedModel', instance.tunedModel); - writeNotNull('completedSteps', instance.completedSteps); writeNotNull( - 'snapshots', instance.snapshots?.map((e) => e.toJson()).toList()); - writeNotNull('completedPercent', instance.completedPercent); + 'embeddings', instance.embeddings?.map((e) => e.toJson()).toList()); return val; } -_$GenerationConfigImpl _$$GenerationConfigImplFromJson( - Map json) => - _$GenerationConfigImpl( - topP: (json['topP'] as num?)?.toDouble(), - topK: json['topK'] as int?, - candidateCount: json['candidateCount'] as int?, - maxOutputTokens: json['maxOutputTokens'] as int?, - temperature: (json['temperature'] as num?)?.toDouble(), - stopSequences: (json['stopSequences'] as List?) - ?.map((e) => e as String) +_$CandidateImpl _$$CandidateImplFromJson(Map json) => + _$CandidateImpl( + content: json['content'] == null + ? null + : Content.fromJson(json['content'] as Map), + finishReason: $enumDecodeNullable( + _$CandidateFinishReasonEnumMap, json['finishReason'], + unknownValue: JsonKey.nullForUndefinedEnumValue), + citationMetadata: json['citationMetadata'] == null + ? null + : CitationMetadata.fromJson( + json['citationMetadata'] as Map), + index: json['index'] as int?, + tokenCount: json['tokenCount'] as int?, + safetyRatings: (json['safetyRatings'] as List?) + ?.map((e) => SafetyRating.fromJson(e as Map)) .toList(), ); -Map _$$GenerationConfigImplToJson( - _$GenerationConfigImpl instance) { +Map _$$CandidateImplToJson(_$CandidateImpl instance) { final val = {}; void writeNotNull(String key, dynamic value) { @@ -87,26 +59,40 @@ Map _$$GenerationConfigImplToJson( } } - writeNotNull('topP', instance.topP); - writeNotNull('topK', instance.topK); - writeNotNull('candidateCount', instance.candidateCount); - writeNotNull('maxOutputTokens', instance.maxOutputTokens); - writeNotNull('temperature', instance.temperature); - writeNotNull('stopSequences', instance.stopSequences); + writeNotNull('content', instance.content?.toJson()); + writeNotNull( + 'finishReason', _$CandidateFinishReasonEnumMap[instance.finishReason]); + writeNotNull('citationMetadata', instance.citationMetadata?.toJson()); + writeNotNull('index', instance.index); + writeNotNull('tokenCount', instance.tokenCount); + writeNotNull( + 'safetyRatings', instance.safetyRatings?.map((e) => e.toJson()).toList()); return val; } -_$ListOperationsResponseImpl _$$ListOperationsResponseImplFromJson( +const _$CandidateFinishReasonEnumMap = { + CandidateFinishReason.finishReasonUnspecified: 'FINISH_REASON_UNSPECIFIED', + CandidateFinishReason.stop: 'STOP', + CandidateFinishReason.maxTokens: 'MAX_TOKENS', + CandidateFinishReason.safety: 'SAFETY', + CandidateFinishReason.recitation: 'RECITATION', + CandidateFinishReason.other: 'OTHER', +}; + +_$CreateTunedModelMetadataImpl _$$CreateTunedModelMetadataImplFromJson( Map json) => - _$ListOperationsResponseImpl( - nextPageToken: json['nextPageToken'] as String?, - operations: (json['operations'] as List?) - ?.map((e) => Operation.fromJson(e as Map)) + _$CreateTunedModelMetadataImpl( + totalSteps: json['totalSteps'] as int?, + tunedModel: json['tunedModel'] as String?, + completedSteps: json['completedSteps'] as int?, + snapshots: (json['snapshots'] as List?) + ?.map((e) => TuningSnapshot.fromJson(e as Map)) .toList(), + completedPercent: (json['completedPercent'] as num?)?.toDouble(), ); -Map _$$ListOperationsResponseImplToJson( - _$ListOperationsResponseImpl instance) { +Map _$$CreateTunedModelMetadataImplToJson( + _$CreateTunedModelMetadataImpl instance) { final val = {}; void writeNotNull(String key, dynamic value) { @@ -115,30 +101,25 @@ Map _$$ListOperationsResponseImplToJson( } } - writeNotNull('nextPageToken', instance.nextPageToken); + writeNotNull('totalSteps', instance.totalSteps); + writeNotNull('tunedModel', instance.tunedModel); + writeNotNull('completedSteps', instance.completedSteps); writeNotNull( - 'operations', instance.operations?.map((e) => e.toJson()).toList()); + 'snapshots', instance.snapshots?.map((e) => e.toJson()).toList()); + writeNotNull('completedPercent', instance.completedPercent); return val; } -_$ModelImpl _$$ModelImplFromJson(Map json) => _$ModelImpl( - name: json['name'] as String?, - displayName: json['displayName'] as String?, - description: json['description'] as String?, - topK: json['topK'] as int?, - version: json['version'] as String?, - temperature: (json['temperature'] as num?)?.toDouble(), - topP: (json['topP'] as num?)?.toDouble(), - baseModelId: json['baseModelId'] as String?, - inputTokenLimit: json['inputTokenLimit'] as int?, - outputTokenLimit: json['outputTokenLimit'] as int?, - supportedGenerationMethods: - (json['supportedGenerationMethods'] as List?) - ?.map((e) => e as String) - .toList(), +_$BatchEmbedContentsRequestImpl _$$BatchEmbedContentsRequestImplFromJson( + Map json) => + _$BatchEmbedContentsRequestImpl( + requests: (json['requests'] as List?) + ?.map((e) => EmbedContentRequest.fromJson(e as Map)) + .toList(), ); -Map _$$ModelImplToJson(_$ModelImpl instance) { +Map _$$BatchEmbedContentsRequestImplToJson( + _$BatchEmbedContentsRequestImpl instance) { final val = {}; void writeNotNull(String key, dynamic value) { @@ -147,18 +128,7 @@ Map _$$ModelImplToJson(_$ModelImpl instance) { } } - writeNotNull('name', instance.name); - writeNotNull('displayName', instance.displayName); - writeNotNull('description', instance.description); - writeNotNull('topK', instance.topK); - writeNotNull('version', instance.version); - writeNotNull('temperature', instance.temperature); - writeNotNull('topP', instance.topP); - writeNotNull('baseModelId', instance.baseModelId); - writeNotNull('inputTokenLimit', instance.inputTokenLimit); - writeNotNull('outputTokenLimit', instance.outputTokenLimit); - writeNotNull( - 'supportedGenerationMethods', instance.supportedGenerationMethods); + writeNotNull('requests', instance.requests?.map((e) => e.toJson()).toList()); return val; } @@ -235,28 +205,18 @@ Map _$$PartImplToJson(_$PartImpl instance) { return val; } -_$EmptyImpl _$$EmptyImplFromJson(Map json) => _$EmptyImpl(); - -Map _$$EmptyImplToJson(_$EmptyImpl instance) => - {}; - -_$GenerateContentRequestImpl _$$GenerateContentRequestImplFromJson( - Map json) => - _$GenerateContentRequestImpl( - generationConfig: json['generationConfig'] == null +_$OperationImpl _$$OperationImplFromJson(Map json) => + _$OperationImpl( + name: json['name'] as String?, + response: json['response'] as Map?, + done: json['done'] as bool?, + metadata: json['metadata'] as Map?, + error: json['error'] == null ? null - : GenerationConfig.fromJson( - json['generationConfig'] as Map), - contents: (json['contents'] as List?) - ?.map((e) => Content.fromJson(e as Map)) - .toList(), - safetySettings: (json['safetySettings'] as List?) - ?.map((e) => SafetySetting.fromJson(e as Map)) - .toList(), + : Status.fromJson(json['error'] as Map), ); -Map _$$GenerateContentRequestImplToJson( - _$GenerateContentRequestImpl instance) { +Map _$$OperationImplToJson(_$OperationImpl instance) { final val = {}; void writeNotNull(String key, dynamic value) { @@ -265,24 +225,23 @@ Map _$$GenerateContentRequestImplToJson( } } - writeNotNull('generationConfig', instance.generationConfig?.toJson()); - writeNotNull('contents', instance.contents?.map((e) => e.toJson()).toList()); - writeNotNull('safetySettings', - instance.safetySettings?.map((e) => e.toJson()).toList()); + writeNotNull('name', instance.name); + writeNotNull('response', instance.response); + writeNotNull('done', instance.done); + writeNotNull('metadata', instance.metadata); + writeNotNull('error', instance.error?.toJson()); return val; } -_$EmbedContentResponseImpl _$$EmbedContentResponseImplFromJson( - Map json) => - _$EmbedContentResponseImpl( - embedding: json['embedding'] == null - ? null - : ContentEmbedding.fromJson( - json['embedding'] as Map), +_$StatusImpl _$$StatusImplFromJson(Map json) => _$StatusImpl( + code: json['code'] as int?, + message: json['message'] as String?, + details: (json['details'] as List?) + ?.map((e) => e as Map) + .toList(), ); -Map _$$EmbedContentResponseImplToJson( - _$EmbedContentResponseImpl instance) { +Map _$$StatusImplToJson(_$StatusImpl instance) { final val = {}; void writeNotNull(String key, dynamic value) { @@ -291,19 +250,22 @@ Map _$$EmbedContentResponseImplToJson( } } - writeNotNull('embedding', instance.embedding?.toJson()); + writeNotNull('code', instance.code); + writeNotNull('message', instance.message); + writeNotNull('details', instance.details); return val; } -_$ContentImpl _$$ContentImplFromJson(Map json) => - _$ContentImpl( - role: json['role'] as String?, - parts: (json['parts'] as List?) - ?.map((e) => Part.fromJson(e as Map)) +_$CitationMetadataImpl _$$CitationMetadataImplFromJson( + Map json) => + _$CitationMetadataImpl( + citationSources: (json['citationSources'] as List?) + ?.map((e) => CitationSource.fromJson(e as Map)) .toList(), ); -Map _$$ContentImplToJson(_$ContentImpl instance) { +Map _$$CitationMetadataImplToJson( + _$CitationMetadataImpl instance) { final val = {}; void writeNotNull(String key, dynamic value) { @@ -312,35 +274,23 @@ Map _$$ContentImplToJson(_$ContentImpl instance) { } } - writeNotNull('role', instance.role); - writeNotNull('parts', instance.parts?.map((e) => e.toJson()).toList()); + writeNotNull('citationSources', + instance.citationSources?.map((e) => e.toJson()).toList()); return val; } -_$CancelOperationRequestImpl _$$CancelOperationRequestImplFromJson( - Map json) => - _$CancelOperationRequestImpl(); +_$SafetySettingImpl _$$SafetySettingImplFromJson(Map json) => + _$SafetySettingImpl( + category: $enumDecodeNullable( + _$SafetySettingCategoryEnumMap, json['category'], + unknownValue: JsonKey.nullForUndefinedEnumValue), + threshold: $enumDecodeNullable( + _$SafetySettingThresholdEnumMap, json['threshold'], + unknownValue: JsonKey.nullForUndefinedEnumValue), + ); -Map _$$CancelOperationRequestImplToJson( - _$CancelOperationRequestImpl instance) => - {}; - -_$EmbedContentRequestImpl _$$EmbedContentRequestImplFromJson( - Map json) => - _$EmbedContentRequestImpl( - content: json['content'] == null - ? null - : Content.fromJson(json['content'] as Map), - taskType: $enumDecodeNullable( - _$EmbedContentRequestTaskTypeEnumMap, json['taskType'], - unknownValue: JsonKey.nullForUndefinedEnumValue), - model: json['model'] as String?, - title: json['title'] as String?, - ); - -Map _$$EmbedContentRequestImplToJson( - _$EmbedContentRequestImpl instance) { - final val = {}; +Map _$$SafetySettingImplToJson(_$SafetySettingImpl instance) { + final val = {}; void writeNotNull(String key, dynamic value) { if (value != null) { @@ -348,34 +298,47 @@ Map _$$EmbedContentRequestImplToJson( } } - writeNotNull('content', instance.content?.toJson()); + writeNotNull('category', _$SafetySettingCategoryEnumMap[instance.category]); writeNotNull( - 'taskType', _$EmbedContentRequestTaskTypeEnumMap[instance.taskType]); - writeNotNull('model', instance.model); - writeNotNull('title', instance.title); + 'threshold', _$SafetySettingThresholdEnumMap[instance.threshold]); return val; } -const _$EmbedContentRequestTaskTypeEnumMap = { - EmbedContentRequestTaskType.taskTypeUnspecified: 'TASK_TYPE_UNSPECIFIED', - EmbedContentRequestTaskType.retrievalQuery: 'RETRIEVAL_QUERY', - EmbedContentRequestTaskType.retrievalDocument: 'RETRIEVAL_DOCUMENT', - EmbedContentRequestTaskType.semanticSimilarity: 'SEMANTIC_SIMILARITY', - EmbedContentRequestTaskType.classification: 'CLASSIFICATION', - EmbedContentRequestTaskType.clustering: 'CLUSTERING', +const _$SafetySettingCategoryEnumMap = { + SafetySettingCategory.harmCategoryUnspecified: 'HARM_CATEGORY_UNSPECIFIED', + SafetySettingCategory.harmCategoryDerogatory: 'HARM_CATEGORY_DEROGATORY', + SafetySettingCategory.harmCategoryToxicity: 'HARM_CATEGORY_TOXICITY', + SafetySettingCategory.harmCategoryViolence: 'HARM_CATEGORY_VIOLENCE', + SafetySettingCategory.harmCategorySexual: 'HARM_CATEGORY_SEXUAL', + SafetySettingCategory.harmCategoryMedical: 'HARM_CATEGORY_MEDICAL', + SafetySettingCategory.harmCategoryDangerous: 'HARM_CATEGORY_DANGEROUS', + SafetySettingCategory.harmCategoryHarassment: 'HARM_CATEGORY_HARASSMENT', + SafetySettingCategory.harmCategoryHateSpeech: 'HARM_CATEGORY_HATE_SPEECH', + SafetySettingCategory.harmCategorySexuallyExplicit: + 'HARM_CATEGORY_SEXUALLY_EXPLICIT', + SafetySettingCategory.harmCategoryDangerousContent: + 'HARM_CATEGORY_DANGEROUS_CONTENT', }; -_$ListModelsResponseImpl _$$ListModelsResponseImplFromJson( - Map json) => - _$ListModelsResponseImpl( - nextPageToken: json['nextPageToken'] as String?, - models: (json['models'] as List?) - ?.map((e) => Model.fromJson(e as Map)) - .toList(), +const _$SafetySettingThresholdEnumMap = { + SafetySettingThreshold.harmBlockThresholdUnspecified: + 'HARM_BLOCK_THRESHOLD_UNSPECIFIED', + SafetySettingThreshold.blockLowAndAbove: 'BLOCK_LOW_AND_ABOVE', + SafetySettingThreshold.blockMediumAndAbove: 'BLOCK_MEDIUM_AND_ABOVE', + SafetySettingThreshold.blockOnlyHigh: 'BLOCK_ONLY_HIGH', + SafetySettingThreshold.blockNone: 'BLOCK_NONE', +}; + +_$CitationSourceImpl _$$CitationSourceImplFromJson(Map json) => + _$CitationSourceImpl( + license: json['license'] as String?, + uri: json['uri'] as String?, + endIndex: json['endIndex'] as int?, + startIndex: json['startIndex'] as int?, ); -Map _$$ListModelsResponseImplToJson( - _$ListModelsResponseImpl instance) { +Map _$$CitationSourceImplToJson( + _$CitationSourceImpl instance) { final val = {}; void writeNotNull(String key, dynamic value) { @@ -384,21 +347,28 @@ Map _$$ListModelsResponseImplToJson( } } - writeNotNull('nextPageToken', instance.nextPageToken); - writeNotNull('models', instance.models?.map((e) => e.toJson()).toList()); + writeNotNull('license', instance.license); + writeNotNull('uri', instance.uri); + writeNotNull('endIndex', instance.endIndex); + writeNotNull('startIndex', instance.startIndex); return val; } -_$BatchEmbedContentsRequestImpl _$$BatchEmbedContentsRequestImplFromJson( +_$GenerationConfigImpl _$$GenerationConfigImplFromJson( Map json) => - _$BatchEmbedContentsRequestImpl( - requests: (json['requests'] as List?) - ?.map((e) => EmbedContentRequest.fromJson(e as Map)) + _$GenerationConfigImpl( + temperature: (json['temperature'] as num?)?.toDouble(), + stopSequences: (json['stopSequences'] as List?) + ?.map((e) => e as String) .toList(), + topK: json['topK'] as int?, + topP: (json['topP'] as num?)?.toDouble(), + candidateCount: json['candidateCount'] as int?, + maxOutputTokens: json['maxOutputTokens'] as int?, ); -Map _$$BatchEmbedContentsRequestImplToJson( - _$BatchEmbedContentsRequestImpl instance) { +Map _$$GenerationConfigImplToJson( + _$GenerationConfigImpl instance) { final val = {}; void writeNotNull(String key, dynamic value) { @@ -407,20 +377,25 @@ Map _$$BatchEmbedContentsRequestImplToJson( } } - writeNotNull('requests', instance.requests?.map((e) => e.toJson()).toList()); + writeNotNull('temperature', instance.temperature); + writeNotNull('stopSequences', instance.stopSequences); + writeNotNull('topK', instance.topK); + writeNotNull('topP', instance.topP); + writeNotNull('candidateCount', instance.candidateCount); + writeNotNull('maxOutputTokens', instance.maxOutputTokens); return val; } -_$ContentEmbeddingImpl _$$ContentEmbeddingImplFromJson( +_$CountTokensRequestImpl _$$CountTokensRequestImplFromJson( Map json) => - _$ContentEmbeddingImpl( - values: (json['values'] as List?) - ?.map((e) => (e as num).toDouble()) + _$CountTokensRequestImpl( + contents: (json['contents'] as List?) + ?.map((e) => Content.fromJson(e as Map)) .toList(), ); -Map _$$ContentEmbeddingImplToJson( - _$ContentEmbeddingImpl instance) { +Map _$$CountTokensRequestImplToJson( + _$CountTokensRequestImpl instance) { final val = {}; void writeNotNull(String key, dynamic value) { @@ -429,22 +404,20 @@ Map _$$ContentEmbeddingImplToJson( } } - writeNotNull('values', instance.values); + writeNotNull('contents', instance.contents?.map((e) => e.toJson()).toList()); return val; } -_$PromptFeedbackImpl _$$PromptFeedbackImplFromJson(Map json) => - _$PromptFeedbackImpl( - safetyRatings: (json['safetyRatings'] as List?) - ?.map((e) => SafetyRating.fromJson(e as Map)) - .toList(), - blockReason: $enumDecodeNullable( - _$PromptFeedbackBlockReasonEnumMap, json['blockReason'], - unknownValue: JsonKey.nullForUndefinedEnumValue), +_$TuningSnapshotImpl _$$TuningSnapshotImplFromJson(Map json) => + _$TuningSnapshotImpl( + step: json['step'] as int?, + computeTime: json['computeTime'] as String?, + epoch: json['epoch'] as int?, + meanLoss: (json['meanLoss'] as num?)?.toDouble(), ); -Map _$$PromptFeedbackImplToJson( - _$PromptFeedbackImpl instance) { +Map _$$TuningSnapshotImplToJson( + _$TuningSnapshotImpl instance) { final val = {}; void writeNotNull(String key, dynamic value) { @@ -453,31 +426,43 @@ Map _$$PromptFeedbackImplToJson( } } - writeNotNull( - 'safetyRatings', instance.safetyRatings?.map((e) => e.toJson()).toList()); - writeNotNull( - 'blockReason', _$PromptFeedbackBlockReasonEnumMap[instance.blockReason]); + writeNotNull('step', instance.step); + writeNotNull('computeTime', instance.computeTime); + writeNotNull('epoch', instance.epoch); + writeNotNull('meanLoss', instance.meanLoss); return val; } -const _$PromptFeedbackBlockReasonEnumMap = { - PromptFeedbackBlockReason.blockReasonUnspecified: 'BLOCK_REASON_UNSPECIFIED', - PromptFeedbackBlockReason.safety: 'SAFETY', - PromptFeedbackBlockReason.other: 'OTHER', -}; +_$BlobImpl _$$BlobImplFromJson(Map json) => _$BlobImpl( + mimeType: json['mimeType'] as String?, + data: json['data'] as String?, + ); -_$OperationImpl _$$OperationImplFromJson(Map json) => - _$OperationImpl( - name: json['name'] as String?, - response: json['response'] as Map?, - done: json['done'] as bool?, - metadata: json['metadata'] as Map?, - error: json['error'] == null - ? null - : Status.fromJson(json['error'] as Map), +Map _$$BlobImplToJson(_$BlobImpl instance) { + final val = {}; + + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull('mimeType', instance.mimeType); + writeNotNull('data', instance.data); + return val; +} + +_$ListModelsResponseImpl _$$ListModelsResponseImplFromJson( + Map json) => + _$ListModelsResponseImpl( + models: (json['models'] as List?) + ?.map((e) => Model.fromJson(e as Map)) + .toList(), + nextPageToken: json['nextPageToken'] as String?, ); -Map _$$OperationImplToJson(_$OperationImpl instance) { +Map _$$ListModelsResponseImplToJson( + _$ListModelsResponseImpl instance) { final val = {}; void writeNotNull(String key, dynamic value) { @@ -486,28 +471,21 @@ Map _$$OperationImplToJson(_$OperationImpl instance) { } } - writeNotNull('name', instance.name); - writeNotNull('response', instance.response); - writeNotNull('done', instance.done); - writeNotNull('metadata', instance.metadata); - writeNotNull('error', instance.error?.toJson()); + writeNotNull('models', instance.models?.map((e) => e.toJson()).toList()); + writeNotNull('nextPageToken', instance.nextPageToken); return val; } -_$GenerateContentResponseImpl _$$GenerateContentResponseImplFromJson( +_$ContentEmbeddingImpl _$$ContentEmbeddingImplFromJson( Map json) => - _$GenerateContentResponseImpl( - promptFeedback: json['promptFeedback'] == null - ? null - : PromptFeedback.fromJson( - json['promptFeedback'] as Map), - candidates: (json['candidates'] as List?) - ?.map((e) => Candidate.fromJson(e as Map)) + _$ContentEmbeddingImpl( + values: (json['values'] as List?) + ?.map((e) => (e as num).toDouble()) .toList(), ); -Map _$$GenerateContentResponseImplToJson( - _$GenerateContentResponseImpl instance) { +Map _$$ContentEmbeddingImplToJson( + _$ContentEmbeddingImpl instance) { final val = {}; void writeNotNull(String key, dynamic value) { @@ -516,23 +494,22 @@ Map _$$GenerateContentResponseImplToJson( } } - writeNotNull('promptFeedback', instance.promptFeedback?.toJson()); - writeNotNull( - 'candidates', instance.candidates?.map((e) => e.toJson()).toList()); + writeNotNull('values', instance.values); return val; } -_$SafetySettingImpl _$$SafetySettingImplFromJson(Map json) => - _$SafetySettingImpl( - category: $enumDecodeNullable( - _$SafetySettingCategoryEnumMap, json['category'], - unknownValue: JsonKey.nullForUndefinedEnumValue), - threshold: $enumDecodeNullable( - _$SafetySettingThresholdEnumMap, json['threshold'], +_$PromptFeedbackImpl _$$PromptFeedbackImplFromJson(Map json) => + _$PromptFeedbackImpl( + safetyRatings: (json['safetyRatings'] as List?) + ?.map((e) => SafetyRating.fromJson(e as Map)) + .toList(), + blockReason: $enumDecodeNullable( + _$PromptFeedbackBlockReasonEnumMap, json['blockReason'], unknownValue: JsonKey.nullForUndefinedEnumValue), ); -Map _$$SafetySettingImplToJson(_$SafetySettingImpl instance) { +Map _$$PromptFeedbackImplToJson( + _$PromptFeedbackImpl instance) { final val = {}; void writeNotNull(String key, dynamic value) { @@ -541,57 +518,34 @@ Map _$$SafetySettingImplToJson(_$SafetySettingImpl instance) { } } - writeNotNull('category', _$SafetySettingCategoryEnumMap[instance.category]); writeNotNull( - 'threshold', _$SafetySettingThresholdEnumMap[instance.threshold]); + 'safetyRatings', instance.safetyRatings?.map((e) => e.toJson()).toList()); + writeNotNull( + 'blockReason', _$PromptFeedbackBlockReasonEnumMap[instance.blockReason]); return val; } -const _$SafetySettingCategoryEnumMap = { - SafetySettingCategory.harmCategoryUnspecified: 'HARM_CATEGORY_UNSPECIFIED', - SafetySettingCategory.harmCategoryDerogatory: 'HARM_CATEGORY_DEROGATORY', - SafetySettingCategory.harmCategoryToxicity: 'HARM_CATEGORY_TOXICITY', - SafetySettingCategory.harmCategoryViolence: 'HARM_CATEGORY_VIOLENCE', - SafetySettingCategory.harmCategorySexual: 'HARM_CATEGORY_SEXUAL', - SafetySettingCategory.harmCategoryMedical: 'HARM_CATEGORY_MEDICAL', - SafetySettingCategory.harmCategoryDangerous: 'HARM_CATEGORY_DANGEROUS', - SafetySettingCategory.harmCategoryHarassment: 'HARM_CATEGORY_HARASSMENT', - SafetySettingCategory.harmCategoryHateSpeech: 'HARM_CATEGORY_HATE_SPEECH', - SafetySettingCategory.harmCategorySexuallyExplicit: - 'HARM_CATEGORY_SEXUALLY_EXPLICIT', - SafetySettingCategory.harmCategoryDangerousContent: - 'HARM_CATEGORY_DANGEROUS_CONTENT', -}; - -const _$SafetySettingThresholdEnumMap = { - SafetySettingThreshold.harmBlockThresholdUnspecified: - 'HARM_BLOCK_THRESHOLD_UNSPECIFIED', - SafetySettingThreshold.blockLowAndAbove: 'BLOCK_LOW_AND_ABOVE', - SafetySettingThreshold.blockMediumAndAbove: 'BLOCK_MEDIUM_AND_ABOVE', - SafetySettingThreshold.blockOnlyHigh: 'BLOCK_ONLY_HIGH', - SafetySettingThreshold.blockNone: 'BLOCK_NONE', +const _$PromptFeedbackBlockReasonEnumMap = { + PromptFeedbackBlockReason.blockReasonUnspecified: 'BLOCK_REASON_UNSPECIFIED', + PromptFeedbackBlockReason.safety: 'SAFETY', + PromptFeedbackBlockReason.other: 'OTHER', }; -_$CandidateImpl _$$CandidateImplFromJson(Map json) => - _$CandidateImpl( +_$EmbedContentRequestImpl _$$EmbedContentRequestImplFromJson( + Map json) => + _$EmbedContentRequestImpl( + title: json['title'] as String?, content: json['content'] == null ? null : Content.fromJson(json['content'] as Map), - finishReason: $enumDecodeNullable( - _$CandidateFinishReasonEnumMap, json['finishReason'], + taskType: $enumDecodeNullable( + _$EmbedContentRequestTaskTypeEnumMap, json['taskType'], unknownValue: JsonKey.nullForUndefinedEnumValue), - citationMetadata: json['citationMetadata'] == null - ? null - : CitationMetadata.fromJson( - json['citationMetadata'] as Map), - index: json['index'] as int?, - tokenCount: json['tokenCount'] as int?, - safetyRatings: (json['safetyRatings'] as List?) - ?.map((e) => SafetyRating.fromJson(e as Map)) - .toList(), + model: json['model'] as String?, ); -Map _$$CandidateImplToJson(_$CandidateImpl instance) { +Map _$$EmbedContentRequestImplToJson( + _$EmbedContentRequestImpl instance) { final val = {}; void writeNotNull(String key, dynamic value) { @@ -600,34 +554,34 @@ Map _$$CandidateImplToJson(_$CandidateImpl instance) { } } + writeNotNull('title', instance.title); writeNotNull('content', instance.content?.toJson()); writeNotNull( - 'finishReason', _$CandidateFinishReasonEnumMap[instance.finishReason]); - writeNotNull('citationMetadata', instance.citationMetadata?.toJson()); - writeNotNull('index', instance.index); - writeNotNull('tokenCount', instance.tokenCount); - writeNotNull( - 'safetyRatings', instance.safetyRatings?.map((e) => e.toJson()).toList()); + 'taskType', _$EmbedContentRequestTaskTypeEnumMap[instance.taskType]); + writeNotNull('model', instance.model); return val; } -const _$CandidateFinishReasonEnumMap = { - CandidateFinishReason.finishReasonUnspecified: 'FINISH_REASON_UNSPECIFIED', - CandidateFinishReason.stop: 'STOP', - CandidateFinishReason.maxTokens: 'MAX_TOKENS', - CandidateFinishReason.safety: 'SAFETY', - CandidateFinishReason.recitation: 'RECITATION', - CandidateFinishReason.other: 'OTHER', +const _$EmbedContentRequestTaskTypeEnumMap = { + EmbedContentRequestTaskType.taskTypeUnspecified: 'TASK_TYPE_UNSPECIFIED', + EmbedContentRequestTaskType.retrievalQuery: 'RETRIEVAL_QUERY', + EmbedContentRequestTaskType.retrievalDocument: 'RETRIEVAL_DOCUMENT', + EmbedContentRequestTaskType.semanticSimilarity: 'SEMANTIC_SIMILARITY', + EmbedContentRequestTaskType.classification: 'CLASSIFICATION', + EmbedContentRequestTaskType.clustering: 'CLUSTERING', }; -_$CountTokensResponseImpl _$$CountTokensResponseImplFromJson( +_$ListOperationsResponseImpl _$$ListOperationsResponseImplFromJson( Map json) => - _$CountTokensResponseImpl( - totalTokens: json['totalTokens'] as int?, + _$ListOperationsResponseImpl( + operations: (json['operations'] as List?) + ?.map((e) => Operation.fromJson(e as Map)) + .toList(), + nextPageToken: json['nextPageToken'] as String?, ); -Map _$$CountTokensResponseImplToJson( - _$CountTokensResponseImpl instance) { +Map _$$ListOperationsResponseImplToJson( + _$ListOperationsResponseImpl instance) { final val = {}; void writeNotNull(String key, dynamic value) { @@ -636,20 +590,26 @@ Map _$$CountTokensResponseImplToJson( } } - writeNotNull('totalTokens', instance.totalTokens); + writeNotNull( + 'operations', instance.operations?.map((e) => e.toJson()).toList()); + writeNotNull('nextPageToken', instance.nextPageToken); return val; } -_$CountTokensRequestImpl _$$CountTokensRequestImplFromJson( - Map json) => - _$CountTokensRequestImpl( - contents: (json['contents'] as List?) - ?.map((e) => Content.fromJson(e as Map)) +_$EmptyImpl _$$EmptyImplFromJson(Map json) => _$EmptyImpl(); + +Map _$$EmptyImplToJson(_$EmptyImpl instance) => + {}; + +_$ContentImpl _$$ContentImplFromJson(Map json) => + _$ContentImpl( + role: json['role'] as String?, + parts: (json['parts'] as List?) + ?.map((e) => Part.fromJson(e as Map)) .toList(), ); -Map _$$CountTokensRequestImplToJson( - _$CountTokensRequestImpl instance) { +Map _$$ContentImplToJson(_$ContentImpl instance) { final val = {}; void writeNotNull(String key, dynamic value) { @@ -658,20 +618,30 @@ Map _$$CountTokensRequestImplToJson( } } - writeNotNull('contents', instance.contents?.map((e) => e.toJson()).toList()); + writeNotNull('role', instance.role); + writeNotNull('parts', instance.parts?.map((e) => e.toJson()).toList()); return val; } -_$BatchEmbedContentsResponseImpl _$$BatchEmbedContentsResponseImplFromJson( +_$CancelOperationRequestImpl _$$CancelOperationRequestImplFromJson( Map json) => - _$BatchEmbedContentsResponseImpl( - embeddings: (json['embeddings'] as List?) - ?.map((e) => ContentEmbedding.fromJson(e as Map)) - .toList(), + _$CancelOperationRequestImpl(); + +Map _$$CancelOperationRequestImplToJson( + _$CancelOperationRequestImpl instance) => + {}; + +_$EmbedContentResponseImpl _$$EmbedContentResponseImplFromJson( + Map json) => + _$EmbedContentResponseImpl( + embedding: json['embedding'] == null + ? null + : ContentEmbedding.fromJson( + json['embedding'] as Map), ); -Map _$$BatchEmbedContentsResponseImplToJson( - _$BatchEmbedContentsResponseImpl instance) { +Map _$$EmbedContentResponseImplToJson( + _$EmbedContentResponseImpl instance) { final val = {}; void writeNotNull(String key, dynamic value) { @@ -680,21 +650,18 @@ Map _$$BatchEmbedContentsResponseImplToJson( } } - writeNotNull( - 'embeddings', instance.embeddings?.map((e) => e.toJson()).toList()); + writeNotNull('embedding', instance.embedding?.toJson()); return val; } -_$CitationMetadataImpl _$$CitationMetadataImplFromJson( +_$CountTokensResponseImpl _$$CountTokensResponseImplFromJson( Map json) => - _$CitationMetadataImpl( - citationSources: (json['citationSources'] as List?) - ?.map((e) => CitationSource.fromJson(e as Map)) - .toList(), + _$CountTokensResponseImpl( + totalTokens: json['totalTokens'] as int?, ); -Map _$$CitationMetadataImplToJson( - _$CitationMetadataImpl instance) { +Map _$$CountTokensResponseImplToJson( + _$CountTokensResponseImpl instance) { final val = {}; void writeNotNull(String key, dynamic value) { @@ -703,17 +670,24 @@ Map _$$CitationMetadataImplToJson( } } - writeNotNull('citationSources', - instance.citationSources?.map((e) => e.toJson()).toList()); + writeNotNull('totalTokens', instance.totalTokens); return val; } -_$BlobImpl _$$BlobImplFromJson(Map json) => _$BlobImpl( - mimeType: json['mimeType'] as String?, - data: json['data'] as String?, +_$GenerateContentResponseImpl _$$GenerateContentResponseImplFromJson( + Map json) => + _$GenerateContentResponseImpl( + promptFeedback: json['promptFeedback'] == null + ? null + : PromptFeedback.fromJson( + json['promptFeedback'] as Map), + candidates: (json['candidates'] as List?) + ?.map((e) => Candidate.fromJson(e as Map)) + .toList(), ); -Map _$$BlobImplToJson(_$BlobImpl instance) { +Map _$$GenerateContentResponseImplToJson( + _$GenerateContentResponseImpl instance) { final val = {}; void writeNotNull(String key, dynamic value) { @@ -722,21 +696,30 @@ Map _$$BlobImplToJson(_$BlobImpl instance) { } } - writeNotNull('mimeType', instance.mimeType); - writeNotNull('data', instance.data); + writeNotNull('promptFeedback', instance.promptFeedback?.toJson()); + writeNotNull( + 'candidates', instance.candidates?.map((e) => e.toJson()).toList()); return val; } -_$CitationSourceImpl _$$CitationSourceImplFromJson(Map json) => - _$CitationSourceImpl( - endIndex: json['endIndex'] as int?, - license: json['license'] as String?, - uri: json['uri'] as String?, - startIndex: json['startIndex'] as int?, +_$ModelImpl _$$ModelImplFromJson(Map json) => _$ModelImpl( + name: json['name'] as String?, + displayName: json['displayName'] as String?, + description: json['description'] as String?, + version: json['version'] as String?, + baseModelId: json['baseModelId'] as String?, + temperature: (json['temperature'] as num?)?.toDouble(), + topK: json['topK'] as int?, + topP: (json['topP'] as num?)?.toDouble(), + inputTokenLimit: json['inputTokenLimit'] as int?, + outputTokenLimit: json['outputTokenLimit'] as int?, + supportedGenerationMethods: + (json['supportedGenerationMethods'] as List?) + ?.map((e) => e as String) + .toList(), ); -Map _$$CitationSourceImplToJson( - _$CitationSourceImpl instance) { +Map _$$ModelImplToJson(_$ModelImpl instance) { final val = {}; void writeNotNull(String key, dynamic value) { @@ -745,22 +728,38 @@ Map _$$CitationSourceImplToJson( } } - writeNotNull('endIndex', instance.endIndex); - writeNotNull('license', instance.license); - writeNotNull('uri', instance.uri); - writeNotNull('startIndex', instance.startIndex); + writeNotNull('name', instance.name); + writeNotNull('displayName', instance.displayName); + writeNotNull('description', instance.description); + writeNotNull('version', instance.version); + writeNotNull('baseModelId', instance.baseModelId); + writeNotNull('temperature', instance.temperature); + writeNotNull('topK', instance.topK); + writeNotNull('topP', instance.topP); + writeNotNull('inputTokenLimit', instance.inputTokenLimit); + writeNotNull('outputTokenLimit', instance.outputTokenLimit); + writeNotNull( + 'supportedGenerationMethods', instance.supportedGenerationMethods); return val; } -_$StatusImpl _$$StatusImplFromJson(Map json) => _$StatusImpl( - details: (json['details'] as List?) - ?.map((e) => e as Map) +_$GenerateContentRequestImpl _$$GenerateContentRequestImplFromJson( + Map json) => + _$GenerateContentRequestImpl( + generationConfig: json['generationConfig'] == null + ? null + : GenerationConfig.fromJson( + json['generationConfig'] as Map), + contents: (json['contents'] as List?) + ?.map((e) => Content.fromJson(e as Map)) + .toList(), + safetySettings: (json['safetySettings'] as List?) + ?.map((e) => SafetySetting.fromJson(e as Map)) .toList(), - code: json['code'] as int?, - message: json['message'] as String?, ); -Map _$$StatusImplToJson(_$StatusImpl instance) { +Map _$$GenerateContentRequestImplToJson( + _$GenerateContentRequestImpl instance) { final val = {}; void writeNotNull(String key, dynamic value) { @@ -769,8 +768,9 @@ Map _$$StatusImplToJson(_$StatusImpl instance) { } } - writeNotNull('details', instance.details); - writeNotNull('code', instance.code); - writeNotNull('message', instance.message); + writeNotNull('generationConfig', instance.generationConfig?.toJson()); + writeNotNull('contents', instance.contents?.map((e) => e.toJson()).toList()); + writeNotNull('safetySettings', + instance.safetySettings?.map((e) => e.toJson()).toList()); return val; } diff --git a/packages/googleai_dart/lib/src/generated/schema/status.dart b/packages/googleai_dart/lib/src/generated/schema/status.dart index 0a2a0222..cee3b901 100644 --- a/packages/googleai_dart/lib/src/generated/schema/status.dart +++ b/packages/googleai_dart/lib/src/generated/schema/status.dart @@ -15,21 +15,21 @@ class Status with _$Status { /// Factory constructor for Status const factory Status({ - /// A list of messages that carry the error details. There is a common set of message types for APIs to use. - @JsonKey(includeIfNull: false) List>? details, - /// The status code, which should be an enum value of google.rpc.Code. @JsonKey(includeIfNull: false) int? code, /// A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client. @JsonKey(includeIfNull: false) String? message, + + /// A list of messages that carry the error details. There is a common set of message types for APIs to use. + @JsonKey(includeIfNull: false) List>? details, }) = _Status; /// Object construction from a JSON representation factory Status.fromJson(Map json) => _$StatusFromJson(json); /// List of all property names of schema - static const List propertyNames = ['details', 'code', 'message']; + static const List propertyNames = ['code', 'message', 'details']; /// Perform validations on the schema property values String? validateSchema() { @@ -39,9 +39,9 @@ class Status with _$Status { /// Map representation of object (not serialized) Map toMap() { return { - 'details': details, 'code': code, 'message': message, + 'details': details, }; } } diff --git a/packages/googleai_dart/oas/googleai_discovery.json b/packages/googleai_dart/oas/googleai_discovery.json new file mode 100644 index 00000000..975e583f --- /dev/null +++ b/packages/googleai_dart/oas/googleai_discovery.json @@ -0,0 +1,1190 @@ +{ + "canonicalName": "Generative Language", + "version": "v1", + "baseUrl": "https://generativelanguage.googleapis.com/", + "mtlsRootUrl": "https://generativelanguage.mtls.googleapis.com/", + "description": "The Gemini API allows developers to build generative AI applications using Gemini models. Gemini is our most capable model, built from the ground up to be multimodal. It can generalize and seamlessly understand, operate across, and combine different types of information. including language, images, audio, video, and code. You can use the Gemini API for use cases like reasoning across text and images, content generation, dialogue agents, summarization and classification systems, and more.", + "resources": { + "operations": { + "methods": { + "delete": { + "id": "generativelanguage.operations.delete", + "httpMethod": "DELETE", + "path": "v1/{+name}", + "parameters": { + "name": { + "type": "string", + "location": "path", + "description": "The name of the operation resource to be deleted.", + "pattern": "^operations/.*$", + "required": true + } + }, + "description": "Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`.", + "parameterOrder": [ + "name" + ], + "response": { + "$ref": "Empty" + }, + "flatPath": "v1/operations/{operationsId}" + }, + "list": { + "path": "v1/{+name}", + "httpMethod": "GET", + "flatPath": "v1/operations", + "parameterOrder": [ + "name" + ], + "id": "generativelanguage.operations.list", + "description": "Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.", + "response": { + "$ref": "ListOperationsResponse" + }, + "parameters": { + "pageToken": { + "description": "The standard list page token.", + "type": "string", + "location": "query" + }, + "filter": { + "location": "query", + "type": "string", + "description": "The standard list filter." + }, + "name": { + "pattern": "^operations$", + "location": "path", + "type": "string", + "description": "The name of the operation's parent resource.", + "required": true + }, + "pageSize": { + "description": "The standard list page size.", + "format": "int32", + "location": "query", + "type": "integer" + } + } + } + } + }, + "models": { + "methods": { + "generateContent": { + "description": "Generates a response from the model given an input `GenerateContentRequest`.", + "flatPath": "v1/models/{modelsId}:generateContent", + "parameters": { + "model": { + "location": "path", + "type": "string", + "pattern": "^models/[^/]+$", + "description": "Required. The name of the `Model` to use for generating the completion. Format: `name=models/{model}`.", + "required": true + } + }, + "parameterOrder": [ + "model" + ], + "path": "v1/{+model}:generateContent", + "request": { + "$ref": "GenerateContentRequest" + }, + "httpMethod": "POST", + "id": "generativelanguage.models.generateContent", + "response": { + "$ref": "GenerateContentResponse" + } + }, + "batchEmbedContents": { + "httpMethod": "POST", + "description": "Generates multiple embeddings from the model given input text in a synchronous call.", + "path": "v1/{+model}:batchEmbedContents", + "response": { + "$ref": "BatchEmbedContentsResponse" + }, + "parameterOrder": [ + "model" + ], + "parameters": { + "model": { + "required": true, + "pattern": "^models/[^/]+$", + "description": "Required. The model's resource name. This serves as an ID for the Model to use. This name should match a model name returned by the `ListModels` method. Format: `models/{model}`", + "type": "string", + "location": "path" + } + }, + "request": { + "$ref": "BatchEmbedContentsRequest" + }, + "flatPath": "v1/models/{modelsId}:batchEmbedContents", + "id": "generativelanguage.models.batchEmbedContents" + }, + "streamGenerateContent": { + "parameters": { + "model": { + "type": "string", + "description": "Required. The name of the `Model` to use for generating the completion. Format: `name=models/{model}`.", + "location": "path", + "required": true, + "pattern": "^models/[^/]+$" + } + }, + "flatPath": "v1/models/{modelsId}:streamGenerateContent", + "response": { + "$ref": "GenerateContentResponse" + }, + "httpMethod": "POST", + "request": { + "$ref": "GenerateContentRequest" + }, + "description": "Generates a streamed response from the model given an input `GenerateContentRequest`.", + "id": "generativelanguage.models.streamGenerateContent", + "parameterOrder": [ + "model" + ], + "path": "v1/{+model}:streamGenerateContent" + }, + "embedContent": { + "description": "Generates an embedding from the model given an input `Content`.", + "flatPath": "v1/models/{modelsId}:embedContent", + "id": "generativelanguage.models.embedContent", + "request": { + "$ref": "EmbedContentRequest" + }, + "parameterOrder": [ + "model" + ], + "path": "v1/{+model}:embedContent", + "httpMethod": "POST", + "parameters": { + "model": { + "pattern": "^models/[^/]+$", + "type": "string", + "description": "Required. The model's resource name. This serves as an ID for the Model to use. This name should match a model name returned by the `ListModels` method. Format: `models/{model}`", + "required": true, + "location": "path" + } + }, + "response": { + "$ref": "EmbedContentResponse" + } + }, + "countTokens": { + "path": "v1/{+model}:countTokens", + "id": "generativelanguage.models.countTokens", + "httpMethod": "POST", + "parameterOrder": [ + "model" + ], + "parameters": { + "model": { + "pattern": "^models/[^/]+$", + "location": "path", + "required": true, + "type": "string", + "description": "Required. The model's resource name. This serves as an ID for the Model to use. This name should match a model name returned by the `ListModels` method. Format: `models/{model}`" + } + }, + "request": { + "$ref": "CountTokensRequest" + }, + "response": { + "$ref": "CountTokensResponse" + }, + "flatPath": "v1/models/{modelsId}:countTokens", + "description": "Runs a model's tokenizer on input content and returns the token count." + }, + "list": { + "id": "generativelanguage.models.list", + "parameters": { + "pageToken": { + "description": "A page token, received from a previous `ListModels` call. Provide the `page_token` returned by one request as an argument to the next request to retrieve the next page. When paginating, all other parameters provided to `ListModels` must match the call that provided the page token.", + "location": "query", + "type": "string" + }, + "pageSize": { + "description": "The maximum number of `Models` to return (per page). The service may return fewer models. If unspecified, at most 50 models will be returned per page. This method returns at most 1000 models per page, even if you pass a larger page_size.", + "format": "int32", + "location": "query", + "type": "integer" + } + }, + "description": "Lists models available through the API.", + "httpMethod": "GET", + "path": "v1/models", + "flatPath": "v1/models", + "response": { + "$ref": "ListModelsResponse" + }, + "parameterOrder": [] + }, + "get": { + "httpMethod": "GET", + "parameterOrder": [ + "name" + ], + "id": "generativelanguage.models.get", + "flatPath": "v1/models/{modelsId}", + "description": "Gets information about a specific Model.", + "path": "v1/{+name}", + "response": { + "$ref": "Model" + }, + "parameters": { + "name": { + "type": "string", + "location": "path", + "pattern": "^models/[^/]+$", + "description": "Required. The resource name of the model. This name should match a model name returned by the `ListModels` method. Format: `models/{model}`", + "required": true + } + } + } + } + }, + "tunedModels": { + "methods": { + "generateContent": { + "httpMethod": "POST", + "flatPath": "v1/tunedModels/{tunedModelsId}:generateContent", + "id": "generativelanguage.tunedModels.generateContent", + "description": "Generates a response from the model given an input `GenerateContentRequest`.", + "response": { + "$ref": "GenerateContentResponse" + }, + "parameterOrder": [ + "model" + ], + "parameters": { + "model": { + "location": "path", + "type": "string", + "pattern": "^tunedModels/[^/]+$", + "required": true, + "description": "Required. The name of the `Model` to use for generating the completion. Format: `name=models/{model}`." + } + }, + "path": "v1/{+model}:generateContent", + "request": { + "$ref": "GenerateContentRequest" + } + } + }, + "resources": { + "operations": { + "methods": { + "list": { + "response": { + "$ref": "ListOperationsResponse" + }, + "description": "Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.", + "path": "v1/{+name}/operations", + "parameterOrder": [ + "name" + ], + "httpMethod": "GET", + "parameters": { + "pageToken": { + "description": "The standard list page token.", + "type": "string", + "location": "query" + }, + "pageSize": { + "type": "integer", + "description": "The standard list page size.", + "location": "query", + "format": "int32" + }, + "filter": { + "type": "string", + "description": "The standard list filter.", + "location": "query" + }, + "name": { + "type": "string", + "description": "The name of the operation's parent resource.", + "required": true, + "pattern": "^tunedModels/[^/]+$", + "location": "path" + } + }, + "flatPath": "v1/tunedModels/{tunedModelsId}/operations", + "id": "generativelanguage.tunedModels.operations.list" + }, + "get": { + "httpMethod": "GET", + "flatPath": "v1/tunedModels/{tunedModelsId}/operations/{operationsId}", + "description": "Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.", + "path": "v1/{+name}", + "parameters": { + "name": { + "pattern": "^tunedModels/[^/]+/operations/[^/]+$", + "type": "string", + "location": "path", + "required": true, + "description": "The name of the operation resource." + } + }, + "response": { + "$ref": "Operation" + }, + "parameterOrder": [ + "name" + ], + "id": "generativelanguage.tunedModels.operations.get" + }, + "cancel": { + "response": { + "$ref": "Empty" + }, + "path": "v1/{+name}:cancel", + "description": "Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`. Clients can use Operations.GetOperation or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an Operation.error value with a google.rpc.Status.code of 1, corresponding to `Code.CANCELLED`.", + "parameters": { + "name": { + "location": "path", + "description": "The name of the operation resource to be cancelled.", + "type": "string", + "pattern": "^tunedModels/[^/]+/operations/[^/]+$", + "required": true + } + }, + "flatPath": "v1/tunedModels/{tunedModelsId}/operations/{operationsId}:cancel", + "httpMethod": "POST", + "parameterOrder": [ + "name" + ], + "request": { + "$ref": "CancelOperationRequest" + }, + "id": "generativelanguage.tunedModels.operations.cancel" + } + } + } + } + } + }, + "icons": { + "x32": "http://www.google.com/images/icons/product/search-32.gif", + "x16": "http://www.google.com/images/icons/product/search-16.gif" + }, + "name": "generativelanguage", + "kind": "discovery#restDescription", + "servicePath": "", + "protocol": "rest", + "parameters": { + "oauth_token": { + "type": "string", + "location": "query", + "description": "OAuth 2.0 token for the current user." + }, + "key": { + "location": "query", + "description": "API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.", + "type": "string" + }, + "uploadType": { + "type": "string", + "location": "query", + "description": "Legacy upload protocol for media (e.g. \"media\", \"multipart\")." + }, + "fields": { + "location": "query", + "type": "string", + "description": "Selector specifying which fields to include in a partial response." + }, + "quotaUser": { + "description": "Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.", + "location": "query", + "type": "string" + }, + "$.xgafv": { + "description": "V1 error format.", + "enumDescriptions": [ + "v1 error format", + "v2 error format" + ], + "location": "query", + "enum": [ + "1", + "2" + ], + "type": "string" + }, + "access_token": { + "description": "OAuth access token.", + "type": "string", + "location": "query" + }, + "alt": { + "enumDescriptions": [ + "Responses with Content-Type of application/json", + "Media download with context-dependent Content-Type", + "Responses with Content-Type of application/x-protobuf" + ], + "location": "query", + "type": "string", + "description": "Data format for response.", + "enum": [ + "json", + "media", + "proto" + ], + "default": "json" + }, + "prettyPrint": { + "location": "query", + "type": "boolean", + "default": "true", + "description": "Returns response with indentations and line breaks." + }, + "upload_protocol": { + "type": "string", + "location": "query", + "description": "Upload protocol for media (e.g. \"raw\", \"multipart\")." + }, + "callback": { + "description": "JSONP", + "location": "query", + "type": "string" + } + }, + "fullyEncodeReservedExpansion": true, + "ownerName": "Google", + "version_module": true, + "batchPath": "batch", + "rootUrl": "https://generativelanguage.googleapis.com/", + "ownerDomain": "google.com", + "revision": "20240331", + "documentationLink": "https://developers.generativeai.google/api", + "basePath": "", + "id": "generativelanguage:v1", + "discoveryVersion": "v1", + "schemas": { + "CitationSource": { + "properties": { + "endIndex": { + "format": "int32", + "description": "Optional. End of the attributed segment, exclusive.", + "type": "integer" + }, + "license": { + "description": "Optional. License for the GitHub project that is attributed as a source for segment. License info is required for code citations.", + "type": "string" + }, + "uri": { + "type": "string", + "description": "Optional. URI that is attributed as a source for a portion of the text." + }, + "startIndex": { + "type": "integer", + "description": "Optional. Start of segment of the response that is attributed to this source. Index indicates the start of the segment, measured in bytes.", + "format": "int32" + } + }, + "description": "A citation to a source for a portion of a specific response.", + "type": "object", + "id": "CitationSource" + }, + "SafetySetting": { + "properties": { + "threshold": { + "enumDescriptions": [ + "Threshold is unspecified.", + "Content with NEGLIGIBLE will be allowed.", + "Content with NEGLIGIBLE and LOW will be allowed.", + "Content with NEGLIGIBLE, LOW, and MEDIUM will be allowed.", + "All content will be allowed." + ], + "description": "Required. Controls the probability threshold at which harm is blocked.", + "type": "string", + "enum": [ + "HARM_BLOCK_THRESHOLD_UNSPECIFIED", + "BLOCK_LOW_AND_ABOVE", + "BLOCK_MEDIUM_AND_ABOVE", + "BLOCK_ONLY_HIGH", + "BLOCK_NONE" + ] + }, + "category": { + "description": "Required. The category for this setting.", + "enum": [ + "HARM_CATEGORY_UNSPECIFIED", + "HARM_CATEGORY_DEROGATORY", + "HARM_CATEGORY_TOXICITY", + "HARM_CATEGORY_VIOLENCE", + "HARM_CATEGORY_SEXUAL", + "HARM_CATEGORY_MEDICAL", + "HARM_CATEGORY_DANGEROUS", + "HARM_CATEGORY_HARASSMENT", + "HARM_CATEGORY_HATE_SPEECH", + "HARM_CATEGORY_SEXUALLY_EXPLICIT", + "HARM_CATEGORY_DANGEROUS_CONTENT" + ], + "enumDescriptions": [ + "Category is unspecified.", + "Negative or harmful comments targeting identity and/or protected attribute.", + "Content that is rude, disrespectful, or profane.", + "Describes scenarios depicting violence against an individual or group, or general descriptions of gore.", + "Contains references to sexual acts or other lewd content.", + "Promotes unchecked medical advice.", + "Dangerous content that promotes, facilitates, or encourages harmful acts.", + "Harasment content.", + "Hate speech and content.", + "Sexually explicit content.", + "Dangerous content." + ], + "type": "string" + } + }, + "description": "Safety setting, affecting the safety-blocking behavior. Passing a safety setting for a category changes the allowed proability that content is blocked.", + "id": "SafetySetting", + "type": "object" + }, + "CitationMetadata": { + "description": "A collection of source attributions for a piece of content.", + "id": "CitationMetadata", + "properties": { + "citationSources": { + "type": "array", + "description": "Citations to sources for a specific response.", + "items": { + "$ref": "CitationSource" + } + } + }, + "type": "object" + }, + "GenerationConfig": { + "properties": { + "temperature": { + "type": "number", + "description": "Optional. Controls the randomness of the output. Note: The default value varies by model, see the `Model.temperature` attribute of the `Model` returned from the `getModel` function. Values can range from [0.0, infinity).", + "format": "float" + }, + "topK": { + "type": "integer", + "description": "Optional. The maximum number of tokens to consider when sampling. The model uses combined Top-k and nucleus sampling. Top-k sampling considers the set of `top_k` most probable tokens. Note: The default value varies by model, see the `Model.top_k` attribute of the `Model` returned from the `getModel` function.", + "format": "int32" + }, + "stopSequences": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Optional. The set of character sequences (up to 5) that will stop output generation. If specified, the API will stop at the first appearance of a stop sequence. The stop sequence will not be included as part of the response." + }, + "maxOutputTokens": { + "type": "integer", + "description": "Optional. The maximum number of tokens to include in a candidate. Note: The default value varies by model, see the `Model.output_token_limit` attribute of the `Model` returned from the `getModel` function.", + "format": "int32" + }, + "candidateCount": { + "type": "integer", + "description": "Optional. Number of generated responses to return. Currently, this value can only be set to 1. If unset, this will default to 1.", + "format": "int32" + }, + "topP": { + "format": "float", + "type": "number", + "description": "Optional. The maximum cumulative probability of tokens to consider when sampling. The model uses combined Top-k and nucleus sampling. Tokens are sorted based on their assigned probabilities so that only the most likely tokens are considered. Top-k sampling directly limits the maximum number of tokens to consider, while Nucleus sampling limits number of tokens based on the cumulative probability. Note: The default value varies by model, see the `Model.top_p` attribute of the `Model` returned from the `getModel` function." + } + }, + "id": "GenerationConfig", + "type": "object", + "description": "Configuration options for model generation and outputs. Not all parameters may be configurable for every model." + }, + "GenerateContentResponse": { + "description": "Response from the model supporting multiple candidates. Note on safety ratings and content filtering. They are reported for both prompt in `GenerateContentResponse.prompt_feedback` and for each candidate in `finish_reason` and in `safety_ratings`. The API contract is that: - either all requested candidates are returned or no candidates at all - no candidates are returned only if there was something wrong with the prompt (see `prompt_feedback`) - feedback on each candidate is reported on `finish_reason` and `safety_ratings`.", + "id": "GenerateContentResponse", + "type": "object", + "properties": { + "candidates": { + "description": "Candidate responses from the model.", + "items": { + "$ref": "Candidate" + }, + "type": "array" + }, + "promptFeedback": { + "$ref": "PromptFeedback", + "description": "Returns the prompt's feedback related to the content filters." + } + } + }, + "PromptFeedback": { + "properties": { + "safetyRatings": { + "items": { + "$ref": "SafetyRating" + }, + "description": "Ratings for safety of the prompt. There is at most one rating per category.", + "type": "array" + }, + "blockReason": { + "description": "Optional. If set, the prompt was blocked and no candidates are returned. Rephrase your prompt.", + "type": "string", + "enumDescriptions": [ + "Default value. This value is unused.", + "Prompt was blocked due to safety reasons. You can inspect `safety_ratings` to understand which safety category blocked it.", + "Prompt was blocked due to unknown reaasons." + ], + "enum": [ + "BLOCK_REASON_UNSPECIFIED", + "SAFETY", + "OTHER" + ] + } + }, + "type": "object", + "description": "A set of the feedback metadata the prompt specified in `GenerateContentRequest.content`.", + "id": "PromptFeedback" + }, + "Blob": { + "id": "Blob", + "properties": { + "data": { + "description": "Raw bytes for media formats.", + "format": "byte", + "type": "string" + }, + "mimeType": { + "description": "The IANA standard MIME type of the source data. Accepted types include: \"image/png\", \"image/jpeg\", \"image/heic\", \"image/heif\", \"image/webp\".", + "type": "string" + } + }, + "description": "Raw media bytes. Text should not be sent as raw bytes, use the 'text' field.", + "type": "object" + }, + "CountTokensRequest": { + "id": "CountTokensRequest", + "properties": { + "contents": { + "type": "array", + "items": { + "$ref": "Content" + }, + "description": "Required. The input given to the model as a prompt." + } + }, + "type": "object", + "description": "Counts the number of tokens in the `prompt` sent to a model. Models may tokenize text differently, so each model may return a different `token_count`." + }, + "Status": { + "id": "Status", + "description": "The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors).", + "type": "object", + "properties": { + "details": { + "items": { + "type": "object", + "additionalProperties": { + "description": "Properties of the object. Contains field @type with type URL.", + "type": "any" + } + }, + "description": "A list of messages that carry the error details. There is a common set of message types for APIs to use.", + "type": "array" + }, + "code": { + "format": "int32", + "type": "integer", + "description": "The status code, which should be an enum value of google.rpc.Code." + }, + "message": { + "type": "string", + "description": "A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client." + } + } + }, + "Model": { + "description": "Information about a Generative Language Model.", + "type": "object", + "id": "Model", + "properties": { + "name": { + "type": "string", + "description": "Required. The resource name of the `Model`. Format: `models/{model}` with a `{model}` naming convention of: * \"{base_model_id}-{version}\" Examples: * `models/chat-bison-001`" + }, + "topK": { + "format": "int32", + "type": "integer", + "description": "For Top-k sampling. Top-k sampling considers the set of `top_k` most probable tokens. This value specifies default to be used by the backend while making the call to the model." + }, + "displayName": { + "description": "The human-readable name of the model. E.g. \"Chat Bison\". The name can be up to 128 characters long and can consist of any UTF-8 characters.", + "type": "string" + }, + "temperature": { + "type": "number", + "description": "Controls the randomness of the output. Values can range over `[0.0,1.0]`, inclusive. A value closer to `1.0` will produce responses that are more varied, while a value closer to `0.0` will typically result in less surprising responses from the model. This value specifies default to be used by the backend while making the call to the model.", + "format": "float" + }, + "inputTokenLimit": { + "description": "Maximum number of input tokens allowed for this model.", + "format": "int32", + "type": "integer" + }, + "baseModelId": { + "description": "Required. The name of the base model, pass this to the generation request. Examples: * `chat-bison`", + "type": "string" + }, + "outputTokenLimit": { + "type": "integer", + "format": "int32", + "description": "Maximum number of output tokens available for this model." + }, + "description": { + "type": "string", + "description": "A short description of the model." + }, + "supportedGenerationMethods": { + "type": "array", + "description": "The model's supported generation methods. The method names are defined as Pascal case strings, such as `generateMessage` which correspond to API methods.", + "items": { + "type": "string" + } + }, + "version": { + "description": "Required. The version number of the model. This represents the major version", + "type": "string" + }, + "topP": { + "type": "number", + "description": "For Nucleus sampling. Nucleus sampling considers the smallest set of tokens whose probability sum is at least `top_p`. This value specifies default to be used by the backend while making the call to the model.", + "format": "float" + } + } + }, + "CreateTunedModelMetadata": { + "type": "object", + "id": "CreateTunedModelMetadata", + "description": "Metadata about the state and progress of creating a tuned model returned from the long-running operation", + "properties": { + "completedSteps": { + "description": "The number of steps completed.", + "type": "integer", + "format": "int32" + }, + "totalSteps": { + "description": "The total number of tuning steps.", + "format": "int32", + "type": "integer" + }, + "snapshots": { + "description": "Metrics collected during tuning.", + "items": { + "$ref": "TuningSnapshot" + }, + "type": "array" + }, + "tunedModel": { + "description": "Name of the tuned model associated with the tuning operation.", + "type": "string" + }, + "completedPercent": { + "format": "float", + "type": "number", + "description": "The completed percentage for the tuning operation." + } + } + }, + "ListOperationsResponse": { + "description": "The response message for Operations.ListOperations.", + "type": "object", + "id": "ListOperationsResponse", + "properties": { + "nextPageToken": { + "type": "string", + "description": "The standard List next-page token." + }, + "operations": { + "type": "array", + "description": "A list of operations that matches the specified filter in the request.", + "items": { + "$ref": "Operation" + } + } + } + }, + "Empty": { + "type": "object", + "description": "A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }", + "id": "Empty", + "properties": {} + }, + "EmbedContentResponse": { + "type": "object", + "description": "The response to an `EmbedContentRequest`.", + "id": "EmbedContentResponse", + "properties": { + "embedding": { + "$ref": "ContentEmbedding", + "readOnly": true, + "description": "Output only. The embedding generated from the input content." + } + } + }, + "EmbedContentRequest": { + "description": "Request containing the `Content` for the model to embed.", + "type": "object", + "properties": { + "content": { + "description": "Required. The content to embed. Only the `parts.text` fields will be counted.", + "$ref": "Content" + }, + "taskType": { + "enum": [ + "TASK_TYPE_UNSPECIFIED", + "RETRIEVAL_QUERY", + "RETRIEVAL_DOCUMENT", + "SEMANTIC_SIMILARITY", + "CLASSIFICATION", + "CLUSTERING" + ], + "enumDescriptions": [ + "Unset value, which will default to one of the other enum values.", + "Specifies the given text is a query in a search/retrieval setting.", + "Specifies the given text is a document from the corpus being searched.", + "Specifies the given text will be used for STS.", + "Specifies that the given text will be classified.", + "Specifies that the embeddings will be used for clustering." + ], + "type": "string", + "description": "Optional. Optional task type for which the embeddings will be used. Can only be set for `models/embedding-001`." + }, + "title": { + "type": "string", + "description": "Optional. An optional title for the text. Only applicable when TaskType is `RETRIEVAL_DOCUMENT`. Note: Specifying a `title` for `RETRIEVAL_DOCUMENT` provides better quality embeddings for retrieval." + }, + "model": { + "description": "Required. The model's resource name. This serves as an ID for the Model to use. This name should match a model name returned by the `ListModels` method. Format: `models/{model}`", + "type": "string" + } + }, + "id": "EmbedContentRequest" + }, + "BatchEmbedContentsRequest": { + "type": "object", + "description": "Batch request to get embeddings from the model for a list of prompts.", + "properties": { + "requests": { + "description": "Required. Embed requests for the batch. The model in each of these requests must match the model specified `BatchEmbedContentsRequest.model`.", + "items": { + "$ref": "EmbedContentRequest" + }, + "type": "array" + } + }, + "id": "BatchEmbedContentsRequest" + }, + "ContentEmbedding": { + "id": "ContentEmbedding", + "type": "object", + "properties": { + "values": { + "type": "array", + "description": "The embedding values.", + "items": { + "type": "number", + "format": "float" + } + } + }, + "description": "A list of floats representing an embedding." + }, + "BatchEmbedContentsResponse": { + "description": "The response to a `BatchEmbedContentsRequest`.", + "properties": { + "embeddings": { + "type": "array", + "description": "Output only. The embeddings for each request, in the same order as provided in the batch request.", + "items": { + "$ref": "ContentEmbedding" + }, + "readOnly": true + } + }, + "id": "BatchEmbedContentsResponse", + "type": "object" + }, + "ListModelsResponse": { + "id": "ListModelsResponse", + "description": "Response from `ListModel` containing a paginated list of Models.", + "type": "object", + "properties": { + "models": { + "type": "array", + "items": { + "$ref": "Model" + }, + "description": "The returned Models." + }, + "nextPageToken": { + "type": "string", + "description": "A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no more pages." + } + } + }, + "CancelOperationRequest": { + "description": "The request message for Operations.CancelOperation.", + "properties": {}, + "type": "object", + "id": "CancelOperationRequest" + }, + "TuningSnapshot": { + "id": "TuningSnapshot", + "type": "object", + "properties": { + "computeTime": { + "format": "google-datetime", + "type": "string", + "description": "Output only. The timestamp when this metric was computed.", + "readOnly": true + }, + "meanLoss": { + "format": "float", + "description": "Output only. The mean loss of the training examples for this step.", + "type": "number", + "readOnly": true + }, + "epoch": { + "description": "Output only. The epoch this step was part of.", + "format": "int32", + "type": "integer", + "readOnly": true + }, + "step": { + "description": "Output only. The tuning step.", + "format": "int32", + "type": "integer", + "readOnly": true + } + }, + "description": "Record for a single tuning step." + }, + "Candidate": { + "description": "A response candidate generated from the model.", + "id": "Candidate", + "properties": { + "finishReason": { + "enum": [ + "FINISH_REASON_UNSPECIFIED", + "STOP", + "MAX_TOKENS", + "SAFETY", + "RECITATION", + "OTHER" + ], + "description": "Optional. Output only. The reason why the model stopped generating tokens. If empty, the model has not stopped generating the tokens.", + "enumDescriptions": [ + "Default value. This value is unused.", + "Natural stop point of the model or provided stop sequence.", + "The maximum number of tokens as specified in the request was reached.", + "The candidate content was flagged for safety reasons.", + "The candidate content was flagged for recitation reasons.", + "Unknown reason." + ], + "readOnly": true, + "type": "string" + }, + "citationMetadata": { + "description": "Output only. Citation information for model-generated candidate. This field may be populated with recitation information for any text included in the `content`. These are passages that are \"recited\" from copyrighted material in the foundational LLM's training data.", + "$ref": "CitationMetadata", + "readOnly": true + }, + "tokenCount": { + "description": "Output only. Token count for this candidate.", + "format": "int32", + "readOnly": true, + "type": "integer" + }, + "safetyRatings": { + "items": { + "$ref": "SafetyRating" + }, + "description": "List of ratings for the safety of a response candidate. There is at most one rating per category.", + "type": "array" + }, + "content": { + "readOnly": true, + "$ref": "Content", + "description": "Output only. Generated content returned from the model." + }, + "index": { + "format": "int32", + "description": "Output only. Index of the candidate in the list of candidates.", + "readOnly": true, + "type": "integer" + } + }, + "type": "object" + }, + "SafetyRating": { + "description": "Safety rating for a piece of content. The safety rating contains the category of harm and the harm probability level in that category for a piece of content. Content is classified for safety across a number of harm categories and the probability of the harm classification is included here.", + "id": "SafetyRating", + "type": "object", + "properties": { + "probability": { + "description": "Required. The probability of harm for this content.", + "enum": [ + "HARM_PROBABILITY_UNSPECIFIED", + "NEGLIGIBLE", + "LOW", + "MEDIUM", + "HIGH" + ], + "type": "string", + "enumDescriptions": [ + "Probability is unspecified.", + "Content has a negligible chance of being unsafe.", + "Content has a low chance of being unsafe.", + "Content has a medium chance of being unsafe.", + "Content has a high chance of being unsafe." + ] + }, + "category": { + "enum": [ + "HARM_CATEGORY_UNSPECIFIED", + "HARM_CATEGORY_DEROGATORY", + "HARM_CATEGORY_TOXICITY", + "HARM_CATEGORY_VIOLENCE", + "HARM_CATEGORY_SEXUAL", + "HARM_CATEGORY_MEDICAL", + "HARM_CATEGORY_DANGEROUS", + "HARM_CATEGORY_HARASSMENT", + "HARM_CATEGORY_HATE_SPEECH", + "HARM_CATEGORY_SEXUALLY_EXPLICIT", + "HARM_CATEGORY_DANGEROUS_CONTENT" + ], + "description": "Required. The category for this rating.", + "type": "string", + "enumDescriptions": [ + "Category is unspecified.", + "Negative or harmful comments targeting identity and/or protected attribute.", + "Content that is rude, disrespectful, or profane.", + "Describes scenarios depicting violence against an individual or group, or general descriptions of gore.", + "Contains references to sexual acts or other lewd content.", + "Promotes unchecked medical advice.", + "Dangerous content that promotes, facilitates, or encourages harmful acts.", + "Harasment content.", + "Hate speech and content.", + "Sexually explicit content.", + "Dangerous content." + ] + }, + "blocked": { + "type": "boolean", + "description": "Was this content blocked because of this rating?" + } + } + }, + "Operation": { + "properties": { + "name": { + "type": "string", + "description": "The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should be a resource name ending with `operations/{unique_id}`." + }, + "done": { + "type": "boolean", + "description": "If the value is `false`, it means the operation is still in progress. If `true`, the operation is completed, and either `error` or `response` is available." + }, + "error": { + "$ref": "Status", + "description": "The error result of the operation in case of failure or cancellation." + }, + "response": { + "description": "The normal, successful response of the operation. If the original method returns no data on success, such as `Delete`, the response is `google.protobuf.Empty`. If the original method is standard `Get`/`Create`/`Update`, the response should be the resource. For other methods, the response should have the type `XxxResponse`, where `Xxx` is the original method name. For example, if the original method name is `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`.", + "additionalProperties": { + "description": "Properties of the object. Contains field @type with type URL.", + "type": "any" + }, + "type": "object" + }, + "metadata": { + "type": "object", + "description": "Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any.", + "additionalProperties": { + "description": "Properties of the object. Contains field @type with type URL.", + "type": "any" + } + } + }, + "id": "Operation", + "description": "This resource represents a long-running operation that is the result of a network API call.", + "type": "object" + }, + "CountTokensResponse": { + "properties": { + "totalTokens": { + "type": "integer", + "description": "The number of tokens that the `model` tokenizes the `prompt` into. Always non-negative.", + "format": "int32" + } + }, + "id": "CountTokensResponse", + "description": "A response from `CountTokens`. It returns the model's `token_count` for the `prompt`.", + "type": "object" + }, + "Part": { + "properties": { + "text": { + "description": "Inline text.", + "type": "string" + }, + "inlineData": { + "description": "Inline media bytes.", + "$ref": "Blob" + } + }, + "description": "A datatype containing media that is part of a multi-part `Content` message. A `Part` consists of data which has an associated datatype. A `Part` can only contain one of the accepted types in `Part.data`. A `Part` must have a fixed IANA MIME type identifying the type and subtype of the media if the `inline_data` field is filled with raw bytes.", + "id": "Part", + "type": "object" + }, + "GenerateContentRequest": { + "description": "Request to generate a completion from the model.", + "properties": { + "contents": { + "items": { + "$ref": "Content" + }, + "description": "Required. The content of the current conversation with the model. For single-turn queries, this is a single instance. For multi-turn queries, this is a repeated field that contains conversation history + latest request.", + "type": "array" + }, + "safetySettings": { + "type": "array", + "description": "Optional. A list of unique `SafetySetting` instances for blocking unsafe content. This will be enforced on the `GenerateContentRequest.contents` and `GenerateContentResponse.candidates`. There should not be more than one setting for each `SafetyCategory` type. The API will block any contents and responses that fail to meet the thresholds set by these settings. This list overrides the default settings for each `SafetyCategory` specified in the safety_settings. If there is no `SafetySetting` for a given `SafetyCategory` provided in the list, the API will use the default safety setting for that category. Harm categories HARM_CATEGORY_HATE_SPEECH, HARM_CATEGORY_SEXUALLY_EXPLICIT, HARM_CATEGORY_DANGEROUS_CONTENT, HARM_CATEGORY_HARASSMENT are supported.", + "items": { + "$ref": "SafetySetting" + } + }, + "generationConfig": { + "description": "Optional. Configuration options for model generation and outputs.", + "$ref": "GenerationConfig" + } + }, + "id": "GenerateContentRequest", + "type": "object" + }, + "Content": { + "type": "object", + "description": "The base structured datatype containing multi-part content of a message. A `Content` includes a `role` field designating the producer of the `Content` and a `parts` field containing multi-part data that contains the content of the message turn.", + "id": "Content", + "properties": { + "parts": { + "description": "Ordered `Parts` that constitute a single message. Parts may have different MIME types.", + "type": "array", + "items": { + "$ref": "Part" + } + }, + "role": { + "description": "Optional. The producer of the content. Must be either 'user' or 'model'. Useful to set for multi-turn conversations, otherwise can be left blank or unset.", + "type": "string" + } + } + } + }, + "title": "Generative Language API" +} diff --git a/packages/googleai_dart/oas/googleai_openapi_curated.yaml b/packages/googleai_dart/oas/googleai_openapi_curated.yaml index 783cde47..7e6d6ed3 100644 --- a/packages/googleai_dart/oas/googleai_openapi_curated.yaml +++ b/packages/googleai_dart/oas/googleai_openapi_curated.yaml @@ -4,14 +4,13 @@ openapi: 3.1.0 info: title: Generative Language API description: >- - The Gemini API allows developers to build generative AI applications using the - Gemini model. Large Language Models (LLMs) are a powerful, versatile type of - machine learning model that enables computers to comprehend and generate - natural language through a series of prompts. The Gemini API is based on - Google's next generation LLM, Gemini. It excels at a variety of different - tasks like code generation, reasoning, and writing. You can use the Gemini API - to build generative AI applications for use cases like content generation, - dialogue agents, summarization and classification systems, and more. + The Gemini API allows developers to build generative AI applications using + Gemini models. Gemini is our most capable model, built from the ground up to + be multimodal. It can generalize and seamlessly understand, operate across, + and combine different types of information. including language, images, + audio, video, and code. You can use the Gemini API for use cases like + reasoning across text and images, content generation, dialogue agents, + summarization and classification systems, and more. version: v1 servers: @@ -19,35 +18,81 @@ servers: components: schemas: - TuningSnapshot: + BatchEmbedContentsResponse: + id: BatchEmbedContentsResponse type: object - description: Record for a single tuning step. properties: - step: - description: Output only. The tuning step. - format: int32 + embeddings: readOnly: true - type: integer - computeTime: - format: google-datetime + description: >- + Output only. The embeddings for each request, in the same order as + provided in the batch request. + type: array + items: + $ref: '#/components/schemas/ContentEmbedding' + description: The response to a `BatchEmbedContentsRequest`. + Candidate: + id: Candidate + type: object + description: A response candidate generated from the model. + properties: + content: + description: Output only. Generated content returned from the model. + readOnly: true + $ref: '#/components/schemas/Content' + finishReason: + enum: + - FINISH_REASON_UNSPECIFIED + - STOP + - MAX_TOKENS + - SAFETY + - RECITATION + - OTHER + readOnly: true + enumDescriptions: + - Default value. This value is unused. + - Natural stop point of the model or provided stop sequence. + - >- + The maximum number of tokens as specified in the request was + reached. + - The candidate content was flagged for safety reasons. + - The candidate content was flagged for recitation reasons. + - Unknown reason. type: string + description: >- + Optional. Output only. The reason why the model stopped generating + tokens. If empty, the model has not stopped generating the tokens. + citationMetadata: + $ref: '#/components/schemas/CitationMetadata' readOnly: true - description: Output only. The timestamp when this metric was computed. - epoch: + description: >- + Output only. Citation information for model-generated candidate. + This field may be populated with recitation information for any text + included in the `content`. These are passages that are "recited" + from copyrighted material in the foundational LLM's training data. + index: + format: int32 type: integer readOnly: true + description: Output only. Index of the candidate in the list of candidates. + tokenCount: + description: Output only. Token count for this candidate. format: int32 - description: Output only. The epoch this step was part of. - meanLoss: - description: Output only. The mean loss of the training examples for this step. - format: float + type: integer readOnly: true - type: number - id: TuningSnapshot + safetyRatings: + type: array + description: >- + List of ratings for the safety of a response candidate. There is at + most one rating per category. + items: + $ref: '#/components/schemas/SafetyRating' CreateTunedModelMetadata: + id: CreateTunedModelMetadata + type: object description: >- Metadata about the state and progress of creating a tuned model returned - from the long-running operation + from the long-running operation. properties: totalSteps: type: integer @@ -69,164 +114,28 @@ components: description: The completed percentage for the tuning operation. format: float type: number - id: CreateTunedModelMetadata - type: object - GenerationConfig: - type: object - properties: - topP: - format: float - description: >- - Optional. The maximum cumulative probability of tokens to consider - when sampling. The model uses combined Top-k and nucleus sampling. - Tokens are sorted based on their assigned probabilities so that only - the most likely tokens are considered. Top-k sampling directly - limits the maximum number of tokens to consider, while Nucleus - sampling limits number of tokens based on the cumulative - probability. Note: The default value varies by model, see the - `Model.top_p` attribute of the `Model` returned the `getModel` - function. - type: number - topK: - type: integer - description: >- - Optional. The maximum number of tokens to consider when sampling. - The model uses combined Top-k and nucleus sampling. Top-k sampling - considers the set of `top_k` most probable tokens. Defaults to 40. - Note: The default value varies by model, see the `Model.top_k` - attribute of the `Model` returned the `getModel` function. - format: int32 - candidateCount: - description: >- - Optional. Number of generated responses to return. This value must - be between [1, 8], inclusive. If unset, this will default to 1. - format: int32 - type: integer - maxOutputTokens: - description: >- - Optional. The maximum number of tokens to include in a candidate. If - unset, this will default to output_token_limit specified in the - `Model` specification. - type: integer - format: int32 - temperature: - type: number - format: float - description: >- - Optional. Controls the randomness of the output. Note: The default - value varies by model, see the `Model.temperature` attribute of the - `Model` returned the `getModel` function. Values can range from - [0.0,1.0], inclusive. A value closer to 1.0 will produce responses - that are more varied and creative, while a value closer to 0.0 will - typically result in more straightforward responses from the model. - stopSequences: - description: >- - Optional. The set of character sequences (up to 5) that will stop - output generation. If specified, the API will stop at the first - appearance of a stop sequence. The stop sequence will not be - included as part of the response. - items: - type: string - type: array - description: >- - Configuration options for model generation and outputs. Not all - parameters may be configurable for every model. - id: GenerationConfig - ListOperationsResponse: - properties: - nextPageToken: - description: The standard List next-page token. - type: string - operations: - description: >- - A list of operations that matches the specified filter in the - request. - items: - $ref: '#/components/schemas/Operation' - type: array - description: The response message for Operations.ListOperations. - id: ListOperationsResponse + BatchEmbedContentsRequest: + id: BatchEmbedContentsRequest type: object - Model: - description: Information about a Generative Language Model. + description: Batch request to get embeddings from the model for a list of prompts. properties: - name: - description: >- - Required. The resource name of the `Model`. Format: `models/{model}` - with a `{model}` naming convention of: * "{base_model_id}-{version}" - Examples: * `models/chat-bison-001` - type: string - displayName: - type: string - description: >- - The human-readable name of the model. E.g. "Chat Bison". The name - can be up to 128 characters long and can consist of any UTF-8 - characters. - description: - type: string - description: A short description of the model. - topK: - description: >- - For Top-k sampling. Top-k sampling considers the set of `top_k` most - probable tokens. This value specifies default to be used by the - backend while making the call to the model. - type: integer - format: int32 - version: - type: string - description: >- - Required. The version number of the model. This represents the major - version - temperature: - description: >- - Controls the randomness of the output. Values can range over - `[0.0,1.0]`, inclusive. A value closer to `1.0` will produce - responses that are more varied, while a value closer to `0.0` will - typically result in less surprising responses from the model. This - value specifies default to be used by the backend while making the - call to the model. - format: float - type: number - topP: - format: float - type: number - description: >- - For Nucleus sampling. Nucleus sampling considers the smallest set of - tokens whose probability sum is at least `top_p`. This value - specifies default to be used by the backend while making the call to - the model. - baseModelId: - description: >- - Required. The name of the base model, pass this to the generation - request. Examples: * `chat-bison` - type: string - inputTokenLimit: - format: int32 - type: integer - description: Maximum number of input tokens allowed for this model. - outputTokenLimit: - type: integer - description: Maximum number of output tokens available for this model. - format: int32 - supportedGenerationMethods: + requests: type: array description: >- - The model's supported generation methods. The method names are - defined as Pascal case strings, such as `generateMessage` which - correspond to API methods. + Required. Embed requests for the batch. The model in each of these + requests must match the model specified + `BatchEmbedContentsRequest.model`. items: - type: string - id: Model - type: object + $ref: '#/components/schemas/EmbedContentRequest' SafetyRating: + id: SafetyRating + type: object description: >- Safety rating for a piece of content. The safety rating contains the category of harm and the harm probability level in that category for a piece of content. Content is classified for safety across a number of harm categories and the probability of the harm classification is included here. - id: SafetyRating - type: object properties: category: type: string @@ -280,7 +189,14 @@ components: type: boolean description: Was this content blocked because of this rating? Part: + id: Part type: object + description: >- + A datatype containing media that is part of a multi-part `Content` + message. A `Part` consists of data which has an associated datatype. A + `Part` can only contain one of the accepted types in `Part.data`. A + `Part` must have a fixed IANA MIME type identifying the type and subtype + of the media if the `inline_data` field is filled with raw bytes. properties: inlineData: $ref: '#/components/schemas/Blob' @@ -288,204 +204,12 @@ components: text: description: Inline text. type: string - id: Part - description: >- - A datatype containing media that is part of a multi-part `Content` - message. A `Part` consists of data which has an associated datatype. A - `Part` can only contain one of the accepted types in `Part.data`. A - `Part` must have a fixed IANA MIME type identifying the type and subtype - of the media if the `inline_data` field is filled with raw bytes. - Empty: - id: Empty - properties: { } - description: >- - A generic empty message that you can re-use to avoid defining duplicated - empty messages in your APIs. A typical example is to use it as the - request or the response type of an API method. For instance: service Foo - { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); } - type: object - GenerateContentRequest: - id: GenerateContentRequest - description: Request to generate a completion from the model. + Operation: + id: Operation type: object - properties: - generationConfig: - $ref: '#/components/schemas/GenerationConfig' - description: Optional. Configuration options for model generation and outputs. - contents: - type: array - items: - $ref: '#/components/schemas/Content' - description: >- - Required. The content of the current conversation with the model. - For single-turn queries, this is a single instance. For multi-turn - queries, this is a repeated field that contains conversation history - + latest request. - safetySettings: - description: >- - Optional. A list of unique `SafetySetting` instances for blocking - unsafe content. This will be enforced on the - `GenerateContentRequest.contents` and - `GenerateContentResponse.candidates`. There should not be more than - one setting for each `SafetyCategory` type. The API will block any - contents and responses that fail to meet the thresholds set by these - settings. This list overrides the default settings for each - `SafetyCategory` specified in the safety_settings. If there is no - `SafetySetting` for a given `SafetyCategory` provided in the list, - the API will use the default safety setting for that category. Harm - categories HARM_CATEGORY_HATE_SPEECH, - HARM_CATEGORY_SEXUALLY_EXPLICIT, HARM_CATEGORY_DANGEROUS_CONTENT, - HARM_CATEGORY_HARASSMENT are supported. - items: - $ref: '#/components/schemas/SafetySetting' - type: array - EmbedContentResponse: - properties: - embedding: - $ref: '#/components/schemas/ContentEmbedding' - description: Output only. The embedding generated from the input content. - readOnly: true - type: object - id: EmbedContentResponse - description: The response to an `EmbedContentRequest`. - Content: - type: object - description: >- - The base structured datatype containing multi-part content of a message. - A `Content` includes a `role` field designating the producer of the - `Content` and a `parts` field containing multi-part data that contains - the content of the message turn. - id: Content - properties: - role: - description: >- - Optional. The producer of the content. Must be either 'user' or - 'model'. Useful to set for multi-turn conversations, otherwise can - be left blank or unset. - type: string - parts: - items: - $ref: '#/components/schemas/Part' - description: >- - Ordered `Parts` that constitute a single message. Parts may have - different MIME types. - type: array - CancelOperationRequest: - id: CancelOperationRequest - description: The request message for Operations.CancelOperation. - properties: { } - type: object - EmbedContentRequest: - properties: - content: - $ref: '#/components/schemas/Content' - description: >- - Required. The content to embed. Only the `parts.text` fields will be - counted. - taskType: - enumDescriptions: - - Unset value, which will default to one of the other enum values. - - Specifies the given text is a query in a search/retrieval setting. - - >- - Specifies the given text is a document from the corpus being - searched. - - Specifies the given text will be used for STS. - - Specifies that the given text will be classified. - - Specifies that the embeddings will be used for clustering. - description: >- - Optional. Optional task type for which the embeddings will be used. - Can only be set for `models/embedding-001`. - enum: - - TASK_TYPE_UNSPECIFIED - - RETRIEVAL_QUERY - - RETRIEVAL_DOCUMENT - - SEMANTIC_SIMILARITY - - CLASSIFICATION - - CLUSTERING - type: string - model: - type: string - description: >- - Required. The model's resource name. This serves as an ID for the - Model to use. This name should match a model name returned by the - `ListModels` method. Format: `models/{model}` - title: - type: string - description: >- - Optional. An optional title for the text. Only applicable when - TaskType is `RETRIEVAL_DOCUMENT`. - id: EmbedContentRequest - description: Request containing the `Content` for the model to embed. - type: object - ListModelsResponse: - description: Response from `ListModel` containing a paginated list of Models. - properties: - nextPageToken: - description: >- - A token, which can be sent as `page_token` to retrieve the next - page. If this field is omitted, there are no more pages. - type: string - models: - type: array - description: The returned Models. - items: - $ref: '#/components/schemas/Model' - type: object - id: ListModelsResponse - BatchEmbedContentsRequest: - properties: - requests: - type: array - description: >- - Required. Embed requests for the batch. The model in each of these - requests must match the model specified - `BatchEmbedContentsRequest.model`. - items: - $ref: '#/components/schemas/EmbedContentRequest' - type: object - description: Batch request to get embeddings from the model for a list of prompts. - id: BatchEmbedContentsRequest - ContentEmbedding: - properties: - values: - description: The embedding values. - items: - format: float - type: number - type: array - id: ContentEmbedding - type: object - description: A list of floats representing an embedding. - PromptFeedback: - properties: - safetyRatings: - type: array - items: - $ref: '#/components/schemas/SafetyRating' - description: >- - Ratings for safety of the prompt. There is at most one rating per - category. - blockReason: - enum: - - BLOCK_REASON_UNSPECIFIED - - SAFETY - - OTHER - enumDescriptions: - - Default value. This value is unused. - - >- - Prompt was blocked due to safety reasons. You can inspect - `safety_ratings` to understand which safety category blocked it. - - Prompt was blocked due to unknown reaasons. - description: >- - Optional. If set, the prompt was blocked and no candidates are - returned. Rephrase your prompt. - type: string - id: PromptFeedback - type: object - description: >- - A set of the feedback metadata the prompt specified in - `GenerateContentRequest.content`. - Operation: + description: >- + This resource represents a long-running operation that is the result of + a network API call. properties: name: type: string @@ -530,35 +254,55 @@ components: description: >- The error result of the operation in case of failure or cancellation. + Status: + id: Status type: object description: >- - This resource represents a long-running operation that is the result of - a network API call. - id: Operation - GenerateContentResponse: - description: >- - Response from the model supporting multiple candidates. Note on safety - ratings and content filtering. They are reported for both prompt in - `GenerateContentResponse.prompt_feedback` and for each candidate in - `finish_reason` and in `safety_ratings`. The API contract is that: - - either all requested candidates are returned or no candidates at all - - no candidates are returned only if there was something wrong with the - prompt (see `prompt_feedback`) - feedback on each candidate is reported - on `finish_reason` and `safety_ratings`. + The `Status` type defines a logical error model that is suitable for + different programming environments, including REST APIs and RPC APIs. It + is used by [gRPC](https://github.com/grpc). Each `Status` message + contains three pieces of data: error code, error message, and error + details. You can find out more about this error model and how to work + with it in the [API Design + Guide](https://cloud.google.com/apis/design/errors). + properties: + code: + description: The status code, which should be an enum value of google.rpc.Code. + format: int32 + type: integer + message: + description: >- + A developer-facing error message, which should be in English. Any + user-facing error message should be localized and sent in the + google.rpc.Status.details field, or localized by the client. + type: string + details: + description: >- + A list of messages that carry the error details. There is a common + set of message types for APIs to use. + items: + additionalProperties: + description: Properties of the object. Contains field @type with type URL. + type: any + type: object + type: array + CitationMetadata: + id: CitationMetadata type: object - id: GenerateContentResponse + description: A collection of source attributions for a piece of content. properties: - promptFeedback: - $ref: '#/components/schemas/PromptFeedback' - description: Returns the prompt's feedback related to the content filters. - candidates: + citationSources: + description: Citations to sources for a specific response. type: array - description: Candidate responses from the model. items: - $ref: '#/components/schemas/Candidate' + $ref: '#/components/schemas/CitationSource' SafetySetting: id: SafetySetting type: object + description: >- + Safety setting, affecting the safety-blocking behavior. Passing a safety + setting for a category changes the allowed proability that content is + blocked. properties: category: enum: @@ -610,118 +354,134 @@ components: - BLOCK_MEDIUM_AND_ABOVE - BLOCK_ONLY_HIGH - BLOCK_NONE - description: >- - Safety setting, affecting the safety-blocking behavior. Passing a safety - setting for a category changes the allowed proability that content is - blocked. - Candidate: - id: Candidate + CitationSource: + id: CitationSource + type: object + description: A citation to a source for a portion of a specific response. properties: - content: - description: Output only. Generated content returned from the model. - readOnly: true - $ref: '#/components/schemas/Content' - finishReason: - enum: - - FINISH_REASON_UNSPECIFIED - - STOP - - MAX_TOKENS - - SAFETY - - RECITATION - - OTHER - readOnly: true - enumDescriptions: - - Default value. This value is unused. - - Natural stop point of the model or provided stop sequence. - - >- - The maximum number of tokens as specified in the request was - reached. - - The candidate content was flagged for safety reasons. - - The candidate content was flagged for recitation reasons. - - Unknown reason. - type: string + license: description: >- - Optional. Output only. The reason why the model stopped generating - tokens. If empty, the model has not stopped generating the tokens. - citationMetadata: - $ref: '#/components/schemas/CitationMetadata' - readOnly: true + Optional. License for the GitHub project that is attributed as a + source for segment. License info is required for code citations. + type: string + uri: + type: string description: >- - Output only. Citation information for model-generated candidate. - This field may be populated with recitation information for any text - included in the `content`. These are passages that are "recited" - from copyrighted material in the foundational LLM's training data. - index: - format: int32 + Optional. URI that is attributed as a source for a portion of the + text. + endIndex: type: integer - readOnly: true - description: Output only. Index of the candidate in the list of candidates. - tokenCount: - description: Output only. Token count for this candidate. + description: Optional. End of the attributed segment, exclusive. format: int32 - type: integer - readOnly: true - safetyRatings: - type: array + startIndex: description: >- - List of ratings for the safety of a response candidate. There is at - most one rating per category. - items: - $ref: '#/components/schemas/SafetyRating' - type: object - description: A response candidate generated from the model. - CountTokensResponse: + Optional. Start of segment of the response that is attributed to + this source. Index indicates the start of the segment, measured in + bytes. + format: int32 + type: integer + + GenerationConfig: + id: GenerationConfig type: object + description: >- + Configuration options for model generation and outputs. Not all + parameters may be configurable for every model. properties: - totalTokens: + temperature: + type: number + format: float + description: >- + Optional. Controls the randomness of the output. Note: The default + value varies by model, see the `Model.temperature` attribute of the + `Model` returned from the `getModel` function. Values can range from + [0.0, infinity). + stopSequences: + type: array + items: + type: string + description: >- + Optional. The set of character sequences (up to 5) that will stop + output generation. If specified, the API will stop at the first + appearance of a stop sequence. The stop sequence will not be + included as part of the response. + topK: type: integer + description: >- + Optional. The maximum number of tokens to consider when sampling. + The model uses combined Top-k and nucleus sampling. Top-k sampling + considers the set of `top_k` most probable tokens. Note: The default + value varies by model, see the `Model.top_k` attribute of the + `Model` returned from the `getModel` function. format: int32 + topP: + format: float description: >- - The number of tokens that the `model` tokenizes the `prompt` into. - Always non-negative. - id: CountTokensResponse - description: >- - A response from `CountTokens`. It returns the model's `token_count` for - the `prompt`. + Optional. The maximum cumulative probability of tokens to consider + when sampling. The model uses combined Top-k and nucleus sampling. + Tokens are sorted based on their assigned probabilities so that only + the most likely tokens are considered. Top-k sampling directly + limits the maximum number of tokens to consider, while Nucleus + sampling limits number of tokens based on the cumulative + probability. Note: The default value varies by model, see the + `Model.top_p` attribute of the `Model` returned from the `getModel` + function. + type: number + candidateCount: + description: >- + Optional. Number of generated responses to return. Currently, this + value can only be set to 1. If unset, this will default to 1. + format: int32 + type: integer + maxOutputTokens: + description: >- + Optional. The maximum number of tokens to include in a candidate. + Note: The default value varies by model, see the + `Model.output_token_limit` attribute of the `Model` returned from + the `getModel` function. + type: integer + format: int32 CountTokensRequest: id: CountTokensRequest - properties: - contents: - type: array - items: - $ref: '#/components/schemas/Content' - description: Required. The input given to the model as a prompt. + type: object description: >- Counts the number of tokens in the `prompt` sent to a model. Models may tokenize text differently, so each model may return a different `token_count`. - type: object - BatchEmbedContentsResponse: - id: BatchEmbedContentsResponse - type: object properties: - embeddings: - readOnly: true - description: >- - Output only. The embeddings for each request, in the same order as - provided in the batch request. + contents: type: array items: - $ref: '#/components/schemas/ContentEmbedding' - description: The response to a `BatchEmbedContentsRequest`. - CitationMetadata: + $ref: '#/components/schemas/Content' + description: Required. The input given to the model as a prompt. + TuningSnapshot: + id: TuningSnapshot type: object + description: Record for a single tuning step. properties: - citationSources: - description: Citations to sources for a specific response. - type: array - items: - $ref: '#/components/schemas/CitationSource' - id: CitationMetadata - description: A collection of source attributions for a piece of content. + step: + description: Output only. The tuning step. + format: int32 + readOnly: true + type: integer + computeTime: + format: google-datetime + type: string + readOnly: true + description: Output only. The timestamp when this metric was computed. + epoch: + type: integer + readOnly: true + format: int32 + description: Output only. The epoch this step was part of. + meanLoss: + description: Output only. The mean loss of the training examples for this step. + format: float + readOnly: true + type: number Blob: - type: object id: Blob + type: object description: >- Raw media bytes. Text should not be sent as raw bytes, use the 'text' field. @@ -736,84 +496,311 @@ components: type: string description: Raw bytes for media formats. format: byte - CitationSource: - description: A citation to a source for a portion of a specific response. + ListModelsResponse: + id: ListModelsResponse type: object - id: CitationSource + description: Response from `ListModel` containing a paginated list of Models. properties: - endIndex: - type: integer - description: Optional. End of the attributed segment, exclusive. - format: int32 - license: + models: + type: array + description: The returned Models. + items: + $ref: '#/components/schemas/Model' + nextPageToken: description: >- - Optional. License for the GitHub project that is attributed as a - source for segment. License info is required for code citations. + A token, which can be sent as `page_token` to retrieve the next + page. If this field is omitted, there are no more pages. type: string - uri: + ContentEmbedding: + id: ContentEmbedding + type: object + description: A list of floats representing an embedding. + properties: + values: + description: The embedding values. + items: + format: float + type: number + type: array + PromptFeedback: + id: PromptFeedback + type: object + description: >- + A set of the feedback metadata the prompt specified in + `GenerateContentRequest.content`. + properties: + safetyRatings: + type: array + items: + $ref: '#/components/schemas/SafetyRating' + description: >- + Ratings for safety of the prompt. There is at most one rating per + category. + blockReason: + enum: + - BLOCK_REASON_UNSPECIFIED + - SAFETY + - OTHER + enumDescriptions: + - Default value. This value is unused. + - >- + Prompt was blocked due to safety reasons. You can inspect + `safety_ratings` to understand which safety category blocked it. + - Prompt was blocked due to unknown reaasons. + description: >- + Optional. If set, the prompt was blocked and no candidates are + returned. Rephrase your prompt. + type: string + EmbedContentRequest: + id: EmbedContentRequest + type: object + description: Request containing the `Content` for the model to embed. + properties: + title: type: string description: >- - Optional. URI that is attributed as a source for a portion of the - text. - startIndex: + Optional. An optional title for the text. Only applicable when + TaskType is `RETRIEVAL_DOCUMENT`. Note: Specifying a `title` for + `RETRIEVAL_DOCUMENT` provides better quality embeddings for + retrieval. + content: + $ref: '#/components/schemas/Content' description: >- - Optional. Start of segment of the response that is attributed to - this source. Index indicates the start of the segment, measured in - bytes. - format: int32 - type: integer - Status: - id: Status + Required. The content to embed. Only the `parts.text` fields will be + counted. + taskType: + type: string + enum: + - TASK_TYPE_UNSPECIFIED + - RETRIEVAL_QUERY + - RETRIEVAL_DOCUMENT + - SEMANTIC_SIMILARITY + - CLASSIFICATION + - CLUSTERING + enumDescriptions: + - Unset value, which will default to one of the other enum values. + - Specifies the given text is a query in a search/retrieval setting. + - >- + Specifies the given text is a document from the corpus being + searched. + - Specifies the given text will be used for STS. + - Specifies that the given text will be classified. + - Specifies that the embeddings will be used for clustering. + description: >- + Optional. Optional task type for which the embeddings will be used. + Can only be set for `models/embedding-001`. + model: + type: string + description: >- + Required. The model's resource name. This serves as an ID for the + Model to use. This name should match a model name returned by the + `ListModels` method. Format: `models/{model}` + ListOperationsResponse: + id: ListOperationsResponse + type: object + description: The response message for Operations.ListOperations. + properties: + operations: + description: >- + A list of operations that matches the specified filter in the + request. + items: + $ref: '#/components/schemas/Operation' + type: array + nextPageToken: + description: The standard List next-page token. + type: string + Empty: + id: Empty + type: object description: >- - The `Status` type defines a logical error model that is suitable for - different programming environments, including REST APIs and RPC APIs. It - is used by [gRPC](https://github.com/grpc). Each `Status` message - contains three pieces of data: error code, error message, and error - details. You can find out more about this error model and how to work - with it in the [API Design - Guide](https://cloud.google.com/apis/design/errors). + A generic empty message that you can re-use to avoid defining duplicated + empty messages in your APIs. A typical example is to use it as the + request or the response type of an API method. For instance: service Foo + { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); } + properties: { } + Content: + id: Content + type: object + description: >- + The base structured datatype containing multi-part content of a message. + A `Content` includes a `role` field designating the producer of the + `Content` and a `parts` field containing multi-part data that contains + the content of the message turn. properties: - details: + role: + type: string description: >- - A list of messages that carry the error details. There is a common - set of message types for APIs to use. + Optional. The producer of the content. Must be either 'user' or + 'model'. Useful to set for multi-turn conversations, otherwise can + be left blank or unset. + parts: + type: array items: - additionalProperties: - description: Properties of the object. Contains field @type with type URL. - type: any - type: object + $ref: '#/components/schemas/Part' + description: >- + Ordered `Parts` that constitute a single message. Parts may have + different MIME types. + CancelOperationRequest: + id: CancelOperationRequest + type: object + description: The request message for Operations.CancelOperation. + properties: { } + EmbedContentResponse: + id: EmbedContentResponse + type: object + description: The response to an `EmbedContentRequest`. + properties: + embedding: + $ref: '#/components/schemas/ContentEmbedding' + description: Output only. The embedding generated from the input content. + readOnly: true + CountTokensResponse: + id: CountTokensResponse + type: object + description: >- + A response from `CountTokens`. It returns the model's `token_count` for + the `prompt`. + properties: + totalTokens: + type: integer + format: int32 + description: >- + The number of tokens that the `model` tokenizes the `prompt` into. + Always non-negative. + GenerateContentResponse: + id: GenerateContentResponse + type: object + description: >- + Response from the model supporting multiple candidates. Note on safety + ratings and content filtering. They are reported for both prompt in + `GenerateContentResponse.prompt_feedback` and for each candidate in + `finish_reason` and in `safety_ratings`. The API contract is that: - + either all requested candidates are returned or no candidates at all - + no candidates are returned only if there was something wrong with the + prompt (see `prompt_feedback`) - feedback on each candidate is reported + on `finish_reason` and `safety_ratings`. + properties: + promptFeedback: + $ref: '#/components/schemas/PromptFeedback' + description: Returns the prompt's feedback related to the content filters. + candidates: type: array - code: - description: The status code, which should be an enum value of google.rpc.Code. + description: Candidate responses from the model. + items: + $ref: '#/components/schemas/Candidate' + Model: + id: Model + type: object + description: Information about a Generative Language Model. + properties: + name: + description: >- + Required. The resource name of the `Model`. Format: `models/{model}` + with a `{model}` naming convention of: * "{base_model_id}-{version}" + Examples: * `models/chat-bison-001` + type: string + displayName: + type: string + description: >- + The human-readable name of the model. E.g. "Chat Bison". The name + can be up to 128 characters long and can consist of any UTF-8 + characters. + description: + type: string + description: A short description of the model. + version: + type: string + description: >- + Required. The version number of the model. This represents the major + version + baseModelId: + type: string + description: >- + Required. The name of the base model, pass this to the generation + request. Examples: * `chat-bison` + temperature: + description: >- + Controls the randomness of the output. Values can range over + `[0.0,1.0]`, inclusive. A value closer to `1.0` will produce + responses that are more varied, while a value closer to `0.0` will + typically result in less surprising responses from the model. This + value specifies default to be used by the backend while making the + call to the model. + format: float + type: number + topK: + type: integer format: int32 + description: >- + For Top-k sampling. Top-k sampling considers the set of `top_k` most + probable tokens. This value specifies default to be used by the + backend while making the call to the model. + topP: + format: float + type: number + description: >- + For Nucleus sampling. Nucleus sampling considers the smallest set of + tokens whose probability sum is at least `top_p`. This value + specifies default to be used by the backend while making the call to + the model. + inputTokenLimit: type: integer - message: + format: int32 + description: Maximum number of input tokens allowed for this model. + outputTokenLimit: + type: integer + format: int32 + description: Maximum number of output tokens available for this model. + supportedGenerationMethods: + type: array description: >- - A developer-facing error message, which should be in English. Any - user-facing error message should be localized and sent in the - google.rpc.Status.details field, or localized by the client. - type: string + The model's supported generation methods. The method names are + defined as Pascal case strings, such as `generateMessage` which + correspond to API methods. + items: + type: string + GenerateContentRequest: + id: GenerateContentRequest type: object - -paths: - /tunedModels/{tunedModelId}/operations/{operationId}:cancel: - post: - description: >- - Starts asynchronous cancellation on a long-running operation. The server - makes a best effort to cancel the operation, but success is not - guaranteed. If the server doesn't support this method, it returns - `google.rpc.Code.UNIMPLEMENTED`. Clients can use Operations.GetOperation - or other methods to check whether the cancellation succeeded or whether - the operation completed despite cancellation. On successful - cancellation, the operation is not deleted; instead, it becomes an - operation with an Operation.error value with a google.rpc.Status.code of - 1, corresponding to `Code.CANCELLED`. - operationId: cancelTunedModelOperation - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/CancelOperationRequest' + description: Request to generate a completion from the model. + properties: + generationConfig: + $ref: '#/components/schemas/GenerationConfig' + description: Optional. Configuration options for model generation and outputs. + contents: + type: array + items: + $ref: '#/components/schemas/Content' + description: >- + Required. The content of the current conversation with the model. + For single-turn queries, this is a single instance. For multi-turn + queries, this is a repeated field that contains conversation history + + latest request. + safetySettings: + type: array + items: + $ref: '#/components/schemas/SafetySetting' + description: >- + Optional. A list of unique `SafetySetting` instances for blocking + unsafe content. This will be enforced on the + `GenerateContentRequest.contents` and + `GenerateContentResponse.candidates`. There should not be more than + one setting for each `SafetyCategory` type. The API will block any + contents and responses that fail to meet the thresholds set by these + settings. This list overrides the default settings for each + `SafetyCategory` specified in the safety_settings. If there is no + `SafetySetting` for a given `SafetyCategory` provided in the list, + the API will use the default safety setting for that category. Harm + categories HARM_CATEGORY_HATE_SPEECH, + HARM_CATEGORY_SEXUALLY_EXPLICIT, HARM_CATEGORY_DANGEROUS_CONTENT, + HARM_CATEGORY_HARASSMENT are supported. + +paths: + /models: + get: + operationId: listModels + description: Lists models available through the API. security: [ ] responses: '200': @@ -821,26 +808,22 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/Empty' + $ref: '#/components/schemas/ListModelsResponse' parameters: - - in: path - name: tunedModelId - description: The id of the tuned model. - required: true + - in: query + name: pageToken + description: The token identifying which page to start with. schema: type: string - - in: path - name: operationId - description: The id of the operation to cancel. - required: true + - in: query + name: pageSize + description: The list page size. schema: - type: string - /tunedModels/{tunedModelId}/operations: + type: integer + /models/{modelId}: get: - description: >- - Lists operations that match the specified filter in the request. If the - server doesn't support this method, it returns `UNIMPLEMENTED`. - operationId: listTunedModelOperations + operationId: getModel + description: Gets information about a specific Model. security: [ ] responses: '200': @@ -848,36 +831,25 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/ListOperationsResponse' + $ref: '#/components/schemas/Model' parameters: - in: path - name: tunedModelId - description: The id of the tuned model. + name: modelId + description: The id of the model to get. required: true schema: type: string - - in: query - name: pageSize - description: The standard list page size. - schema: - type: integer - - in: query - name: filter - description: The filters to apply. - schema: - type: string - - in: query - name: pageToken - description: The token identifying which page to start with. - schema: - type: string - /tunedModels/{tunedModelId}/operations/{operationId}: - get: - description: >- - Gets the latest state of a long-running operation. Clients can use this - method to poll the operation result at intervals as recommended by the - API service. - operationId: getTunedModelOperations + /models/{modelId}:generateContent: + post: + operationId: generateContent + description: > + Generates a response from the model given an input + `GenerateContentRequest`. + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/GenerateContentRequest' security: [ ] responses: '200': @@ -885,31 +857,51 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/Operation' + $ref: '#/components/schemas/GenerateContentResponse' parameters: - in: path - name: tunedModelId - description: The id of the tuned model. - required: true + name: modelId + description: The id of the model to use. + required: false schema: type: string + default: gemini-pro + /models/{modelId}:embedContent: + post: + operationId: embedContent + description: Generates an embedding from the model given an input `Content`. + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/EmbedContentRequest' + security: [ ] + responses: + '200': + description: Successful response + content: + application/json: + schema: + $ref: '#/components/schemas/EmbedContentResponse' + parameters: - in: path - name: operationId - description: The id of the operation to get. - required: true + name: modelId + description: The id of the model to use. + required: false schema: type: string - /models/{modelId}:generateContent: + default: embedding-001 + /models/{modelId}:batchEmbedContents: post: - description: > - Generates a response from the model given an input - `GenerateContentRequest`. - operationId: generateContent + operationId: batchEmbedContents + description: >- + Generates multiple embeddings from the model given input text in a + synchronous call. requestBody: content: application/json: schema: - $ref: '#/components/schemas/GenerateContentRequest' + $ref: '#/components/schemas/BatchEmbedContentsRequest' security: [ ] responses: '200': @@ -917,7 +909,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/GenerateContentResponse' + $ref: '#/components/schemas/BatchEmbedContentsResponse' parameters: - in: path name: modelId @@ -925,11 +917,11 @@ paths: required: false schema: type: string - default: gemini-pro + default: embedding-001 /models/{modelId}:countTokens: post: - description: Runs a model's tokenizer on input content and returns the token count. operationId: countTokens + description: Runs a model's tokenizer on input content and returns the token count. requestBody: content: application/json: @@ -951,33 +943,38 @@ paths: schema: type: string default: gemini-pro - /models: - get: - description: Lists models available through the API. - operationId: listModels - security: [ ] + /tunedModels/{tunedModelId}:generateContent: + post: + operationId: generateContentTunedModel + description: >- + Generates a response from the model given an input + `GenerateContentRequest`. + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/GenerateContentRequest' + security: [] responses: '200': description: Successful response content: application/json: schema: - $ref: '#/components/schemas/ListModelsResponse' + $ref: '#/components/schemas/GenerateContentResponse' parameters: - - in: query - name: pageToken - description: The token identifying which page to start with. + - in: path + name: tunedModelId + description: The id of the tuned model. + required: true schema: type: string - - in: query - name: pageSize - description: The list page size. - schema: - type: integer - /models/{modelId}: + /tunedModels/{tunedModelId}/operations: get: - description: Gets information about a specific Model. - operationId: getModel + operationId: listTunedModelOperations + description: >- + Lists operations that match the specified filter in the request. If the + server doesn't support this method, it returns `UNIMPLEMENTED`. security: [ ] responses: '200': @@ -985,25 +982,36 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/Model' + $ref: '#/components/schemas/ListOperationsResponse' parameters: - in: path - name: modelId - description: The id of the model to get. + name: tunedModelId + description: The id of the tuned model. required: true schema: type: string - /models/{modelId}:batchEmbedContents: - post: + - in: query + name: pageSize + description: The standard list page size. + schema: + type: integer + - in: query + name: filter + description: The filters to apply. + schema: + type: string + - in: query + name: pageToken + description: The token identifying which page to start with. + schema: + type: string + /tunedModels/{tunedModelId}/operations/{operationId}: + get: + operationId: getTunedModelOperation description: >- - Generates multiple embeddings from the model given input text in a - synchronous call. - operationId: batchEmbedContents - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/BatchEmbedContentsRequest' + Gets the latest state of a long-running operation. Clients can use this + method to poll the operation result at intervals as recommended by the + API service. security: [ ] responses: '200': @@ -1011,24 +1019,38 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/BatchEmbedContentsResponse' + $ref: '#/components/schemas/Operation' parameters: - in: path - name: modelId - description: The id of the model to use. - required: false + name: tunedModelId + description: The id of the tuned model. + required: true schema: type: string - default: embedding-001 - /models/{modelId}:embedContent: + - in: path + name: operationId + description: The id of the operation to get. + required: true + schema: + type: string + /tunedModels/{tunedModelId}/operations/{operationId}:cancel: post: - description: Generates an embedding from the model given an input `Content`. - operationId: embedContent + operationId: cancelTunedModelOperation + description: >- + Starts asynchronous cancellation on a long-running operation. The server + makes a best effort to cancel the operation, but success is not + guaranteed. If the server doesn't support this method, it returns + `google.rpc.Code.UNIMPLEMENTED`. Clients can use Operations.GetOperation + or other methods to check whether the cancellation succeeded or whether + the operation completed despite cancellation. On successful + cancellation, the operation is not deleted; instead, it becomes an + operation with an Operation.error value with a google.rpc.Status.code of + 1, corresponding to `Code.CANCELLED`. requestBody: content: application/json: schema: - $ref: '#/components/schemas/EmbedContentRequest' + $ref: '#/components/schemas/CancelOperationRequest' security: [ ] responses: '200': @@ -1036,21 +1058,26 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/EmbedContentResponse' + $ref: '#/components/schemas/Empty' parameters: - in: path - name: modelId - description: The id of the model to use. - required: false + name: tunedModelId + description: The id of the tuned model. + required: true + schema: + type: string + - in: path + name: operationId + description: The id of the operation to cancel. + required: true schema: type: string - default: embedding-001 /operations: get: + operationId: listOperations description: >- Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`. - operationId: listOperations security: [ ] responses: '200': @@ -1077,12 +1104,12 @@ paths: type: string /operations/{operationId}: delete: + operationId: deleteOperation description: >- Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`. - operationId: deleteOperations security: [ ] responses: '200': diff --git a/packages/googleai_dart/oas/googleai_openapi_official.yaml b/packages/googleai_dart/oas/googleai_openapi_official.yaml index 29d909f5..b3da1efa 100644 --- a/packages/googleai_dart/oas/googleai_openapi_official.yaml +++ b/packages/googleai_dart/oas/googleai_openapi_official.yaml @@ -6,234 +6,325 @@ info: email: info@stackql.io title: Generative Language API description: >- - The PaLM API allows developers to build generative AI applications using the - PaLM model. Large Language Models (LLMs) are a powerful, versatile type of - machine learning model that enables computers to comprehend and generate - natural language through a series of prompts. The PaLM API is based on - Google's next generation LLM, PaLM. It excels at a variety of different - tasks like code generation, reasoning, and writing. You can use the PaLM API - to build generative AI applications for use cases like content generation, - dialogue agents, summarization and classification systems, and more. + The Gemini API allows developers to build generative AI applications using + Gemini models. Gemini is our most capable model, built from the ground up to + be multimodal. It can generalize and seamlessly understand, operate across, + and combine different types of information. including language, images, + audio, video, and code. You can use the Gemini API for use cases like + reasoning across text and images, content generation, dialogue agents, + summarization and classification systems, and more. version: v1 - x-discovery-doc-revision: '20231211' - x-generated-date: '2023-12-14' + x-discovery-doc-revision: '20240331' + x-generated-date: '2024-04-02' externalDocs: url: https://developers.generativeai.google/api servers: - url: https://generativelanguage.googleapis.com components: schemas: - TuningSnapshot: + BatchEmbedContentsResponse: + description: The response to a `BatchEmbedContentsRequest`. + properties: + embeddings: + items: + $ref: '#/components/schemas/ContentEmbedding' + readOnly: true + type: array + description: >- + Output only. The embeddings for each request, in the same order as + provided in the batch request. type: object - description: Record for a single tuning step. + id: BatchEmbedContentsResponse + Candidate: + description: A response candidate generated from the model. + type: object + id: Candidate properties: - step: - description: Output only. The tuning step. + safetyRatings: + type: array + items: + $ref: '#/components/schemas/SafetyRating' + description: >- + List of ratings for the safety of a response candidate. There is at + most one rating per category. + index: + description: Output only. Index of the candidate in the list of candidates. + type: integer format: int32 readOnly: true - type: integer - computeTime: - format: google-datetime - type: string + tokenCount: + description: Output only. Token count for this candidate. readOnly: true - description: Output only. The timestamp when this metric was computed. - epoch: + format: int32 type: integer + content: + $ref: '#/components/schemas/Content' + description: Output only. Generated content returned from the model. readOnly: true - format: int32 - description: Output only. The epoch this step was part of. - meanLoss: - description: Output only. The mean loss of the training examples for this step. - format: float + citationMetadata: + description: >- + Output only. Citation information for model-generated candidate. + This field may be populated with recitation information for any text + included in the `content`. These are passages that are "recited" + from copyrighted material in the foundational LLM's training data. + $ref: '#/components/schemas/CitationMetadata' readOnly: true - type: number - id: TuningSnapshot + finishReason: + enum: + - FINISH_REASON_UNSPECIFIED + - STOP + - MAX_TOKENS + - SAFETY + - RECITATION + - OTHER + description: >- + Optional. Output only. The reason why the model stopped generating + tokens. If empty, the model has not stopped generating the tokens. + readOnly: true + enumDescriptions: + - Default value. This value is unused. + - Natural stop point of the model or provided stop sequence. + - >- + The maximum number of tokens as specified in the request was + reached. + - The candidate content was flagged for safety reasons. + - The candidate content was flagged for recitation reasons. + - Unknown reason. + type: string CreateTunedModelMetadata: description: >- Metadata about the state and progress of creating a tuned model returned from the long-running operation + type: object properties: + tunedModel: + description: Name of the tuned model associated with the tuning operation. + type: string totalSteps: - type: integer description: The total number of tuning steps. format: int32 - tunedModel: - type: string - description: Name of the tuned model associated with the tuning operation. + type: integer + completedPercent: + description: The completed percentage for the tuning operation. + type: number + format: float completedSteps: format: int32 - type: integer description: The number of steps completed. + type: integer snapshots: description: Metrics collected during tuning. type: array items: $ref: '#/components/schemas/TuningSnapshot' - completedPercent: - description: The completed percentage for the tuning operation. - format: float - type: number id: CreateTunedModelMetadata - type: object - GenerationConfig: + BatchEmbedContentsRequest: + description: Batch request to get embeddings from the model for a list of prompts. + id: BatchEmbedContentsRequest type: object properties: - topP: - format: float - description: >- - Optional. The maximum cumulative probability of tokens to consider - when sampling. The model uses combined Top-k and nucleus sampling. - Tokens are sorted based on their assigned probabilities so that only - the most likely tokens are considered. Top-k sampling directly - limits the maximum number of tokens to consider, while Nucleus - sampling limits number of tokens based on the cumulative - probability. Note: The default value varies by model, see the - `Model.top_p` attribute of the `Model` returned the `getModel` - function. - type: number - topK: - type: integer - description: >- - Optional. The maximum number of tokens to consider when sampling. - The model uses combined Top-k and nucleus sampling. Top-k sampling - considers the set of `top_k` most probable tokens. Defaults to 40. - Note: The default value varies by model, see the `Model.top_k` - attribute of the `Model` returned the `getModel` function. - format: int32 - candidateCount: - description: >- - Optional. Number of generated responses to return. This value must - be between [1, 8], inclusive. If unset, this will default to 1. - format: int32 - type: integer - maxOutputTokens: - description: >- - Optional. The maximum number of tokens to include in a candidate. If - unset, this will default to output_token_limit specified in the - `Model` specification. - type: integer - format: int32 - temperature: - type: number - format: float - description: >- - Optional. Controls the randomness of the output. Note: The default - value varies by model, see the `Model.temperature` attribute of the - `Model` returned the `getModel` function. Values can range from - [0.0,1.0], inclusive. A value closer to 1.0 will produce responses - that are more varied and creative, while a value closer to 0.0 will - typically result in more straightforward responses from the model. - stopSequences: + requests: description: >- - Optional. The set of character sequences (up to 5) that will stop - output generation. If specified, the API will stop at the first - appearance of a stop sequence. The stop sequence will not be - included as part of the response. - items: - type: string + Required. Embed requests for the batch. The model in each of these + requests must match the model specified + `BatchEmbedContentsRequest.model`. type: array + items: + $ref: '#/components/schemas/EmbedContentRequest' + SafetyRating: + properties: + probability: + description: Required. The probability of harm for this content. + type: string + enumDescriptions: + - Probability is unspecified. + - Content has a negligible chance of being unsafe. + - Content has a low chance of being unsafe. + - Content has a medium chance of being unsafe. + - Content has a high chance of being unsafe. + enum: + - HARM_PROBABILITY_UNSPECIFIED + - NEGLIGIBLE + - LOW + - MEDIUM + - HIGH + blocked: + type: boolean + description: Was this content blocked because of this rating? + category: + enum: + - HARM_CATEGORY_UNSPECIFIED + - HARM_CATEGORY_DEROGATORY + - HARM_CATEGORY_TOXICITY + - HARM_CATEGORY_VIOLENCE + - HARM_CATEGORY_SEXUAL + - HARM_CATEGORY_MEDICAL + - HARM_CATEGORY_DANGEROUS + - HARM_CATEGORY_HARASSMENT + - HARM_CATEGORY_HATE_SPEECH + - HARM_CATEGORY_SEXUALLY_EXPLICIT + - HARM_CATEGORY_DANGEROUS_CONTENT + type: string + description: Required. The category for this rating. + enumDescriptions: + - Category is unspecified. + - >- + Negative or harmful comments targeting identity and/or protected + attribute. + - Content that is rude, disrespectful, or profane. + - >- + Describes scenarios depicting violence against an individual or + group, or general descriptions of gore. + - Contains references to sexual acts or other lewd content. + - Promotes unchecked medical advice. + - >- + Dangerous content that promotes, facilitates, or encourages + harmful acts. + - Harasment content. + - Hate speech and content. + - Sexually explicit content. + - Dangerous content. description: >- - Configuration options for model generation and outputs. Not all - parameters may be configurable for every model. - id: GenerationConfig - ListOperationsResponse: + Safety rating for a piece of content. The safety rating contains the + category of harm and the harm probability level in that category for a + piece of content. Content is classified for safety across a number of + harm categories and the probability of the harm classification is + included here. + type: object + id: SafetyRating + Part: + description: >- + A datatype containing media that is part of a multi-part `Content` + message. A `Part` consists of data which has an associated datatype. A + `Part` can only contain one of the accepted types in `Part.data`. A + `Part` must have a fixed IANA MIME type identifying the type and subtype + of the media if the `inline_data` field is filled with raw bytes. + type: object properties: - nextPageToken: - description: The standard List next-page token. + text: + description: Inline text. type: string - operations: - description: >- - A list of operations that matches the specified filter in the - request. - items: - $ref: '#/components/schemas/Operation' - type: array - description: The response message for Operations.ListOperations. - id: ListOperationsResponse + inlineData: + $ref: '#/components/schemas/Blob' + description: Inline media bytes. + id: Part + Operation: + description: >- + This resource represents a long-running operation that is the result of + a network API call. type: object - Model: - description: Information about a Generative Language Model. properties: - name: + done: description: >- - Required. The resource name of the `Model`. Format: `models/{model}` - with a `{model}` naming convention of: * "{base_model_id}-{version}" - Examples: * `models/chat-bison-001` - type: string - displayName: - type: string + If the value is `false`, it means the operation is still in + progress. If `true`, the operation is completed, and either `error` + or `response` is available. + type: boolean + response: + additionalProperties: + description: Properties of the object. Contains field @type with type URL. + type: any description: >- - The human-readable name of the model. E.g. "Chat Bison". The name - can be up to 128 characters long and can consist of any UTF-8 - characters. - description: + The normal, successful response of the operation. If the original + method returns no data on success, such as `Delete`, the response is + `google.protobuf.Empty`. If the original method is standard + `Get`/`Create`/`Update`, the response should be the resource. For + other methods, the response should have the type `XxxResponse`, + where `Xxx` is the original method name. For example, if the + original method name is `TakeSnapshot()`, the inferred response type + is `TakeSnapshotResponse`. + type: object + metadata: + type: object + description: >- + Service-specific metadata associated with the operation. It + typically contains progress information and common metadata such as + create time. Some services might not provide such metadata. Any + method that returns a long-running operation should document the + metadata type, if any. + additionalProperties: + type: any + description: Properties of the object. Contains field @type with type URL. + name: + description: >- + The server-assigned name, which is only unique within the same + service that originally returns it. If you use the default HTTP + mapping, the `name` should be a resource name ending with + `operations/{unique_id}`. type: string - description: A short description of the model. - topK: + error: description: >- - For Top-k sampling. Top-k sampling considers the set of `top_k` most - probable tokens. This value specifies default to be used by the - backend while making the call to the model. + The error result of the operation in case of failure or + cancellation. + $ref: '#/components/schemas/Status' + id: Operation + Status: + type: object + id: Status + properties: + code: + description: The status code, which should be an enum value of google.rpc.Code. type: integer format: int32 - version: + message: type: string description: >- - Required. The version number of the model. This represents the major - version - temperature: - description: >- - Controls the randomness of the output. Values can range over - `[0.0,1.0]`, inclusive. A value closer to `1.0` will produce - responses that are more varied, while a value closer to `0.0` will - typically result in less surprising responses from the model. This - value specifies default to be used by the backend while making the - call to the model. - format: float - type: number - topP: - format: float - type: number - description: >- - For Nucleus sampling. Nucleus sampling considers the smallest set of - tokens whose probability sum is at least `top_p`. This value - specifies default to be used by the backend while making the call to - the model. - baseModelId: - description: >- - Required. The name of the base model, pass this to the generation - request. Examples: * `chat-bison` - type: string - inputTokenLimit: - format: int32 - type: integer - description: Maximum number of input tokens allowed for this model. - outputTokenLimit: - type: integer - description: Maximum number of output tokens available for this model. - format: int32 - supportedGenerationMethods: + A developer-facing error message, which should be in English. Any + user-facing error message should be localized and sent in the + google.rpc.Status.details field, or localized by the client. + details: + items: + additionalProperties: + description: Properties of the object. Contains field @type with type URL. + type: any + type: object type: array description: >- - The model's supported generation methods. The method names are - defined as Pascal case strings, such as `generateMessage` which - correspond to API methods. + A list of messages that carry the error details. There is a common + set of message types for APIs to use. + description: >- + The `Status` type defines a logical error model that is suitable for + different programming environments, including REST APIs and RPC APIs. It + is used by [gRPC](https://github.com/grpc). Each `Status` message + contains three pieces of data: error code, error message, and error + details. You can find out more about this error model and how to work + with it in the [API Design + Guide](https://cloud.google.com/apis/design/errors). + CitationMetadata: + id: CitationMetadata + properties: + citationSources: + type: array items: - type: string - id: Model + $ref: '#/components/schemas/CitationSource' + description: Citations to sources for a specific response. type: object - SafetyRating: - description: >- - Safety rating for a piece of content. The safety rating contains the - category of harm and the harm probability level in that category for a - piece of content. Content is classified for safety across a number of - harm categories and the probability of the harm classification is - included here. - id: SafetyRating + description: A collection of source attributions for a piece of content. + SafetySetting: type: object + description: >- + Safety setting, affecting the safety-blocking behavior. Passing a safety + setting for a category changes the allowed proability that content is + blocked. properties: - category: + threshold: + enumDescriptions: + - Threshold is unspecified. + - Content with NEGLIGIBLE will be allowed. + - Content with NEGLIGIBLE and LOW will be allowed. + - Content with NEGLIGIBLE, LOW, and MEDIUM will be allowed. + - All content will be allowed. + description: >- + Required. Controls the probability threshold at which harm is + blocked. + enum: + - HARM_BLOCK_THRESHOLD_UNSPECIFIED + - BLOCK_LOW_AND_ABOVE + - BLOCK_MEDIUM_AND_ABOVE + - BLOCK_ONLY_HIGH + - BLOCK_NONE type: string + category: enum: - HARM_CATEGORY_UNSPECIFIED - HARM_CATEGORY_DEROGATORY @@ -246,15 +337,16 @@ components: - HARM_CATEGORY_HATE_SPEECH - HARM_CATEGORY_SEXUALLY_EXPLICIT - HARM_CATEGORY_DANGEROUS_CONTENT - description: Required. The category for this rating. + type: string + description: Required. The category for this setting. enumDescriptions: - Category is unspecified. - >- Negative or harmful comments targeting identity and/or protected attribute. - - Content that is rude, disrepspectful, or profane. + - Content that is rude, disrespectful, or profane. - >- - Describes scenarios depictng violence against an individual or + Describes scenarios depicting violence against an individual or group, or general descriptions of gore. - Contains references to sexual acts or other lewd content. - Promotes unchecked medical advice. @@ -265,544 +357,452 @@ components: - Hate speech and content. - Sexually explicit content. - Dangerous content. - probability: - enum: - - HARM_PROBABILITY_UNSPECIFIED - - NEGLIGIBLE - - LOW - - MEDIUM - - HIGH - type: string - enumDescriptions: - - Probability is unspecified. - - Content has a negligible chance of being unsafe. - - Content has a low chance of being unsafe. - - Content has a medium chance of being unsafe. - - Content has a high chance of being unsafe. - description: Required. The probability of harm for this content. - blocked: - type: boolean - description: Was this content blocked because of this rating? - Part: - type: object + id: SafetySetting + CitationSource: properties: - inlineData: - $ref: '#/components/schemas/Blob' - description: Inline media bytes. - text: - description: Inline text. + license: type: string - id: Part - description: >- - A datatype containing media that is part of a multi-part `Content` - message. A `Part` consists of data which has an associated datatype. A - `Part` can only contain one of the accepted types in `Part.data`. A - `Part` must have a fixed IANA MIME type identifying the type and subtype - of the media if the `inline_data` field is filled with raw bytes. - Empty: - id: Empty - properties: {} - description: >- - A generic empty message that you can re-use to avoid defining duplicated - empty messages in your APIs. A typical example is to use it as the - request or the response type of an API method. For instance: service Foo - { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); } - type: object - GenerateContentRequest: - id: GenerateContentRequest - description: Request to generate a completion from the model. + description: >- + Optional. License for the GitHub project that is attributed as a + source for segment. License info is required for code citations. + uri: + description: >- + Optional. URI that is attributed as a source for a portion of the + text. + type: string + endIndex: + type: integer + format: int32 + description: Optional. End of the attributed segment, exclusive. + startIndex: + description: >- + Optional. Start of segment of the response that is attributed to + this source. Index indicates the start of the segment, measured in + bytes. + type: integer + format: int32 type: object + description: A citation to a source for a portion of a specific response. + id: CitationSource + GenerationConfig: + id: GenerationConfig properties: - generationConfig: - $ref: '#/components/schemas/GenerationConfig' - description: Optional. Configuration options for model generation and outputs. - contents: - type: array - items: - $ref: '#/components/schemas/Content' + temperature: + format: float + type: number description: >- - Required. The content of the current conversation with the model. - For single-turn queries, this is a single instance. For multi-turn - queries, this is a repeated field that contains conversation history - + latest request. - safetySettings: + Optional. Controls the randomness of the output. Note: The default + value varies by model, see the `Model.temperature` attribute of the + `Model` returned from the `getModel` function. Values can range from + [0.0, infinity). + stopSequences: description: >- - Optional. A list of unique `SafetySetting` instances for blocking - unsafe content. This will be enforced on the - `GenerateContentRequest.contents` and - `GenerateContentResponse.candidates`. There should not be more than - one setting for each `SafetyCategory` type. The API will block any - contents and responses that fail to meet the thresholds set by these - settings. This list overrides the default settings for each - `SafetyCategory` specified in the safety_settings. If there is no - `SafetySetting` for a given `SafetyCategory` provided in the list, - the API will use the default safety setting for that category. Harm - categories HARM_CATEGORY_HATE_SPEECH, - HARM_CATEGORY_SEXUALLY_EXPLICIT, HARM_CATEGORY_DANGEROUS_CONTENT, - HARM_CATEGORY_HARASSMENT are supported. + Optional. The set of character sequences (up to 5) that will stop + output generation. If specified, the API will stop at the first + appearance of a stop sequence. The stop sequence will not be + included as part of the response. items: - $ref: '#/components/schemas/SafetySetting' + type: string type: array - EmbedContentResponse: - properties: - embedding: - $ref: '#/components/schemas/ContentEmbedding' - description: Output only. The embedding generated from the input content. - readOnly: true - type: object - id: EmbedContentResponse - description: The response to an `EmbedContentRequest`. - Content: - type: object + topK: + format: int32 + type: integer + description: >- + Optional. The maximum number of tokens to consider when sampling. + The model uses combined Top-k and nucleus sampling. Top-k sampling + considers the set of `top_k` most probable tokens. Note: The default + value varies by model, see the `Model.top_k` attribute of the + `Model` returned from the `getModel` function. + candidateCount: + description: >- + Optional. Number of generated responses to return. Currently, this + value can only be set to 1. If unset, this will default to 1. + format: int32 + type: integer + topP: + description: >- + Optional. The maximum cumulative probability of tokens to consider + when sampling. The model uses combined Top-k and nucleus sampling. + Tokens are sorted based on their assigned probabilities so that only + the most likely tokens are considered. Top-k sampling directly + limits the maximum number of tokens to consider, while Nucleus + sampling limits number of tokens based on the cumulative + probability. Note: The default value varies by model, see the + `Model.top_p` attribute of the `Model` returned from the `getModel` + function. + format: float + type: number + maxOutputTokens: + description: >- + Optional. The maximum number of tokens to include in a candidate. + Note: The default value varies by model, see the + `Model.output_token_limit` attribute of the `Model` returned from + the `getModel` function. + type: integer + format: int32 description: >- - The base structured datatype containing multi-part content of a message. - A `Content` includes a `role` field designating the producer of the - `Content` and a `parts` field containing multi-part data that contains - the content of the message turn. - id: Content + Configuration options for model generation and outputs. Not all + parameters may be configurable for every model. + type: object + CountTokensRequest: properties: - role: - description: >- - Optional. The producer of the content. Must be either 'user' or - 'model'. Useful to set for multi-turn conversations, otherwise can - be left blank or unset. - type: string - parts: + contents: items: - $ref: '#/components/schemas/Part' - description: >- - Ordered `Parts` that constitute a single message. Parts may have - different MIME types. + $ref: '#/components/schemas/Content' type: array - CancelOperationRequest: - id: CancelOperationRequest - description: The request message for Operations.CancelOperation. - properties: {} + description: Required. The input given to the model as a prompt. + id: CountTokensRequest + description: >- + Counts the number of tokens in the `prompt` sent to a model. Models may + tokenize text differently, so each model may return a different + `token_count`. type: object - EmbedContentRequest: + TuningSnapshot: properties: - content: - $ref: '#/components/schemas/Content' - description: >- - Required. The content to embed. Only the `parts.text` fields will be - counted. - taskType: - enumDescriptions: - - Unset value, which will default to one of the other enum values. - - Specifies the given text is a query in a search/retrieval setting. - - >- - Specifies the given text is a document from the corpus being - searched. - - Specifies the given text will be used for STS. - - Specifies that the given text will be classified. - - Specifies that the embeddings will be used for clustering. - description: >- - Optional. Optional task type for which the embeddings will be used. - Can only be set for `models/embedding-001`. - enum: - - TASK_TYPE_UNSPECIFIED - - RETRIEVAL_QUERY - - RETRIEVAL_DOCUMENT - - SEMANTIC_SIMILARITY - - CLASSIFICATION - - CLUSTERING + computeTime: + description: Output only. The timestamp when this metric was computed. type: string - model: + readOnly: true + format: google-datetime + step: + type: integer + format: int32 + description: Output only. The tuning step. + readOnly: true + meanLoss: + readOnly: true + description: Output only. The mean loss of the training examples for this step. + type: number + format: float + epoch: + type: integer + format: int32 + readOnly: true + description: Output only. The epoch this step was part of. + description: Record for a single tuning step. + type: object + id: TuningSnapshot + Blob: + id: Blob + properties: + data: + description: Raw bytes for media formats. type: string - description: >- - Required. The model's resource name. This serves as an ID for the - Model to use. This name should match a model name returned by the - `ListModels` method. Format: `models/{model}` - title: + format: byte + mimeType: type: string description: >- - Optional. An optional title for the text. Only applicable when - TaskType is `RETRIEVAL_DOCUMENT`. - id: EmbedContentRequest - description: Request containing the `Content` for the model to embed. + The IANA standard MIME type of the source data. Accepted types + include: "image/png", "image/jpeg", "image/heic", "image/heif", + "image/webp". + description: >- + Raw media bytes. Text should not be sent as raw bytes, use the 'text' + field. type: object ListModelsResponse: + id: ListModelsResponse + type: object description: Response from `ListModel` containing a paginated list of Models. properties: nextPageToken: + type: string description: >- A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no more pages. - type: string models: type: array description: The returned Models. items: $ref: '#/components/schemas/Model' - type: object - id: ListModelsResponse - BatchEmbedContentsRequest: - properties: - requests: - type: array - description: >- - Required. Embed requests for the batch. The model in each of these - requests must match the model specified - `BatchEmbedContentsRequest.model`. - items: - $ref: '#/components/schemas/EmbedContentRequest' - type: object - description: Batch request to get embeddings from the model for a list of prompts. - id: BatchEmbedContentsRequest ContentEmbedding: + description: A list of floats representing an embedding. + id: ContentEmbedding + type: object properties: values: description: The embedding values. + type: array items: - format: float type: number - type: array - id: ContentEmbedding - type: object - description: A list of floats representing an embedding. + format: float PromptFeedback: + id: PromptFeedback + type: object properties: - safetyRatings: - type: array - items: - $ref: '#/components/schemas/SafetyRating' - description: >- - Ratings for safety of the prompt. There is at most one rating per - category. blockReason: enum: - BLOCK_REASON_UNSPECIFIED - SAFETY - OTHER + type: string + description: >- + Optional. If set, the prompt was blocked and no candidates are + returned. Rephrase your prompt. enumDescriptions: - Default value. This value is unused. - >- Prompt was blocked due to safety reasons. You can inspect `safety_ratings` to understand which safety category blocked it. - Prompt was blocked due to unknown reaasons. + safetyRatings: + items: + $ref: '#/components/schemas/SafetyRating' + type: array description: >- - Optional. If set, the prompt was blocked and no candidates are - returned. Rephrase your prompt. - type: string - id: PromptFeedback - type: object + Ratings for safety of the prompt. There is at most one rating per + category. description: >- A set of the feedback metadata the prompt specified in `GenerateContentRequest.content`. - Operation: + EmbedContentRequest: + description: Request containing the `Content` for the model to embed. + type: object properties: - name: - type: string - description: >- - The server-assigned name, which is only unique within the same - service that originally returns it. If you use the default HTTP - mapping, the `name` should be a resource name ending with - `operations/{unique_id}`. - response: - type: object - additionalProperties: - type: any - description: Properties of the object. Contains field @type with type URL. + taskType: description: >- - The normal, successful response of the operation. If the original - method returns no data on success, such as `Delete`, the response is - `google.protobuf.Empty`. If the original method is standard - `Get`/`Create`/`Update`, the response should be the resource. For - other methods, the response should have the type `XxxResponse`, - where `Xxx` is the original method name. For example, if the - original method name is `TakeSnapshot()`, the inferred response type - is `TakeSnapshotResponse`. - done: - type: boolean + Optional. Optional task type for which the embeddings will be used. + Can only be set for `models/embedding-001`. + enumDescriptions: + - Unset value, which will default to one of the other enum values. + - Specifies the given text is a query in a search/retrieval setting. + - >- + Specifies the given text is a document from the corpus being + searched. + - Specifies the given text will be used for STS. + - Specifies that the given text will be classified. + - Specifies that the embeddings will be used for clustering. + type: string + enum: + - TASK_TYPE_UNSPECIFIED + - RETRIEVAL_QUERY + - RETRIEVAL_DOCUMENT + - SEMANTIC_SIMILARITY + - CLASSIFICATION + - CLUSTERING + model: description: >- - If the value is `false`, it means the operation is still in - progress. If `true`, the operation is completed, and either `error` - or `response` is available. - metadata: - additionalProperties: - description: Properties of the object. Contains field @type with type URL. - type: any + Required. The model's resource name. This serves as an ID for the + Model to use. This name should match a model name returned by the + `ListModels` method. Format: `models/{model}` + type: string + content: + $ref: '#/components/schemas/Content' description: >- - Service-specific metadata associated with the operation. It - typically contains progress information and common metadata such as - create time. Some services might not provide such metadata. Any - method that returns a long-running operation should document the - metadata type, if any. - type: object - error: - $ref: '#/components/schemas/Status' + Required. The content to embed. Only the `parts.text` fields will be + counted. + title: + type: string description: >- - The error result of the operation in case of failure or - cancellation. - type: object - description: >- - This resource represents a long-running operation that is the result of - a network API call. - id: Operation - GenerateContentResponse: - description: >- - Response from the model supporting multiple candidates. Note on safety - ratings and content filtering. They are reported for both prompt in - `GenerateContentResponse.prompt_feedback` and for each candidate in - `finish_reason` and in `safety_ratings`. The API contract is that: - - either all requested candidates are returned or no candidates at all - - no candidates are returned only if there was something wrong with the - prompt (see `prompt_feedback`) - feedback on each candidate is reported - on `finish_reason` and `safety_ratings`. - type: object - id: GenerateContentResponse - properties: - promptFeedback: - $ref: '#/components/schemas/PromptFeedback' - description: Returns the prompt's feedback related to the content filters. - candidates: - type: array - description: Candidate responses from the model. - items: - $ref: '#/components/schemas/Candidate' - SafetySetting: - id: SafetySetting + Optional. An optional title for the text. Only applicable when + TaskType is `RETRIEVAL_DOCUMENT`. Note: Specifying a `title` for + `RETRIEVAL_DOCUMENT` provides better quality embeddings for + retrieval. + id: EmbedContentRequest + ListOperationsResponse: type: object properties: - category: - enum: - - HARM_CATEGORY_UNSPECIFIED - - HARM_CATEGORY_DEROGATORY - - HARM_CATEGORY_TOXICITY - - HARM_CATEGORY_VIOLENCE - - HARM_CATEGORY_SEXUAL - - HARM_CATEGORY_MEDICAL - - HARM_CATEGORY_DANGEROUS - - HARM_CATEGORY_HARASSMENT - - HARM_CATEGORY_HATE_SPEECH - - HARM_CATEGORY_SEXUALLY_EXPLICIT - - HARM_CATEGORY_DANGEROUS_CONTENT + nextPageToken: + description: The standard List next-page token. type: string - description: Required. The category for this setting. - enumDescriptions: - - Category is unspecified. - - >- - Negative or harmful comments targeting identity and/or protected - attribute. - - Content that is rude, disrepspectful, or profane. - - >- - Describes scenarios depictng violence against an individual or - group, or general descriptions of gore. - - Contains references to sexual acts or other lewd content. - - Promotes unchecked medical advice. - - >- - Dangerous content that promotes, facilitates, or encourages - harmful acts. - - Harasment content. - - Hate speech and content. - - Sexually explicit content. - - Dangerous content. - threshold: + operations: + items: + $ref: '#/components/schemas/Operation' + type: array description: >- - Required. Controls the probability threshold at which harm is - blocked. - enumDescriptions: - - Threshold is unspecified. - - Content with NEGLIGIBLE will be allowed. - - Content with NEGLIGIBLE and LOW will be allowed. - - Content with NEGLIGIBLE, LOW, and MEDIUM will be allowed. - - All content will be allowed. - type: string - enum: - - HARM_BLOCK_THRESHOLD_UNSPECIFIED - - BLOCK_LOW_AND_ABOVE - - BLOCK_MEDIUM_AND_ABOVE - - BLOCK_ONLY_HIGH - - BLOCK_NONE + A list of operations that matches the specified filter in the + request. + description: The response message for Operations.ListOperations. + id: ListOperationsResponse + Empty: + properties: {} description: >- - Safety setting, affecting the safety-blocking behavior. Passing a safety - setting for a category changes the allowed proability that content is - blocked. - Candidate: - id: Candidate + A generic empty message that you can re-use to avoid defining duplicated + empty messages in your APIs. A typical example is to use it as the + request or the response type of an API method. For instance: service Foo + { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); } + id: Empty + type: object + Content: + description: >- + The base structured datatype containing multi-part content of a message. + A `Content` includes a `role` field designating the producer of the + `Content` and a `parts` field containing multi-part data that contains + the content of the message turn. + type: object + id: Content properties: - content: - description: Output only. Generated content returned from the model. - readOnly: true - $ref: '#/components/schemas/Content' - finishReason: - enum: - - FINISH_REASON_UNSPECIFIED - - STOP - - MAX_TOKENS - - SAFETY - - RECITATION - - OTHER - readOnly: true - enumDescriptions: - - Default value. This value is unused. - - Natural stop point of the model or provided stop sequence. - - >- - The maximum number of tokens as specified in the request was - reached. - - The candidate content was flagged for safety reasons. - - The candidate content was flagged for recitation reasons. - - Unknown reason. + role: type: string description: >- - Optional. Output only. The reason why the model stopped generating - tokens. If empty, the model has not stopped generating the tokens. - citationMetadata: - $ref: '#/components/schemas/CitationMetadata' - readOnly: true - description: >- - Output only. Citation information for model-generated candidate. - This field may be populated with recitation information for any text - included in the `content`. These are passages that are "recited" - from copyrighted material in the foundational LLM's training data. - index: - format: int32 - type: integer - readOnly: true - description: Output only. Index of the candidate in the list of candidates. - tokenCount: - description: Output only. Token count for this candidate. - format: int32 - type: integer - readOnly: true - safetyRatings: + Optional. The producer of the content. Must be either 'user' or + 'model'. Useful to set for multi-turn conversations, otherwise can + be left blank or unset. + parts: type: array description: >- - List of ratings for the safety of a response candidate. There is at - most one rating per category. + Ordered `Parts` that constitute a single message. Parts may have + different MIME types. items: - $ref: '#/components/schemas/SafetyRating' + $ref: '#/components/schemas/Part' + CancelOperationRequest: + properties: {} + description: The request message for Operations.CancelOperation. type: object - description: A response candidate generated from the model. - CountTokensResponse: + id: CancelOperationRequest + EmbedContentResponse: + description: The response to an `EmbedContentRequest`. type: object + properties: + embedding: + description: Output only. The embedding generated from the input content. + readOnly: true + $ref: '#/components/schemas/ContentEmbedding' + id: EmbedContentResponse + CountTokensResponse: properties: totalTokens: - type: integer - format: int32 description: >- The number of tokens that the `model` tokenizes the `prompt` into. Always non-negative. - id: CountTokensResponse + type: integer + format: int32 description: >- A response from `CountTokens`. It returns the model's `token_count` for the `prompt`. - CountTokensRequest: - id: CountTokensRequest - properties: - contents: - type: array - items: - $ref: '#/components/schemas/Content' - description: Required. The input given to the model as a prompt. - description: >- - Counts the number of tokens in the `prompt` sent to a model. Models may - tokenize text differently, so each model may return a different - `token_count`. - type: object - BatchEmbedContentsResponse: - id: BatchEmbedContentsResponse + id: CountTokensResponse type: object + GenerateContentResponse: properties: - embeddings: - readOnly: true - description: >- - Output only. The embeddings for each request, in the same order as - provided in the batch request. + promptFeedback: + $ref: '#/components/schemas/PromptFeedback' + description: Returns the prompt's feedback related to the content filters. + candidates: type: array + description: Candidate responses from the model. items: - $ref: '#/components/schemas/ContentEmbedding' - description: The response to a `BatchEmbedContentsRequest`. - CitationMetadata: + $ref: '#/components/schemas/Candidate' type: object - properties: - citationSources: - description: Citations to sources for a specific response. - type: array - items: - $ref: '#/components/schemas/CitationSource' - id: CitationMetadata - description: A collection of source attributions for a piece of content. - Blob: + id: GenerateContentResponse + description: >- + Response from the model supporting multiple candidates. Note on safety + ratings and content filtering. They are reported for both prompt in + `GenerateContentResponse.prompt_feedback` and for each candidate in + `finish_reason` and in `safety_ratings`. The API contract is that: - + either all requested candidates are returned or no candidates at all - + no candidates are returned only if there was something wrong with the + prompt (see `prompt_feedback`) - feedback on each candidate is reported + on `finish_reason` and `safety_ratings`. + Model: type: object - id: Blob - description: >- - Raw media bytes. Text should not be sent as raw bytes, use the 'text' - field. + description: Information about a Generative Language Model. properties: - mimeType: - type: string + topP: + type: number + format: float description: >- - The IANA standard MIME type of the source data. Accepted types - include: "image/png", "image/jpeg", "image/heic", "image/heif", - "image/webp". - data: + For Nucleus sampling. Nucleus sampling considers the smallest set of + tokens whose probability sum is at least `top_p`. This value + specifies default to be used by the backend while making the call to + the model. + supportedGenerationMethods: + description: >- + The model's supported generation methods. The method names are + defined as Pascal case strings, such as `generateMessage` which + correspond to API methods. + type: array + items: + type: string + description: type: string - description: Raw bytes for media formats. - format: byte - CitationSource: - description: A citation to a source for a portion of a specific response. - type: object - id: CitationSource - properties: - endIndex: + description: A short description of the model. + inputTokenLimit: type: integer - description: Optional. End of the attributed segment, exclusive. + description: Maximum number of input tokens allowed for this model. format: int32 - license: + displayName: description: >- - Optional. License for the GitHub project that is attributed as a - source for segment. License info is required for code citations. + The human-readable name of the model. E.g. "Chat Bison". The name + can be up to 128 characters long and can consist of any UTF-8 + characters. type: string - uri: + baseModelId: type: string description: >- - Optional. URI that is attributed as a source for a portion of the - text. - startIndex: - description: >- - Optional. Start of segment of the response that is attributed to - this source. Index indicates the start of the segment, measured in - bytes. + Required. The name of the base model, pass this to the generation + request. Examples: * `chat-bison` + outputTokenLimit: + type: integer + description: Maximum number of output tokens available for this model. format: int32 + version: + description: >- + Required. The version number of the model. This represents the major + version + type: string + name: + description: >- + Required. The resource name of the `Model`. Format: `models/{model}` + with a `{model}` naming convention of: * "{base_model_id}-{version}" + Examples: * `models/chat-bison-001` + type: string + topK: type: integer - Status: - id: Status - description: >- - The `Status` type defines a logical error model that is suitable for - different programming environments, including REST APIs and RPC APIs. It - is used by [gRPC](https://github.com/grpc). Each `Status` message - contains three pieces of data: error code, error message, and error - details. You can find out more about this error model and how to work - with it in the [API Design - Guide](https://cloud.google.com/apis/design/errors). + description: >- + For Top-k sampling. Top-k sampling considers the set of `top_k` most + probable tokens. This value specifies default to be used by the + backend while making the call to the model. + format: int32 + temperature: + description: >- + Controls the randomness of the output. Values can range over + `[0.0,1.0]`, inclusive. A value closer to `1.0` will produce + responses that are more varied, while a value closer to `0.0` will + typically result in less surprising responses from the model. This + value specifies default to be used by the backend while making the + call to the model. + format: float + type: number + id: Model + GenerateContentRequest: + id: GenerateContentRequest + type: object properties: - details: + generationConfig: + $ref: '#/components/schemas/GenerationConfig' + description: Optional. Configuration options for model generation and outputs. + contents: description: >- - A list of messages that carry the error details. There is a common - set of message types for APIs to use. + Required. The content of the current conversation with the model. + For single-turn queries, this is a single instance. For multi-turn + queries, this is a repeated field that contains conversation history + + latest request. + type: array items: - additionalProperties: - description: Properties of the object. Contains field @type with type URL. - type: any - type: object + $ref: '#/components/schemas/Content' + safetySettings: + items: + $ref: '#/components/schemas/SafetySetting' type: array - code: - description: The status code, which should be an enum value of google.rpc.Code. - format: int32 - type: integer - message: description: >- - A developer-facing error message, which should be in English. Any - user-facing error message should be localized and sent in the - google.rpc.Status.details field, or localized by the client. - type: string - type: object + Optional. A list of unique `SafetySetting` instances for blocking + unsafe content. This will be enforced on the + `GenerateContentRequest.contents` and + `GenerateContentResponse.candidates`. There should not be more than + one setting for each `SafetyCategory` type. The API will block any + contents and responses that fail to meet the thresholds set by these + settings. This list overrides the default settings for each + `SafetyCategory` specified in the safety_settings. If there is no + `SafetySetting` for a given `SafetyCategory` provided in the list, + the API will use the default safety setting for that category. Harm + categories HARM_CATEGORY_HATE_SPEECH, + HARM_CATEGORY_SEXUALLY_EXPLICIT, HARM_CATEGORY_DANGEROUS_CONTENT, + HARM_CATEGORY_HARASSMENT are supported. + description: Request to generate a completion from the model. parameters: - upload_protocol: - description: Upload protocol for media (e.g. "raw", "multipart"). + uploadType: + description: Legacy upload protocol for media (e.g. "media", "multipart"). in: query - name: upload_protocol + name: uploadType schema: type: string _.xgafv: @@ -814,10 +814,25 @@ components: enum: - '1' - '2' - uploadType: - description: Legacy upload protocol for media (e.g. "media", "multipart"). + quotaUser: + description: >- + Available to use for quota purposes for server-side applications. Can be + any arbitrary string assigned to a user, but should not exceed 40 + characters. in: query - name: uploadType + name: quotaUser + schema: + type: string + access_token: + description: OAuth access token. + in: query + name: access_token + schema: + type: string + fields: + description: Selector specifying which fields to include in a partial response. + in: query + name: fields schema: type: string prettyPrint: @@ -826,25 +841,22 @@ components: name: prettyPrint schema: type: boolean - key: - description: >- - API key. Your API key identifies your project and provides you with API - access, quota, and reports. Required unless you provide an OAuth 2.0 - token. + callback: + description: JSONP in: query - name: key + name: callback schema: type: string - access_token: - description: OAuth access token. + oauth_token: + description: OAuth 2.0 token for the current user. in: query - name: access_token + name: oauth_token schema: type: string - callback: - description: JSONP + upload_protocol: + description: Upload protocol for media (e.g. "raw", "multipart"). in: query - name: callback + name: upload_protocol schema: type: string alt: @@ -857,41 +869,88 @@ components: - json - media - proto - fields: - description: Selector specifying which fields to include in a partial response. - in: query - name: fields - schema: - type: string - quotaUser: + key: description: >- - Available to use for quota purposes for server-side applications. Can be - any arbitrary string assigned to a user, but should not exceed 40 - characters. - in: query - name: quotaUser - schema: - type: string - oauth_token: - description: OAuth 2.0 token for the current user. + API key. Your API key identifies your project and provides you with API + access, quota, and reports. Required unless you provide an OAuth 2.0 + token. in: query - name: oauth_token + name: key schema: type: string paths: + /v1/tunedModels/{tunedModelsId}:generateContent: + parameters: &ref_0 + - $ref: '#/components/parameters/uploadType' + - $ref: '#/components/parameters/_.xgafv' + - $ref: '#/components/parameters/quotaUser' + - $ref: '#/components/parameters/access_token' + - $ref: '#/components/parameters/fields' + - $ref: '#/components/parameters/prettyPrint' + - $ref: '#/components/parameters/callback' + - $ref: '#/components/parameters/oauth_token' + - $ref: '#/components/parameters/upload_protocol' + - $ref: '#/components/parameters/alt' + - $ref: '#/components/parameters/key' + post: + description: >- + Generates a response from the model given an input + `GenerateContentRequest`. + operationId: generativelanguage.tunedModels.generateContent + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/GenerateContentRequest' + security: [] + responses: + '200': + description: Successful response + content: + application/json: + schema: + $ref: '#/components/schemas/GenerateContentResponse' + parameters: + - in: path + name: tunedModelsId + required: true + schema: + type: string + x-stackQL-resource: tuned_models + x-stackQL-method: generate_content + x-stackQL-verb: exec + /v1/tunedModels/{tunedModelsId}/operations/{operationsId}: + parameters: *ref_0 + get: + description: >- + Gets the latest state of a long-running operation. Clients can use this + method to poll the operation result at intervals as recommended by the + API service. + operationId: generativelanguage.tunedModels.operations.get + security: [] + responses: + '200': + description: Successful response + content: + application/json: + schema: + $ref: '#/components/schemas/Operation' + parameters: + - in: path + name: tunedModelsId + required: true + schema: + type: string + - in: path + name: operationsId + required: true + schema: + type: string + x-stackQL-resource: operations + x-stackQL-method: get + x-stackQL-verb: select /v1/tunedModels/{tunedModelsId}/operations/{operationsId}:cancel: - parameters: &ref_0 - - $ref: '#/components/parameters/upload_protocol' - - $ref: '#/components/parameters/_.xgafv' - - $ref: '#/components/parameters/uploadType' - - $ref: '#/components/parameters/prettyPrint' - - $ref: '#/components/parameters/key' - - $ref: '#/components/parameters/access_token' - - $ref: '#/components/parameters/callback' - - $ref: '#/components/parameters/alt' - - $ref: '#/components/parameters/fields' - - $ref: '#/components/parameters/quotaUser' - - $ref: '#/components/parameters/oauth_token' + parameters: *ref_0 post: description: >- Starts asynchronous cancellation on a long-running operation. The server @@ -952,14 +1011,14 @@ paths: required: true schema: type: string - - in: query - name: pageSize - schema: - type: integer - in: query name: filter schema: type: string + - in: query + name: pageSize + schema: + type: integer - in: query name: pageToken schema: @@ -968,14 +1027,13 @@ paths: x-stackQL-method: list x-stackQL-verb: select x-stackQL-objectKey: $.operations - /v1/tunedModels/{tunedModelsId}/operations/{operationsId}: + /v1/operations: parameters: *ref_0 get: description: >- - Gets the latest state of a long-running operation. Clients can use this - method to poll the operation result at intervals as recommended by the - API service. - operationId: generativelanguage.tunedModels.operations.get + Lists operations that match the specified filter in the request. If the + server doesn't support this method, it returns `UNIMPLEMENTED`. + operationId: generativelanguage.operations.list security: [] responses: '200': @@ -983,60 +1041,33 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/Operation' + $ref: '#/components/schemas/ListOperationsResponse' parameters: - - in: path - name: tunedModelsId - required: true + - in: query + name: pageSize + schema: + type: integer + - in: query + name: filter schema: type: string - - in: path - name: operationsId - required: true + - in: query + name: pageToken schema: type: string x-stackQL-resource: operations - x-stackQL-method: get + x-stackQL-method: list x-stackQL-verb: select - /v1/models/{modelsId}:generateContent: + x-stackQL-objectKey: $.operations + /v1/operations/{operationsId}: parameters: *ref_0 - post: + delete: description: >- - Generates a response from the model given an input - `GenerateContentRequest`. - operationId: generativelanguage.models.generateContent - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/GenerateContentRequest' - security: [] - responses: - '200': - description: Successful response - content: - application/json: - schema: - $ref: '#/components/schemas/GenerateContentResponse' - parameters: - - in: path - name: modelsId - required: true - schema: - type: string - x-stackQL-resource: models - x-stackQL-method: generate_content - x-stackQL-verb: exec - /v1/models/{modelsId}:countTokens: - parameters: *ref_0 - post: - description: Runs a model's tokenizer on input content and returns the token count. - operationId: generativelanguage.models.countTokens - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/CountTokensRequest' + Deletes a long-running operation. This method indicates that the client + is no longer interested in the operation result. It does not cancel the + operation. If the server doesn't support this method, it returns + `google.rpc.Code.UNIMPLEMENTED`. + operationId: generativelanguage.operations.delete security: [] responses: '200': @@ -1044,42 +1075,16 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/CountTokensResponse' + $ref: '#/components/schemas/Empty' parameters: - in: path - name: modelsId + name: operationsId required: true schema: type: string - x-stackQL-resource: models - x-stackQL-method: count_tokens - x-stackQL-verb: exec - /v1/models: - parameters: *ref_0 - get: - description: Lists models available through the API. - operationId: generativelanguage.models.list - security: [] - responses: - '200': - description: Successful response - content: - application/json: - schema: - $ref: '#/components/schemas/ListModelsResponse' - parameters: - - in: query - name: pageToken - schema: - type: string - - in: query - name: pageSize - schema: - type: integer - x-stackQL-resource: models - x-stackQL-method: list - x-stackQL-verb: select - x-stackQL-objectKey: $.models + x-stackQL-resource: operations + x-stackQL-method: delete + x-stackQL-verb: delete /v1/models/{modelsId}: parameters: *ref_0 get: @@ -1102,18 +1107,16 @@ paths: x-stackQL-resource: models x-stackQL-method: get x-stackQL-verb: select - /v1/models/{modelsId}:batchEmbedContents: + /v1/models/{modelsId}:embedContent: parameters: *ref_0 post: - description: >- - Generates multiple embeddings from the model given input text in a - synchronous call. - operationId: generativelanguage.models.batchEmbedContents + description: Generates an embedding from the model given an input `Content`. + operationId: generativelanguage.models.embedContent requestBody: content: application/json: schema: - $ref: '#/components/schemas/BatchEmbedContentsRequest' + $ref: '#/components/schemas/EmbedContentRequest' security: [] responses: '200': @@ -1121,7 +1124,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/BatchEmbedContentsResponse' + $ref: '#/components/schemas/EmbedContentResponse' parameters: - in: path name: modelsId @@ -1129,7 +1132,7 @@ paths: schema: type: string x-stackQL-resource: models - x-stackQL-method: batch_embed_contents + x-stackQL-method: embed_content x-stackQL-verb: exec /v1/models/{modelsId}:streamGenerateContent: parameters: *ref_0 @@ -1160,16 +1163,18 @@ paths: x-stackQL-resource: models x-stackQL-method: stream_generate_content x-stackQL-verb: exec - /v1/models/{modelsId}:embedContent: + /v1/models/{modelsId}:generateContent: parameters: *ref_0 post: - description: Generates an embedding from the model given an input `Content`. - operationId: generativelanguage.models.embedContent + description: >- + Generates a response from the model given an input + `GenerateContentRequest`. + operationId: generativelanguage.models.generateContent requestBody: content: application/json: schema: - $ref: '#/components/schemas/EmbedContentRequest' + $ref: '#/components/schemas/GenerateContentRequest' security: [] responses: '200': @@ -1177,7 +1182,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/EmbedContentResponse' + $ref: '#/components/schemas/GenerateContentResponse' parameters: - in: path name: modelsId @@ -1185,15 +1190,13 @@ paths: schema: type: string x-stackQL-resource: models - x-stackQL-method: embed_content + x-stackQL-method: generate_content x-stackQL-verb: exec - /v1/operations: + /v1/models: parameters: *ref_0 get: - description: >- - Lists operations that match the specified filter in the request. If the - server doesn't support this method, it returns `UNIMPLEMENTED`. - operationId: generativelanguage.operations.list + description: Lists models available through the API. + operationId: generativelanguage.models.list security: [] responses: '200': @@ -1201,7 +1204,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/ListOperationsResponse' + $ref: '#/components/schemas/ListModelsResponse' parameters: - in: query name: pageToken @@ -1211,23 +1214,22 @@ paths: name: pageSize schema: type: integer - - in: query - name: filter - schema: - type: string - x-stackQL-resource: operations + x-stackQL-resource: models x-stackQL-method: list x-stackQL-verb: select - x-stackQL-objectKey: $.operations - /v1/operations/{operationsId}: + x-stackQL-objectKey: $.models + /v1/models/{modelsId}:batchEmbedContents: parameters: *ref_0 - delete: + post: description: >- - Deletes a long-running operation. This method indicates that the client - is no longer interested in the operation result. It does not cancel the - operation. If the server doesn't support this method, it returns - `google.rpc.Code.UNIMPLEMENTED`. - operationId: generativelanguage.operations.delete + Generates multiple embeddings from the model given input text in a + synchronous call. + operationId: generativelanguage.models.batchEmbedContents + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/BatchEmbedContentsRequest' security: [] responses: '200': @@ -1235,13 +1237,40 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/Empty' + $ref: '#/components/schemas/BatchEmbedContentsResponse' parameters: - in: path - name: operationsId + name: modelsId required: true schema: type: string - x-stackQL-resource: operations - x-stackQL-method: delete - x-stackQL-verb: delete + x-stackQL-resource: models + x-stackQL-method: batch_embed_contents + x-stackQL-verb: exec + /v1/models/{modelsId}:countTokens: + parameters: *ref_0 + post: + description: Runs a model's tokenizer on input content and returns the token count. + operationId: generativelanguage.models.countTokens + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CountTokensRequest' + security: [] + responses: + '200': + description: Successful response + content: + application/json: + schema: + $ref: '#/components/schemas/CountTokensResponse' + parameters: + - in: path + name: modelsId + required: true + schema: + type: string + x-stackQL-resource: models + x-stackQL-method: count_tokens + x-stackQL-verb: exec diff --git a/packages/googleai_dart/oas/main.dart b/packages/googleai_dart/oas/main.dart index e515f1c7..9a21c1c7 100644 --- a/packages/googleai_dart/oas/main.dart +++ b/packages/googleai_dart/oas/main.dart @@ -4,6 +4,8 @@ import 'package:openapi_spec/openapi_spec.dart'; /// Generates Google AI API client Dart code from the OpenAPI spec. /// https://generativelanguage.googleapis.com//$discovery/rest?version={version}&key={key} +/// To convert Google Discovery to OpenAPI: +/// https://github.com/stackql/google-discovery-to-openapi void main() async { final spec = OpenApi.fromFile(source: 'oas/googleai_openapi_curated.yaml'); diff --git a/packages/googleai_dart/test/generate_content_test.dart b/packages/googleai_dart/test/generate_content_test.dart index d0515a56..dfaeffc2 100644 --- a/packages/googleai_dart/test/generate_content_test.dart +++ b/packages/googleai_dart/test/generate_content_test.dart @@ -22,6 +22,7 @@ void main() { }); test('Test Text-only input with gemini-pro', () async { + client.cancelTunedModelOperation(tunedModelId: tunedModelId, operationId: operationId) final res = await client.generateContent( modelId: 'gemini-pro', request: const GenerateContentRequest(