@voctiv/agent-sdk 0.2.13 → 0.2.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,26 +6,63 @@
6
6
  * `intents_exclude`) are mapped to `entities_policy` / `intents_policy`.
7
7
  */
8
8
  export interface NluExtractOptions {
9
- /** Include only these entity types (e.g. `"date"`, `"phone"`); forwarded as `entities`. */
9
+ /**
10
+ * Entity names to search — always forwarded to nlu-engine as a JSON array.
11
+ * Prefer `['confirmation', 'check']`; comma-separated string is accepted for LE compat.
12
+ */
10
13
  entities?: string | string[] | null;
11
14
  /** Legacy compatibility field; mapped to exclude policy on nlu-engine. */
12
15
  entities_exclude?: string | string[] | null;
13
- /** Include only these intent names; forwarded as `intents`. */
16
+ /**
17
+ * Intent names to search — always forwarded to nlu-engine as a JSON array.
18
+ * Prefer `['balance_check']`; comma-separated string is accepted for LE compat.
19
+ */
14
20
  intents?: string | string[] | null;
15
21
  /** Legacy compatibility field; mapped to exclude policy on nlu-engine. */
16
22
  intents_exclude?: string | string[] | null;
17
23
  /**
18
24
  * Additional context for disambiguation.
19
25
  *
20
- * Objects and arrays are JSON-stringified before sending. Omitted when not set
21
- * (logic-executor default).
26
+ * Objects and arrays are JSON-stringified before sending. When omitted, the runtime
27
+ * uses dialog `flag` (logic-executor scripts usually pass the same value explicitly).
22
28
  */
23
29
  context?: string | unknown[] | Record<string, unknown> | null;
30
+ /**
31
+ * BCP-47 / LE language for this call only (e.g. `es-ES`).
32
+ * Default NLU language comes from the LE agent (`_nlu.language`), not `context.lang`.
33
+ */
34
+ language?: string;
35
+ /** Alias for {@link language}. */
36
+ lang?: string;
24
37
  /** Forwarded as `use_neuro_api`; nlu-engine may call remote NLU API when true. */
25
38
  use_neuro_api?: boolean;
26
39
  /** Forwarded as `use_synonyms`; enables synonym expansion in nlu-engine. */
27
40
  use_synonyms?: boolean;
28
41
  }
29
- /** Raw parsed JSON response from nlu-engine `/nlu_engine` endpoint. */
30
- export type NluInferResult = Record<string, unknown>;
42
+ export interface NluProbabilityValue {
43
+ value: unknown;
44
+ probability: number;
45
+ }
46
+ /**
47
+ * logic-executor `NeuroNluRecognitionResult` method surface returned from
48
+ * `platform.nlu.extract()` / `extract$()`.
49
+ */
50
+ export interface NluInferResult {
51
+ utterance(): string | null;
52
+ context(): unknown;
53
+ entity(entityName: string): unknown;
54
+ intent(intentName: string): unknown;
55
+ has_entity(entityName: string): boolean;
56
+ has_intent(intentName: string): boolean;
57
+ has_entities(): boolean;
58
+ has_intents(): boolean;
59
+ entities(): Record<string, unknown>;
60
+ intents(): Record<string, unknown>;
61
+ entity_with_probability(entityName: string): NluProbabilityValue | null;
62
+ intent_with_probability(intentName: string): NluProbabilityValue | null;
63
+ entities_with_probability(): Record<string, NluProbabilityValue>;
64
+ intents_with_probability(): Record<string, NluProbabilityValue>;
65
+ dump(): Record<string, unknown>;
66
+ dump_json(): string;
67
+ }
31
68
  //# sourceMappingURL=nlu.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"nlu.d.ts","sourceRoot":"","sources":["../../src/types/nlu.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,WAAW,iBAAiB;IAChC,2FAA2F;IAC3F,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,CAAC;IACpC,0EAA0E;IAC1E,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,CAAC;IAC5C,+DAA+D;IAC/D,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,CAAC;IACnC,0EAA0E;IAC1E,eAAe,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,CAAC;IAC3C;;;;;OAKG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC9D,kFAAkF;IAClF,aAAa,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,MAAM,GAAG,OAAO,CAAC;IACpC,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC;IACxC,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC;IACxC,YAAY,IAAI,OAAO,CAAC;IACxB,WAAW,IAAI,OAAO,CAAC;IACvB,QAAQ,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpC,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,uBAAuB,CAAC,UAAU,EAAE,MAAM,GAAG,mBAAmB,GAAG,IAAI,CAAC;IACxE,uBAAuB,CAAC,UAAU,EAAE,MAAM,GAAG,mBAAmB,GAAG,IAAI,CAAC;IACxE,yBAAyB,IAAI,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;IACjE,wBAAwB,IAAI,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;IAChE,IAAI,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,SAAS,IAAI,MAAM,CAAC;CACrB"}
@@ -18,13 +18,13 @@ export interface NluScriptApi {
18
18
  * Extract intents and entities from one user utterance.
19
19
  *
20
20
  * The runtime sends a logic-executor-compatible recognition request to
21
- * nlu-engine (`/nlu_engine?agent_id=…`). Context is included only when
22
- * `options.context` is set explicitly.
21
+ * nlu-engine (`/nlu_engine?agent_id=…`). Pass `options.context` explicitly when
22
+ * needed (same as LE `nlu.extract(..., context=flag)`).
23
23
  *
24
24
  * @param utterance - User input text to analyze.
25
25
  * @param options - Optional NLU filters and flags. `entities`, `intents`,
26
- * `use_neuro_api`, and `use_synonyms` are forwarded by ScriptEngine.
27
- * @returns Raw parsed JSON response from nlu-engine (recognition result dump).
26
+ * `language` / `lang`, `use_neuro_api`, and `use_synonyms` are forwarded by ScriptEngine.
27
+ * @returns logic-executor-compatible {@link NluInferResult} (`entity()`, `has_entities()`, ).
28
28
  */
29
29
  extract(utterance: string, options?: NluExtractOptions): Promise<NluInferResult>;
30
30
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voctiv/agent-sdk",
3
- "version": "0.2.13",
3
+ "version": "0.2.14",
4
4
  "description": "Voctiv TypeScript agent SDK: defineScript and platform types for the voice/dialog scripting runtime.",
5
5
  "license": "UNLICENSED",
6
6
  "author": "",