UNPKG

@aristech-org/nlp-client

Version:

A Node.js client library for the Aristech NLP Service

1,293 lines (1,212 loc) 48.6 kB
// Code generated by protoc-gen-ts_proto. DO NOT EDIT. // versions: // protoc-gen-ts_proto v2.11.8 // protoc v6.33.1 // source: nlp_server.proto /* eslint-disable */ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; import { type CallOptions, type ChannelCredentials, Client, type ClientOptions, type ClientReadableStream, type ClientUnaryCall, type handleServerStreamingCall, type handleUnaryCall, makeGenericClientConstructor, type Metadata, type ServiceError, type UntypedServiceImplementation, } from "@grpc/grpc-js"; import { AddDocumentsRequest, AddDocumentsResponse, ContentType, contentTypeFromJSON, contentTypeToJSON, GetDocumentsRequest, GetDocumentsResponse, GetDocumentStatusRequest, GetDocumentStatusResponse, ProcessDocumentsRequest, ProcessDocumentsResponse, RemoveDocumentsRequest, RemoveDocumentsResponse, UpdateDocumentsRequest, UpdateDocumentsResponse, } from "./documents.js"; import { GetContentRequest, GetContentResponse, GetIntentsRequest, GetKeywordsRequest, GetKeywordsResponse, GetScoreLimitsRequest, GetScoreLimitsResponse, Intent, RemoveContentRequest, RemoveContentResponse, UpdateContentRequest, UpdateContentResponse, } from "./intents.js"; import { AddProjectRequest, AddProjectResponse, EmbeddingModel, GetEmbeddingModelsRequest, GetProjectsRequest, Project, RemoveProjectRequest, RemoveProjectResponse, UpdateProjectRequest, UpdateProjectResponse, } from "./projects.js"; export const protobufPackage = "aristech.nlp"; /** Request for the list of functions provided by the server. */ export interface FunctionRequest { } /** * Describes a specific operation that can be applied to incoming text, * such as classification or recasing. */ export interface FunctionMessage { /** Unique identifier of the function. */ id: string; /** Descriptive name of the function. */ name: string; /** Detailed description of the function. */ description: string; /** List of arguments accepted by the function. */ arguments: string[]; /** bool that indicates if the function can process attachments */ supportsAttachments: boolean; supportedContentTypes: ContentType[]; } /** Request to process raw text using specified functions. */ export interface RunFunctionsRequest { /** List of functions to apply. */ functions: FunctionMessage[]; /** The raw text to process. */ input: string; /** Additional parameters for the functions. */ arguments: string[]; /** Optional attachments for additional data (e.g. images, files). */ attachments: Attachment[]; } export interface Attachment { /** A unique identifier or filename for the attachment. */ name: string; /** MIME type (e.g. "image/png", "application/pdf"). */ contentType: ContentType; /** Raw binary data of the attachment. */ data: Uint8Array; } /** Response message containing the result of text processing. */ export interface RunFunctionsResponse { /** The processed text result. */ output: string; } export interface SyncDBsRequest { } export interface SyncDBsResponse { status: string; } function createBaseFunctionRequest(): FunctionRequest { return {}; } export const FunctionRequest: MessageFns<FunctionRequest> = { encode(_: FunctionRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): FunctionRequest { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFunctionRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(_: any): FunctionRequest { return {}; }, toJSON(_: FunctionRequest): unknown { const obj: any = {}; return obj; }, create<I extends Exact<DeepPartial<FunctionRequest>, I>>(base?: I): FunctionRequest { return FunctionRequest.fromPartial(base ?? ({} as any)); }, fromPartial<I extends Exact<DeepPartial<FunctionRequest>, I>>(_: I): FunctionRequest { const message = createBaseFunctionRequest(); return message; }, }; function createBaseFunctionMessage(): FunctionMessage { return { id: "", name: "", description: "", arguments: [], supportsAttachments: false, supportedContentTypes: [] }; } export const FunctionMessage: MessageFns<FunctionMessage> = { encode(message: FunctionMessage, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.id !== "") { writer.uint32(10).string(message.id); } if (message.name !== "") { writer.uint32(18).string(message.name); } if (message.description !== "") { writer.uint32(26).string(message.description); } for (const v of message.arguments) { writer.uint32(34).string(v!); } if (message.supportsAttachments !== false) { writer.uint32(40).bool(message.supportsAttachments); } writer.uint32(50).fork(); for (const v of message.supportedContentTypes) { writer.int32(v); } writer.join(); return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): FunctionMessage { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const end = length === undefined ? reader.len : reader.pos + length; const message = createBaseFunctionMessage(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.id = reader.string(); continue; } case 2: { if (tag !== 18) { break; } message.name = reader.string(); continue; } case 3: { if (tag !== 26) { break; } message.description = reader.string(); continue; } case 4: { if (tag !== 34) { break; } message.arguments.push(reader.string()); continue; } case 5: { if (tag !== 40) { break; } message.supportsAttachments = reader.bool(); continue; } case 6: { if (tag === 48) { message.supportedContentTypes.push(reader.int32() as any); continue; } if (tag === 50) { const end2 = reader.uint32() + reader.pos; while (reader.pos < end2) { message.supportedContentTypes.push(reader.int32() as any); } continue; } break; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object: any): FunctionMessage { return { id: isSet(object.id) ? globalThis.String(object.id) : "", name: isSet(object.name) ? globalThis.String(object.name) : "", description: isSet(object.description) ? globalThis.String(object.description) : "", arguments: globalThis.Array.isArray(object?.arguments) ? object.arguments.map((e: any) => globalThis.String(e)) : [], supportsAttachments: isSet(object.supportsAttachments) ? globalThis.Boolean(object.supportsAttachments) : isSet(object.supports_attachments) ? globalThis.Boolean(object.supports_attachments) : false, supportedContentTypes: globalThis.Array.isArray(object?.supportedContentTypes) ? object.supportedContentTypes.map((e: any) => contentTypeFromJSON(e)) : globalThis.Array.isArray(object?.supported_content_types) ? object.supported_content_types.map((e: any) => contentTypeFromJSON(e)) : [], }; }, toJSON(message: FunctionMessage): unknown { const obj: any = {}; if (message.id !== "") { obj.id = message.id; } if (message.name !== "") { obj.name = message.name; } if (message.description !== "") { obj.description = message.description; } if (message.arguments?.length) { obj.arguments = message.arguments; } if (message.supportsAttachments !== false) { obj.supportsAttachments = message.supportsAttachments; } if (message.supportedContentTypes?.length) { obj.supportedContentTypes = message.supportedContentTypes.map((e) => contentTypeToJSON(e)); } return obj; }, create<I extends Exact<DeepPartial<FunctionMessage>, I>>(base?: I): FunctionMessage { return FunctionMessage.fromPartial(base ?? ({} as any)); }, fromPartial<I extends Exact<DeepPartial<FunctionMessage>, I>>(object: I): FunctionMessage { const message = createBaseFunctionMessage(); message.id = object.id ?? ""; message.name = object.name ?? ""; message.description = object.description ?? ""; message.arguments = object.arguments?.map((e) => e) || []; message.supportsAttachments = object.supportsAttachments ?? false; message.supportedContentTypes = object.supportedContentTypes?.map((e) => e) || []; return message; }, }; function createBaseRunFunctionsRequest(): RunFunctionsRequest { return { functions: [], input: "", arguments: [], attachments: [] }; } export const RunFunctionsRequest: MessageFns<RunFunctionsRequest> = { encode(message: RunFunctionsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.functions) { FunctionMessage.encode(v!, writer.uint32(10).fork()).join(); } if (message.input !== "") { writer.uint32(18).string(message.input); } for (const v of message.arguments) { writer.uint32(26).string(v!); } for (const v of message.attachments) { Attachment.encode(v!, writer.uint32(34).fork()).join(); } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): RunFunctionsRequest { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const end = length === undefined ? reader.len : reader.pos + length; const message = createBaseRunFunctionsRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.functions.push(FunctionMessage.decode(reader, reader.uint32())); continue; } case 2: { if (tag !== 18) { break; } message.input = reader.string(); continue; } case 3: { if (tag !== 26) { break; } message.arguments.push(reader.string()); continue; } case 4: { if (tag !== 34) { break; } message.attachments.push(Attachment.decode(reader, reader.uint32())); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object: any): RunFunctionsRequest { return { functions: globalThis.Array.isArray(object?.functions) ? object.functions.map((e: any) => FunctionMessage.fromJSON(e)) : [], input: isSet(object.input) ? globalThis.String(object.input) : "", arguments: globalThis.Array.isArray(object?.arguments) ? object.arguments.map((e: any) => globalThis.String(e)) : [], attachments: globalThis.Array.isArray(object?.attachments) ? object.attachments.map((e: any) => Attachment.fromJSON(e)) : [], }; }, toJSON(message: RunFunctionsRequest): unknown { const obj: any = {}; if (message.functions?.length) { obj.functions = message.functions.map((e) => FunctionMessage.toJSON(e)); } if (message.input !== "") { obj.input = message.input; } if (message.arguments?.length) { obj.arguments = message.arguments; } if (message.attachments?.length) { obj.attachments = message.attachments.map((e) => Attachment.toJSON(e)); } return obj; }, create<I extends Exact<DeepPartial<RunFunctionsRequest>, I>>(base?: I): RunFunctionsRequest { return RunFunctionsRequest.fromPartial(base ?? ({} as any)); }, fromPartial<I extends Exact<DeepPartial<RunFunctionsRequest>, I>>(object: I): RunFunctionsRequest { const message = createBaseRunFunctionsRequest(); message.functions = object.functions?.map((e) => FunctionMessage.fromPartial(e)) || []; message.input = object.input ?? ""; message.arguments = object.arguments?.map((e) => e) || []; message.attachments = object.attachments?.map((e) => Attachment.fromPartial(e)) || []; return message; }, }; function createBaseAttachment(): Attachment { return { name: "", contentType: 0, data: new Uint8Array(0) }; } export const Attachment: MessageFns<Attachment> = { encode(message: Attachment, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.name !== "") { writer.uint32(10).string(message.name); } if (message.contentType !== 0) { writer.uint32(16).int32(message.contentType); } if (message.data.length !== 0) { writer.uint32(26).bytes(message.data); } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): Attachment { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const end = length === undefined ? reader.len : reader.pos + length; const message = createBaseAttachment(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.name = reader.string(); continue; } case 2: { if (tag !== 16) { break; } message.contentType = reader.int32() as any; continue; } case 3: { if (tag !== 26) { break; } message.data = reader.bytes(); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object: any): Attachment { return { name: isSet(object.name) ? globalThis.String(object.name) : "", contentType: isSet(object.contentType) ? contentTypeFromJSON(object.contentType) : isSet(object.content_type) ? contentTypeFromJSON(object.content_type) : 0, data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0), }; }, toJSON(message: Attachment): unknown { const obj: any = {}; if (message.name !== "") { obj.name = message.name; } if (message.contentType !== 0) { obj.contentType = contentTypeToJSON(message.contentType); } if (message.data.length !== 0) { obj.data = base64FromBytes(message.data); } return obj; }, create<I extends Exact<DeepPartial<Attachment>, I>>(base?: I): Attachment { return Attachment.fromPartial(base ?? ({} as any)); }, fromPartial<I extends Exact<DeepPartial<Attachment>, I>>(object: I): Attachment { const message = createBaseAttachment(); message.name = object.name ?? ""; message.contentType = object.contentType ?? 0; message.data = object.data ?? new Uint8Array(0); return message; }, }; function createBaseRunFunctionsResponse(): RunFunctionsResponse { return { output: "" }; } export const RunFunctionsResponse: MessageFns<RunFunctionsResponse> = { encode(message: RunFunctionsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.output !== "") { writer.uint32(10).string(message.output); } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): RunFunctionsResponse { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const end = length === undefined ? reader.len : reader.pos + length; const message = createBaseRunFunctionsResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.output = reader.string(); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object: any): RunFunctionsResponse { return { output: isSet(object.output) ? globalThis.String(object.output) : "" }; }, toJSON(message: RunFunctionsResponse): unknown { const obj: any = {}; if (message.output !== "") { obj.output = message.output; } return obj; }, create<I extends Exact<DeepPartial<RunFunctionsResponse>, I>>(base?: I): RunFunctionsResponse { return RunFunctionsResponse.fromPartial(base ?? ({} as any)); }, fromPartial<I extends Exact<DeepPartial<RunFunctionsResponse>, I>>(object: I): RunFunctionsResponse { const message = createBaseRunFunctionsResponse(); message.output = object.output ?? ""; return message; }, }; function createBaseSyncDBsRequest(): SyncDBsRequest { return {}; } export const SyncDBsRequest: MessageFns<SyncDBsRequest> = { encode(_: SyncDBsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): SyncDBsRequest { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSyncDBsRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(_: any): SyncDBsRequest { return {}; }, toJSON(_: SyncDBsRequest): unknown { const obj: any = {}; return obj; }, create<I extends Exact<DeepPartial<SyncDBsRequest>, I>>(base?: I): SyncDBsRequest { return SyncDBsRequest.fromPartial(base ?? ({} as any)); }, fromPartial<I extends Exact<DeepPartial<SyncDBsRequest>, I>>(_: I): SyncDBsRequest { const message = createBaseSyncDBsRequest(); return message; }, }; function createBaseSyncDBsResponse(): SyncDBsResponse { return { status: "" }; } export const SyncDBsResponse: MessageFns<SyncDBsResponse> = { encode(message: SyncDBsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.status !== "") { writer.uint32(10).string(message.status); } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): SyncDBsResponse { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSyncDBsResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.status = reader.string(); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object: any): SyncDBsResponse { return { status: isSet(object.status) ? globalThis.String(object.status) : "" }; }, toJSON(message: SyncDBsResponse): unknown { const obj: any = {}; if (message.status !== "") { obj.status = message.status; } return obj; }, create<I extends Exact<DeepPartial<SyncDBsResponse>, I>>(base?: I): SyncDBsResponse { return SyncDBsResponse.fromPartial(base ?? ({} as any)); }, fromPartial<I extends Exact<DeepPartial<SyncDBsResponse>, I>>(object: I): SyncDBsResponse { const message = createBaseSyncDBsResponse(); message.status = object.status ?? ""; return message; }, }; /** * NLPServer provides the interface for various NLP functionalities. * These functions include text processing, content management in projects, * and interaction with vectorized data structures. */ export type NLPServerService = typeof NLPServerService; export const NLPServerService = { /** * Returns all available processing functions (models) of the server. * Each function includes a unique ID, a descriptive name, * a description, and a list of possible arguments. */ getFunctions: { path: "/aristech.nlp.NLPServer/GetFunctions" as const, requestStream: false as const, responseStream: true as const, requestSerialize: (value: FunctionRequest): Buffer => Buffer.from(FunctionRequest.encode(value).finish()), requestDeserialize: (value: Buffer): FunctionRequest => FunctionRequest.decode(value), responseSerialize: (value: FunctionMessage): Buffer => Buffer.from(FunctionMessage.encode(value).finish()), responseDeserialize: (value: Buffer): FunctionMessage => FunctionMessage.decode(value), }, /** * Processes the provided raw text using the specified functions. * Multiple functions can be applied sequentially. */ runFunctions: { path: "/aristech.nlp.NLPServer/RunFunctions" as const, requestStream: false as const, responseStream: false as const, requestSerialize: (value: RunFunctionsRequest): Buffer => Buffer.from(RunFunctionsRequest.encode(value).finish()), requestDeserialize: (value: Buffer): RunFunctionsRequest => RunFunctionsRequest.decode(value), responseSerialize: (value: RunFunctionsResponse): Buffer => Buffer.from(RunFunctionsResponse.encode(value).finish()), responseDeserialize: (value: Buffer): RunFunctionsResponse => RunFunctionsResponse.decode(value), }, /** Adds new content or updates existing content. */ updateContent: { path: "/aristech.nlp.NLPServer/UpdateContent" as const, requestStream: false as const, responseStream: false as const, requestSerialize: (value: UpdateContentRequest): Buffer => Buffer.from(UpdateContentRequest.encode(value).finish()), requestDeserialize: (value: Buffer): UpdateContentRequest => UpdateContentRequest.decode(value), responseSerialize: (value: UpdateContentResponse): Buffer => Buffer.from(UpdateContentResponse.encode(value).finish()), responseDeserialize: (value: Buffer): UpdateContentResponse => UpdateContentResponse.decode(value), }, /** Removes the specified content. */ removeContent: { path: "/aristech.nlp.NLPServer/RemoveContent" as const, requestStream: false as const, responseStream: false as const, requestSerialize: (value: RemoveContentRequest): Buffer => Buffer.from(RemoveContentRequest.encode(value).finish()), requestDeserialize: (value: Buffer): RemoveContentRequest => RemoveContentRequest.decode(value), responseSerialize: (value: RemoveContentResponse): Buffer => Buffer.from(RemoveContentResponse.encode(value).finish()), responseDeserialize: (value: Buffer): RemoveContentResponse => RemoveContentResponse.decode(value), }, /** Retrieves content that is available both as vectorized data and as plain text. */ getContent: { path: "/aristech.nlp.NLPServer/GetContent" as const, requestStream: false as const, responseStream: true as const, requestSerialize: (value: GetContentRequest): Buffer => Buffer.from(GetContentRequest.encode(value).finish()), requestDeserialize: (value: Buffer): GetContentRequest => GetContentRequest.decode(value), responseSerialize: (value: GetContentResponse): Buffer => Buffer.from(GetContentResponse.encode(value).finish()), responseDeserialize: (value: Buffer): GetContentResponse => GetContentResponse.decode(value), }, /** Initializes a new project. */ addProject: { path: "/aristech.nlp.NLPServer/AddProject" as const, requestStream: false as const, responseStream: false as const, requestSerialize: (value: AddProjectRequest): Buffer => Buffer.from(AddProjectRequest.encode(value).finish()), requestDeserialize: (value: Buffer): AddProjectRequest => AddProjectRequest.decode(value), responseSerialize: (value: AddProjectResponse): Buffer => Buffer.from(AddProjectResponse.encode(value).finish()), responseDeserialize: (value: Buffer): AddProjectResponse => AddProjectResponse.decode(value), }, /** Removes an existing project and all associated content. */ removeProject: { path: "/aristech.nlp.NLPServer/RemoveProject" as const, requestStream: false as const, responseStream: false as const, requestSerialize: (value: RemoveProjectRequest): Buffer => Buffer.from(RemoveProjectRequest.encode(value).finish()), requestDeserialize: (value: Buffer): RemoveProjectRequest => RemoveProjectRequest.decode(value), responseSerialize: (value: RemoveProjectResponse): Buffer => Buffer.from(RemoveProjectResponse.encode(value).finish()), responseDeserialize: (value: Buffer): RemoveProjectResponse => RemoveProjectResponse.decode(value), }, /** Updates the settings or configuration of an existing project. */ updateProject: { path: "/aristech.nlp.NLPServer/UpdateProject" as const, requestStream: false as const, responseStream: false as const, requestSerialize: (value: UpdateProjectRequest): Buffer => Buffer.from(UpdateProjectRequest.encode(value).finish()), requestDeserialize: (value: Buffer): UpdateProjectRequest => UpdateProjectRequest.decode(value), responseSerialize: (value: UpdateProjectResponse): Buffer => Buffer.from(UpdateProjectResponse.encode(value).finish()), responseDeserialize: (value: Buffer): UpdateProjectResponse => UpdateProjectResponse.decode(value), }, /** Returns a list of all projects. */ getProjects: { path: "/aristech.nlp.NLPServer/GetProjects" as const, requestStream: false as const, responseStream: true as const, requestSerialize: (value: GetProjectsRequest): Buffer => Buffer.from(GetProjectsRequest.encode(value).finish()), requestDeserialize: (value: Buffer): GetProjectsRequest => GetProjectsRequest.decode(value), responseSerialize: (value: Project): Buffer => Buffer.from(Project.encode(value).finish()), responseDeserialize: (value: Buffer): Project => Project.decode(value), }, /** Retrieves all intents of a project. */ getIntents: { path: "/aristech.nlp.NLPServer/GetIntents" as const, requestStream: false as const, responseStream: true as const, requestSerialize: (value: GetIntentsRequest): Buffer => Buffer.from(GetIntentsRequest.encode(value).finish()), requestDeserialize: (value: Buffer): GetIntentsRequest => GetIntentsRequest.decode(value), responseSerialize: (value: Intent): Buffer => Buffer.from(Intent.encode(value).finish()), responseDeserialize: (value: Buffer): Intent => Intent.decode(value), }, /** Determines score limits for a project based on test inputs. */ getScoreLimits: { path: "/aristech.nlp.NLPServer/GetScoreLimits" as const, requestStream: false as const, responseStream: false as const, requestSerialize: (value: GetScoreLimitsRequest): Buffer => Buffer.from(GetScoreLimitsRequest.encode(value).finish()), requestDeserialize: (value: Buffer): GetScoreLimitsRequest => GetScoreLimitsRequest.decode(value), responseSerialize: (value: GetScoreLimitsResponse): Buffer => Buffer.from(GetScoreLimitsResponse.encode(value).finish()), responseDeserialize: (value: Buffer): GetScoreLimitsResponse => GetScoreLimitsResponse.decode(value), }, /** Returns a list of available embedding models for similarity searches. */ getEmbeddingModels: { path: "/aristech.nlp.NLPServer/GetEmbeddingModels" as const, requestStream: false as const, responseStream: true as const, requestSerialize: (value: GetEmbeddingModelsRequest): Buffer => Buffer.from(GetEmbeddingModelsRequest.encode(value).finish()), requestDeserialize: (value: Buffer): GetEmbeddingModelsRequest => GetEmbeddingModelsRequest.decode(value), responseSerialize: (value: EmbeddingModel): Buffer => Buffer.from(EmbeddingModel.encode(value).finish()), responseDeserialize: (value: Buffer): EmbeddingModel => EmbeddingModel.decode(value), }, syncDBs: { path: "/aristech.nlp.NLPServer/SyncDBs" as const, requestStream: false as const, responseStream: false as const, requestSerialize: (value: SyncDBsRequest): Buffer => Buffer.from(SyncDBsRequest.encode(value).finish()), requestDeserialize: (value: Buffer): SyncDBsRequest => SyncDBsRequest.decode(value), responseSerialize: (value: SyncDBsResponse): Buffer => Buffer.from(SyncDBsResponse.encode(value).finish()), responseDeserialize: (value: Buffer): SyncDBsResponse => SyncDBsResponse.decode(value), }, getKeywords: { path: "/aristech.nlp.NLPServer/GetKeywords" as const, requestStream: false as const, responseStream: true as const, requestSerialize: (value: GetKeywordsRequest): Buffer => Buffer.from(GetKeywordsRequest.encode(value).finish()), requestDeserialize: (value: Buffer): GetKeywordsRequest => GetKeywordsRequest.decode(value), responseSerialize: (value: GetKeywordsResponse): Buffer => Buffer.from(GetKeywordsResponse.encode(value).finish()), responseDeserialize: (value: Buffer): GetKeywordsResponse => GetKeywordsResponse.decode(value), }, addDocuments: { path: "/aristech.nlp.NLPServer/AddDocuments" as const, requestStream: false as const, responseStream: false as const, requestSerialize: (value: AddDocumentsRequest): Buffer => Buffer.from(AddDocumentsRequest.encode(value).finish()), requestDeserialize: (value: Buffer): AddDocumentsRequest => AddDocumentsRequest.decode(value), responseSerialize: (value: AddDocumentsResponse): Buffer => Buffer.from(AddDocumentsResponse.encode(value).finish()), responseDeserialize: (value: Buffer): AddDocumentsResponse => AddDocumentsResponse.decode(value), }, getDocuments: { path: "/aristech.nlp.NLPServer/GetDocuments" as const, requestStream: false as const, responseStream: false as const, requestSerialize: (value: GetDocumentsRequest): Buffer => Buffer.from(GetDocumentsRequest.encode(value).finish()), requestDeserialize: (value: Buffer): GetDocumentsRequest => GetDocumentsRequest.decode(value), responseSerialize: (value: GetDocumentsResponse): Buffer => Buffer.from(GetDocumentsResponse.encode(value).finish()), responseDeserialize: (value: Buffer): GetDocumentsResponse => GetDocumentsResponse.decode(value), }, processDocuments: { path: "/aristech.nlp.NLPServer/ProcessDocuments" as const, requestStream: false as const, responseStream: false as const, requestSerialize: (value: ProcessDocumentsRequest): Buffer => Buffer.from(ProcessDocumentsRequest.encode(value).finish()), requestDeserialize: (value: Buffer): ProcessDocumentsRequest => ProcessDocumentsRequest.decode(value), responseSerialize: (value: ProcessDocumentsResponse): Buffer => Buffer.from(ProcessDocumentsResponse.encode(value).finish()), responseDeserialize: (value: Buffer): ProcessDocumentsResponse => ProcessDocumentsResponse.decode(value), }, updateDocuments: { path: "/aristech.nlp.NLPServer/UpdateDocuments" as const, requestStream: false as const, responseStream: false as const, requestSerialize: (value: UpdateDocumentsRequest): Buffer => Buffer.from(UpdateDocumentsRequest.encode(value).finish()), requestDeserialize: (value: Buffer): UpdateDocumentsRequest => UpdateDocumentsRequest.decode(value), responseSerialize: (value: UpdateDocumentsResponse): Buffer => Buffer.from(UpdateDocumentsResponse.encode(value).finish()), responseDeserialize: (value: Buffer): UpdateDocumentsResponse => UpdateDocumentsResponse.decode(value), }, removeDocuments: { path: "/aristech.nlp.NLPServer/RemoveDocuments" as const, requestStream: false as const, responseStream: false as const, requestSerialize: (value: RemoveDocumentsRequest): Buffer => Buffer.from(RemoveDocumentsRequest.encode(value).finish()), requestDeserialize: (value: Buffer): RemoveDocumentsRequest => RemoveDocumentsRequest.decode(value), responseSerialize: (value: RemoveDocumentsResponse): Buffer => Buffer.from(RemoveDocumentsResponse.encode(value).finish()), responseDeserialize: (value: Buffer): RemoveDocumentsResponse => RemoveDocumentsResponse.decode(value), }, getDocumentStatus: { path: "/aristech.nlp.NLPServer/GetDocumentStatus" as const, requestStream: false as const, responseStream: false as const, requestSerialize: (value: GetDocumentStatusRequest): Buffer => Buffer.from(GetDocumentStatusRequest.encode(value).finish()), requestDeserialize: (value: Buffer): GetDocumentStatusRequest => GetDocumentStatusRequest.decode(value), responseSerialize: (value: GetDocumentStatusResponse): Buffer => Buffer.from(GetDocumentStatusResponse.encode(value).finish()), responseDeserialize: (value: Buffer): GetDocumentStatusResponse => GetDocumentStatusResponse.decode(value), }, } as const; export interface NLPServerServer extends UntypedServiceImplementation { /** * Returns all available processing functions (models) of the server. * Each function includes a unique ID, a descriptive name, * a description, and a list of possible arguments. */ getFunctions: handleServerStreamingCall<FunctionRequest, FunctionMessage>; /** * Processes the provided raw text using the specified functions. * Multiple functions can be applied sequentially. */ runFunctions: handleUnaryCall<RunFunctionsRequest, RunFunctionsResponse>; /** Adds new content or updates existing content. */ updateContent: handleUnaryCall<UpdateContentRequest, UpdateContentResponse>; /** Removes the specified content. */ removeContent: handleUnaryCall<RemoveContentRequest, RemoveContentResponse>; /** Retrieves content that is available both as vectorized data and as plain text. */ getContent: handleServerStreamingCall<GetContentRequest, GetContentResponse>; /** Initializes a new project. */ addProject: handleUnaryCall<AddProjectRequest, AddProjectResponse>; /** Removes an existing project and all associated content. */ removeProject: handleUnaryCall<RemoveProjectRequest, RemoveProjectResponse>; /** Updates the settings or configuration of an existing project. */ updateProject: handleUnaryCall<UpdateProjectRequest, UpdateProjectResponse>; /** Returns a list of all projects. */ getProjects: handleServerStreamingCall<GetProjectsRequest, Project>; /** Retrieves all intents of a project. */ getIntents: handleServerStreamingCall<GetIntentsRequest, Intent>; /** Determines score limits for a project based on test inputs. */ getScoreLimits: handleUnaryCall<GetScoreLimitsRequest, GetScoreLimitsResponse>; /** Returns a list of available embedding models for similarity searches. */ getEmbeddingModels: handleServerStreamingCall<GetEmbeddingModelsRequest, EmbeddingModel>; syncDBs: handleUnaryCall<SyncDBsRequest, SyncDBsResponse>; getKeywords: handleServerStreamingCall<GetKeywordsRequest, GetKeywordsResponse>; addDocuments: handleUnaryCall<AddDocumentsRequest, AddDocumentsResponse>; getDocuments: handleUnaryCall<GetDocumentsRequest, GetDocumentsResponse>; processDocuments: handleUnaryCall<ProcessDocumentsRequest, ProcessDocumentsResponse>; updateDocuments: handleUnaryCall<UpdateDocumentsRequest, UpdateDocumentsResponse>; removeDocuments: handleUnaryCall<RemoveDocumentsRequest, RemoveDocumentsResponse>; getDocumentStatus: handleUnaryCall<GetDocumentStatusRequest, GetDocumentStatusResponse>; } export interface NLPServerClient extends Client { /** * Returns all available processing functions (models) of the server. * Each function includes a unique ID, a descriptive name, * a description, and a list of possible arguments. */ getFunctions(request: FunctionRequest, options?: Partial<CallOptions>): ClientReadableStream<FunctionMessage>; getFunctions( request: FunctionRequest, metadata?: Metadata, options?: Partial<CallOptions>, ): ClientReadableStream<FunctionMessage>; /** * Processes the provided raw text using the specified functions. * Multiple functions can be applied sequentially. */ runFunctions( request: RunFunctionsRequest, callback: (error: ServiceError | null, response: RunFunctionsResponse) => void, ): ClientUnaryCall; runFunctions( request: RunFunctionsRequest, metadata: Metadata, callback: (error: ServiceError | null, response: RunFunctionsResponse) => void, ): ClientUnaryCall; runFunctions( request: RunFunctionsRequest, metadata: Metadata, options: Partial<CallOptions>, callback: (error: ServiceError | null, response: RunFunctionsResponse) => void, ): ClientUnaryCall; /** Adds new content or updates existing content. */ updateContent( request: UpdateContentRequest, callback: (error: ServiceError | null, response: UpdateContentResponse) => void, ): ClientUnaryCall; updateContent( request: UpdateContentRequest, metadata: Metadata, callback: (error: ServiceError | null, response: UpdateContentResponse) => void, ): ClientUnaryCall; updateContent( request: UpdateContentRequest, metadata: Metadata, options: Partial<CallOptions>, callback: (error: ServiceError | null, response: UpdateContentResponse) => void, ): ClientUnaryCall; /** Removes the specified content. */ removeContent( request: RemoveContentRequest, callback: (error: ServiceError | null, response: RemoveContentResponse) => void, ): ClientUnaryCall; removeContent( request: RemoveContentRequest, metadata: Metadata, callback: (error: ServiceError | null, response: RemoveContentResponse) => void, ): ClientUnaryCall; removeContent( request: RemoveContentRequest, metadata: Metadata, options: Partial<CallOptions>, callback: (error: ServiceError | null, response: RemoveContentResponse) => void, ): ClientUnaryCall; /** Retrieves content that is available both as vectorized data and as plain text. */ getContent(request: GetContentRequest, options?: Partial<CallOptions>): ClientReadableStream<GetContentResponse>; getContent( request: GetContentRequest, metadata?: Metadata, options?: Partial<CallOptions>, ): ClientReadableStream<GetContentResponse>; /** Initializes a new project. */ addProject( request: AddProjectRequest, callback: (error: ServiceError | null, response: AddProjectResponse) => void, ): ClientUnaryCall; addProject( request: AddProjectRequest, metadata: Metadata, callback: (error: ServiceError | null, response: AddProjectResponse) => void, ): ClientUnaryCall; addProject( request: AddProjectRequest, metadata: Metadata, options: Partial<CallOptions>, callback: (error: ServiceError | null, response: AddProjectResponse) => void, ): ClientUnaryCall; /** Removes an existing project and all associated content. */ removeProject( request: RemoveProjectRequest, callback: (error: ServiceError | null, response: RemoveProjectResponse) => void, ): ClientUnaryCall; removeProject( request: RemoveProjectRequest, metadata: Metadata, callback: (error: ServiceError | null, response: RemoveProjectResponse) => void, ): ClientUnaryCall; removeProject( request: RemoveProjectRequest, metadata: Metadata, options: Partial<CallOptions>, callback: (error: ServiceError | null, response: RemoveProjectResponse) => void, ): ClientUnaryCall; /** Updates the settings or configuration of an existing project. */ updateProject( request: UpdateProjectRequest, callback: (error: ServiceError | null, response: UpdateProjectResponse) => void, ): ClientUnaryCall; updateProject( request: UpdateProjectRequest, metadata: Metadata, callback: (error: ServiceError | null, response: UpdateProjectResponse) => void, ): ClientUnaryCall; updateProject( request: UpdateProjectRequest, metadata: Metadata, options: Partial<CallOptions>, callback: (error: ServiceError | null, response: UpdateProjectResponse) => void, ): ClientUnaryCall; /** Returns a list of all projects. */ getProjects(request: GetProjectsRequest, options?: Partial<CallOptions>): ClientReadableStream<Project>; getProjects( request: GetProjectsRequest, metadata?: Metadata, options?: Partial<CallOptions>, ): ClientReadableStream<Project>; /** Retrieves all intents of a project. */ getIntents(request: GetIntentsRequest, options?: Partial<CallOptions>): ClientReadableStream<Intent>; getIntents( request: GetIntentsRequest, metadata?: Metadata, options?: Partial<CallOptions>, ): ClientReadableStream<Intent>; /** Determines score limits for a project based on test inputs. */ getScoreLimits( request: GetScoreLimitsRequest, callback: (error: ServiceError | null, response: GetScoreLimitsResponse) => void, ): ClientUnaryCall; getScoreLimits( request: GetScoreLimitsRequest, metadata: Metadata, callback: (error: ServiceError | null, response: GetScoreLimitsResponse) => void, ): ClientUnaryCall; getScoreLimits( request: GetScoreLimitsRequest, metadata: Metadata, options: Partial<CallOptions>, callback: (error: ServiceError | null, response: GetScoreLimitsResponse) => void, ): ClientUnaryCall; /** Returns a list of available embedding models for similarity searches. */ getEmbeddingModels( request: GetEmbeddingModelsRequest, options?: Partial<CallOptions>, ): ClientReadableStream<EmbeddingModel>; getEmbeddingModels( request: GetEmbeddingModelsRequest, metadata?: Metadata, options?: Partial<CallOptions>, ): ClientReadableStream<EmbeddingModel>; syncDBs( request: SyncDBsRequest, callback: (error: ServiceError | null, response: SyncDBsResponse) => void, ): ClientUnaryCall; syncDBs( request: SyncDBsRequest, metadata: Metadata, callback: (error: ServiceError | null, response: SyncDBsResponse) => void, ): ClientUnaryCall; syncDBs( request: SyncDBsRequest, metadata: Metadata, options: Partial<CallOptions>, callback: (error: ServiceError | null, response: SyncDBsResponse) => void, ): ClientUnaryCall; getKeywords(request: GetKeywordsRequest, options?: Partial<CallOptions>): ClientReadableStream<GetKeywordsResponse>; getKeywords( request: GetKeywordsRequest, metadata?: Metadata, options?: Partial<CallOptions>, ): ClientReadableStream<GetKeywordsResponse>; addDocuments( request: AddDocumentsRequest, callback: (error: ServiceError | null, response: AddDocumentsResponse) => void, ): ClientUnaryCall; addDocuments( request: AddDocumentsRequest, metadata: Metadata, callback: (error: ServiceError | null, response: AddDocumentsResponse) => void, ): ClientUnaryCall; addDocuments( request: AddDocumentsRequest, metadata: Metadata, options: Partial<CallOptions>, callback: (error: ServiceError | null, response: AddDocumentsResponse) => void, ): ClientUnaryCall; getDocuments( request: GetDocumentsRequest, callback: (error: ServiceError | null, response: GetDocumentsResponse) => void, ): ClientUnaryCall; getDocuments( request: GetDocumentsRequest, metadata: Metadata, callback: (error: ServiceError | null, response: GetDocumentsResponse) => void, ): ClientUnaryCall; getDocuments( request: GetDocumentsRequest, metadata: Metadata, options: Partial<CallOptions>, callback: (error: ServiceError | null, response: GetDocumentsResponse) => void, ): ClientUnaryCall; processDocuments( request: ProcessDocumentsRequest, callback: (error: ServiceError | null, response: ProcessDocumentsResponse) => void, ): ClientUnaryCall; processDocuments( request: ProcessDocumentsRequest, metadata: Metadata, callback: (error: ServiceError | null, response: ProcessDocumentsResponse) => void, ): ClientUnaryCall; processDocuments( request: ProcessDocumentsRequest, metadata: Metadata, options: Partial<CallOptions>, callback: (error: ServiceError | null, response: ProcessDocumentsResponse) => void, ): ClientUnaryCall; updateDocuments( request: UpdateDocumentsRequest, callback: (error: ServiceError | null, response: UpdateDocumentsResponse) => void, ): ClientUnaryCall; updateDocuments( request: UpdateDocumentsRequest, metadata: Metadata, callback: (error: ServiceError | null, response: UpdateDocumentsResponse) => void, ): ClientUnaryCall; updateDocuments( request: UpdateDocumentsRequest, metadata: Metadata, options: Partial<CallOptions>, callback: (error: ServiceError | null, response: UpdateDocumentsResponse) => void, ): ClientUnaryCall; removeDocuments( request: RemoveDocumentsRequest, callback: (error: ServiceError | null, response: RemoveDocumentsResponse) => void, ): ClientUnaryCall; removeDocuments( request: RemoveDocumentsRequest, metadata: Metadata, callback: (error: ServiceError | null, response: RemoveDocumentsResponse) => void, ): ClientUnaryCall; removeDocuments( request: RemoveDocumentsRequest, metadata: Metadata, options: Partial<CallOptions>, callback: (error: ServiceError | null, response: RemoveDocumentsResponse) => void, ): ClientUnaryCall; getDocumentStatus( request: GetDocumentStatusRequest, callback: (error: ServiceError | null, response: GetDocumentStatusResponse) => void, ): ClientUnaryCall; getDocumentStatus( request: GetDocumentStatusRequest, metadata: Metadata, callback: (error: ServiceError | null, response: GetDocumentStatusResponse) => void, ): ClientUnaryCall; getDocumentStatus( request: GetDocumentStatusRequest, metadata: Metadata, options: Partial<CallOptions>, callback: (error: ServiceError | null, response: GetDocumentStatusResponse) => void, ): ClientUnaryCall; } export const NLPServerClient = makeGenericClientConstructor(NLPServerService, "aristech.nlp.NLPServer") as unknown as { new (address: string, credentials: ChannelCredentials, options?: Partial<ClientOptions>): NLPServerClient; service: typeof NLPServerService; serviceName: string; }; function bytesFromBase64(b64: string): Uint8Array { if ((globalThis as any).Buffer) { return Uint8Array.from((globalThis as any).Buffer.from(b64, "base64")); } else { const bin = globalThis.atob(b64); const arr = new Uint8Array(bin.length); for (let i = 0; i < bin.length; ++i) { arr[i] = bin.charCodeAt(i); } return arr; } } function base64FromBytes(arr: Uint8Array): string { if ((globalThis as any).Buffer) { return (globalThis as any).Buffer.from(arr).toString("base64"); } else { const bin: string[] = []; arr.forEach((byte) => { bin.push(globalThis.String.fromCharCode(byte)); }); return globalThis.btoa(bin.join("")); } } type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> } : Partial<T>; type KeysOfUnion<T> = T extends T ? keyof T : never; export type Exact<P, I extends P> = P extends Builtin ? P : P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never }; function isSet(value: any): boolean { return value !== null && value !== undefined; } export interface MessageFns<T> { encode(message: T, writer?: BinaryWriter): BinaryWriter; decode(input: BinaryReader | Uint8Array, length?: number): T; fromJSON(object: any): T; toJSON(message: T): unknown; create<I extends Exact<DeepPartial<T>, I>>(base?: I): T; fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T; }