Class protos.google.ai.generativelanguage.v1.GenerativeService (2.6.0)

Represents a GenerativeService

Inheritance

$protobuf.rpc.Service > protos.google.ai.generativelanguage.v1.GenerativeService

Package

@google-ai/generativelanguage

Constructors

(constructor)(rpcImpl, requestDelimited, responseDelimited)

constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean);

Constructs a new GenerativeService service.

Parameters
Name Description
rpcImpl $protobuf.RPCImpl

RPC implementation

requestDelimited boolean

Whether requests are length-delimited

responseDelimited boolean

Whether responses are length-delimited

Methods

batchEmbedContents(request, callback)

public batchEmbedContents(request: google.ai.generativelanguage.v1.IBatchEmbedContentsRequest, callback: google.ai.generativelanguage.v1.GenerativeService.BatchEmbedContentsCallback): void;

Calls BatchEmbedContents.

Parameters
Name Description
request IBatchEmbedContentsRequest

BatchEmbedContentsRequest message or plain object

callback BatchEmbedContentsCallback

Node-style callback called with the error, if any, and BatchEmbedContentsResponse

Returns
Type Description
void

batchEmbedContents(request)

public batchEmbedContents(request: google.ai.generativelanguage.v1.IBatchEmbedContentsRequest): Promise<google.ai.generativelanguage.v1.BatchEmbedContentsResponse>;

Calls BatchEmbedContents.

Parameter
Name Description
request IBatchEmbedContentsRequest

BatchEmbedContentsRequest message or plain object

Returns
Type Description
Promise<google.ai.generativelanguage.v1.BatchEmbedContentsResponse>

Promise

countTokens(request, callback)

public countTokens(request: google.ai.generativelanguage.v1.ICountTokensRequest, callback: google.ai.generativelanguage.v1.GenerativeService.CountTokensCallback): void;

Calls CountTokens.

Parameters
Name Description
request ICountTokensRequest

CountTokensRequest message or plain object

callback CountTokensCallback

Node-style callback called with the error, if any, and CountTokensResponse

Returns
Type Description
void

countTokens(request)

public countTokens(request: google.ai.generativelanguage.v1.ICountTokensRequest): Promise<google.ai.generativelanguage.v1.CountTokensResponse>;

Calls CountTokens.

Parameter
Name Description
request ICountTokensRequest

CountTokensRequest message or plain object

Returns
Type Description
Promise<google.ai.generativelanguage.v1.CountTokensResponse>

Promise

create(rpcImpl, requestDelimited, responseDelimited)

public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): GenerativeService;

Creates new GenerativeService service using the specified rpc implementation.

Parameters
Name Description
rpcImpl $protobuf.RPCImpl

RPC implementation

requestDelimited boolean

Whether requests are length-delimited

responseDelimited boolean

Whether responses are length-delimited

Returns
Type Description
GenerativeService

RPC service. Useful where requests and/or responses are streamed.

embedContent(request, callback)

public embedContent(request: google.ai.generativelanguage.v1.IEmbedContentRequest, callback: google.ai.generativelanguage.v1.GenerativeService.EmbedContentCallback): void;

Calls EmbedContent.

Parameters
Name Description
request IEmbedContentRequest

EmbedContentRequest message or plain object

callback EmbedContentCallback

Node-style callback called with the error, if any, and EmbedContentResponse

Returns
Type Description
void

embedContent(request)

public embedContent(request: google.ai.generativelanguage.v1.IEmbedContentRequest): Promise<google.ai.generativelanguage.v1.EmbedContentResponse>;

Calls EmbedContent.

Parameter
Name Description
request IEmbedContentRequest

EmbedContentRequest message or plain object

Returns
Type Description
Promise<google.ai.generativelanguage.v1.EmbedContentResponse>

Promise

generateContent(request, callback)

public generateContent(request: google.ai.generativelanguage.v1.IGenerateContentRequest, callback: google.ai.generativelanguage.v1.GenerativeService.GenerateContentCallback): void;

Calls GenerateContent.

Parameters
Name Description
request IGenerateContentRequest

GenerateContentRequest message or plain object

callback GenerateContentCallback

Node-style callback called with the error, if any, and GenerateContentResponse

Returns
Type Description
void

generateContent(request)

public generateContent(request: google.ai.generativelanguage.v1.IGenerateContentRequest): Promise<google.ai.generativelanguage.v1.GenerateContentResponse>;

Calls GenerateContent.

Parameter
Name Description
request IGenerateContentRequest

GenerateContentRequest message or plain object

Returns
Type Description
Promise<google.ai.generativelanguage.v1.GenerateContentResponse>

Promise

streamGenerateContent(request, callback)

public streamGenerateContent(request: google.ai.generativelanguage.v1.IGenerateContentRequest, callback: google.ai.generativelanguage.v1.GenerativeService.StreamGenerateContentCallback): void;

Calls StreamGenerateContent.

Parameters
Name Description
request IGenerateContentRequest

GenerateContentRequest message or plain object

callback StreamGenerateContentCallback

Node-style callback called with the error, if any, and GenerateContentResponse

Returns
Type Description
void

streamGenerateContent(request)

public streamGenerateContent(request: google.ai.generativelanguage.v1.IGenerateContentRequest): Promise<google.ai.generativelanguage.v1.GenerateContentResponse>;

Calls StreamGenerateContent.

Parameter
Name Description
request IGenerateContentRequest

GenerateContentRequest message or plain object

Returns
Type Description
Promise<google.ai.generativelanguage.v1.GenerateContentResponse>

Promise