From 0b27dc2c46300e144e82f6bd90a0fbf7072b22db Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 21 Nov 2024 09:24:41 -0800 Subject: [PATCH] feat: [generativelanguage] Adds search grounding (#5828) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: Add GenerateContentRespoinse.model_version feat: Add GroundingMetadata.web_search_queries docs: Small updates PiperOrigin-RevId: 698047489 Source-Link: https://github.com/googleapis/googleapis/commit/c70bd1ef0b0d0691f165b864681c6637f9cec150 Source-Link: https://github.com/googleapis/googleapis-gen/commit/a7fd007c547fa077c97846e6087b7b57d3a37f3f Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWFpLWdlbmVyYXRpdmVsYW5ndWFnZS8uT3dsQm90LnlhbWwiLCJoIjoiYTdmZDAwN2M1NDdmYTA3N2M5Nzg0NmU2MDg3YjdiNTdkM2EzN2YzZiJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * feat: Adds search grounding feat: Adds `GenerateContentResponse.model_version` output docs: Some small updates. PiperOrigin-RevId: 698047851 Source-Link: https://github.com/googleapis/googleapis/commit/7466a5b356efdc34beb322a91f341f9e9463e802 Source-Link: https://github.com/googleapis/googleapis-gen/commit/edb373c46e78548d3c32c5a7b5949dd8b727fee8 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWFpLWdlbmVyYXRpdmVsYW5ndWFnZS8uT3dsQm90LnlhbWwiLCJoIjoiZWRiMzczYzQ2ZTc4NTQ4ZDNjMzJjNWE3YjU5NDlkZDhiNzI3ZmVlOCJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * Update gapic_cache_service_v1beta.ts --------- Co-authored-by: Owl Bot Co-authored-by: sofisl <55454395+sofisl@users.noreply.github.com> --- .../v1/generative_service.proto | 110 +- .../v1beta/generative_service.proto | 14 +- .../v1beta/model_service.proto | 4 +- .../v1beta/tuned_model.proto | 8 +- .../protos/protos.d.ts | 842 ++++++- .../protos/protos.js | 2180 ++++++++++++++++- .../protos/protos.json | 231 +- .../model_service.update_tuned_model.js | 5 +- ...a_google.ai.generativelanguage.v1beta.json | 2 +- .../src/v1beta/model_service_client.ts | 20 +- 10 files changed, 3293 insertions(+), 123 deletions(-) diff --git a/packages/google-ai-generativelanguage/protos/google/ai/generativelanguage/v1/generative_service.proto b/packages/google-ai-generativelanguage/protos/google/ai/generativelanguage/v1/generative_service.proto index 710ad0d944f..270bb79cf7b 100644 --- a/packages/google-ai-generativelanguage/protos/google/ai/generativelanguage/v1/generative_service.proto +++ b/packages/google-ai-generativelanguage/protos/google/ai/generativelanguage/v1/generative_service.proto @@ -62,6 +62,10 @@ service GenerativeService { option (google.api.http) = { post: "/v1/{model=models/*}:streamGenerateContent" body: "*" + additional_bindings { + post: "/v1/{model=tunedModels/*}:streamGenerateContent" + body: "*" + } }; option (google.api.method_signature) = "model,contents"; } @@ -260,7 +264,7 @@ message GenerationConfig { // values will cause the model to start repeating a common token until it // hits the // [max_output_tokens][google.ai.generativelanguage.v1.GenerationConfig.max_output_tokens] - // limit: "...the the the the the...". + // limit. optional float frequency_penalty = 16 [(google.api.field_behavior) = OPTIONAL]; @@ -340,6 +344,9 @@ message GenerateContentResponse { // Output only. Metadata on the generation requests' token usage. UsageMetadata usage_metadata = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The model version used to generate the response. + string model_version = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; } // A response candidate generated from the model. @@ -412,7 +419,13 @@ message Candidate { // Output only. Token count for this candidate. int32 token_count = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - // Output only. + // Output only. Grounding metadata for the candidate. + // + // This field is populated for `GenerateContent` calls. + GroundingMetadata grounding_metadata = 9 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Average log probability score of the candidate. double avg_logprobs = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; // Output only. Log-likelihood scores for the response tokens and top tokens @@ -448,6 +461,99 @@ message LogprobsResult { repeated Candidate chosen_candidates = 2; } +// Metadata related to retrieval in the grounding flow. +message RetrievalMetadata { + // Optional. Score indicating how likely information from google search could + // help answer the prompt. The score is in the range [0, 1], where 0 is the + // least likely and 1 is the most likely. This score is only populated when + // google search grounding and dynamic retrieval is enabled. It will be + // compared to the threshold to determine whether to trigger google search. + float google_search_dynamic_retrieval_score = 2 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Metadata returned to client when grounding is enabled. +message GroundingMetadata { + // Optional. Google search entry for the following-up web searches. + optional SearchEntryPoint search_entry_point = 1 + [(google.api.field_behavior) = OPTIONAL]; + + // List of supporting references retrieved from specified grounding source. + repeated GroundingChunk grounding_chunks = 2; + + // List of grounding support. + repeated GroundingSupport grounding_supports = 3; + + // Metadata related to retrieval in the grounding flow. + optional RetrievalMetadata retrieval_metadata = 4; + + // Web search queries for the following-up web search. + repeated string web_search_queries = 5; +} + +// Google search entry point. +message SearchEntryPoint { + // Optional. Web content snippet that can be embedded in a web page or an app + // webview. + string rendered_content = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Base64 encoded JSON representing array of tuple. + bytes sdk_blob = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Grounding chunk. +message GroundingChunk { + // Chunk from the web. + message Web { + // URI reference of the chunk. + optional string uri = 1; + + // Title of the chunk. + optional string title = 2; + } + + // Chunk type. + oneof chunk_type { + // Grounding chunk from the web. + Web web = 1; + } +} + +// Segment of the content. +message Segment { + // Output only. The index of a Part object within its parent Content object. + int32 part_index = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Start index in the given Part, measured in bytes. Offset from + // the start of the Part, inclusive, starting at zero. + int32 start_index = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. End index in the given Part, measured in bytes. Offset from + // the start of the Part, exclusive, starting at zero. + int32 end_index = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The text corresponding to the segment from the response. + string text = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Grounding support. +message GroundingSupport { + // Segment of the content this support belongs to. + optional Segment segment = 1; + + // A list of indices (into 'grounding_chunk') specifying the + // citations associated with the claim. For instance [1,3,4] means + // that grounding_chunk[1], grounding_chunk[3], + // grounding_chunk[4] are the retrieved content attributed to the claim. + repeated int32 grounding_chunk_indices = 2; + + // Confidence score of the support references. Ranges from 0 to 1. 1 is the + // most confident. This list must have the same size as the + // grounding_chunk_indices. + repeated float confidence_scores = 3; +} + // Request containing the `Content` for the model to embed. message EmbedContentRequest { // Required. The model's resource name. This serves as an ID for the Model to diff --git a/packages/google-ai-generativelanguage/protos/google/ai/generativelanguage/v1beta/generative_service.proto b/packages/google-ai-generativelanguage/protos/google/ai/generativelanguage/v1beta/generative_service.proto index 30f42f2c51c..4e019338356 100644 --- a/packages/google-ai-generativelanguage/protos/google/ai/generativelanguage/v1beta/generative_service.proto +++ b/packages/google-ai-generativelanguage/protos/google/ai/generativelanguage/v1beta/generative_service.proto @@ -74,6 +74,10 @@ service GenerativeService { option (google.api.http) = { post: "/v1beta/{model=models/*}:streamGenerateContent" body: "*" + additional_bindings { + post: "/v1beta/{model=tunedModels/*}:streamGenerateContent" + body: "*" + } }; option (google.api.method_signature) = "model,contents"; } @@ -327,7 +331,7 @@ message GenerationConfig { // values will cause the model to start repeating a common token until it // hits the // [max_output_tokens][google.ai.generativelanguage.v1beta.GenerationConfig.max_output_tokens] - // limit: "...the the the the the...". + // limit. optional float frequency_penalty = 16 [(google.api.field_behavior) = OPTIONAL]; @@ -434,6 +438,9 @@ message GenerateContentResponse { // Output only. Metadata on the generation requests' token usage. UsageMetadata usage_metadata = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The model version used to generate the response. + string model_version = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; } // A response candidate generated from the model. @@ -519,7 +526,7 @@ message Candidate { GroundingMetadata grounding_metadata = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; - // Output only. + // Output only. Average log probability score of the candidate. double avg_logprobs = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; // Output only. Log-likelihood scores for the response tokens and top tokens @@ -624,6 +631,9 @@ message GroundingMetadata { // Metadata related to retrieval in the grounding flow. optional RetrievalMetadata retrieval_metadata = 4; + + // Web search queries for the following-up web search. + repeated string web_search_queries = 5; } // Google search entry point. diff --git a/packages/google-ai-generativelanguage/protos/google/ai/generativelanguage/v1beta/model_service.proto b/packages/google-ai-generativelanguage/protos/google/ai/generativelanguage/v1beta/model_service.proto index 37ca4202bd7..08adef67b83 100644 --- a/packages/google-ai-generativelanguage/protos/google/ai/generativelanguage/v1beta/model_service.proto +++ b/packages/google-ai-generativelanguage/protos/google/ai/generativelanguage/v1beta/model_service.proto @@ -257,9 +257,9 @@ message UpdateTunedModelRequest { // Required. The tuned model to update. TunedModel tuned_model = 1 [(google.api.field_behavior) = REQUIRED]; - // Required. The list of fields to update. + // Optional. The list of fields to update. google.protobuf.FieldMask update_mask = 2 - [(google.api.field_behavior) = REQUIRED]; + [(google.api.field_behavior) = OPTIONAL]; } // Request to delete a TunedModel. diff --git a/packages/google-ai-generativelanguage/protos/google/ai/generativelanguage/v1beta/tuned_model.proto b/packages/google-ai-generativelanguage/protos/google/ai/generativelanguage/v1beta/tuned_model.proto index f9732af3ec1..ad1bcffff13 100644 --- a/packages/google-ai-generativelanguage/protos/google/ai/generativelanguage/v1beta/tuned_model.proto +++ b/packages/google-ai-generativelanguage/protos/google/ai/generativelanguage/v1beta/tuned_model.proto @@ -219,16 +219,16 @@ message Hyperparameters { message Dataset { // Inline data or a reference to the data. oneof dataset { - // Optional. Inline examples. + // Optional. Inline examples with simple input/output text. TuningExamples examples = 1 [(google.api.field_behavior) = OPTIONAL]; } } // A set of tuning examples. Can be training or validation data. message TuningExamples { - // Required. The examples. Example input can be for text or discuss, but all - // examples in a set must be of the same type. - repeated TuningExample examples = 1 [(google.api.field_behavior) = REQUIRED]; + // The examples. Example input can be for text or discuss, but all examples + // in a set must be of the same type. + repeated TuningExample examples = 1; } // A single example for tuning. diff --git a/packages/google-ai-generativelanguage/protos/protos.d.ts b/packages/google-ai-generativelanguage/protos/protos.d.ts index 552df2ac410..136b0197d4a 100644 --- a/packages/google-ai-generativelanguage/protos/protos.d.ts +++ b/packages/google-ai-generativelanguage/protos/protos.d.ts @@ -1010,6 +1010,9 @@ export namespace google { /** GenerateContentResponse usageMetadata */ usageMetadata?: (google.ai.generativelanguage.v1.GenerateContentResponse.IUsageMetadata|null); + + /** GenerateContentResponse modelVersion */ + modelVersion?: (string|null); } /** Represents a GenerateContentResponse. */ @@ -1030,6 +1033,9 @@ export namespace google { /** GenerateContentResponse usageMetadata. */ public usageMetadata?: (google.ai.generativelanguage.v1.GenerateContentResponse.IUsageMetadata|null); + /** GenerateContentResponse modelVersion. */ + public modelVersion: string; + /** * Creates a new GenerateContentResponse instance using the specified properties. * @param [properties] Properties to set @@ -1356,6 +1362,9 @@ export namespace google { /** Candidate tokenCount */ tokenCount?: (number|null); + /** Candidate groundingMetadata */ + groundingMetadata?: (google.ai.generativelanguage.v1.IGroundingMetadata|null); + /** Candidate avgLogprobs */ avgLogprobs?: (number|null); @@ -1390,6 +1399,9 @@ export namespace google { /** Candidate tokenCount. */ public tokenCount: number; + /** Candidate groundingMetadata. */ + public groundingMetadata?: (google.ai.generativelanguage.v1.IGroundingMetadata|null); + /** Candidate avgLogprobs. */ public avgLogprobs: number; @@ -1734,81 +1746,620 @@ export namespace google { */ constructor(properties?: google.ai.generativelanguage.v1.LogprobsResult.ITopCandidates); - /** TopCandidates candidates. */ - public candidates: google.ai.generativelanguage.v1.LogprobsResult.ICandidate[]; + /** TopCandidates candidates. */ + public candidates: google.ai.generativelanguage.v1.LogprobsResult.ICandidate[]; + + /** + * Creates a new TopCandidates instance using the specified properties. + * @param [properties] Properties to set + * @returns TopCandidates instance + */ + public static create(properties?: google.ai.generativelanguage.v1.LogprobsResult.ITopCandidates): google.ai.generativelanguage.v1.LogprobsResult.TopCandidates; + + /** + * Encodes the specified TopCandidates message. Does not implicitly {@link google.ai.generativelanguage.v1.LogprobsResult.TopCandidates.verify|verify} messages. + * @param message TopCandidates message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.ai.generativelanguage.v1.LogprobsResult.ITopCandidates, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TopCandidates message, length delimited. Does not implicitly {@link google.ai.generativelanguage.v1.LogprobsResult.TopCandidates.verify|verify} messages. + * @param message TopCandidates message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.ai.generativelanguage.v1.LogprobsResult.ITopCandidates, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TopCandidates message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TopCandidates + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.ai.generativelanguage.v1.LogprobsResult.TopCandidates; + + /** + * Decodes a TopCandidates message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TopCandidates + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.ai.generativelanguage.v1.LogprobsResult.TopCandidates; + + /** + * Verifies a TopCandidates message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TopCandidates message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TopCandidates + */ + public static fromObject(object: { [k: string]: any }): google.ai.generativelanguage.v1.LogprobsResult.TopCandidates; + + /** + * Creates a plain object from a TopCandidates message. Also converts values to other types if specified. + * @param message TopCandidates + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.ai.generativelanguage.v1.LogprobsResult.TopCandidates, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TopCandidates to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TopCandidates + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a RetrievalMetadata. */ + interface IRetrievalMetadata { + + /** RetrievalMetadata googleSearchDynamicRetrievalScore */ + googleSearchDynamicRetrievalScore?: (number|null); + } + + /** Represents a RetrievalMetadata. */ + class RetrievalMetadata implements IRetrievalMetadata { + + /** + * Constructs a new RetrievalMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.ai.generativelanguage.v1.IRetrievalMetadata); + + /** RetrievalMetadata googleSearchDynamicRetrievalScore. */ + public googleSearchDynamicRetrievalScore: number; + + /** + * Creates a new RetrievalMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns RetrievalMetadata instance + */ + public static create(properties?: google.ai.generativelanguage.v1.IRetrievalMetadata): google.ai.generativelanguage.v1.RetrievalMetadata; + + /** + * Encodes the specified RetrievalMetadata message. Does not implicitly {@link google.ai.generativelanguage.v1.RetrievalMetadata.verify|verify} messages. + * @param message RetrievalMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.ai.generativelanguage.v1.IRetrievalMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RetrievalMetadata message, length delimited. Does not implicitly {@link google.ai.generativelanguage.v1.RetrievalMetadata.verify|verify} messages. + * @param message RetrievalMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.ai.generativelanguage.v1.IRetrievalMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RetrievalMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RetrievalMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.ai.generativelanguage.v1.RetrievalMetadata; + + /** + * Decodes a RetrievalMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RetrievalMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.ai.generativelanguage.v1.RetrievalMetadata; + + /** + * Verifies a RetrievalMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RetrievalMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RetrievalMetadata + */ + public static fromObject(object: { [k: string]: any }): google.ai.generativelanguage.v1.RetrievalMetadata; + + /** + * Creates a plain object from a RetrievalMetadata message. Also converts values to other types if specified. + * @param message RetrievalMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.ai.generativelanguage.v1.RetrievalMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RetrievalMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RetrievalMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GroundingMetadata. */ + interface IGroundingMetadata { + + /** GroundingMetadata searchEntryPoint */ + searchEntryPoint?: (google.ai.generativelanguage.v1.ISearchEntryPoint|null); + + /** GroundingMetadata groundingChunks */ + groundingChunks?: (google.ai.generativelanguage.v1.IGroundingChunk[]|null); + + /** GroundingMetadata groundingSupports */ + groundingSupports?: (google.ai.generativelanguage.v1.IGroundingSupport[]|null); + + /** GroundingMetadata retrievalMetadata */ + retrievalMetadata?: (google.ai.generativelanguage.v1.IRetrievalMetadata|null); + + /** GroundingMetadata webSearchQueries */ + webSearchQueries?: (string[]|null); + } + + /** Represents a GroundingMetadata. */ + class GroundingMetadata implements IGroundingMetadata { + + /** + * Constructs a new GroundingMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.ai.generativelanguage.v1.IGroundingMetadata); + + /** GroundingMetadata searchEntryPoint. */ + public searchEntryPoint?: (google.ai.generativelanguage.v1.ISearchEntryPoint|null); + + /** GroundingMetadata groundingChunks. */ + public groundingChunks: google.ai.generativelanguage.v1.IGroundingChunk[]; + + /** GroundingMetadata groundingSupports. */ + public groundingSupports: google.ai.generativelanguage.v1.IGroundingSupport[]; + + /** GroundingMetadata retrievalMetadata. */ + public retrievalMetadata?: (google.ai.generativelanguage.v1.IRetrievalMetadata|null); + + /** GroundingMetadata webSearchQueries. */ + public webSearchQueries: string[]; + + /** GroundingMetadata _searchEntryPoint. */ + public _searchEntryPoint?: "searchEntryPoint"; + + /** GroundingMetadata _retrievalMetadata. */ + public _retrievalMetadata?: "retrievalMetadata"; + + /** + * Creates a new GroundingMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns GroundingMetadata instance + */ + public static create(properties?: google.ai.generativelanguage.v1.IGroundingMetadata): google.ai.generativelanguage.v1.GroundingMetadata; + + /** + * Encodes the specified GroundingMetadata message. Does not implicitly {@link google.ai.generativelanguage.v1.GroundingMetadata.verify|verify} messages. + * @param message GroundingMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.ai.generativelanguage.v1.IGroundingMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GroundingMetadata message, length delimited. Does not implicitly {@link google.ai.generativelanguage.v1.GroundingMetadata.verify|verify} messages. + * @param message GroundingMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.ai.generativelanguage.v1.IGroundingMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GroundingMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GroundingMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.ai.generativelanguage.v1.GroundingMetadata; + + /** + * Decodes a GroundingMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GroundingMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.ai.generativelanguage.v1.GroundingMetadata; + + /** + * Verifies a GroundingMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GroundingMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GroundingMetadata + */ + public static fromObject(object: { [k: string]: any }): google.ai.generativelanguage.v1.GroundingMetadata; + + /** + * Creates a plain object from a GroundingMetadata message. Also converts values to other types if specified. + * @param message GroundingMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.ai.generativelanguage.v1.GroundingMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GroundingMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GroundingMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SearchEntryPoint. */ + interface ISearchEntryPoint { + + /** SearchEntryPoint renderedContent */ + renderedContent?: (string|null); + + /** SearchEntryPoint sdkBlob */ + sdkBlob?: (Uint8Array|string|null); + } + + /** Represents a SearchEntryPoint. */ + class SearchEntryPoint implements ISearchEntryPoint { + + /** + * Constructs a new SearchEntryPoint. + * @param [properties] Properties to set + */ + constructor(properties?: google.ai.generativelanguage.v1.ISearchEntryPoint); + + /** SearchEntryPoint renderedContent. */ + public renderedContent: string; + + /** SearchEntryPoint sdkBlob. */ + public sdkBlob: (Uint8Array|string); + + /** + * Creates a new SearchEntryPoint instance using the specified properties. + * @param [properties] Properties to set + * @returns SearchEntryPoint instance + */ + public static create(properties?: google.ai.generativelanguage.v1.ISearchEntryPoint): google.ai.generativelanguage.v1.SearchEntryPoint; + + /** + * Encodes the specified SearchEntryPoint message. Does not implicitly {@link google.ai.generativelanguage.v1.SearchEntryPoint.verify|verify} messages. + * @param message SearchEntryPoint message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.ai.generativelanguage.v1.ISearchEntryPoint, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SearchEntryPoint message, length delimited. Does not implicitly {@link google.ai.generativelanguage.v1.SearchEntryPoint.verify|verify} messages. + * @param message SearchEntryPoint message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.ai.generativelanguage.v1.ISearchEntryPoint, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SearchEntryPoint message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SearchEntryPoint + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.ai.generativelanguage.v1.SearchEntryPoint; + + /** + * Decodes a SearchEntryPoint message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SearchEntryPoint + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.ai.generativelanguage.v1.SearchEntryPoint; + + /** + * Verifies a SearchEntryPoint message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SearchEntryPoint message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SearchEntryPoint + */ + public static fromObject(object: { [k: string]: any }): google.ai.generativelanguage.v1.SearchEntryPoint; + + /** + * Creates a plain object from a SearchEntryPoint message. Also converts values to other types if specified. + * @param message SearchEntryPoint + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.ai.generativelanguage.v1.SearchEntryPoint, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SearchEntryPoint to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SearchEntryPoint + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GroundingChunk. */ + interface IGroundingChunk { + + /** GroundingChunk web */ + web?: (google.ai.generativelanguage.v1.GroundingChunk.IWeb|null); + } + + /** Represents a GroundingChunk. */ + class GroundingChunk implements IGroundingChunk { + + /** + * Constructs a new GroundingChunk. + * @param [properties] Properties to set + */ + constructor(properties?: google.ai.generativelanguage.v1.IGroundingChunk); + + /** GroundingChunk web. */ + public web?: (google.ai.generativelanguage.v1.GroundingChunk.IWeb|null); + + /** GroundingChunk chunkType. */ + public chunkType?: "web"; + + /** + * Creates a new GroundingChunk instance using the specified properties. + * @param [properties] Properties to set + * @returns GroundingChunk instance + */ + public static create(properties?: google.ai.generativelanguage.v1.IGroundingChunk): google.ai.generativelanguage.v1.GroundingChunk; + + /** + * Encodes the specified GroundingChunk message. Does not implicitly {@link google.ai.generativelanguage.v1.GroundingChunk.verify|verify} messages. + * @param message GroundingChunk message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.ai.generativelanguage.v1.IGroundingChunk, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GroundingChunk message, length delimited. Does not implicitly {@link google.ai.generativelanguage.v1.GroundingChunk.verify|verify} messages. + * @param message GroundingChunk message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.ai.generativelanguage.v1.IGroundingChunk, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GroundingChunk message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GroundingChunk + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.ai.generativelanguage.v1.GroundingChunk; + + /** + * Decodes a GroundingChunk message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GroundingChunk + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.ai.generativelanguage.v1.GroundingChunk; + + /** + * Verifies a GroundingChunk message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GroundingChunk message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GroundingChunk + */ + public static fromObject(object: { [k: string]: any }): google.ai.generativelanguage.v1.GroundingChunk; + + /** + * Creates a plain object from a GroundingChunk message. Also converts values to other types if specified. + * @param message GroundingChunk + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.ai.generativelanguage.v1.GroundingChunk, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GroundingChunk to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GroundingChunk + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace GroundingChunk { + + /** Properties of a Web. */ + interface IWeb { + + /** Web uri */ + uri?: (string|null); + + /** Web title */ + title?: (string|null); + } + + /** Represents a Web. */ + class Web implements IWeb { + + /** + * Constructs a new Web. + * @param [properties] Properties to set + */ + constructor(properties?: google.ai.generativelanguage.v1.GroundingChunk.IWeb); + + /** Web uri. */ + public uri?: (string|null); + + /** Web title. */ + public title?: (string|null); + + /** Web _uri. */ + public _uri?: "uri"; + + /** Web _title. */ + public _title?: "title"; /** - * Creates a new TopCandidates instance using the specified properties. + * Creates a new Web instance using the specified properties. * @param [properties] Properties to set - * @returns TopCandidates instance + * @returns Web instance */ - public static create(properties?: google.ai.generativelanguage.v1.LogprobsResult.ITopCandidates): google.ai.generativelanguage.v1.LogprobsResult.TopCandidates; + public static create(properties?: google.ai.generativelanguage.v1.GroundingChunk.IWeb): google.ai.generativelanguage.v1.GroundingChunk.Web; /** - * Encodes the specified TopCandidates message. Does not implicitly {@link google.ai.generativelanguage.v1.LogprobsResult.TopCandidates.verify|verify} messages. - * @param message TopCandidates message or plain object to encode + * Encodes the specified Web message. Does not implicitly {@link google.ai.generativelanguage.v1.GroundingChunk.Web.verify|verify} messages. + * @param message Web message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.ai.generativelanguage.v1.LogprobsResult.ITopCandidates, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.ai.generativelanguage.v1.GroundingChunk.IWeb, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified TopCandidates message, length delimited. Does not implicitly {@link google.ai.generativelanguage.v1.LogprobsResult.TopCandidates.verify|verify} messages. - * @param message TopCandidates message or plain object to encode + * Encodes the specified Web message, length delimited. Does not implicitly {@link google.ai.generativelanguage.v1.GroundingChunk.Web.verify|verify} messages. + * @param message Web message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.ai.generativelanguage.v1.LogprobsResult.ITopCandidates, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.ai.generativelanguage.v1.GroundingChunk.IWeb, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a TopCandidates message from the specified reader or buffer. + * Decodes a Web message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns TopCandidates + * @returns Web * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.ai.generativelanguage.v1.LogprobsResult.TopCandidates; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.ai.generativelanguage.v1.GroundingChunk.Web; /** - * Decodes a TopCandidates message from the specified reader or buffer, length delimited. + * Decodes a Web message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns TopCandidates + * @returns Web * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.ai.generativelanguage.v1.LogprobsResult.TopCandidates; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.ai.generativelanguage.v1.GroundingChunk.Web; /** - * Verifies a TopCandidates message. + * Verifies a Web message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a TopCandidates message from a plain object. Also converts values to their respective internal types. + * Creates a Web message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns TopCandidates + * @returns Web */ - public static fromObject(object: { [k: string]: any }): google.ai.generativelanguage.v1.LogprobsResult.TopCandidates; + public static fromObject(object: { [k: string]: any }): google.ai.generativelanguage.v1.GroundingChunk.Web; /** - * Creates a plain object from a TopCandidates message. Also converts values to other types if specified. - * @param message TopCandidates + * Creates a plain object from a Web message. Also converts values to other types if specified. + * @param message Web * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.ai.generativelanguage.v1.LogprobsResult.TopCandidates, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.ai.generativelanguage.v1.GroundingChunk.Web, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this TopCandidates to JSON. + * Converts this Web to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; /** - * Gets the default type url for TopCandidates + * Gets the default type url for Web * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns The default type url */ @@ -1816,6 +2367,233 @@ export namespace google { } } + /** Properties of a Segment. */ + interface ISegment { + + /** Segment partIndex */ + partIndex?: (number|null); + + /** Segment startIndex */ + startIndex?: (number|null); + + /** Segment endIndex */ + endIndex?: (number|null); + + /** Segment text */ + text?: (string|null); + } + + /** Represents a Segment. */ + class Segment implements ISegment { + + /** + * Constructs a new Segment. + * @param [properties] Properties to set + */ + constructor(properties?: google.ai.generativelanguage.v1.ISegment); + + /** Segment partIndex. */ + public partIndex: number; + + /** Segment startIndex. */ + public startIndex: number; + + /** Segment endIndex. */ + public endIndex: number; + + /** Segment text. */ + public text: string; + + /** + * Creates a new Segment instance using the specified properties. + * @param [properties] Properties to set + * @returns Segment instance + */ + public static create(properties?: google.ai.generativelanguage.v1.ISegment): google.ai.generativelanguage.v1.Segment; + + /** + * Encodes the specified Segment message. Does not implicitly {@link google.ai.generativelanguage.v1.Segment.verify|verify} messages. + * @param message Segment message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.ai.generativelanguage.v1.ISegment, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Segment message, length delimited. Does not implicitly {@link google.ai.generativelanguage.v1.Segment.verify|verify} messages. + * @param message Segment message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.ai.generativelanguage.v1.ISegment, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Segment message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Segment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.ai.generativelanguage.v1.Segment; + + /** + * Decodes a Segment message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Segment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.ai.generativelanguage.v1.Segment; + + /** + * Verifies a Segment message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Segment message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Segment + */ + public static fromObject(object: { [k: string]: any }): google.ai.generativelanguage.v1.Segment; + + /** + * Creates a plain object from a Segment message. Also converts values to other types if specified. + * @param message Segment + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.ai.generativelanguage.v1.Segment, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Segment to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Segment + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GroundingSupport. */ + interface IGroundingSupport { + + /** GroundingSupport segment */ + segment?: (google.ai.generativelanguage.v1.ISegment|null); + + /** GroundingSupport groundingChunkIndices */ + groundingChunkIndices?: (number[]|null); + + /** GroundingSupport confidenceScores */ + confidenceScores?: (number[]|null); + } + + /** Represents a GroundingSupport. */ + class GroundingSupport implements IGroundingSupport { + + /** + * Constructs a new GroundingSupport. + * @param [properties] Properties to set + */ + constructor(properties?: google.ai.generativelanguage.v1.IGroundingSupport); + + /** GroundingSupport segment. */ + public segment?: (google.ai.generativelanguage.v1.ISegment|null); + + /** GroundingSupport groundingChunkIndices. */ + public groundingChunkIndices: number[]; + + /** GroundingSupport confidenceScores. */ + public confidenceScores: number[]; + + /** GroundingSupport _segment. */ + public _segment?: "segment"; + + /** + * Creates a new GroundingSupport instance using the specified properties. + * @param [properties] Properties to set + * @returns GroundingSupport instance + */ + public static create(properties?: google.ai.generativelanguage.v1.IGroundingSupport): google.ai.generativelanguage.v1.GroundingSupport; + + /** + * Encodes the specified GroundingSupport message. Does not implicitly {@link google.ai.generativelanguage.v1.GroundingSupport.verify|verify} messages. + * @param message GroundingSupport message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.ai.generativelanguage.v1.IGroundingSupport, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GroundingSupport message, length delimited. Does not implicitly {@link google.ai.generativelanguage.v1.GroundingSupport.verify|verify} messages. + * @param message GroundingSupport message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.ai.generativelanguage.v1.IGroundingSupport, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GroundingSupport message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GroundingSupport + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.ai.generativelanguage.v1.GroundingSupport; + + /** + * Decodes a GroundingSupport message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GroundingSupport + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.ai.generativelanguage.v1.GroundingSupport; + + /** + * Verifies a GroundingSupport message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GroundingSupport message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GroundingSupport + */ + public static fromObject(object: { [k: string]: any }): google.ai.generativelanguage.v1.GroundingSupport; + + /** + * Creates a plain object from a GroundingSupport message. Also converts values to other types if specified. + * @param message GroundingSupport + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.ai.generativelanguage.v1.GroundingSupport, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GroundingSupport to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GroundingSupport + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + /** Properties of an EmbedContentRequest. */ interface IEmbedContentRequest { @@ -9485,6 +10263,9 @@ export namespace google { /** GenerateContentResponse usageMetadata */ usageMetadata?: (google.ai.generativelanguage.v1beta.GenerateContentResponse.IUsageMetadata|null); + + /** GenerateContentResponse modelVersion */ + modelVersion?: (string|null); } /** Represents a GenerateContentResponse. */ @@ -9505,6 +10286,9 @@ export namespace google { /** GenerateContentResponse usageMetadata. */ public usageMetadata?: (google.ai.generativelanguage.v1beta.GenerateContentResponse.IUsageMetadata|null); + /** GenerateContentResponse modelVersion. */ + public modelVersion: string; + /** * Creates a new GenerateContentResponse instance using the specified properties. * @param [properties] Properties to set @@ -10838,6 +11622,9 @@ export namespace google { /** GroundingMetadata retrievalMetadata */ retrievalMetadata?: (google.ai.generativelanguage.v1beta.IRetrievalMetadata|null); + + /** GroundingMetadata webSearchQueries */ + webSearchQueries?: (string[]|null); } /** Represents a GroundingMetadata. */ @@ -10861,6 +11648,9 @@ export namespace google { /** GroundingMetadata retrievalMetadata. */ public retrievalMetadata?: (google.ai.generativelanguage.v1beta.IRetrievalMetadata|null); + /** GroundingMetadata webSearchQueries. */ + public webSearchQueries: string[]; + /** GroundingMetadata _searchEntryPoint. */ public _searchEntryPoint?: "searchEntryPoint"; diff --git a/packages/google-ai-generativelanguage/protos/protos.js b/packages/google-ai-generativelanguage/protos/protos.js index 5706217c392..ad8fc7194ae 100644 --- a/packages/google-ai-generativelanguage/protos/protos.js +++ b/packages/google-ai-generativelanguage/protos/protos.js @@ -2506,6 +2506,7 @@ * @property {Array.|null} [candidates] GenerateContentResponse candidates * @property {google.ai.generativelanguage.v1.GenerateContentResponse.IPromptFeedback|null} [promptFeedback] GenerateContentResponse promptFeedback * @property {google.ai.generativelanguage.v1.GenerateContentResponse.IUsageMetadata|null} [usageMetadata] GenerateContentResponse usageMetadata + * @property {string|null} [modelVersion] GenerateContentResponse modelVersion */ /** @@ -2548,6 +2549,14 @@ */ GenerateContentResponse.prototype.usageMetadata = null; + /** + * GenerateContentResponse modelVersion. + * @member {string} modelVersion + * @memberof google.ai.generativelanguage.v1.GenerateContentResponse + * @instance + */ + GenerateContentResponse.prototype.modelVersion = ""; + /** * Creates a new GenerateContentResponse instance using the specified properties. * @function create @@ -2579,6 +2588,8 @@ $root.google.ai.generativelanguage.v1.GenerateContentResponse.PromptFeedback.encode(message.promptFeedback, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); if (message.usageMetadata != null && Object.hasOwnProperty.call(message, "usageMetadata")) $root.google.ai.generativelanguage.v1.GenerateContentResponse.UsageMetadata.encode(message.usageMetadata, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.modelVersion != null && Object.hasOwnProperty.call(message, "modelVersion")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.modelVersion); return writer; }; @@ -2627,6 +2638,10 @@ message.usageMetadata = $root.google.ai.generativelanguage.v1.GenerateContentResponse.UsageMetadata.decode(reader, reader.uint32()); break; } + case 4: { + message.modelVersion = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -2681,6 +2696,9 @@ if (error) return "usageMetadata." + error; } + if (message.modelVersion != null && message.hasOwnProperty("modelVersion")) + if (!$util.isString(message.modelVersion)) + return "modelVersion: string expected"; return null; }; @@ -2716,6 +2734,8 @@ throw TypeError(".google.ai.generativelanguage.v1.GenerateContentResponse.usageMetadata: object expected"); message.usageMetadata = $root.google.ai.generativelanguage.v1.GenerateContentResponse.UsageMetadata.fromObject(object.usageMetadata); } + if (object.modelVersion != null) + message.modelVersion = String(object.modelVersion); return message; }; @@ -2737,6 +2757,7 @@ if (options.defaults) { object.promptFeedback = null; object.usageMetadata = null; + object.modelVersion = ""; } if (message.candidates && message.candidates.length) { object.candidates = []; @@ -2747,6 +2768,8 @@ object.promptFeedback = $root.google.ai.generativelanguage.v1.GenerateContentResponse.PromptFeedback.toObject(message.promptFeedback, options); if (message.usageMetadata != null && message.hasOwnProperty("usageMetadata")) object.usageMetadata = $root.google.ai.generativelanguage.v1.GenerateContentResponse.UsageMetadata.toObject(message.usageMetadata, options); + if (message.modelVersion != null && message.hasOwnProperty("modelVersion")) + object.modelVersion = message.modelVersion; return object; }; @@ -3343,6 +3366,7 @@ * @property {Array.|null} [safetyRatings] Candidate safetyRatings * @property {google.ai.generativelanguage.v1.ICitationMetadata|null} [citationMetadata] Candidate citationMetadata * @property {number|null} [tokenCount] Candidate tokenCount + * @property {google.ai.generativelanguage.v1.IGroundingMetadata|null} [groundingMetadata] Candidate groundingMetadata * @property {number|null} [avgLogprobs] Candidate avgLogprobs * @property {google.ai.generativelanguage.v1.ILogprobsResult|null} [logprobsResult] Candidate logprobsResult */ @@ -3411,6 +3435,14 @@ */ Candidate.prototype.tokenCount = 0; + /** + * Candidate groundingMetadata. + * @member {google.ai.generativelanguage.v1.IGroundingMetadata|null|undefined} groundingMetadata + * @memberof google.ai.generativelanguage.v1.Candidate + * @instance + */ + Candidate.prototype.groundingMetadata = null; + /** * Candidate avgLogprobs. * @member {number} avgLogprobs @@ -3478,6 +3510,8 @@ $root.google.ai.generativelanguage.v1.CitationMetadata.encode(message.citationMetadata, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); if (message.tokenCount != null && Object.hasOwnProperty.call(message, "tokenCount")) writer.uint32(/* id 7, wireType 0 =*/56).int32(message.tokenCount); + if (message.groundingMetadata != null && Object.hasOwnProperty.call(message, "groundingMetadata")) + $root.google.ai.generativelanguage.v1.GroundingMetadata.encode(message.groundingMetadata, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); if (message.avgLogprobs != null && Object.hasOwnProperty.call(message, "avgLogprobs")) writer.uint32(/* id 10, wireType 1 =*/81).double(message.avgLogprobs); if (message.logprobsResult != null && Object.hasOwnProperty.call(message, "logprobsResult")) @@ -3542,6 +3576,10 @@ message.tokenCount = reader.int32(); break; } + case 9: { + message.groundingMetadata = $root.google.ai.generativelanguage.v1.GroundingMetadata.decode(reader, reader.uint32()); + break; + } case 10: { message.avgLogprobs = reader.double(); break; @@ -3630,6 +3668,11 @@ if (message.tokenCount != null && message.hasOwnProperty("tokenCount")) if (!$util.isInteger(message.tokenCount)) return "tokenCount: integer expected"; + if (message.groundingMetadata != null && message.hasOwnProperty("groundingMetadata")) { + var error = $root.google.ai.generativelanguage.v1.GroundingMetadata.verify(message.groundingMetadata); + if (error) + return "groundingMetadata." + error; + } if (message.avgLogprobs != null && message.hasOwnProperty("avgLogprobs")) if (typeof message.avgLogprobs !== "number") return "avgLogprobs: number expected"; @@ -3729,6 +3772,11 @@ } if (object.tokenCount != null) message.tokenCount = object.tokenCount | 0; + if (object.groundingMetadata != null) { + if (typeof object.groundingMetadata !== "object") + throw TypeError(".google.ai.generativelanguage.v1.Candidate.groundingMetadata: object expected"); + message.groundingMetadata = $root.google.ai.generativelanguage.v1.GroundingMetadata.fromObject(object.groundingMetadata); + } if (object.avgLogprobs != null) message.avgLogprobs = Number(object.avgLogprobs); if (object.logprobsResult != null) { @@ -3759,6 +3807,7 @@ object.finishReason = options.enums === String ? "FINISH_REASON_UNSPECIFIED" : 0; object.citationMetadata = null; object.tokenCount = 0; + object.groundingMetadata = null; object.avgLogprobs = 0; object.logprobsResult = null; } @@ -3780,6 +3829,8 @@ object.citationMetadata = $root.google.ai.generativelanguage.v1.CitationMetadata.toObject(message.citationMetadata, options); if (message.tokenCount != null && message.hasOwnProperty("tokenCount")) object.tokenCount = message.tokenCount; + if (message.groundingMetadata != null && message.hasOwnProperty("groundingMetadata")) + object.groundingMetadata = $root.google.ai.generativelanguage.v1.GroundingMetadata.toObject(message.groundingMetadata, options); if (message.avgLogprobs != null && message.hasOwnProperty("avgLogprobs")) object.avgLogprobs = options.json && !isFinite(message.avgLogprobs) ? String(message.avgLogprobs) : message.avgLogprobs; if (message.logprobsResult != null && message.hasOwnProperty("logprobsResult")) @@ -4554,88 +4605,2009 @@ if (error) return "candidates." + error; } - } - return null; - }; - - /** - * Creates a TopCandidates message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.ai.generativelanguage.v1.LogprobsResult.TopCandidates - * @static - * @param {Object.} object Plain object - * @returns {google.ai.generativelanguage.v1.LogprobsResult.TopCandidates} TopCandidates - */ - TopCandidates.fromObject = function fromObject(object) { - if (object instanceof $root.google.ai.generativelanguage.v1.LogprobsResult.TopCandidates) - return object; - var message = new $root.google.ai.generativelanguage.v1.LogprobsResult.TopCandidates(); - if (object.candidates) { - if (!Array.isArray(object.candidates)) - throw TypeError(".google.ai.generativelanguage.v1.LogprobsResult.TopCandidates.candidates: array expected"); - message.candidates = []; - for (var i = 0; i < object.candidates.length; ++i) { - if (typeof object.candidates[i] !== "object") - throw TypeError(".google.ai.generativelanguage.v1.LogprobsResult.TopCandidates.candidates: object expected"); - message.candidates[i] = $root.google.ai.generativelanguage.v1.LogprobsResult.Candidate.fromObject(object.candidates[i]); + } + return null; + }; + + /** + * Creates a TopCandidates message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.ai.generativelanguage.v1.LogprobsResult.TopCandidates + * @static + * @param {Object.} object Plain object + * @returns {google.ai.generativelanguage.v1.LogprobsResult.TopCandidates} TopCandidates + */ + TopCandidates.fromObject = function fromObject(object) { + if (object instanceof $root.google.ai.generativelanguage.v1.LogprobsResult.TopCandidates) + return object; + var message = new $root.google.ai.generativelanguage.v1.LogprobsResult.TopCandidates(); + if (object.candidates) { + if (!Array.isArray(object.candidates)) + throw TypeError(".google.ai.generativelanguage.v1.LogprobsResult.TopCandidates.candidates: array expected"); + message.candidates = []; + for (var i = 0; i < object.candidates.length; ++i) { + if (typeof object.candidates[i] !== "object") + throw TypeError(".google.ai.generativelanguage.v1.LogprobsResult.TopCandidates.candidates: object expected"); + message.candidates[i] = $root.google.ai.generativelanguage.v1.LogprobsResult.Candidate.fromObject(object.candidates[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a TopCandidates message. Also converts values to other types if specified. + * @function toObject + * @memberof google.ai.generativelanguage.v1.LogprobsResult.TopCandidates + * @static + * @param {google.ai.generativelanguage.v1.LogprobsResult.TopCandidates} message TopCandidates + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TopCandidates.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.candidates = []; + if (message.candidates && message.candidates.length) { + object.candidates = []; + for (var j = 0; j < message.candidates.length; ++j) + object.candidates[j] = $root.google.ai.generativelanguage.v1.LogprobsResult.Candidate.toObject(message.candidates[j], options); + } + return object; + }; + + /** + * Converts this TopCandidates to JSON. + * @function toJSON + * @memberof google.ai.generativelanguage.v1.LogprobsResult.TopCandidates + * @instance + * @returns {Object.} JSON object + */ + TopCandidates.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TopCandidates + * @function getTypeUrl + * @memberof google.ai.generativelanguage.v1.LogprobsResult.TopCandidates + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TopCandidates.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.ai.generativelanguage.v1.LogprobsResult.TopCandidates"; + }; + + return TopCandidates; + })(); + + return LogprobsResult; + })(); + + v1.RetrievalMetadata = (function() { + + /** + * Properties of a RetrievalMetadata. + * @memberof google.ai.generativelanguage.v1 + * @interface IRetrievalMetadata + * @property {number|null} [googleSearchDynamicRetrievalScore] RetrievalMetadata googleSearchDynamicRetrievalScore + */ + + /** + * Constructs a new RetrievalMetadata. + * @memberof google.ai.generativelanguage.v1 + * @classdesc Represents a RetrievalMetadata. + * @implements IRetrievalMetadata + * @constructor + * @param {google.ai.generativelanguage.v1.IRetrievalMetadata=} [properties] Properties to set + */ + function RetrievalMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RetrievalMetadata googleSearchDynamicRetrievalScore. + * @member {number} googleSearchDynamicRetrievalScore + * @memberof google.ai.generativelanguage.v1.RetrievalMetadata + * @instance + */ + RetrievalMetadata.prototype.googleSearchDynamicRetrievalScore = 0; + + /** + * Creates a new RetrievalMetadata instance using the specified properties. + * @function create + * @memberof google.ai.generativelanguage.v1.RetrievalMetadata + * @static + * @param {google.ai.generativelanguage.v1.IRetrievalMetadata=} [properties] Properties to set + * @returns {google.ai.generativelanguage.v1.RetrievalMetadata} RetrievalMetadata instance + */ + RetrievalMetadata.create = function create(properties) { + return new RetrievalMetadata(properties); + }; + + /** + * Encodes the specified RetrievalMetadata message. Does not implicitly {@link google.ai.generativelanguage.v1.RetrievalMetadata.verify|verify} messages. + * @function encode + * @memberof google.ai.generativelanguage.v1.RetrievalMetadata + * @static + * @param {google.ai.generativelanguage.v1.IRetrievalMetadata} message RetrievalMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RetrievalMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.googleSearchDynamicRetrievalScore != null && Object.hasOwnProperty.call(message, "googleSearchDynamicRetrievalScore")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.googleSearchDynamicRetrievalScore); + return writer; + }; + + /** + * Encodes the specified RetrievalMetadata message, length delimited. Does not implicitly {@link google.ai.generativelanguage.v1.RetrievalMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.ai.generativelanguage.v1.RetrievalMetadata + * @static + * @param {google.ai.generativelanguage.v1.IRetrievalMetadata} message RetrievalMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RetrievalMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RetrievalMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.ai.generativelanguage.v1.RetrievalMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.ai.generativelanguage.v1.RetrievalMetadata} RetrievalMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RetrievalMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.ai.generativelanguage.v1.RetrievalMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + message.googleSearchDynamicRetrievalScore = reader.float(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RetrievalMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.ai.generativelanguage.v1.RetrievalMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.ai.generativelanguage.v1.RetrievalMetadata} RetrievalMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RetrievalMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RetrievalMetadata message. + * @function verify + * @memberof google.ai.generativelanguage.v1.RetrievalMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RetrievalMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.googleSearchDynamicRetrievalScore != null && message.hasOwnProperty("googleSearchDynamicRetrievalScore")) + if (typeof message.googleSearchDynamicRetrievalScore !== "number") + return "googleSearchDynamicRetrievalScore: number expected"; + return null; + }; + + /** + * Creates a RetrievalMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.ai.generativelanguage.v1.RetrievalMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.ai.generativelanguage.v1.RetrievalMetadata} RetrievalMetadata + */ + RetrievalMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.ai.generativelanguage.v1.RetrievalMetadata) + return object; + var message = new $root.google.ai.generativelanguage.v1.RetrievalMetadata(); + if (object.googleSearchDynamicRetrievalScore != null) + message.googleSearchDynamicRetrievalScore = Number(object.googleSearchDynamicRetrievalScore); + return message; + }; + + /** + * Creates a plain object from a RetrievalMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.ai.generativelanguage.v1.RetrievalMetadata + * @static + * @param {google.ai.generativelanguage.v1.RetrievalMetadata} message RetrievalMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RetrievalMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.googleSearchDynamicRetrievalScore = 0; + if (message.googleSearchDynamicRetrievalScore != null && message.hasOwnProperty("googleSearchDynamicRetrievalScore")) + object.googleSearchDynamicRetrievalScore = options.json && !isFinite(message.googleSearchDynamicRetrievalScore) ? String(message.googleSearchDynamicRetrievalScore) : message.googleSearchDynamicRetrievalScore; + return object; + }; + + /** + * Converts this RetrievalMetadata to JSON. + * @function toJSON + * @memberof google.ai.generativelanguage.v1.RetrievalMetadata + * @instance + * @returns {Object.} JSON object + */ + RetrievalMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for RetrievalMetadata + * @function getTypeUrl + * @memberof google.ai.generativelanguage.v1.RetrievalMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RetrievalMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.ai.generativelanguage.v1.RetrievalMetadata"; + }; + + return RetrievalMetadata; + })(); + + v1.GroundingMetadata = (function() { + + /** + * Properties of a GroundingMetadata. + * @memberof google.ai.generativelanguage.v1 + * @interface IGroundingMetadata + * @property {google.ai.generativelanguage.v1.ISearchEntryPoint|null} [searchEntryPoint] GroundingMetadata searchEntryPoint + * @property {Array.|null} [groundingChunks] GroundingMetadata groundingChunks + * @property {Array.|null} [groundingSupports] GroundingMetadata groundingSupports + * @property {google.ai.generativelanguage.v1.IRetrievalMetadata|null} [retrievalMetadata] GroundingMetadata retrievalMetadata + * @property {Array.|null} [webSearchQueries] GroundingMetadata webSearchQueries + */ + + /** + * Constructs a new GroundingMetadata. + * @memberof google.ai.generativelanguage.v1 + * @classdesc Represents a GroundingMetadata. + * @implements IGroundingMetadata + * @constructor + * @param {google.ai.generativelanguage.v1.IGroundingMetadata=} [properties] Properties to set + */ + function GroundingMetadata(properties) { + this.groundingChunks = []; + this.groundingSupports = []; + this.webSearchQueries = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GroundingMetadata searchEntryPoint. + * @member {google.ai.generativelanguage.v1.ISearchEntryPoint|null|undefined} searchEntryPoint + * @memberof google.ai.generativelanguage.v1.GroundingMetadata + * @instance + */ + GroundingMetadata.prototype.searchEntryPoint = null; + + /** + * GroundingMetadata groundingChunks. + * @member {Array.} groundingChunks + * @memberof google.ai.generativelanguage.v1.GroundingMetadata + * @instance + */ + GroundingMetadata.prototype.groundingChunks = $util.emptyArray; + + /** + * GroundingMetadata groundingSupports. + * @member {Array.} groundingSupports + * @memberof google.ai.generativelanguage.v1.GroundingMetadata + * @instance + */ + GroundingMetadata.prototype.groundingSupports = $util.emptyArray; + + /** + * GroundingMetadata retrievalMetadata. + * @member {google.ai.generativelanguage.v1.IRetrievalMetadata|null|undefined} retrievalMetadata + * @memberof google.ai.generativelanguage.v1.GroundingMetadata + * @instance + */ + GroundingMetadata.prototype.retrievalMetadata = null; + + /** + * GroundingMetadata webSearchQueries. + * @member {Array.} webSearchQueries + * @memberof google.ai.generativelanguage.v1.GroundingMetadata + * @instance + */ + GroundingMetadata.prototype.webSearchQueries = $util.emptyArray; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * GroundingMetadata _searchEntryPoint. + * @member {"searchEntryPoint"|undefined} _searchEntryPoint + * @memberof google.ai.generativelanguage.v1.GroundingMetadata + * @instance + */ + Object.defineProperty(GroundingMetadata.prototype, "_searchEntryPoint", { + get: $util.oneOfGetter($oneOfFields = ["searchEntryPoint"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * GroundingMetadata _retrievalMetadata. + * @member {"retrievalMetadata"|undefined} _retrievalMetadata + * @memberof google.ai.generativelanguage.v1.GroundingMetadata + * @instance + */ + Object.defineProperty(GroundingMetadata.prototype, "_retrievalMetadata", { + get: $util.oneOfGetter($oneOfFields = ["retrievalMetadata"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new GroundingMetadata instance using the specified properties. + * @function create + * @memberof google.ai.generativelanguage.v1.GroundingMetadata + * @static + * @param {google.ai.generativelanguage.v1.IGroundingMetadata=} [properties] Properties to set + * @returns {google.ai.generativelanguage.v1.GroundingMetadata} GroundingMetadata instance + */ + GroundingMetadata.create = function create(properties) { + return new GroundingMetadata(properties); + }; + + /** + * Encodes the specified GroundingMetadata message. Does not implicitly {@link google.ai.generativelanguage.v1.GroundingMetadata.verify|verify} messages. + * @function encode + * @memberof google.ai.generativelanguage.v1.GroundingMetadata + * @static + * @param {google.ai.generativelanguage.v1.IGroundingMetadata} message GroundingMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GroundingMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.searchEntryPoint != null && Object.hasOwnProperty.call(message, "searchEntryPoint")) + $root.google.ai.generativelanguage.v1.SearchEntryPoint.encode(message.searchEntryPoint, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.groundingChunks != null && message.groundingChunks.length) + for (var i = 0; i < message.groundingChunks.length; ++i) + $root.google.ai.generativelanguage.v1.GroundingChunk.encode(message.groundingChunks[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.groundingSupports != null && message.groundingSupports.length) + for (var i = 0; i < message.groundingSupports.length; ++i) + $root.google.ai.generativelanguage.v1.GroundingSupport.encode(message.groundingSupports[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.retrievalMetadata != null && Object.hasOwnProperty.call(message, "retrievalMetadata")) + $root.google.ai.generativelanguage.v1.RetrievalMetadata.encode(message.retrievalMetadata, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.webSearchQueries != null && message.webSearchQueries.length) + for (var i = 0; i < message.webSearchQueries.length; ++i) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.webSearchQueries[i]); + return writer; + }; + + /** + * Encodes the specified GroundingMetadata message, length delimited. Does not implicitly {@link google.ai.generativelanguage.v1.GroundingMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.ai.generativelanguage.v1.GroundingMetadata + * @static + * @param {google.ai.generativelanguage.v1.IGroundingMetadata} message GroundingMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GroundingMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GroundingMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.ai.generativelanguage.v1.GroundingMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.ai.generativelanguage.v1.GroundingMetadata} GroundingMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GroundingMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.ai.generativelanguage.v1.GroundingMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.searchEntryPoint = $root.google.ai.generativelanguage.v1.SearchEntryPoint.decode(reader, reader.uint32()); + break; + } + case 2: { + if (!(message.groundingChunks && message.groundingChunks.length)) + message.groundingChunks = []; + message.groundingChunks.push($root.google.ai.generativelanguage.v1.GroundingChunk.decode(reader, reader.uint32())); + break; + } + case 3: { + if (!(message.groundingSupports && message.groundingSupports.length)) + message.groundingSupports = []; + message.groundingSupports.push($root.google.ai.generativelanguage.v1.GroundingSupport.decode(reader, reader.uint32())); + break; + } + case 4: { + message.retrievalMetadata = $root.google.ai.generativelanguage.v1.RetrievalMetadata.decode(reader, reader.uint32()); + break; + } + case 5: { + if (!(message.webSearchQueries && message.webSearchQueries.length)) + message.webSearchQueries = []; + message.webSearchQueries.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GroundingMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.ai.generativelanguage.v1.GroundingMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.ai.generativelanguage.v1.GroundingMetadata} GroundingMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GroundingMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GroundingMetadata message. + * @function verify + * @memberof google.ai.generativelanguage.v1.GroundingMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GroundingMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.searchEntryPoint != null && message.hasOwnProperty("searchEntryPoint")) { + properties._searchEntryPoint = 1; + { + var error = $root.google.ai.generativelanguage.v1.SearchEntryPoint.verify(message.searchEntryPoint); + if (error) + return "searchEntryPoint." + error; + } + } + if (message.groundingChunks != null && message.hasOwnProperty("groundingChunks")) { + if (!Array.isArray(message.groundingChunks)) + return "groundingChunks: array expected"; + for (var i = 0; i < message.groundingChunks.length; ++i) { + var error = $root.google.ai.generativelanguage.v1.GroundingChunk.verify(message.groundingChunks[i]); + if (error) + return "groundingChunks." + error; + } + } + if (message.groundingSupports != null && message.hasOwnProperty("groundingSupports")) { + if (!Array.isArray(message.groundingSupports)) + return "groundingSupports: array expected"; + for (var i = 0; i < message.groundingSupports.length; ++i) { + var error = $root.google.ai.generativelanguage.v1.GroundingSupport.verify(message.groundingSupports[i]); + if (error) + return "groundingSupports." + error; + } + } + if (message.retrievalMetadata != null && message.hasOwnProperty("retrievalMetadata")) { + properties._retrievalMetadata = 1; + { + var error = $root.google.ai.generativelanguage.v1.RetrievalMetadata.verify(message.retrievalMetadata); + if (error) + return "retrievalMetadata." + error; + } + } + if (message.webSearchQueries != null && message.hasOwnProperty("webSearchQueries")) { + if (!Array.isArray(message.webSearchQueries)) + return "webSearchQueries: array expected"; + for (var i = 0; i < message.webSearchQueries.length; ++i) + if (!$util.isString(message.webSearchQueries[i])) + return "webSearchQueries: string[] expected"; + } + return null; + }; + + /** + * Creates a GroundingMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.ai.generativelanguage.v1.GroundingMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.ai.generativelanguage.v1.GroundingMetadata} GroundingMetadata + */ + GroundingMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.ai.generativelanguage.v1.GroundingMetadata) + return object; + var message = new $root.google.ai.generativelanguage.v1.GroundingMetadata(); + if (object.searchEntryPoint != null) { + if (typeof object.searchEntryPoint !== "object") + throw TypeError(".google.ai.generativelanguage.v1.GroundingMetadata.searchEntryPoint: object expected"); + message.searchEntryPoint = $root.google.ai.generativelanguage.v1.SearchEntryPoint.fromObject(object.searchEntryPoint); + } + if (object.groundingChunks) { + if (!Array.isArray(object.groundingChunks)) + throw TypeError(".google.ai.generativelanguage.v1.GroundingMetadata.groundingChunks: array expected"); + message.groundingChunks = []; + for (var i = 0; i < object.groundingChunks.length; ++i) { + if (typeof object.groundingChunks[i] !== "object") + throw TypeError(".google.ai.generativelanguage.v1.GroundingMetadata.groundingChunks: object expected"); + message.groundingChunks[i] = $root.google.ai.generativelanguage.v1.GroundingChunk.fromObject(object.groundingChunks[i]); + } + } + if (object.groundingSupports) { + if (!Array.isArray(object.groundingSupports)) + throw TypeError(".google.ai.generativelanguage.v1.GroundingMetadata.groundingSupports: array expected"); + message.groundingSupports = []; + for (var i = 0; i < object.groundingSupports.length; ++i) { + if (typeof object.groundingSupports[i] !== "object") + throw TypeError(".google.ai.generativelanguage.v1.GroundingMetadata.groundingSupports: object expected"); + message.groundingSupports[i] = $root.google.ai.generativelanguage.v1.GroundingSupport.fromObject(object.groundingSupports[i]); + } + } + if (object.retrievalMetadata != null) { + if (typeof object.retrievalMetadata !== "object") + throw TypeError(".google.ai.generativelanguage.v1.GroundingMetadata.retrievalMetadata: object expected"); + message.retrievalMetadata = $root.google.ai.generativelanguage.v1.RetrievalMetadata.fromObject(object.retrievalMetadata); + } + if (object.webSearchQueries) { + if (!Array.isArray(object.webSearchQueries)) + throw TypeError(".google.ai.generativelanguage.v1.GroundingMetadata.webSearchQueries: array expected"); + message.webSearchQueries = []; + for (var i = 0; i < object.webSearchQueries.length; ++i) + message.webSearchQueries[i] = String(object.webSearchQueries[i]); + } + return message; + }; + + /** + * Creates a plain object from a GroundingMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.ai.generativelanguage.v1.GroundingMetadata + * @static + * @param {google.ai.generativelanguage.v1.GroundingMetadata} message GroundingMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GroundingMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.groundingChunks = []; + object.groundingSupports = []; + object.webSearchQueries = []; + } + if (message.searchEntryPoint != null && message.hasOwnProperty("searchEntryPoint")) { + object.searchEntryPoint = $root.google.ai.generativelanguage.v1.SearchEntryPoint.toObject(message.searchEntryPoint, options); + if (options.oneofs) + object._searchEntryPoint = "searchEntryPoint"; + } + if (message.groundingChunks && message.groundingChunks.length) { + object.groundingChunks = []; + for (var j = 0; j < message.groundingChunks.length; ++j) + object.groundingChunks[j] = $root.google.ai.generativelanguage.v1.GroundingChunk.toObject(message.groundingChunks[j], options); + } + if (message.groundingSupports && message.groundingSupports.length) { + object.groundingSupports = []; + for (var j = 0; j < message.groundingSupports.length; ++j) + object.groundingSupports[j] = $root.google.ai.generativelanguage.v1.GroundingSupport.toObject(message.groundingSupports[j], options); + } + if (message.retrievalMetadata != null && message.hasOwnProperty("retrievalMetadata")) { + object.retrievalMetadata = $root.google.ai.generativelanguage.v1.RetrievalMetadata.toObject(message.retrievalMetadata, options); + if (options.oneofs) + object._retrievalMetadata = "retrievalMetadata"; + } + if (message.webSearchQueries && message.webSearchQueries.length) { + object.webSearchQueries = []; + for (var j = 0; j < message.webSearchQueries.length; ++j) + object.webSearchQueries[j] = message.webSearchQueries[j]; + } + return object; + }; + + /** + * Converts this GroundingMetadata to JSON. + * @function toJSON + * @memberof google.ai.generativelanguage.v1.GroundingMetadata + * @instance + * @returns {Object.} JSON object + */ + GroundingMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GroundingMetadata + * @function getTypeUrl + * @memberof google.ai.generativelanguage.v1.GroundingMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GroundingMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.ai.generativelanguage.v1.GroundingMetadata"; + }; + + return GroundingMetadata; + })(); + + v1.SearchEntryPoint = (function() { + + /** + * Properties of a SearchEntryPoint. + * @memberof google.ai.generativelanguage.v1 + * @interface ISearchEntryPoint + * @property {string|null} [renderedContent] SearchEntryPoint renderedContent + * @property {Uint8Array|null} [sdkBlob] SearchEntryPoint sdkBlob + */ + + /** + * Constructs a new SearchEntryPoint. + * @memberof google.ai.generativelanguage.v1 + * @classdesc Represents a SearchEntryPoint. + * @implements ISearchEntryPoint + * @constructor + * @param {google.ai.generativelanguage.v1.ISearchEntryPoint=} [properties] Properties to set + */ + function SearchEntryPoint(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SearchEntryPoint renderedContent. + * @member {string} renderedContent + * @memberof google.ai.generativelanguage.v1.SearchEntryPoint + * @instance + */ + SearchEntryPoint.prototype.renderedContent = ""; + + /** + * SearchEntryPoint sdkBlob. + * @member {Uint8Array} sdkBlob + * @memberof google.ai.generativelanguage.v1.SearchEntryPoint + * @instance + */ + SearchEntryPoint.prototype.sdkBlob = $util.newBuffer([]); + + /** + * Creates a new SearchEntryPoint instance using the specified properties. + * @function create + * @memberof google.ai.generativelanguage.v1.SearchEntryPoint + * @static + * @param {google.ai.generativelanguage.v1.ISearchEntryPoint=} [properties] Properties to set + * @returns {google.ai.generativelanguage.v1.SearchEntryPoint} SearchEntryPoint instance + */ + SearchEntryPoint.create = function create(properties) { + return new SearchEntryPoint(properties); + }; + + /** + * Encodes the specified SearchEntryPoint message. Does not implicitly {@link google.ai.generativelanguage.v1.SearchEntryPoint.verify|verify} messages. + * @function encode + * @memberof google.ai.generativelanguage.v1.SearchEntryPoint + * @static + * @param {google.ai.generativelanguage.v1.ISearchEntryPoint} message SearchEntryPoint message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SearchEntryPoint.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.renderedContent != null && Object.hasOwnProperty.call(message, "renderedContent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.renderedContent); + if (message.sdkBlob != null && Object.hasOwnProperty.call(message, "sdkBlob")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.sdkBlob); + return writer; + }; + + /** + * Encodes the specified SearchEntryPoint message, length delimited. Does not implicitly {@link google.ai.generativelanguage.v1.SearchEntryPoint.verify|verify} messages. + * @function encodeDelimited + * @memberof google.ai.generativelanguage.v1.SearchEntryPoint + * @static + * @param {google.ai.generativelanguage.v1.ISearchEntryPoint} message SearchEntryPoint message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SearchEntryPoint.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SearchEntryPoint message from the specified reader or buffer. + * @function decode + * @memberof google.ai.generativelanguage.v1.SearchEntryPoint + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.ai.generativelanguage.v1.SearchEntryPoint} SearchEntryPoint + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SearchEntryPoint.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.ai.generativelanguage.v1.SearchEntryPoint(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.renderedContent = reader.string(); + break; + } + case 2: { + message.sdkBlob = reader.bytes(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SearchEntryPoint message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.ai.generativelanguage.v1.SearchEntryPoint + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.ai.generativelanguage.v1.SearchEntryPoint} SearchEntryPoint + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SearchEntryPoint.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SearchEntryPoint message. + * @function verify + * @memberof google.ai.generativelanguage.v1.SearchEntryPoint + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SearchEntryPoint.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.renderedContent != null && message.hasOwnProperty("renderedContent")) + if (!$util.isString(message.renderedContent)) + return "renderedContent: string expected"; + if (message.sdkBlob != null && message.hasOwnProperty("sdkBlob")) + if (!(message.sdkBlob && typeof message.sdkBlob.length === "number" || $util.isString(message.sdkBlob))) + return "sdkBlob: buffer expected"; + return null; + }; + + /** + * Creates a SearchEntryPoint message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.ai.generativelanguage.v1.SearchEntryPoint + * @static + * @param {Object.} object Plain object + * @returns {google.ai.generativelanguage.v1.SearchEntryPoint} SearchEntryPoint + */ + SearchEntryPoint.fromObject = function fromObject(object) { + if (object instanceof $root.google.ai.generativelanguage.v1.SearchEntryPoint) + return object; + var message = new $root.google.ai.generativelanguage.v1.SearchEntryPoint(); + if (object.renderedContent != null) + message.renderedContent = String(object.renderedContent); + if (object.sdkBlob != null) + if (typeof object.sdkBlob === "string") + $util.base64.decode(object.sdkBlob, message.sdkBlob = $util.newBuffer($util.base64.length(object.sdkBlob)), 0); + else if (object.sdkBlob.length >= 0) + message.sdkBlob = object.sdkBlob; + return message; + }; + + /** + * Creates a plain object from a SearchEntryPoint message. Also converts values to other types if specified. + * @function toObject + * @memberof google.ai.generativelanguage.v1.SearchEntryPoint + * @static + * @param {google.ai.generativelanguage.v1.SearchEntryPoint} message SearchEntryPoint + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SearchEntryPoint.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.renderedContent = ""; + if (options.bytes === String) + object.sdkBlob = ""; + else { + object.sdkBlob = []; + if (options.bytes !== Array) + object.sdkBlob = $util.newBuffer(object.sdkBlob); + } + } + if (message.renderedContent != null && message.hasOwnProperty("renderedContent")) + object.renderedContent = message.renderedContent; + if (message.sdkBlob != null && message.hasOwnProperty("sdkBlob")) + object.sdkBlob = options.bytes === String ? $util.base64.encode(message.sdkBlob, 0, message.sdkBlob.length) : options.bytes === Array ? Array.prototype.slice.call(message.sdkBlob) : message.sdkBlob; + return object; + }; + + /** + * Converts this SearchEntryPoint to JSON. + * @function toJSON + * @memberof google.ai.generativelanguage.v1.SearchEntryPoint + * @instance + * @returns {Object.} JSON object + */ + SearchEntryPoint.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SearchEntryPoint + * @function getTypeUrl + * @memberof google.ai.generativelanguage.v1.SearchEntryPoint + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SearchEntryPoint.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.ai.generativelanguage.v1.SearchEntryPoint"; + }; + + return SearchEntryPoint; + })(); + + v1.GroundingChunk = (function() { + + /** + * Properties of a GroundingChunk. + * @memberof google.ai.generativelanguage.v1 + * @interface IGroundingChunk + * @property {google.ai.generativelanguage.v1.GroundingChunk.IWeb|null} [web] GroundingChunk web + */ + + /** + * Constructs a new GroundingChunk. + * @memberof google.ai.generativelanguage.v1 + * @classdesc Represents a GroundingChunk. + * @implements IGroundingChunk + * @constructor + * @param {google.ai.generativelanguage.v1.IGroundingChunk=} [properties] Properties to set + */ + function GroundingChunk(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GroundingChunk web. + * @member {google.ai.generativelanguage.v1.GroundingChunk.IWeb|null|undefined} web + * @memberof google.ai.generativelanguage.v1.GroundingChunk + * @instance + */ + GroundingChunk.prototype.web = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * GroundingChunk chunkType. + * @member {"web"|undefined} chunkType + * @memberof google.ai.generativelanguage.v1.GroundingChunk + * @instance + */ + Object.defineProperty(GroundingChunk.prototype, "chunkType", { + get: $util.oneOfGetter($oneOfFields = ["web"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new GroundingChunk instance using the specified properties. + * @function create + * @memberof google.ai.generativelanguage.v1.GroundingChunk + * @static + * @param {google.ai.generativelanguage.v1.IGroundingChunk=} [properties] Properties to set + * @returns {google.ai.generativelanguage.v1.GroundingChunk} GroundingChunk instance + */ + GroundingChunk.create = function create(properties) { + return new GroundingChunk(properties); + }; + + /** + * Encodes the specified GroundingChunk message. Does not implicitly {@link google.ai.generativelanguage.v1.GroundingChunk.verify|verify} messages. + * @function encode + * @memberof google.ai.generativelanguage.v1.GroundingChunk + * @static + * @param {google.ai.generativelanguage.v1.IGroundingChunk} message GroundingChunk message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GroundingChunk.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.web != null && Object.hasOwnProperty.call(message, "web")) + $root.google.ai.generativelanguage.v1.GroundingChunk.Web.encode(message.web, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GroundingChunk message, length delimited. Does not implicitly {@link google.ai.generativelanguage.v1.GroundingChunk.verify|verify} messages. + * @function encodeDelimited + * @memberof google.ai.generativelanguage.v1.GroundingChunk + * @static + * @param {google.ai.generativelanguage.v1.IGroundingChunk} message GroundingChunk message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GroundingChunk.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GroundingChunk message from the specified reader or buffer. + * @function decode + * @memberof google.ai.generativelanguage.v1.GroundingChunk + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.ai.generativelanguage.v1.GroundingChunk} GroundingChunk + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GroundingChunk.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.ai.generativelanguage.v1.GroundingChunk(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.web = $root.google.ai.generativelanguage.v1.GroundingChunk.Web.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GroundingChunk message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.ai.generativelanguage.v1.GroundingChunk + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.ai.generativelanguage.v1.GroundingChunk} GroundingChunk + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GroundingChunk.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GroundingChunk message. + * @function verify + * @memberof google.ai.generativelanguage.v1.GroundingChunk + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GroundingChunk.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.web != null && message.hasOwnProperty("web")) { + properties.chunkType = 1; + { + var error = $root.google.ai.generativelanguage.v1.GroundingChunk.Web.verify(message.web); + if (error) + return "web." + error; + } + } + return null; + }; + + /** + * Creates a GroundingChunk message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.ai.generativelanguage.v1.GroundingChunk + * @static + * @param {Object.} object Plain object + * @returns {google.ai.generativelanguage.v1.GroundingChunk} GroundingChunk + */ + GroundingChunk.fromObject = function fromObject(object) { + if (object instanceof $root.google.ai.generativelanguage.v1.GroundingChunk) + return object; + var message = new $root.google.ai.generativelanguage.v1.GroundingChunk(); + if (object.web != null) { + if (typeof object.web !== "object") + throw TypeError(".google.ai.generativelanguage.v1.GroundingChunk.web: object expected"); + message.web = $root.google.ai.generativelanguage.v1.GroundingChunk.Web.fromObject(object.web); + } + return message; + }; + + /** + * Creates a plain object from a GroundingChunk message. Also converts values to other types if specified. + * @function toObject + * @memberof google.ai.generativelanguage.v1.GroundingChunk + * @static + * @param {google.ai.generativelanguage.v1.GroundingChunk} message GroundingChunk + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GroundingChunk.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.web != null && message.hasOwnProperty("web")) { + object.web = $root.google.ai.generativelanguage.v1.GroundingChunk.Web.toObject(message.web, options); + if (options.oneofs) + object.chunkType = "web"; + } + return object; + }; + + /** + * Converts this GroundingChunk to JSON. + * @function toJSON + * @memberof google.ai.generativelanguage.v1.GroundingChunk + * @instance + * @returns {Object.} JSON object + */ + GroundingChunk.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GroundingChunk + * @function getTypeUrl + * @memberof google.ai.generativelanguage.v1.GroundingChunk + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GroundingChunk.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.ai.generativelanguage.v1.GroundingChunk"; + }; + + GroundingChunk.Web = (function() { + + /** + * Properties of a Web. + * @memberof google.ai.generativelanguage.v1.GroundingChunk + * @interface IWeb + * @property {string|null} [uri] Web uri + * @property {string|null} [title] Web title + */ + + /** + * Constructs a new Web. + * @memberof google.ai.generativelanguage.v1.GroundingChunk + * @classdesc Represents a Web. + * @implements IWeb + * @constructor + * @param {google.ai.generativelanguage.v1.GroundingChunk.IWeb=} [properties] Properties to set + */ + function Web(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Web uri. + * @member {string|null|undefined} uri + * @memberof google.ai.generativelanguage.v1.GroundingChunk.Web + * @instance + */ + Web.prototype.uri = null; + + /** + * Web title. + * @member {string|null|undefined} title + * @memberof google.ai.generativelanguage.v1.GroundingChunk.Web + * @instance + */ + Web.prototype.title = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Web _uri. + * @member {"uri"|undefined} _uri + * @memberof google.ai.generativelanguage.v1.GroundingChunk.Web + * @instance + */ + Object.defineProperty(Web.prototype, "_uri", { + get: $util.oneOfGetter($oneOfFields = ["uri"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Web _title. + * @member {"title"|undefined} _title + * @memberof google.ai.generativelanguage.v1.GroundingChunk.Web + * @instance + */ + Object.defineProperty(Web.prototype, "_title", { + get: $util.oneOfGetter($oneOfFields = ["title"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Web instance using the specified properties. + * @function create + * @memberof google.ai.generativelanguage.v1.GroundingChunk.Web + * @static + * @param {google.ai.generativelanguage.v1.GroundingChunk.IWeb=} [properties] Properties to set + * @returns {google.ai.generativelanguage.v1.GroundingChunk.Web} Web instance + */ + Web.create = function create(properties) { + return new Web(properties); + }; + + /** + * Encodes the specified Web message. Does not implicitly {@link google.ai.generativelanguage.v1.GroundingChunk.Web.verify|verify} messages. + * @function encode + * @memberof google.ai.generativelanguage.v1.GroundingChunk.Web + * @static + * @param {google.ai.generativelanguage.v1.GroundingChunk.IWeb} message Web message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Web.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri); + if (message.title != null && Object.hasOwnProperty.call(message, "title")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.title); + return writer; + }; + + /** + * Encodes the specified Web message, length delimited. Does not implicitly {@link google.ai.generativelanguage.v1.GroundingChunk.Web.verify|verify} messages. + * @function encodeDelimited + * @memberof google.ai.generativelanguage.v1.GroundingChunk.Web + * @static + * @param {google.ai.generativelanguage.v1.GroundingChunk.IWeb} message Web message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Web.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Web message from the specified reader or buffer. + * @function decode + * @memberof google.ai.generativelanguage.v1.GroundingChunk.Web + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.ai.generativelanguage.v1.GroundingChunk.Web} Web + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Web.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.ai.generativelanguage.v1.GroundingChunk.Web(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.uri = reader.string(); + break; + } + case 2: { + message.title = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Web message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.ai.generativelanguage.v1.GroundingChunk.Web + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.ai.generativelanguage.v1.GroundingChunk.Web} Web + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Web.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Web message. + * @function verify + * @memberof google.ai.generativelanguage.v1.GroundingChunk.Web + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Web.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.uri != null && message.hasOwnProperty("uri")) { + properties._uri = 1; + if (!$util.isString(message.uri)) + return "uri: string expected"; + } + if (message.title != null && message.hasOwnProperty("title")) { + properties._title = 1; + if (!$util.isString(message.title)) + return "title: string expected"; + } + return null; + }; + + /** + * Creates a Web message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.ai.generativelanguage.v1.GroundingChunk.Web + * @static + * @param {Object.} object Plain object + * @returns {google.ai.generativelanguage.v1.GroundingChunk.Web} Web + */ + Web.fromObject = function fromObject(object) { + if (object instanceof $root.google.ai.generativelanguage.v1.GroundingChunk.Web) + return object; + var message = new $root.google.ai.generativelanguage.v1.GroundingChunk.Web(); + if (object.uri != null) + message.uri = String(object.uri); + if (object.title != null) + message.title = String(object.title); + return message; + }; + + /** + * Creates a plain object from a Web message. Also converts values to other types if specified. + * @function toObject + * @memberof google.ai.generativelanguage.v1.GroundingChunk.Web + * @static + * @param {google.ai.generativelanguage.v1.GroundingChunk.Web} message Web + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Web.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.uri != null && message.hasOwnProperty("uri")) { + object.uri = message.uri; + if (options.oneofs) + object._uri = "uri"; + } + if (message.title != null && message.hasOwnProperty("title")) { + object.title = message.title; + if (options.oneofs) + object._title = "title"; + } + return object; + }; + + /** + * Converts this Web to JSON. + * @function toJSON + * @memberof google.ai.generativelanguage.v1.GroundingChunk.Web + * @instance + * @returns {Object.} JSON object + */ + Web.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Web + * @function getTypeUrl + * @memberof google.ai.generativelanguage.v1.GroundingChunk.Web + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Web.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.ai.generativelanguage.v1.GroundingChunk.Web"; + }; + + return Web; + })(); + + return GroundingChunk; + })(); + + v1.Segment = (function() { + + /** + * Properties of a Segment. + * @memberof google.ai.generativelanguage.v1 + * @interface ISegment + * @property {number|null} [partIndex] Segment partIndex + * @property {number|null} [startIndex] Segment startIndex + * @property {number|null} [endIndex] Segment endIndex + * @property {string|null} [text] Segment text + */ + + /** + * Constructs a new Segment. + * @memberof google.ai.generativelanguage.v1 + * @classdesc Represents a Segment. + * @implements ISegment + * @constructor + * @param {google.ai.generativelanguage.v1.ISegment=} [properties] Properties to set + */ + function Segment(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Segment partIndex. + * @member {number} partIndex + * @memberof google.ai.generativelanguage.v1.Segment + * @instance + */ + Segment.prototype.partIndex = 0; + + /** + * Segment startIndex. + * @member {number} startIndex + * @memberof google.ai.generativelanguage.v1.Segment + * @instance + */ + Segment.prototype.startIndex = 0; + + /** + * Segment endIndex. + * @member {number} endIndex + * @memberof google.ai.generativelanguage.v1.Segment + * @instance + */ + Segment.prototype.endIndex = 0; + + /** + * Segment text. + * @member {string} text + * @memberof google.ai.generativelanguage.v1.Segment + * @instance + */ + Segment.prototype.text = ""; + + /** + * Creates a new Segment instance using the specified properties. + * @function create + * @memberof google.ai.generativelanguage.v1.Segment + * @static + * @param {google.ai.generativelanguage.v1.ISegment=} [properties] Properties to set + * @returns {google.ai.generativelanguage.v1.Segment} Segment instance + */ + Segment.create = function create(properties) { + return new Segment(properties); + }; + + /** + * Encodes the specified Segment message. Does not implicitly {@link google.ai.generativelanguage.v1.Segment.verify|verify} messages. + * @function encode + * @memberof google.ai.generativelanguage.v1.Segment + * @static + * @param {google.ai.generativelanguage.v1.ISegment} message Segment message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Segment.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.partIndex != null && Object.hasOwnProperty.call(message, "partIndex")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.partIndex); + if (message.startIndex != null && Object.hasOwnProperty.call(message, "startIndex")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.startIndex); + if (message.endIndex != null && Object.hasOwnProperty.call(message, "endIndex")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.endIndex); + if (message.text != null && Object.hasOwnProperty.call(message, "text")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.text); + return writer; + }; + + /** + * Encodes the specified Segment message, length delimited. Does not implicitly {@link google.ai.generativelanguage.v1.Segment.verify|verify} messages. + * @function encodeDelimited + * @memberof google.ai.generativelanguage.v1.Segment + * @static + * @param {google.ai.generativelanguage.v1.ISegment} message Segment message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Segment.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Segment message from the specified reader or buffer. + * @function decode + * @memberof google.ai.generativelanguage.v1.Segment + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.ai.generativelanguage.v1.Segment} Segment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Segment.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.ai.generativelanguage.v1.Segment(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.partIndex = reader.int32(); + break; + } + case 2: { + message.startIndex = reader.int32(); + break; + } + case 3: { + message.endIndex = reader.int32(); + break; + } + case 4: { + message.text = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Segment message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.ai.generativelanguage.v1.Segment + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.ai.generativelanguage.v1.Segment} Segment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Segment.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Segment message. + * @function verify + * @memberof google.ai.generativelanguage.v1.Segment + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Segment.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.partIndex != null && message.hasOwnProperty("partIndex")) + if (!$util.isInteger(message.partIndex)) + return "partIndex: integer expected"; + if (message.startIndex != null && message.hasOwnProperty("startIndex")) + if (!$util.isInteger(message.startIndex)) + return "startIndex: integer expected"; + if (message.endIndex != null && message.hasOwnProperty("endIndex")) + if (!$util.isInteger(message.endIndex)) + return "endIndex: integer expected"; + if (message.text != null && message.hasOwnProperty("text")) + if (!$util.isString(message.text)) + return "text: string expected"; + return null; + }; + + /** + * Creates a Segment message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.ai.generativelanguage.v1.Segment + * @static + * @param {Object.} object Plain object + * @returns {google.ai.generativelanguage.v1.Segment} Segment + */ + Segment.fromObject = function fromObject(object) { + if (object instanceof $root.google.ai.generativelanguage.v1.Segment) + return object; + var message = new $root.google.ai.generativelanguage.v1.Segment(); + if (object.partIndex != null) + message.partIndex = object.partIndex | 0; + if (object.startIndex != null) + message.startIndex = object.startIndex | 0; + if (object.endIndex != null) + message.endIndex = object.endIndex | 0; + if (object.text != null) + message.text = String(object.text); + return message; + }; + + /** + * Creates a plain object from a Segment message. Also converts values to other types if specified. + * @function toObject + * @memberof google.ai.generativelanguage.v1.Segment + * @static + * @param {google.ai.generativelanguage.v1.Segment} message Segment + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Segment.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.partIndex = 0; + object.startIndex = 0; + object.endIndex = 0; + object.text = ""; + } + if (message.partIndex != null && message.hasOwnProperty("partIndex")) + object.partIndex = message.partIndex; + if (message.startIndex != null && message.hasOwnProperty("startIndex")) + object.startIndex = message.startIndex; + if (message.endIndex != null && message.hasOwnProperty("endIndex")) + object.endIndex = message.endIndex; + if (message.text != null && message.hasOwnProperty("text")) + object.text = message.text; + return object; + }; + + /** + * Converts this Segment to JSON. + * @function toJSON + * @memberof google.ai.generativelanguage.v1.Segment + * @instance + * @returns {Object.} JSON object + */ + Segment.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Segment + * @function getTypeUrl + * @memberof google.ai.generativelanguage.v1.Segment + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Segment.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.ai.generativelanguage.v1.Segment"; + }; + + return Segment; + })(); + + v1.GroundingSupport = (function() { + + /** + * Properties of a GroundingSupport. + * @memberof google.ai.generativelanguage.v1 + * @interface IGroundingSupport + * @property {google.ai.generativelanguage.v1.ISegment|null} [segment] GroundingSupport segment + * @property {Array.|null} [groundingChunkIndices] GroundingSupport groundingChunkIndices + * @property {Array.|null} [confidenceScores] GroundingSupport confidenceScores + */ + + /** + * Constructs a new GroundingSupport. + * @memberof google.ai.generativelanguage.v1 + * @classdesc Represents a GroundingSupport. + * @implements IGroundingSupport + * @constructor + * @param {google.ai.generativelanguage.v1.IGroundingSupport=} [properties] Properties to set + */ + function GroundingSupport(properties) { + this.groundingChunkIndices = []; + this.confidenceScores = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GroundingSupport segment. + * @member {google.ai.generativelanguage.v1.ISegment|null|undefined} segment + * @memberof google.ai.generativelanguage.v1.GroundingSupport + * @instance + */ + GroundingSupport.prototype.segment = null; + + /** + * GroundingSupport groundingChunkIndices. + * @member {Array.} groundingChunkIndices + * @memberof google.ai.generativelanguage.v1.GroundingSupport + * @instance + */ + GroundingSupport.prototype.groundingChunkIndices = $util.emptyArray; + + /** + * GroundingSupport confidenceScores. + * @member {Array.} confidenceScores + * @memberof google.ai.generativelanguage.v1.GroundingSupport + * @instance + */ + GroundingSupport.prototype.confidenceScores = $util.emptyArray; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * GroundingSupport _segment. + * @member {"segment"|undefined} _segment + * @memberof google.ai.generativelanguage.v1.GroundingSupport + * @instance + */ + Object.defineProperty(GroundingSupport.prototype, "_segment", { + get: $util.oneOfGetter($oneOfFields = ["segment"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new GroundingSupport instance using the specified properties. + * @function create + * @memberof google.ai.generativelanguage.v1.GroundingSupport + * @static + * @param {google.ai.generativelanguage.v1.IGroundingSupport=} [properties] Properties to set + * @returns {google.ai.generativelanguage.v1.GroundingSupport} GroundingSupport instance + */ + GroundingSupport.create = function create(properties) { + return new GroundingSupport(properties); + }; + + /** + * Encodes the specified GroundingSupport message. Does not implicitly {@link google.ai.generativelanguage.v1.GroundingSupport.verify|verify} messages. + * @function encode + * @memberof google.ai.generativelanguage.v1.GroundingSupport + * @static + * @param {google.ai.generativelanguage.v1.IGroundingSupport} message GroundingSupport message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GroundingSupport.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.segment != null && Object.hasOwnProperty.call(message, "segment")) + $root.google.ai.generativelanguage.v1.Segment.encode(message.segment, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.groundingChunkIndices != null && message.groundingChunkIndices.length) { + writer.uint32(/* id 2, wireType 2 =*/18).fork(); + for (var i = 0; i < message.groundingChunkIndices.length; ++i) + writer.int32(message.groundingChunkIndices[i]); + writer.ldelim(); + } + if (message.confidenceScores != null && message.confidenceScores.length) { + writer.uint32(/* id 3, wireType 2 =*/26).fork(); + for (var i = 0; i < message.confidenceScores.length; ++i) + writer.float(message.confidenceScores[i]); + writer.ldelim(); + } + return writer; + }; + + /** + * Encodes the specified GroundingSupport message, length delimited. Does not implicitly {@link google.ai.generativelanguage.v1.GroundingSupport.verify|verify} messages. + * @function encodeDelimited + * @memberof google.ai.generativelanguage.v1.GroundingSupport + * @static + * @param {google.ai.generativelanguage.v1.IGroundingSupport} message GroundingSupport message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GroundingSupport.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GroundingSupport message from the specified reader or buffer. + * @function decode + * @memberof google.ai.generativelanguage.v1.GroundingSupport + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.ai.generativelanguage.v1.GroundingSupport} GroundingSupport + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GroundingSupport.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.ai.generativelanguage.v1.GroundingSupport(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.segment = $root.google.ai.generativelanguage.v1.Segment.decode(reader, reader.uint32()); + break; + } + case 2: { + if (!(message.groundingChunkIndices && message.groundingChunkIndices.length)) + message.groundingChunkIndices = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.groundingChunkIndices.push(reader.int32()); + } else + message.groundingChunkIndices.push(reader.int32()); + break; + } + case 3: { + if (!(message.confidenceScores && message.confidenceScores.length)) + message.confidenceScores = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.confidenceScores.push(reader.float()); + } else + message.confidenceScores.push(reader.float()); + break; } + default: + reader.skipType(tag & 7); + break; } - return message; - }; + } + return message; + }; - /** - * Creates a plain object from a TopCandidates message. Also converts values to other types if specified. - * @function toObject - * @memberof google.ai.generativelanguage.v1.LogprobsResult.TopCandidates - * @static - * @param {google.ai.generativelanguage.v1.LogprobsResult.TopCandidates} message TopCandidates - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - TopCandidates.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.candidates = []; - if (message.candidates && message.candidates.length) { - object.candidates = []; - for (var j = 0; j < message.candidates.length; ++j) - object.candidates[j] = $root.google.ai.generativelanguage.v1.LogprobsResult.Candidate.toObject(message.candidates[j], options); + /** + * Decodes a GroundingSupport message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.ai.generativelanguage.v1.GroundingSupport + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.ai.generativelanguage.v1.GroundingSupport} GroundingSupport + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GroundingSupport.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GroundingSupport message. + * @function verify + * @memberof google.ai.generativelanguage.v1.GroundingSupport + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GroundingSupport.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.segment != null && message.hasOwnProperty("segment")) { + properties._segment = 1; + { + var error = $root.google.ai.generativelanguage.v1.Segment.verify(message.segment); + if (error) + return "segment." + error; } + } + if (message.groundingChunkIndices != null && message.hasOwnProperty("groundingChunkIndices")) { + if (!Array.isArray(message.groundingChunkIndices)) + return "groundingChunkIndices: array expected"; + for (var i = 0; i < message.groundingChunkIndices.length; ++i) + if (!$util.isInteger(message.groundingChunkIndices[i])) + return "groundingChunkIndices: integer[] expected"; + } + if (message.confidenceScores != null && message.hasOwnProperty("confidenceScores")) { + if (!Array.isArray(message.confidenceScores)) + return "confidenceScores: array expected"; + for (var i = 0; i < message.confidenceScores.length; ++i) + if (typeof message.confidenceScores[i] !== "number") + return "confidenceScores: number[] expected"; + } + return null; + }; + + /** + * Creates a GroundingSupport message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.ai.generativelanguage.v1.GroundingSupport + * @static + * @param {Object.} object Plain object + * @returns {google.ai.generativelanguage.v1.GroundingSupport} GroundingSupport + */ + GroundingSupport.fromObject = function fromObject(object) { + if (object instanceof $root.google.ai.generativelanguage.v1.GroundingSupport) return object; - }; + var message = new $root.google.ai.generativelanguage.v1.GroundingSupport(); + if (object.segment != null) { + if (typeof object.segment !== "object") + throw TypeError(".google.ai.generativelanguage.v1.GroundingSupport.segment: object expected"); + message.segment = $root.google.ai.generativelanguage.v1.Segment.fromObject(object.segment); + } + if (object.groundingChunkIndices) { + if (!Array.isArray(object.groundingChunkIndices)) + throw TypeError(".google.ai.generativelanguage.v1.GroundingSupport.groundingChunkIndices: array expected"); + message.groundingChunkIndices = []; + for (var i = 0; i < object.groundingChunkIndices.length; ++i) + message.groundingChunkIndices[i] = object.groundingChunkIndices[i] | 0; + } + if (object.confidenceScores) { + if (!Array.isArray(object.confidenceScores)) + throw TypeError(".google.ai.generativelanguage.v1.GroundingSupport.confidenceScores: array expected"); + message.confidenceScores = []; + for (var i = 0; i < object.confidenceScores.length; ++i) + message.confidenceScores[i] = Number(object.confidenceScores[i]); + } + return message; + }; - /** - * Converts this TopCandidates to JSON. - * @function toJSON - * @memberof google.ai.generativelanguage.v1.LogprobsResult.TopCandidates - * @instance - * @returns {Object.} JSON object - */ - TopCandidates.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Creates a plain object from a GroundingSupport message. Also converts values to other types if specified. + * @function toObject + * @memberof google.ai.generativelanguage.v1.GroundingSupport + * @static + * @param {google.ai.generativelanguage.v1.GroundingSupport} message GroundingSupport + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GroundingSupport.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.groundingChunkIndices = []; + object.confidenceScores = []; + } + if (message.segment != null && message.hasOwnProperty("segment")) { + object.segment = $root.google.ai.generativelanguage.v1.Segment.toObject(message.segment, options); + if (options.oneofs) + object._segment = "segment"; + } + if (message.groundingChunkIndices && message.groundingChunkIndices.length) { + object.groundingChunkIndices = []; + for (var j = 0; j < message.groundingChunkIndices.length; ++j) + object.groundingChunkIndices[j] = message.groundingChunkIndices[j]; + } + if (message.confidenceScores && message.confidenceScores.length) { + object.confidenceScores = []; + for (var j = 0; j < message.confidenceScores.length; ++j) + object.confidenceScores[j] = options.json && !isFinite(message.confidenceScores[j]) ? String(message.confidenceScores[j]) : message.confidenceScores[j]; + } + return object; + }; - /** - * Gets the default type url for TopCandidates - * @function getTypeUrl - * @memberof google.ai.generativelanguage.v1.LogprobsResult.TopCandidates - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - TopCandidates.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.ai.generativelanguage.v1.LogprobsResult.TopCandidates"; - }; + /** + * Converts this GroundingSupport to JSON. + * @function toJSON + * @memberof google.ai.generativelanguage.v1.GroundingSupport + * @instance + * @returns {Object.} JSON object + */ + GroundingSupport.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - return TopCandidates; - })(); + /** + * Gets the default type url for GroundingSupport + * @function getTypeUrl + * @memberof google.ai.generativelanguage.v1.GroundingSupport + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GroundingSupport.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.ai.generativelanguage.v1.GroundingSupport"; + }; - return LogprobsResult; + return GroundingSupport; })(); v1.EmbedContentRequest = (function() { @@ -23696,6 +25668,7 @@ * @property {Array.|null} [candidates] GenerateContentResponse candidates * @property {google.ai.generativelanguage.v1beta.GenerateContentResponse.IPromptFeedback|null} [promptFeedback] GenerateContentResponse promptFeedback * @property {google.ai.generativelanguage.v1beta.GenerateContentResponse.IUsageMetadata|null} [usageMetadata] GenerateContentResponse usageMetadata + * @property {string|null} [modelVersion] GenerateContentResponse modelVersion */ /** @@ -23738,6 +25711,14 @@ */ GenerateContentResponse.prototype.usageMetadata = null; + /** + * GenerateContentResponse modelVersion. + * @member {string} modelVersion + * @memberof google.ai.generativelanguage.v1beta.GenerateContentResponse + * @instance + */ + GenerateContentResponse.prototype.modelVersion = ""; + /** * Creates a new GenerateContentResponse instance using the specified properties. * @function create @@ -23769,6 +25750,8 @@ $root.google.ai.generativelanguage.v1beta.GenerateContentResponse.PromptFeedback.encode(message.promptFeedback, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); if (message.usageMetadata != null && Object.hasOwnProperty.call(message, "usageMetadata")) $root.google.ai.generativelanguage.v1beta.GenerateContentResponse.UsageMetadata.encode(message.usageMetadata, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.modelVersion != null && Object.hasOwnProperty.call(message, "modelVersion")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.modelVersion); return writer; }; @@ -23817,6 +25800,10 @@ message.usageMetadata = $root.google.ai.generativelanguage.v1beta.GenerateContentResponse.UsageMetadata.decode(reader, reader.uint32()); break; } + case 4: { + message.modelVersion = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -23871,6 +25858,9 @@ if (error) return "usageMetadata." + error; } + if (message.modelVersion != null && message.hasOwnProperty("modelVersion")) + if (!$util.isString(message.modelVersion)) + return "modelVersion: string expected"; return null; }; @@ -23906,6 +25896,8 @@ throw TypeError(".google.ai.generativelanguage.v1beta.GenerateContentResponse.usageMetadata: object expected"); message.usageMetadata = $root.google.ai.generativelanguage.v1beta.GenerateContentResponse.UsageMetadata.fromObject(object.usageMetadata); } + if (object.modelVersion != null) + message.modelVersion = String(object.modelVersion); return message; }; @@ -23927,6 +25919,7 @@ if (options.defaults) { object.promptFeedback = null; object.usageMetadata = null; + object.modelVersion = ""; } if (message.candidates && message.candidates.length) { object.candidates = []; @@ -23937,6 +25930,8 @@ object.promptFeedback = $root.google.ai.generativelanguage.v1beta.GenerateContentResponse.PromptFeedback.toObject(message.promptFeedback, options); if (message.usageMetadata != null && message.hasOwnProperty("usageMetadata")) object.usageMetadata = $root.google.ai.generativelanguage.v1beta.GenerateContentResponse.UsageMetadata.toObject(message.usageMetadata, options); + if (message.modelVersion != null && message.hasOwnProperty("modelVersion")) + object.modelVersion = message.modelVersion; return object; }; @@ -27090,6 +29085,7 @@ * @property {Array.|null} [groundingChunks] GroundingMetadata groundingChunks * @property {Array.|null} [groundingSupports] GroundingMetadata groundingSupports * @property {google.ai.generativelanguage.v1beta.IRetrievalMetadata|null} [retrievalMetadata] GroundingMetadata retrievalMetadata + * @property {Array.|null} [webSearchQueries] GroundingMetadata webSearchQueries */ /** @@ -27103,6 +29099,7 @@ function GroundingMetadata(properties) { this.groundingChunks = []; this.groundingSupports = []; + this.webSearchQueries = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -27141,6 +29138,14 @@ */ GroundingMetadata.prototype.retrievalMetadata = null; + /** + * GroundingMetadata webSearchQueries. + * @member {Array.} webSearchQueries + * @memberof google.ai.generativelanguage.v1beta.GroundingMetadata + * @instance + */ + GroundingMetadata.prototype.webSearchQueries = $util.emptyArray; + // OneOf field names bound to virtual getters and setters var $oneOfFields; @@ -27200,6 +29205,9 @@ $root.google.ai.generativelanguage.v1beta.GroundingSupport.encode(message.groundingSupports[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); if (message.retrievalMetadata != null && Object.hasOwnProperty.call(message, "retrievalMetadata")) $root.google.ai.generativelanguage.v1beta.RetrievalMetadata.encode(message.retrievalMetadata, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.webSearchQueries != null && message.webSearchQueries.length) + for (var i = 0; i < message.webSearchQueries.length; ++i) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.webSearchQueries[i]); return writer; }; @@ -27254,6 +29262,12 @@ message.retrievalMetadata = $root.google.ai.generativelanguage.v1beta.RetrievalMetadata.decode(reader, reader.uint32()); break; } + case 5: { + if (!(message.webSearchQueries && message.webSearchQueries.length)) + message.webSearchQueries = []; + message.webSearchQueries.push(reader.string()); + break; + } default: reader.skipType(tag & 7); break; @@ -27324,6 +29338,13 @@ return "retrievalMetadata." + error; } } + if (message.webSearchQueries != null && message.hasOwnProperty("webSearchQueries")) { + if (!Array.isArray(message.webSearchQueries)) + return "webSearchQueries: array expected"; + for (var i = 0; i < message.webSearchQueries.length; ++i) + if (!$util.isString(message.webSearchQueries[i])) + return "webSearchQueries: string[] expected"; + } return null; }; @@ -27369,6 +29390,13 @@ throw TypeError(".google.ai.generativelanguage.v1beta.GroundingMetadata.retrievalMetadata: object expected"); message.retrievalMetadata = $root.google.ai.generativelanguage.v1beta.RetrievalMetadata.fromObject(object.retrievalMetadata); } + if (object.webSearchQueries) { + if (!Array.isArray(object.webSearchQueries)) + throw TypeError(".google.ai.generativelanguage.v1beta.GroundingMetadata.webSearchQueries: array expected"); + message.webSearchQueries = []; + for (var i = 0; i < object.webSearchQueries.length; ++i) + message.webSearchQueries[i] = String(object.webSearchQueries[i]); + } return message; }; @@ -27388,6 +29416,7 @@ if (options.arrays || options.defaults) { object.groundingChunks = []; object.groundingSupports = []; + object.webSearchQueries = []; } if (message.searchEntryPoint != null && message.hasOwnProperty("searchEntryPoint")) { object.searchEntryPoint = $root.google.ai.generativelanguage.v1beta.SearchEntryPoint.toObject(message.searchEntryPoint, options); @@ -27409,6 +29438,11 @@ if (options.oneofs) object._retrievalMetadata = "retrievalMetadata"; } + if (message.webSearchQueries && message.webSearchQueries.length) { + object.webSearchQueries = []; + for (var j = 0; j < message.webSearchQueries.length; ++j) + object.webSearchQueries[j] = message.webSearchQueries[j]; + } return object; }; diff --git a/packages/google-ai-generativelanguage/protos/protos.json b/packages/google-ai-generativelanguage/protos/protos.json index c87a2791d4f..3ac503d059b 100644 --- a/packages/google-ai-generativelanguage/protos/protos.json +++ b/packages/google-ai-generativelanguage/protos/protos.json @@ -170,13 +170,19 @@ "options": { "(google.api.http).post": "/v1/{model=models/*}:streamGenerateContent", "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v1/{model=tunedModels/*}:streamGenerateContent", + "(google.api.http).additional_bindings.body": "*", "(google.api.method_signature)": "model,contents" }, "parsedOptions": [ { "(google.api.http)": { "post": "/v1/{model=models/*}:streamGenerateContent", - "body": "*" + "body": "*", + "additional_bindings": { + "post": "/v1/{model=tunedModels/*}:streamGenerateContent", + "body": "*" + } } }, { @@ -449,6 +455,13 @@ "options": { "(google.api.field_behavior)": "OUTPUT_ONLY" } + }, + "modelVersion": { + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } } }, "nested": { @@ -547,6 +560,13 @@ "(google.api.field_behavior)": "OUTPUT_ONLY" } }, + "groundingMetadata": { + "type": "GroundingMetadata", + "id": 9, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, "avgLogprobs": { "type": "double", "id": 10, @@ -647,6 +667,188 @@ } } }, + "RetrievalMetadata": { + "fields": { + "googleSearchDynamicRetrievalScore": { + "type": "float", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "GroundingMetadata": { + "oneofs": { + "_searchEntryPoint": { + "oneof": [ + "searchEntryPoint" + ] + }, + "_retrievalMetadata": { + "oneof": [ + "retrievalMetadata" + ] + } + }, + "fields": { + "searchEntryPoint": { + "type": "SearchEntryPoint", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true + } + }, + "groundingChunks": { + "rule": "repeated", + "type": "GroundingChunk", + "id": 2 + }, + "groundingSupports": { + "rule": "repeated", + "type": "GroundingSupport", + "id": 3 + }, + "retrievalMetadata": { + "type": "RetrievalMetadata", + "id": 4, + "options": { + "proto3_optional": true + } + }, + "webSearchQueries": { + "rule": "repeated", + "type": "string", + "id": 5 + } + } + }, + "SearchEntryPoint": { + "fields": { + "renderedContent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "sdkBlob": { + "type": "bytes", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "GroundingChunk": { + "oneofs": { + "chunkType": { + "oneof": [ + "web" + ] + } + }, + "fields": { + "web": { + "type": "Web", + "id": 1 + } + }, + "nested": { + "Web": { + "oneofs": { + "_uri": { + "oneof": [ + "uri" + ] + }, + "_title": { + "oneof": [ + "title" + ] + } + }, + "fields": { + "uri": { + "type": "string", + "id": 1, + "options": { + "proto3_optional": true + } + }, + "title": { + "type": "string", + "id": 2, + "options": { + "proto3_optional": true + } + } + } + } + } + }, + "Segment": { + "fields": { + "partIndex": { + "type": "int32", + "id": 1, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "startIndex": { + "type": "int32", + "id": 2, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "endIndex": { + "type": "int32", + "id": 3, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "text": { + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + } + }, + "GroundingSupport": { + "oneofs": { + "_segment": { + "oneof": [ + "segment" + ] + } + }, + "fields": { + "segment": { + "type": "Segment", + "id": 1, + "options": { + "proto3_optional": true + } + }, + "groundingChunkIndices": { + "rule": "repeated", + "type": "int32", + "id": 2 + }, + "confidenceScores": { + "rule": "repeated", + "type": "float", + "id": 3 + } + } + }, "EmbedContentRequest": { "oneofs": { "_taskType": { @@ -2590,13 +2792,19 @@ "options": { "(google.api.http).post": "/v1beta/{model=models/*}:streamGenerateContent", "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v1beta/{model=tunedModels/*}:streamGenerateContent", + "(google.api.http).additional_bindings.body": "*", "(google.api.method_signature)": "model,contents" }, "parsedOptions": [ { "(google.api.http)": { "post": "/v1beta/{model=models/*}:streamGenerateContent", - "body": "*" + "body": "*", + "additional_bindings": { + "post": "/v1beta/{model=tunedModels/*}:streamGenerateContent", + "body": "*" + } } }, { @@ -2979,6 +3187,13 @@ "options": { "(google.api.field_behavior)": "OUTPUT_ONLY" } + }, + "modelVersion": { + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } } }, "nested": { @@ -3318,6 +3533,11 @@ "options": { "proto3_optional": true } + }, + "webSearchQueries": { + "rule": "repeated", + "type": "string", + "id": 5 } } }, @@ -4408,7 +4628,7 @@ "type": "google.protobuf.FieldMask", "id": 2, "options": { - "(google.api.field_behavior)": "REQUIRED" + "(google.api.field_behavior)": "OPTIONAL" } } } @@ -4699,10 +4919,7 @@ "examples": { "rule": "repeated", "type": "TuningExample", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } + "id": 1 } } }, diff --git a/packages/google-ai-generativelanguage/samples/generated/v1beta/model_service.update_tuned_model.js b/packages/google-ai-generativelanguage/samples/generated/v1beta/model_service.update_tuned_model.js index 75e0c226243..43b779c6b11 100644 --- a/packages/google-ai-generativelanguage/samples/generated/v1beta/model_service.update_tuned_model.js +++ b/packages/google-ai-generativelanguage/samples/generated/v1beta/model_service.update_tuned_model.js @@ -20,7 +20,7 @@ 'use strict'; -function main(tunedModel, updateMask) { +function main(tunedModel) { // [START generativelanguage_v1beta_generated_ModelService_UpdateTunedModel_async] /** * This snippet has been automatically generated and should be regarded as a code template only. @@ -33,7 +33,7 @@ function main(tunedModel, updateMask) { */ // const tunedModel = {} /** - * Required. The list of fields to update. + * Optional. The list of fields to update. */ // const updateMask = {} @@ -47,7 +47,6 @@ function main(tunedModel, updateMask) { // Construct request const request = { tunedModel, - updateMask, }; // Run request diff --git a/packages/google-ai-generativelanguage/samples/generated/v1beta/snippet_metadata_google.ai.generativelanguage.v1beta.json b/packages/google-ai-generativelanguage/samples/generated/v1beta/snippet_metadata_google.ai.generativelanguage.v1beta.json index 4af35f2d7b4..0f0477f7031 100644 --- a/packages/google-ai-generativelanguage/samples/generated/v1beta/snippet_metadata_google.ai.generativelanguage.v1beta.json +++ b/packages/google-ai-generativelanguage/samples/generated/v1beta/snippet_metadata_google.ai.generativelanguage.v1beta.json @@ -1062,7 +1062,7 @@ "segments": [ { "start": 25, - "end": 58, + "end": 57, "type": "FULL" } ], diff --git a/packages/google-ai-generativelanguage/src/v1beta/model_service_client.ts b/packages/google-ai-generativelanguage/src/v1beta/model_service_client.ts index 3591bde3366..38b592b0adf 100644 --- a/packages/google-ai-generativelanguage/src/v1beta/model_service_client.ts +++ b/packages/google-ai-generativelanguage/src/v1beta/model_service_client.ts @@ -251,7 +251,21 @@ export class ModelServiceClient { }; if (opts.fallback) { lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = []; + lroOptions.httpRules = [ + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v1beta/{name=tunedModels/*/operations/*}', + additional_bindings: [ + {get: '/v1beta/{name=generatedFiles/*/operations/*}'}, + {get: '/v1beta/{name=models/*/operations/*}'}, + ], + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v1beta/{name=tunedModels/*}/operations', + additional_bindings: [{get: '/v1beta/{name=models/*}/operations'}], + }, + ]; } this.operationsClient = this._gaxModule .lro(lroOptions) @@ -650,8 +664,8 @@ export class ModelServiceClient { * The request object that will be sent. * @param {google.ai.generativelanguage.v1beta.TunedModel} request.tunedModel * Required. The tuned model to update. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. The list of fields to update. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. The list of fields to update. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array.