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

Represents a GenerativeService

Inheritance

$protobuf.rpc.Service > protos.google.ai.generativelanguage.v1beta.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.v1beta.IBatchEmbedContentsRequest, callback: google.ai.generativelanguage.v1beta.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.v1beta.IBatchEmbedContentsRequest): Promise<google.ai.generativelanguage.v1beta.BatchEmbedContentsResponse>;

Calls BatchEmbedContents.

Parameter
Name Description
request IBatchEmbedContentsRequest

BatchEmbedContentsRequest message or plain object

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

Promise

countTokens(request, callback)

public countTokens(request: google.ai.generativelanguage.v1beta.ICountTokensRequest, callback: google.ai.generativelanguage.v1beta.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.v1beta.ICountTokensRequest): Promise<google.ai.generativelanguage.v1beta.CountTokensResponse>;

Calls CountTokens.

Parameter
Name Description
request ICountTokensRequest

CountTokensRequest message or plain object

Returns
Type Description
Promise<google.ai.generativelanguage.v1beta.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.v1beta.IEmbedContentRequest, callback: google.ai.generativelanguage.v1beta.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.v1beta.IEmbedContentRequest): Promise<google.ai.generativelanguage.v1beta.EmbedContentResponse>;

Calls EmbedContent.

Parameter
Name Description
request IEmbedContentRequest

EmbedContentRequest message or plain object

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

Promise

generateAnswer(request, callback)

public generateAnswer(request: google.ai.generativelanguage.v1beta.IGenerateAnswerRequest, callback: google.ai.generativelanguage.v1beta.GenerativeService.GenerateAnswerCallback): void;

Calls GenerateAnswer.

Parameters
Name Description
request IGenerateAnswerRequest

GenerateAnswerRequest message or plain object

callback GenerateAnswerCallback

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

Returns
Type Description
void

generateAnswer(request)

public generateAnswer(request: google.ai.generativelanguage.v1beta.IGenerateAnswerRequest): Promise<google.ai.generativelanguage.v1beta.GenerateAnswerResponse>;

Calls GenerateAnswer.

Parameter
Name Description
request IGenerateAnswerRequest

GenerateAnswerRequest message or plain object

Returns
Type Description
Promise<google.ai.generativelanguage.v1beta.GenerateAnswerResponse>

Promise

generateContent(request, callback)

public generateContent(request: google.ai.generativelanguage.v1beta.IGenerateContentRequest, callback: google.ai.generativelanguage.v1beta.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.v1beta.IGenerateContentRequest): Promise<google.ai.generativelanguage.v1beta.GenerateContentResponse>;

Calls GenerateContent.

Parameter
Name Description
request IGenerateContentRequest

GenerateContentRequest message or plain object

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

Promise

streamGenerateContent(request, callback)

public streamGenerateContent(request: google.ai.generativelanguage.v1beta.IGenerateContentRequest, callback: google.ai.generativelanguage.v1beta.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.v1beta.IGenerateContentRequest): Promise<google.ai.generativelanguage.v1beta.GenerateContentResponse>;

Calls StreamGenerateContent.

Parameter
Name Description
request IGenerateContentRequest

GenerateContentRequest message or plain object

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

Promise