UNPKG

@aristech-org/nlp-client

Version:

A Node.js client library for the Aristech NLP Service

211 lines (210 loc) 7.71 kB
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; import { FallbackMessage } from "./projects.js"; export declare const protobufPackage = "aristech.nlp"; /** Describes a single response of an intent. */ export interface OutputMessage { /** Channel through which the message is delivered. */ channel: OutputMessage_Channel; /** * Flexible key/value pairs for message data. * Example: "text": "Hello, how can I help?" * "redirect": "intent_123" * "tts_speed": "slow" */ data: { [key: string]: string; }; } export declare enum OutputMessage_Channel { CHAT = 0, VOICE = 1, EMAIL = 2, UNRECOGNIZED = -1 } export declare function outputMessage_ChannelFromJSON(object: any): OutputMessage_Channel; export declare function outputMessage_ChannelToJSON(object: OutputMessage_Channel): string; export interface OutputMessage_DataEntry { key: string; value: string; } /** Represents an intent within a project. */ export interface Intent { /** Unique ID of the intent. */ id: string; /** Project ID to which this intent belongs. */ projectId: string; /** Default locale for input and output. */ locale: string; /** Topic assignment of the intent. */ topic: string; /** List of inputs (IntentInput) assigned to this intent. */ inputs: IntentInput[]; /** * Old, channel-separated outputs (still present). * * @deprecated */ outputChat: string[]; /** @deprecated */ outputVoice: string[]; /** @deprecated */ outputEmail: string[]; /** New, extensible outputs. */ outputs: OutputMessage[]; /** Relationships to other intents (parents, children, peers). */ relatedTo: Relation[]; /** Indicates whether the intent is published (not a draft). */ published: boolean; /** If true, the output of this intent is excluded from search queries. */ excludeOutputFromSearch: boolean; /** List of keywords for targeted search. */ keywords: Keyword[]; /** ID of the creator of this intent. */ creatorId: string; /** Optional: ID of the document this intent was generated from. */ documentId: string; } /** * Defines an input for an intent. * Each input can be identified by UUID; if it does not exist, a new input is created. */ export interface IntentInput { /** UUID for identification. */ uuid: string; /** The actual input text. */ input: string; } /** Relation */ export interface Relation { /** Parents are intents that are directly related to this intent. */ parents: string[]; /** Children are intents that are directly related to this intent. */ children: string[]; /** Peers are intents that are at the same level in the hierarchy. */ peers: string[]; } /** Represents a keyword for identification or prioritization of an intent. */ export interface Keyword { /** The keyword. */ keyword: string; /** Priority (e.g. for ranking). */ priority: number; } /** Used to add or update intents. */ export interface UpdateContentRequest { /** Intents to add or update. */ intents: Intent[]; } /** Contains the status of the update operation. */ export interface UpdateContentResponse { /** IDs of added or updated intents. */ intentIds: string[]; } /** Used to remove intents. */ export interface RemoveContentRequest { /** IDs of intents to delete. */ id: string[]; /** Project from which to delete. */ projectId: string; } /** Confirms removal of intents. */ export interface RemoveContentResponse { } /** Retrieves content (intents) and performs similarity searches. */ export interface GetContentRequest { prompt: string; projectId: string; numResults: number; threshold?: number | undefined; filters: ContentFilter[]; chatId: string; includeUnpublishedIntents: boolean; } /** Response to a content query. */ export interface GetContentResponse { items: ContentResponseItem[]; chatId: string; } /** Defines filter criteria for content queries. */ export interface ContentFilter { field: string; value: string; operator: string; label: string[]; } /** A single search result. */ export interface ContentResponseItem { /** ID of the matching IntentInput element. */ id: string; /** Similarity/relevance score. */ score: number; /** Full intent. */ intent: Intent | undefined; /** A single fallback message as a string */ fallbackMessage: string; fallbackMessages: FallbackMessage[]; /** Number of inputs of the intent that matched the query. */ matchedInputs: number; /** Might contain the keyword that resulted in the match rather than semantic similarity search. */ matchedKeyword: Keyword | undefined; } /** Requests all intents of a specific project. */ export interface GetIntentsRequest { projectId: string; } /** Determines score limits for a project. */ export interface GetScoreLimitsRequest { projectId: string; testSentencesUpperLimit: string[]; testSentencesLowerLimit: string[]; } /** Returns the determined score limits for a project. */ export interface GetScoreLimitsResponse { minThreshold: number; maxThreshold: number; } export interface GetKeywordsRequest { projectId: string; } export interface GetKeywordsResponse { keyword: Keyword | undefined; id: string; } export declare const OutputMessage: MessageFns<OutputMessage>; export declare const OutputMessage_DataEntry: MessageFns<OutputMessage_DataEntry>; export declare const Intent: MessageFns<Intent>; export declare const IntentInput: MessageFns<IntentInput>; export declare const Relation: MessageFns<Relation>; export declare const Keyword: MessageFns<Keyword>; export declare const UpdateContentRequest: MessageFns<UpdateContentRequest>; export declare const UpdateContentResponse: MessageFns<UpdateContentResponse>; export declare const RemoveContentRequest: MessageFns<RemoveContentRequest>; export declare const RemoveContentResponse: MessageFns<RemoveContentResponse>; export declare const GetContentRequest: MessageFns<GetContentRequest>; export declare const GetContentResponse: MessageFns<GetContentResponse>; export declare const ContentFilter: MessageFns<ContentFilter>; export declare const ContentResponseItem: MessageFns<ContentResponseItem>; export declare const GetIntentsRequest: MessageFns<GetIntentsRequest>; export declare const GetScoreLimitsRequest: MessageFns<GetScoreLimitsRequest>; export declare const GetScoreLimitsResponse: MessageFns<GetScoreLimitsResponse>; export declare const GetKeywordsRequest: MessageFns<GetKeywordsRequest>; export declare const GetKeywordsResponse: MessageFns<GetKeywordsResponse>; 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 {};