UNPKG

@aristech-org/nlp-client

Version:

A Node.js client library for the Aristech NLP Service

225 lines (224 loc) 8.43 kB
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; import { History } from "./projects.js"; export declare const protobufPackage = "aristech.nlp"; export declare enum ContentType { IMAGE_PNG = 0, APPLICATION_MD = 1, APPLICATION_TXT = 2, APPLICATION_PDF = 3, IMAGE_JPEG = 4, IMAGE_WEBP = 5, APPLICATION_XLSX = 6, UNRECOGNIZED = -1 } export declare function contentTypeFromJSON(object: any): ContentType; export declare function contentTypeToJSON(object: ContentType): string; /** Document with metadata and content */ export interface Document { /** Document ID (only for Get/Update/Delete). */ id: string; /** Project this document belongs to. */ projectId: string; /** Document name/title. */ name: string; /** Content type. */ contentType: ContentType; /** Original filename. */ filename: string; /** Optional description. */ description: string; /** Raw document content (bytes) */ data: Uint8Array; /** Read-only fields (returned by server, ignored on Add/Update): */ history: History | undefined; intentIds: string[]; processingStatus: ProcessingStatus | undefined; chunkCount: number; fileSize: number; contentHash: string; contentPreview: string; } /** Processing status. */ export interface ProcessingStatus { status: ProcessingStatus_Status; progress: number; errorMessage: string; lastUpdated: string; } export declare enum ProcessingStatus_Status { PENDING = 0, PROCESSING = 1, COMPLETED = 2, FAILED = 3, UNRECOGNIZED = -1 } export declare function processingStatus_StatusFromJSON(object: any): ProcessingStatus_Status; export declare function processingStatus_StatusToJSON(object: ProcessingStatus_Status): string; /** Request to add documents. */ export interface AddDocumentsRequest { projectId: string; creatorId: string; /** Documents to add (with data field filled). */ documents: Document[]; autoProcess: boolean; chunkingStrategy: string; /** If true, exclude output messages from vector search (only inputs will be vectorized). */ excludeOutputsFromSearch: boolean; } /** Response from adding documents. */ export interface AddDocumentsResponse { results: AddDocumentsResponse_Result[]; succeeded: number; failed: number; } export interface AddDocumentsResponse_Result { documentId: string; contentHash: string; processingStatus: ProcessingStatus | undefined; error: string; } /** Request to get documents. */ export interface GetDocumentsRequest { projectId: string; /** Filters */ contentTypeFilter: ContentType; statusFilter: ProcessingStatus_Status; documentIds: string[]; /** Pagination */ limit: number; offset: number; /** Include data field in response. */ includeData: boolean; /** Set to true when content_type_filter is explicitly set (needed because enum default 0 = IMAGE_PNG). */ hasContentTypeFilter: boolean; /** Set to true when status_filter is explicitly set (needed because enum default 0 = PENDING). */ hasStatusFilter: boolean; } /** Response with documents. */ export interface GetDocumentsResponse { documents: Document[]; totalCount: number; } /** Request to process documents into intents. */ export interface ProcessDocumentsRequest { projectId: string; documentIds: string[]; chunkingStrategy: string; batchSize: number; forceReprocess: boolean; /** If true, exclude output messages from vector search (only inputs will be vectorized). */ excludeOutputsFromSearch: boolean; } /** Response from processing. */ export interface ProcessDocumentsResponse { results: ProcessDocumentsResponse_Result[]; succeeded: number; failed: number; } export interface ProcessDocumentsResponse_Result { documentId: string; intentsCreated: number; intentIds: string[]; processingStatus: ProcessingStatus | undefined; error: string; } /** * Request to update documents. * Fill data field only if content should be updated. */ export interface UpdateDocumentsRequest { projectId: string; /** Documents to update (id required, fill other fields to update them). */ documents: Document[]; autoReprocess: boolean; deleteOldIntents: boolean; /** If true, exclude output messages from vector search (only inputs will be vectorized). */ excludeOutputsFromSearch: boolean; } /** Response from update. */ export interface UpdateDocumentsResponse { results: UpdateDocumentsResponse_Result[]; succeeded: number; failed: number; } export interface UpdateDocumentsResponse_Result { documentId: string; contentHash: string; processingStatus: ProcessingStatus | undefined; deletedIntentsCount: number; error: string; /** Number of new intents created (if auto_reprocess) */ intentsCreated: number; /** IDs of new intents created (if auto_reprocess) */ intentIds: string[]; } /** Request to remove documents. */ export interface RemoveDocumentsRequest { projectId: string; documentIds: string[]; cascadeDelete: boolean; } /** Response from removal. */ export interface RemoveDocumentsResponse { results: RemoveDocumentsResponse_Result[]; succeeded: number; failed: number; } export interface RemoveDocumentsResponse_Result { documentId: string; intentsDeleted: number; error: string; } /** Request to get document status. */ export interface GetDocumentStatusRequest { projectId: string; documentIds: string[]; } /** Response with status. */ export interface GetDocumentStatusResponse { statuses: GetDocumentStatusResponse_Status[]; } export interface GetDocumentStatusResponse_Status { documentId: string; processingStatus: ProcessingStatus | undefined; intentsCreated: number; intentIds: string[]; } export declare const Document: MessageFns<Document>; export declare const ProcessingStatus: MessageFns<ProcessingStatus>; export declare const AddDocumentsRequest: MessageFns<AddDocumentsRequest>; export declare const AddDocumentsResponse: MessageFns<AddDocumentsResponse>; export declare const AddDocumentsResponse_Result: MessageFns<AddDocumentsResponse_Result>; export declare const GetDocumentsRequest: MessageFns<GetDocumentsRequest>; export declare const GetDocumentsResponse: MessageFns<GetDocumentsResponse>; export declare const ProcessDocumentsRequest: MessageFns<ProcessDocumentsRequest>; export declare const ProcessDocumentsResponse: MessageFns<ProcessDocumentsResponse>; export declare const ProcessDocumentsResponse_Result: MessageFns<ProcessDocumentsResponse_Result>; export declare const UpdateDocumentsRequest: MessageFns<UpdateDocumentsRequest>; export declare const UpdateDocumentsResponse: MessageFns<UpdateDocumentsResponse>; export declare const UpdateDocumentsResponse_Result: MessageFns<UpdateDocumentsResponse_Result>; export declare const RemoveDocumentsRequest: MessageFns<RemoveDocumentsRequest>; export declare const RemoveDocumentsResponse: MessageFns<RemoveDocumentsResponse>; export declare const RemoveDocumentsResponse_Result: MessageFns<RemoveDocumentsResponse_Result>; export declare const GetDocumentStatusRequest: MessageFns<GetDocumentStatusRequest>; export declare const GetDocumentStatusResponse: MessageFns<GetDocumentStatusResponse>; export declare const GetDocumentStatusResponse_Status: MessageFns<GetDocumentStatusResponse_Status>; 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; }; 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; } export {};