/// import { ChannelCredentials, ChannelOptions, UntypedServiceImplementation, handleServerStreamingCall, Client, CallOptions, ClientReadableStream, Metadata, handleUnaryCall, ClientUnaryCall, ServiceError } from '@grpc/grpc-js'; import _m0 from 'protobufjs/minimal'; import { GenerationOptions, Message, Alternative, Token } from '../../../../../yandex/cloud/ai/llm/v1alpha/llm'; import { Operation } from '../../../../../yandex/cloud/operation/operation'; export declare const protobufPackage = "yandex.cloud.ai.llm.v1alpha"; /** Request for instructing the model to generate text. */ export interface InstructRequest { /** * The name or identifier of the model to be used for text generation. * Possible value for now: `general`. */ model: string; /** Configuration options for text generation. */ generationOptions?: GenerationOptions; /** The text-based instruction for text generation. */ instructionText: string | undefined; /** A URI containing instructions for text generation. */ instructionUri: string | undefined; /** The text-based request for text generation. */ requestText: string | undefined; } /** Response containing generated text alternatives and token count. */ export interface InstructResponse { /** A list of alternative text responses. */ alternatives: Alternative[]; /** The number of tokens used in the prompt, including both the [instruction_text] and [request_text]. */ numPromptTokens: number; } /** Request to engage in a chat conversation with a text generation model. */ export interface ChatRequest { /** * The name or identifier of the model to be used for the chat. * Possible value for now: `general`. */ model: string; /** Configuration options for text generation. */ generationOptions?: GenerationOptions; /** The text-based instruction for the conversation. */ instructionText: string | undefined; /** A list of messages in the conversation. */ messages: Message[]; } /** Contains a model-generated response for a chat query. */ export interface ChatResponse { /** The assistant's message in the chat conversation. */ message?: Message; /** Total number of tokens used in both the chat request and chat response. */ numTokens: number; } /** Request to tokenize input text. */ export interface TokenizeRequest { /** * The name or identifier of the model to be used for tokenization. * Possible values for now: `general`, `general:embedding`. */ model: string; /** The input text to tokenize. */ text: string; } /** Tokenization response. */ export interface TokenizeResponse { /** A list of tokens obtained from tokenization. */ tokens: Token[]; } /** Represents a request to obtain embeddings for text data. */ export interface EmbeddingRequest { /** The type of embedding to be generated. */ embeddingType: EmbeddingRequest_EmbeddingType; /** The name or identifier of the model to be used for embedding. Possible value for now: `general:embedding`. */ model: string; /** The input text for which the embedding is requested. */ text: string; } /** Enum to specify the type of embedding to be generated. */ export declare enum EmbeddingRequest_EmbeddingType { /** EMBEDDING_TYPE_UNSPECIFIED - Unspecified embedding type. */ EMBEDDING_TYPE_UNSPECIFIED = 0, /** * EMBEDDING_TYPE_QUERY - Embedding for a query. Use this when you have a short query or search term * that you want to obtain an embedding for. Query embeddings are typically * used in information retrieval and search applications. */ EMBEDDING_TYPE_QUERY = 1, /** * EMBEDDING_TYPE_DOCUMENT - Embedding for a document. Use this when you have a longer document or a piece * of text that you want to obtain an embedding for. Document embeddings are often * used in natural language understanding and document similarity tasks. */ EMBEDDING_TYPE_DOCUMENT = 2, UNRECOGNIZED = -1 } export declare function embeddingRequest_EmbeddingTypeFromJSON(object: any): EmbeddingRequest_EmbeddingType; export declare function embeddingRequest_EmbeddingTypeToJSON(object: EmbeddingRequest_EmbeddingType): string; /** Represents a response containing embeddings for input text data. */ export interface EmbeddingResponse { /** A repeated list of double values representing the embedding. */ embedding: number[]; /** The number of tokens in the input text. */ numTokens: number; } export declare const InstructRequest: { encode(message: InstructRequest, writer?: _m0.Writer): _m0.Writer; decode(input: _m0.Reader | Uint8Array, length?: number): InstructRequest; fromJSON(object: any): InstructRequest; toJSON(message: InstructRequest): unknown; fromPartial, never>) | undefined; instructionText?: string | undefined; instructionUri?: string | undefined; requestText?: string | undefined; } & Record, never>>(object: I): InstructRequest; }; export declare const InstructResponse: { encode(message: InstructResponse, writer?: _m0.Writer): _m0.Writer; decode(input: _m0.Reader | Uint8Array, length?: number): InstructResponse; fromJSON(object: any): InstructResponse; toJSON(message: InstructResponse): unknown; fromPartial, never>)[] & Record, never>) | undefined; numPromptTokens?: number | undefined; } & Record, never>>(object: I): InstructResponse; }; export declare const ChatRequest: { encode(message: ChatRequest, writer?: _m0.Writer): _m0.Writer; decode(input: _m0.Reader | Uint8Array, length?: number): ChatRequest; fromJSON(object: any): ChatRequest; toJSON(message: ChatRequest): unknown; fromPartial, never>) | undefined; instructionText?: string | undefined; messages?: ({ role?: string | undefined; text?: string | undefined; }[] & ({ role?: string | undefined; text?: string | undefined; } & { role?: string | undefined; text?: string | undefined; } & Record, never>)[] & Record, never>) | undefined; } & Record, never>>(object: I): ChatRequest; }; export declare const ChatResponse: { encode(message: ChatResponse, writer?: _m0.Writer): _m0.Writer; decode(input: _m0.Reader | Uint8Array, length?: number): ChatResponse; fromJSON(object: any): ChatResponse; toJSON(message: ChatResponse): unknown; fromPartial, never>) | undefined; numTokens?: number | undefined; } & Record, never>>(object: I): ChatResponse; }; export declare const TokenizeRequest: { encode(message: TokenizeRequest, writer?: _m0.Writer): _m0.Writer; decode(input: _m0.Reader | Uint8Array, length?: number): TokenizeRequest; fromJSON(object: any): TokenizeRequest; toJSON(message: TokenizeRequest): unknown; fromPartial, never>>(object: I): TokenizeRequest; }; export declare const TokenizeResponse: { encode(message: TokenizeResponse, writer?: _m0.Writer): _m0.Writer; decode(input: _m0.Reader | Uint8Array, length?: number): TokenizeResponse; fromJSON(object: any): TokenizeResponse; toJSON(message: TokenizeResponse): unknown; fromPartial, never>)[] & Record, never>) | undefined; } & Record, never>>(object: I): TokenizeResponse; }; export declare const EmbeddingRequest: { encode(message: EmbeddingRequest, writer?: _m0.Writer): _m0.Writer; decode(input: _m0.Reader | Uint8Array, length?: number): EmbeddingRequest; fromJSON(object: any): EmbeddingRequest; toJSON(message: EmbeddingRequest): unknown; fromPartial, never>>(object: I): EmbeddingRequest; }; export declare const EmbeddingResponse: { encode(message: EmbeddingResponse, writer?: _m0.Writer): _m0.Writer; decode(input: _m0.Reader | Uint8Array, length?: number): EmbeddingResponse; fromJSON(object: any): EmbeddingResponse; toJSON(message: EmbeddingResponse): unknown; fromPartial, never>) | undefined; numTokens?: number | undefined; } & Record, never>>(object: I): EmbeddingResponse; }; /** Service for text generation and conversation. */ export declare const TextGenerationServiceService: { /** RPC method for instructing the model to generate text. */ readonly instruct: { readonly path: "/yandex.cloud.ai.llm.v1alpha.TextGenerationService/Instruct"; readonly requestStream: false; readonly responseStream: true; readonly requestSerialize: (value: InstructRequest) => Buffer; readonly requestDeserialize: (value: Buffer) => InstructRequest; readonly responseSerialize: (value: InstructResponse) => Buffer; readonly responseDeserialize: (value: Buffer) => InstructResponse; }; /** RPC method for engaging in a chat conversation with the model. */ readonly chat: { readonly path: "/yandex.cloud.ai.llm.v1alpha.TextGenerationService/Chat"; readonly requestStream: false; readonly responseStream: true; readonly requestSerialize: (value: ChatRequest) => Buffer; readonly requestDeserialize: (value: Buffer) => ChatRequest; readonly responseSerialize: (value: ChatResponse) => Buffer; readonly responseDeserialize: (value: Buffer) => ChatResponse; }; }; export interface TextGenerationServiceServer extends UntypedServiceImplementation { /** RPC method for instructing the model to generate text. */ instruct: handleServerStreamingCall; /** RPC method for engaging in a chat conversation with the model. */ chat: handleServerStreamingCall; } export interface TextGenerationServiceClient extends Client { /** RPC method for instructing the model to generate text. */ instruct(request: InstructRequest, options?: Partial): ClientReadableStream; instruct(request: InstructRequest, metadata?: Metadata, options?: Partial): ClientReadableStream; /** RPC method for engaging in a chat conversation with the model. */ chat(request: ChatRequest, options?: Partial): ClientReadableStream; chat(request: ChatRequest, metadata?: Metadata, options?: Partial): ClientReadableStream; } export declare const TextGenerationServiceClient: { new (address: string, credentials: ChannelCredentials, options?: Partial): TextGenerationServiceClient; service: typeof TextGenerationServiceService; }; /** Service for tokenizing input text. */ export declare const TokenizerServiceService: { /** RPC method for tokenizing input text. */ readonly tokenize: { readonly path: "/yandex.cloud.ai.llm.v1alpha.TokenizerService/Tokenize"; readonly requestStream: false; readonly responseStream: false; readonly requestSerialize: (value: TokenizeRequest) => Buffer; readonly requestDeserialize: (value: Buffer) => TokenizeRequest; readonly responseSerialize: (value: TokenizeResponse) => Buffer; readonly responseDeserialize: (value: Buffer) => TokenizeResponse; }; }; export interface TokenizerServiceServer extends UntypedServiceImplementation { /** RPC method for tokenizing input text. */ tokenize: handleUnaryCall; } export interface TokenizerServiceClient extends Client { /** RPC method for tokenizing input text. */ tokenize(request: TokenizeRequest, callback: (error: ServiceError | null, response: TokenizeResponse) => void): ClientUnaryCall; tokenize(request: TokenizeRequest, metadata: Metadata, callback: (error: ServiceError | null, response: TokenizeResponse) => void): ClientUnaryCall; tokenize(request: TokenizeRequest, metadata: Metadata, options: Partial, callback: (error: ServiceError | null, response: TokenizeResponse) => void): ClientUnaryCall; } export declare const TokenizerServiceClient: { new (address: string, credentials: ChannelCredentials, options?: Partial): TokenizerServiceClient; service: typeof TokenizerServiceService; }; /** Service for obtaining embeddings for text data. */ export declare const EmbeddingsServiceService: { /** RPC method to obtain embeddings for input text data. */ readonly embedding: { readonly path: "/yandex.cloud.ai.llm.v1alpha.EmbeddingsService/Embedding"; readonly requestStream: false; readonly responseStream: false; readonly requestSerialize: (value: EmbeddingRequest) => Buffer; readonly requestDeserialize: (value: Buffer) => EmbeddingRequest; readonly responseSerialize: (value: EmbeddingResponse) => Buffer; readonly responseDeserialize: (value: Buffer) => EmbeddingResponse; }; }; export interface EmbeddingsServiceServer extends UntypedServiceImplementation { /** RPC method to obtain embeddings for input text data. */ embedding: handleUnaryCall; } export interface EmbeddingsServiceClient extends Client { /** RPC method to obtain embeddings for input text data. */ embedding(request: EmbeddingRequest, callback: (error: ServiceError | null, response: EmbeddingResponse) => void): ClientUnaryCall; embedding(request: EmbeddingRequest, metadata: Metadata, callback: (error: ServiceError | null, response: EmbeddingResponse) => void): ClientUnaryCall; embedding(request: EmbeddingRequest, metadata: Metadata, options: Partial, callback: (error: ServiceError | null, response: EmbeddingResponse) => void): ClientUnaryCall; } export declare const EmbeddingsServiceClient: { new (address: string, credentials: ChannelCredentials, options?: Partial): EmbeddingsServiceClient; service: typeof EmbeddingsServiceService; }; /** Service for asynchronous text generation. */ export declare const TextGenerationAsyncServiceService: { /** RPC method for instructing the model to generate text. */ readonly instruct: { readonly path: "/yandex.cloud.ai.llm.v1alpha.TextGenerationAsyncService/Instruct"; readonly requestStream: false; readonly responseStream: false; readonly requestSerialize: (value: InstructRequest) => Buffer; readonly requestDeserialize: (value: Buffer) => InstructRequest; readonly responseSerialize: (value: Operation) => Buffer; readonly responseDeserialize: (value: Buffer) => Operation; }; }; export interface TextGenerationAsyncServiceServer extends UntypedServiceImplementation { /** RPC method for instructing the model to generate text. */ instruct: handleUnaryCall; } export interface TextGenerationAsyncServiceClient extends Client { /** RPC method for instructing the model to generate text. */ instruct(request: InstructRequest, callback: (error: ServiceError | null, response: Operation) => void): ClientUnaryCall; instruct(request: InstructRequest, metadata: Metadata, callback: (error: ServiceError | null, response: Operation) => void): ClientUnaryCall; instruct(request: InstructRequest, metadata: Metadata, options: Partial, callback: (error: ServiceError | null, response: Operation) => void): ClientUnaryCall; } export declare const TextGenerationAsyncServiceClient: { new (address: string, credentials: ChannelCredentials, options?: Partial): TextGenerationAsyncServiceClient; service: typeof TextGenerationAsyncServiceService; }; type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial; } : Partial; type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact; } & Record>, never>; export {};