Class protos.google.ai.generativelanguage.v1beta.TextService (2.8.0)

Represents a TextService

Inheritance

$protobuf.rpc.Service > protos.google.ai.generativelanguage.v1beta.TextService

Package

@google-ai/generativelanguage

Constructors

(constructor)(rpcImpl, requestDelimited, responseDelimited)

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

Constructs a new TextService service.

Parameters
Name Description
rpcImpl $protobuf.RPCImpl

RPC implementation

requestDelimited boolean

Whether requests are length-delimited

responseDelimited boolean

Whether responses are length-delimited

Methods

batchEmbedText(request, callback)

public batchEmbedText(request: google.ai.generativelanguage.v1beta.IBatchEmbedTextRequest, callback: google.ai.generativelanguage.v1beta.TextService.BatchEmbedTextCallback): void;

Calls BatchEmbedText.

Parameters
Name Description
request IBatchEmbedTextRequest

BatchEmbedTextRequest message or plain object

callback BatchEmbedTextCallback

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

Returns
Type Description
void

batchEmbedText(request)

public batchEmbedText(request: google.ai.generativelanguage.v1beta.IBatchEmbedTextRequest): Promise<google.ai.generativelanguage.v1beta.BatchEmbedTextResponse>;

Calls BatchEmbedText.

Parameter
Name Description
request IBatchEmbedTextRequest

BatchEmbedTextRequest message or plain object

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

Promise

countTextTokens(request, callback)

public countTextTokens(request: google.ai.generativelanguage.v1beta.ICountTextTokensRequest, callback: google.ai.generativelanguage.v1beta.TextService.CountTextTokensCallback): void;

Calls CountTextTokens.

Parameters
Name Description
request ICountTextTokensRequest

CountTextTokensRequest message or plain object

callback CountTextTokensCallback

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

Returns
Type Description
void

countTextTokens(request)

public countTextTokens(request: google.ai.generativelanguage.v1beta.ICountTextTokensRequest): Promise<google.ai.generativelanguage.v1beta.CountTextTokensResponse>;

Calls CountTextTokens.

Parameter
Name Description
request ICountTextTokensRequest

CountTextTokensRequest message or plain object

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

Promise

create(rpcImpl, requestDelimited, responseDelimited)

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

Creates new TextService 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
TextService

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

embedText(request, callback)

public embedText(request: google.ai.generativelanguage.v1beta.IEmbedTextRequest, callback: google.ai.generativelanguage.v1beta.TextService.EmbedTextCallback): void;

Calls EmbedText.

Parameters
Name Description
request IEmbedTextRequest

EmbedTextRequest message or plain object

callback EmbedTextCallback

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

Returns
Type Description
void

embedText(request)

public embedText(request: google.ai.generativelanguage.v1beta.IEmbedTextRequest): Promise<google.ai.generativelanguage.v1beta.EmbedTextResponse>;

Calls EmbedText.

Parameter
Name Description
request IEmbedTextRequest

EmbedTextRequest message or plain object

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

Promise

generateText(request, callback)

public generateText(request: google.ai.generativelanguage.v1beta.IGenerateTextRequest, callback: google.ai.generativelanguage.v1beta.TextService.GenerateTextCallback): void;

Calls GenerateText.

Parameters
Name Description
request IGenerateTextRequest

GenerateTextRequest message or plain object

callback GenerateTextCallback

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

Returns
Type Description
void

generateText(request)

public generateText(request: google.ai.generativelanguage.v1beta.IGenerateTextRequest): Promise<google.ai.generativelanguage.v1beta.GenerateTextResponse>;

Calls GenerateText.

Parameter
Name Description
request IGenerateTextRequest

GenerateTextRequest message or plain object

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

Promise