@google-ai/generativelanguage
Version:
Generative Language API client for Node.js
948 lines (788 loc) • 3.5 MB
TypeScript
// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import type {protobuf as $protobuf} from "google-gax";
import Long = require("long");
/** Namespace google. */
export namespace google {
/** Namespace ai. */
namespace ai {
/** Namespace generativelanguage. */
namespace generativelanguage {
/** Namespace v1. */
namespace v1 {
/** Properties of a CitationMetadata. */
interface ICitationMetadata {
/** CitationMetadata citationSources */
citationSources?: (google.ai.generativelanguage.v1.ICitationSource[]|null);
}
/** Represents a CitationMetadata. */
class CitationMetadata implements ICitationMetadata {
/**
* Constructs a new CitationMetadata.
* @param [properties] Properties to set
*/
constructor(properties?: google.ai.generativelanguage.v1.ICitationMetadata);
/** CitationMetadata citationSources. */
public citationSources: google.ai.generativelanguage.v1.ICitationSource[];
/**
* Creates a new CitationMetadata instance using the specified properties.
* @param [properties] Properties to set
* @returns CitationMetadata instance
*/
public static create(properties?: google.ai.generativelanguage.v1.ICitationMetadata): google.ai.generativelanguage.v1.CitationMetadata;
/**
* Encodes the specified CitationMetadata message. Does not implicitly {@link google.ai.generativelanguage.v1.CitationMetadata.verify|verify} messages.
* @param message CitationMetadata message or plain object to encode
* @param [writer] Writer to encode to
* @returns Writer
*/
public static encode(message: google.ai.generativelanguage.v1.ICitationMetadata, writer?: $protobuf.Writer): $protobuf.Writer;
/**
* Encodes the specified CitationMetadata message, length delimited. Does not implicitly {@link google.ai.generativelanguage.v1.CitationMetadata.verify|verify} messages.
* @param message CitationMetadata message or plain object to encode
* @param [writer] Writer to encode to
* @returns Writer
*/
public static encodeDelimited(message: google.ai.generativelanguage.v1.ICitationMetadata, writer?: $protobuf.Writer): $protobuf.Writer;
/**
* Decodes a CitationMetadata message from the specified reader or buffer.
* @param reader Reader or buffer to decode from
* @param [length] Message length if known beforehand
* @returns CitationMetadata
* @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.CitationMetadata;
/**
* Decodes a CitationMetadata message from the specified reader or buffer, length delimited.
* @param reader Reader or buffer to decode from
* @returns CitationMetadata
* @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.CitationMetadata;
/**
* Verifies a CitationMetadata 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 CitationMetadata message from a plain object. Also converts values to their respective internal types.
* @param object Plain object
* @returns CitationMetadata
*/
public static fromObject(object: { [k: string]: any }): google.ai.generativelanguage.v1.CitationMetadata;
/**
* Creates a plain object from a CitationMetadata message. Also converts values to other types if specified.
* @param message CitationMetadata
* @param [options] Conversion options
* @returns Plain object
*/
public static toObject(message: google.ai.generativelanguage.v1.CitationMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any };
/**
* Converts this CitationMetadata to JSON.
* @returns JSON object
*/
public toJSON(): { [k: string]: any };
/**
* Gets the default type url for CitationMetadata
* @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
* @returns The default type url
*/
public static getTypeUrl(typeUrlPrefix?: string): string;
}
/** Properties of a CitationSource. */
interface ICitationSource {
/** CitationSource startIndex */
startIndex?: (number|null);
/** CitationSource endIndex */
endIndex?: (number|null);
/** CitationSource uri */
uri?: (string|null);
/** CitationSource license */
license?: (string|null);
}
/** Represents a CitationSource. */
class CitationSource implements ICitationSource {
/**
* Constructs a new CitationSource.
* @param [properties] Properties to set
*/
constructor(properties?: google.ai.generativelanguage.v1.ICitationSource);
/** CitationSource startIndex. */
public startIndex?: (number|null);
/** CitationSource endIndex. */
public endIndex?: (number|null);
/** CitationSource uri. */
public uri?: (string|null);
/** CitationSource license. */
public license?: (string|null);
/** CitationSource _startIndex. */
public _startIndex?: "startIndex";
/** CitationSource _endIndex. */
public _endIndex?: "endIndex";
/** CitationSource _uri. */
public _uri?: "uri";
/** CitationSource _license. */
public _license?: "license";
/**
* Creates a new CitationSource instance using the specified properties.
* @param [properties] Properties to set
* @returns CitationSource instance
*/
public static create(properties?: google.ai.generativelanguage.v1.ICitationSource): google.ai.generativelanguage.v1.CitationSource;
/**
* Encodes the specified CitationSource message. Does not implicitly {@link google.ai.generativelanguage.v1.CitationSource.verify|verify} messages.
* @param message CitationSource message or plain object to encode
* @param [writer] Writer to encode to
* @returns Writer
*/
public static encode(message: google.ai.generativelanguage.v1.ICitationSource, writer?: $protobuf.Writer): $protobuf.Writer;
/**
* Encodes the specified CitationSource message, length delimited. Does not implicitly {@link google.ai.generativelanguage.v1.CitationSource.verify|verify} messages.
* @param message CitationSource message or plain object to encode
* @param [writer] Writer to encode to
* @returns Writer
*/
public static encodeDelimited(message: google.ai.generativelanguage.v1.ICitationSource, writer?: $protobuf.Writer): $protobuf.Writer;
/**
* Decodes a CitationSource message from the specified reader or buffer.
* @param reader Reader or buffer to decode from
* @param [length] Message length if known beforehand
* @returns CitationSource
* @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.CitationSource;
/**
* Decodes a CitationSource message from the specified reader or buffer, length delimited.
* @param reader Reader or buffer to decode from
* @returns CitationSource
* @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.CitationSource;
/**
* Verifies a CitationSource 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 CitationSource message from a plain object. Also converts values to their respective internal types.
* @param object Plain object
* @returns CitationSource
*/
public static fromObject(object: { [k: string]: any }): google.ai.generativelanguage.v1.CitationSource;
/**
* Creates a plain object from a CitationSource message. Also converts values to other types if specified.
* @param message CitationSource
* @param [options] Conversion options
* @returns Plain object
*/
public static toObject(message: google.ai.generativelanguage.v1.CitationSource, options?: $protobuf.IConversionOptions): { [k: string]: any };
/**
* Converts this CitationSource to JSON.
* @returns JSON object
*/
public toJSON(): { [k: string]: any };
/**
* Gets the default type url for CitationSource
* @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
* @returns The default type url
*/
public static getTypeUrl(typeUrlPrefix?: string): string;
}
/** Modality enum. */
enum Modality {
MODALITY_UNSPECIFIED = 0,
TEXT = 1,
IMAGE = 2,
VIDEO = 3,
AUDIO = 4,
DOCUMENT = 5
}
/** Properties of a Content. */
interface IContent {
/** Content parts */
parts?: (google.ai.generativelanguage.v1.IPart[]|null);
/** Content role */
role?: (string|null);
}
/** Represents a Content. */
class Content implements IContent {
/**
* Constructs a new Content.
* @param [properties] Properties to set
*/
constructor(properties?: google.ai.generativelanguage.v1.IContent);
/** Content parts. */
public parts: google.ai.generativelanguage.v1.IPart[];
/** Content role. */
public role: string;
/**
* Creates a new Content instance using the specified properties.
* @param [properties] Properties to set
* @returns Content instance
*/
public static create(properties?: google.ai.generativelanguage.v1.IContent): google.ai.generativelanguage.v1.Content;
/**
* Encodes the specified Content message. Does not implicitly {@link google.ai.generativelanguage.v1.Content.verify|verify} messages.
* @param message Content message or plain object to encode
* @param [writer] Writer to encode to
* @returns Writer
*/
public static encode(message: google.ai.generativelanguage.v1.IContent, writer?: $protobuf.Writer): $protobuf.Writer;
/**
* Encodes the specified Content message, length delimited. Does not implicitly {@link google.ai.generativelanguage.v1.Content.verify|verify} messages.
* @param message Content message or plain object to encode
* @param [writer] Writer to encode to
* @returns Writer
*/
public static encodeDelimited(message: google.ai.generativelanguage.v1.IContent, writer?: $protobuf.Writer): $protobuf.Writer;
/**
* Decodes a Content message from the specified reader or buffer.
* @param reader Reader or buffer to decode from
* @param [length] Message length if known beforehand
* @returns Content
* @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.Content;
/**
* Decodes a Content message from the specified reader or buffer, length delimited.
* @param reader Reader or buffer to decode from
* @returns Content
* @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.Content;
/**
* Verifies a Content 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 Content message from a plain object. Also converts values to their respective internal types.
* @param object Plain object
* @returns Content
*/
public static fromObject(object: { [k: string]: any }): google.ai.generativelanguage.v1.Content;
/**
* Creates a plain object from a Content message. Also converts values to other types if specified.
* @param message Content
* @param [options] Conversion options
* @returns Plain object
*/
public static toObject(message: google.ai.generativelanguage.v1.Content, options?: $protobuf.IConversionOptions): { [k: string]: any };
/**
* Converts this Content to JSON.
* @returns JSON object
*/
public toJSON(): { [k: string]: any };
/**
* Gets the default type url for Content
* @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
* @returns The default type url
*/
public static getTypeUrl(typeUrlPrefix?: string): string;
}
/** Properties of a Part. */
interface IPart {
/** Part text */
text?: (string|null);
/** Part inlineData */
inlineData?: (google.ai.generativelanguage.v1.IBlob|null);
}
/** Represents a Part. */
class Part implements IPart {
/**
* Constructs a new Part.
* @param [properties] Properties to set
*/
constructor(properties?: google.ai.generativelanguage.v1.IPart);
/** Part text. */
public text?: (string|null);
/** Part inlineData. */
public inlineData?: (google.ai.generativelanguage.v1.IBlob|null);
/** Part data. */
public data?: ("text"|"inlineData");
/**
* Creates a new Part instance using the specified properties.
* @param [properties] Properties to set
* @returns Part instance
*/
public static create(properties?: google.ai.generativelanguage.v1.IPart): google.ai.generativelanguage.v1.Part;
/**
* Encodes the specified Part message. Does not implicitly {@link google.ai.generativelanguage.v1.Part.verify|verify} messages.
* @param message Part message or plain object to encode
* @param [writer] Writer to encode to
* @returns Writer
*/
public static encode(message: google.ai.generativelanguage.v1.IPart, writer?: $protobuf.Writer): $protobuf.Writer;
/**
* Encodes the specified Part message, length delimited. Does not implicitly {@link google.ai.generativelanguage.v1.Part.verify|verify} messages.
* @param message Part message or plain object to encode
* @param [writer] Writer to encode to
* @returns Writer
*/
public static encodeDelimited(message: google.ai.generativelanguage.v1.IPart, writer?: $protobuf.Writer): $protobuf.Writer;
/**
* Decodes a Part message from the specified reader or buffer.
* @param reader Reader or buffer to decode from
* @param [length] Message length if known beforehand
* @returns Part
* @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.Part;
/**
* Decodes a Part message from the specified reader or buffer, length delimited.
* @param reader Reader or buffer to decode from
* @returns Part
* @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.Part;
/**
* Verifies a Part 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 Part message from a plain object. Also converts values to their respective internal types.
* @param object Plain object
* @returns Part
*/
public static fromObject(object: { [k: string]: any }): google.ai.generativelanguage.v1.Part;
/**
* Creates a plain object from a Part message. Also converts values to other types if specified.
* @param message Part
* @param [options] Conversion options
* @returns Plain object
*/
public static toObject(message: google.ai.generativelanguage.v1.Part, options?: $protobuf.IConversionOptions): { [k: string]: any };
/**
* Converts this Part to JSON.
* @returns JSON object
*/
public toJSON(): { [k: string]: any };
/**
* Gets the default type url for Part
* @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
* @returns The default type url
*/
public static getTypeUrl(typeUrlPrefix?: string): string;
}
/** Properties of a Blob. */
interface IBlob {
/** Blob mimeType */
mimeType?: (string|null);
/** Blob data */
data?: (Uint8Array|string|null);
}
/** Represents a Blob. */
class Blob implements IBlob {
/**
* Constructs a new Blob.
* @param [properties] Properties to set
*/
constructor(properties?: google.ai.generativelanguage.v1.IBlob);
/** Blob mimeType. */
public mimeType: string;
/** Blob data. */
public data: (Uint8Array|string);
/**
* Creates a new Blob instance using the specified properties.
* @param [properties] Properties to set
* @returns Blob instance
*/
public static create(properties?: google.ai.generativelanguage.v1.IBlob): google.ai.generativelanguage.v1.Blob;
/**
* Encodes the specified Blob message. Does not implicitly {@link google.ai.generativelanguage.v1.Blob.verify|verify} messages.
* @param message Blob message or plain object to encode
* @param [writer] Writer to encode to
* @returns Writer
*/
public static encode(message: google.ai.generativelanguage.v1.IBlob, writer?: $protobuf.Writer): $protobuf.Writer;
/**
* Encodes the specified Blob message, length delimited. Does not implicitly {@link google.ai.generativelanguage.v1.Blob.verify|verify} messages.
* @param message Blob message or plain object to encode
* @param [writer] Writer to encode to
* @returns Writer
*/
public static encodeDelimited(message: google.ai.generativelanguage.v1.IBlob, writer?: $protobuf.Writer): $protobuf.Writer;
/**
* Decodes a Blob message from the specified reader or buffer.
* @param reader Reader or buffer to decode from
* @param [length] Message length if known beforehand
* @returns Blob
* @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.Blob;
/**
* Decodes a Blob message from the specified reader or buffer, length delimited.
* @param reader Reader or buffer to decode from
* @returns Blob
* @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.Blob;
/**
* Verifies a Blob 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 Blob message from a plain object. Also converts values to their respective internal types.
* @param object Plain object
* @returns Blob
*/
public static fromObject(object: { [k: string]: any }): google.ai.generativelanguage.v1.Blob;
/**
* Creates a plain object from a Blob message. Also converts values to other types if specified.
* @param message Blob
* @param [options] Conversion options
* @returns Plain object
*/
public static toObject(message: google.ai.generativelanguage.v1.Blob, options?: $protobuf.IConversionOptions): { [k: string]: any };
/**
* Converts this Blob to JSON.
* @returns JSON object
*/
public toJSON(): { [k: string]: any };
/**
* Gets the default type url for Blob
* @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
* @returns The default type url
*/
public static getTypeUrl(typeUrlPrefix?: string): string;
}
/** Properties of a ModalityTokenCount. */
interface IModalityTokenCount {
/** ModalityTokenCount modality */
modality?: (google.ai.generativelanguage.v1.Modality|keyof typeof google.ai.generativelanguage.v1.Modality|null);
/** ModalityTokenCount tokenCount */
tokenCount?: (number|null);
}
/** Represents a ModalityTokenCount. */
class ModalityTokenCount implements IModalityTokenCount {
/**
* Constructs a new ModalityTokenCount.
* @param [properties] Properties to set
*/
constructor(properties?: google.ai.generativelanguage.v1.IModalityTokenCount);
/** ModalityTokenCount modality. */
public modality: (google.ai.generativelanguage.v1.Modality|keyof typeof google.ai.generativelanguage.v1.Modality);
/** ModalityTokenCount tokenCount. */
public tokenCount: number;
/**
* Creates a new ModalityTokenCount instance using the specified properties.
* @param [properties] Properties to set
* @returns ModalityTokenCount instance
*/
public static create(properties?: google.ai.generativelanguage.v1.IModalityTokenCount): google.ai.generativelanguage.v1.ModalityTokenCount;
/**
* Encodes the specified ModalityTokenCount message. Does not implicitly {@link google.ai.generativelanguage.v1.ModalityTokenCount.verify|verify} messages.
* @param message ModalityTokenCount message or plain object to encode
* @param [writer] Writer to encode to
* @returns Writer
*/
public static encode(message: google.ai.generativelanguage.v1.IModalityTokenCount, writer?: $protobuf.Writer): $protobuf.Writer;
/**
* Encodes the specified ModalityTokenCount message, length delimited. Does not implicitly {@link google.ai.generativelanguage.v1.ModalityTokenCount.verify|verify} messages.
* @param message ModalityTokenCount message or plain object to encode
* @param [writer] Writer to encode to
* @returns Writer
*/
public static encodeDelimited(message: google.ai.generativelanguage.v1.IModalityTokenCount, writer?: $protobuf.Writer): $protobuf.Writer;
/**
* Decodes a ModalityTokenCount message from the specified reader or buffer.
* @param reader Reader or buffer to decode from
* @param [length] Message length if known beforehand
* @returns ModalityTokenCount
* @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.ModalityTokenCount;
/**
* Decodes a ModalityTokenCount message from the specified reader or buffer, length delimited.
* @param reader Reader or buffer to decode from
* @returns ModalityTokenCount
* @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.ModalityTokenCount;
/**
* Verifies a ModalityTokenCount 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 ModalityTokenCount message from a plain object. Also converts values to their respective internal types.
* @param object Plain object
* @returns ModalityTokenCount
*/
public static fromObject(object: { [k: string]: any }): google.ai.generativelanguage.v1.ModalityTokenCount;
/**
* Creates a plain object from a ModalityTokenCount message. Also converts values to other types if specified.
* @param message ModalityTokenCount
* @param [options] Conversion options
* @returns Plain object
*/
public static toObject(message: google.ai.generativelanguage.v1.ModalityTokenCount, options?: $protobuf.IConversionOptions): { [k: string]: any };
/**
* Converts this ModalityTokenCount to JSON.
* @returns JSON object
*/
public toJSON(): { [k: string]: any };
/**
* Gets the default type url for ModalityTokenCount
* @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
* @returns The default type url
*/
public static getTypeUrl(typeUrlPrefix?: string): string;
}
/** Represents a GenerativeService */
class GenerativeService extends $protobuf.rpc.Service {
/**
* Constructs a new GenerativeService service.
* @param rpcImpl RPC implementation
* @param [requestDelimited=false] Whether requests are length-delimited
* @param [responseDelimited=false] Whether responses are length-delimited
*/
constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean);
/**
* Creates new GenerativeService service using the specified rpc implementation.
* @param rpcImpl RPC implementation
* @param [requestDelimited=false] Whether requests are length-delimited
* @param [responseDelimited=false] Whether responses are length-delimited
* @returns RPC service. Useful where requests and/or responses are streamed.
*/
public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): GenerativeService;
/**
* Calls GenerateContent.
* @param request GenerateContentRequest message or plain object
* @param callback Node-style callback called with the error, if any, and GenerateContentResponse
*/
public generateContent(request: google.ai.generativelanguage.v1.IGenerateContentRequest, callback: google.ai.generativelanguage.v1.GenerativeService.GenerateContentCallback): void;
/**
* Calls GenerateContent.
* @param request GenerateContentRequest message or plain object
* @returns Promise
*/
public generateContent(request: google.ai.generativelanguage.v1.IGenerateContentRequest): Promise<google.ai.generativelanguage.v1.GenerateContentResponse>;
/**
* Calls StreamGenerateContent.
* @param request GenerateContentRequest message or plain object
* @param callback Node-style callback called with the error, if any, and GenerateContentResponse
*/
public streamGenerateContent(request: google.ai.generativelanguage.v1.IGenerateContentRequest, callback: google.ai.generativelanguage.v1.GenerativeService.StreamGenerateContentCallback): void;
/**
* Calls StreamGenerateContent.
* @param request GenerateContentRequest message or plain object
* @returns Promise
*/
public streamGenerateContent(request: google.ai.generativelanguage.v1.IGenerateContentRequest): Promise<google.ai.generativelanguage.v1.GenerateContentResponse>;
/**
* Calls EmbedContent.
* @param request EmbedContentRequest message or plain object
* @param callback Node-style callback called with the error, if any, and EmbedContentResponse
*/
public embedContent(request: google.ai.generativelanguage.v1.IEmbedContentRequest, callback: google.ai.generativelanguage.v1.GenerativeService.EmbedContentCallback): void;
/**
* Calls EmbedContent.
* @param request EmbedContentRequest message or plain object
* @returns Promise
*/
public embedContent(request: google.ai.generativelanguage.v1.IEmbedContentRequest): Promise<google.ai.generativelanguage.v1.EmbedContentResponse>;
/**
* Calls BatchEmbedContents.
* @param request BatchEmbedContentsRequest message or plain object
* @param callback Node-style callback called with the error, if any, and BatchEmbedContentsResponse
*/
public batchEmbedContents(request: google.ai.generativelanguage.v1.IBatchEmbedContentsRequest, callback: google.ai.generativelanguage.v1.GenerativeService.BatchEmbedContentsCallback): void;
/**
* Calls BatchEmbedContents.
* @param request BatchEmbedContentsRequest message or plain object
* @returns Promise
*/
public batchEmbedContents(request: google.ai.generativelanguage.v1.IBatchEmbedContentsRequest): Promise<google.ai.generativelanguage.v1.BatchEmbedContentsResponse>;
/**
* Calls CountTokens.
* @param request CountTokensRequest message or plain object
* @param callback Node-style callback called with the error, if any, and CountTokensResponse
*/
public countTokens(request: google.ai.generativelanguage.v1.ICountTokensRequest, callback: google.ai.generativelanguage.v1.GenerativeService.CountTokensCallback): void;
/**
* Calls CountTokens.
* @param request CountTokensRequest message or plain object
* @returns Promise
*/
public countTokens(request: google.ai.generativelanguage.v1.ICountTokensRequest): Promise<google.ai.generativelanguage.v1.CountTokensResponse>;
}
namespace GenerativeService {
/**
* Callback as used by {@link google.ai.generativelanguage.v1.GenerativeService|generateContent}.
* @param error Error, if any
* @param [response] GenerateContentResponse
*/
type GenerateContentCallback = (error: (Error|null), response?: google.ai.generativelanguage.v1.GenerateContentResponse) => void;
/**
* Callback as used by {@link google.ai.generativelanguage.v1.GenerativeService|streamGenerateContent}.
* @param error Error, if any
* @param [response] GenerateContentResponse
*/
type StreamGenerateContentCallback = (error: (Error|null), response?: google.ai.generativelanguage.v1.GenerateContentResponse) => void;
/**
* Callback as used by {@link google.ai.generativelanguage.v1.GenerativeService|embedContent}.
* @param error Error, if any
* @param [response] EmbedContentResponse
*/
type EmbedContentCallback = (error: (Error|null), response?: google.ai.generativelanguage.v1.EmbedContentResponse) => void;
/**
* Callback as used by {@link google.ai.generativelanguage.v1.GenerativeService|batchEmbedContents}.
* @param error Error, if any
* @param [response] BatchEmbedContentsResponse
*/
type BatchEmbedContentsCallback = (error: (Error|null), response?: google.ai.generativelanguage.v1.BatchEmbedContentsResponse) => void;
/**
* Callback as used by {@link google.ai.generativelanguage.v1.GenerativeService|countTokens}.
* @param error Error, if any
* @param [response] CountTokensResponse
*/
type CountTokensCallback = (error: (Error|null), response?: google.ai.generativelanguage.v1.CountTokensResponse) => void;
}
/** TaskType enum. */
enum TaskType {
TASK_TYPE_UNSPECIFIED = 0,
RETRIEVAL_QUERY = 1,
RETRIEVAL_DOCUMENT = 2,
SEMANTIC_SIMILARITY = 3,
CLASSIFICATION = 4,
CLUSTERING = 5,
QUESTION_ANSWERING = 6,
FACT_VERIFICATION = 7,
CODE_RETRIEVAL_QUERY = 8
}
/** Properties of a GenerateContentRequest. */
interface IGenerateContentRequest {
/** GenerateContentRequest model */
model?: (string|null);
/** GenerateContentRequest contents */
contents?: (google.ai.generativelanguage.v1.IContent[]|null);
/** GenerateContentRequest safetySettings */
safetySettings?: (google.ai.generativelanguage.v1.ISafetySetting[]|null);
/** GenerateContentRequest generationConfig */
generationConfig?: (google.ai.generativelanguage.v1.IGenerationConfig|null);
}
/** Represents a GenerateContentRequest. */
class GenerateContentRequest implements IGenerateContentRequest {
/**
* Constructs a new GenerateContentRequest.
* @param [properties] Properties to set
*/
constructor(properties?: google.ai.generativelanguage.v1.IGenerateContentRequest);
/** GenerateContentRequest model. */
public model: string;
/** GenerateContentRequest contents. */
public contents: google.ai.generativelanguage.v1.IContent[];
/** GenerateContentRequest safetySettings. */
public safetySettings: google.ai.generativelanguage.v1.ISafetySetting[];
/** GenerateContentRequest generationConfig. */
public generationConfig?: (google.ai.generativelanguage.v1.IGenerationConfig|null);
/** GenerateContentRequest _generationConfig. */
public _generationConfig?: "generationConfig";
/**
* Creates a new GenerateContentRequest instance using the specified properties.
* @param [properties] Properties to set
* @returns GenerateContentRequest instance
*/
public static create(properties?: google.ai.generativelanguage.v1.IGenerateContentRequest): google.ai.generativelanguage.v1.GenerateContentRequest;
/**
* Encodes the specified GenerateContentRequest message. Does not implicitly {@link google.ai.generativelanguage.v1.GenerateContentRequest.verify|verify} messages.
* @param message GenerateContentRequest message or plain object to encode
* @param [writer] Writer to encode to
* @returns Writer
*/
public static encode(message: google.ai.generativelanguage.v1.IGenerateContentRequest, writer?: $protobuf.Writer): $protobuf.Writer;
/**
* Encodes the specified GenerateContentRequest message, length delimited. Does not implicitly {@link google.ai.generativelanguage.v1.GenerateContentRequest.verify|verify} messages.
* @param message GenerateContentRequest message or plain object to encode
* @param [writer] Writer to encode to
* @returns Writer
*/
public static encodeDelimited(message: google.ai.generativelanguage.v1.IGenerateContentRequest, writer?: $protobuf.Writer): $protobuf.Writer;
/**
* Decodes a GenerateContentRequest message from the specified reader or buffer.
* @param reader Reader or buffer to decode from
* @param [length] Message length if known beforehand
* @returns GenerateContentRequest
* @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.GenerateContentRequest;
/**
* Decodes a GenerateContentRequest message from the specified reader or buffer, length delimited.
* @param reader Reader or buffer to decode from
* @returns GenerateContentRequest
* @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.GenerateContentRequest;
/**
* Verifies a GenerateContentRequest 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 GenerateContentRequest message from a plain object. Also converts values to their respective internal types.
* @param object Plain object
* @returns GenerateContentRequest
*/
public static fromObject(object: { [k: string]: any }): google.ai.generativelanguage.v1.GenerateContentRequest;
/**
* Creates a plain object from a GenerateContentRequest message. Also converts values to other types if specified.
* @param message GenerateContentRequest
* @param [options] Conversion options
* @returns Plain object
*/
public static toObject(message: google.ai.generativelanguage.v1.GenerateContentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any };
/**
* Converts this GenerateContentRequest to JSON.
* @returns JSON object
*/
public toJSON(): { [k: string]: any };
/**
* Gets the default type url for GenerateContentRequest
* @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
* @returns The default type url
*/
public static getTypeUrl(typeUrlPrefix?: string): string;
}
/** Properties of a GenerationConfig. */
interface IGenerationConfig {
/** GenerationConfig candidateCount */
candidateCount?: (number|null);
/** GenerationConfig stopSequences */
stopSequences?: (string[]|null);
/** GenerationConfig maxOutputTokens */
maxOutputTokens?: