@guava-ai/guava-sdk 0.2.0 → 0.4.0

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.
Files changed (61) hide show
  1. package/README.md +2 -7
  2. package/bin/example-runner.js +16 -7
  3. package/dist/examples/credit-card-activation.js +94 -112
  4. package/dist/examples/credit-card-activation.js.map +1 -1
  5. package/dist/examples/property-insurance.js +12 -26
  6. package/dist/examples/property-insurance.js.map +1 -1
  7. package/dist/examples/scheduling-outbound.d.ts +1 -0
  8. package/dist/examples/scheduling-outbound.js +62 -0
  9. package/dist/examples/scheduling-outbound.js.map +1 -0
  10. package/dist/examples/thai-palace.js +61 -0
  11. package/dist/examples/thai-palace.js.map +1 -0
  12. package/dist/package.json +7 -5
  13. package/dist/src/action_item.d.ts +34 -12
  14. package/dist/src/action_item.js +34 -7
  15. package/dist/src/action_item.js.map +1 -1
  16. package/dist/src/call-controller.d.ts +137 -0
  17. package/dist/src/call-controller.js +433 -0
  18. package/dist/src/call-controller.js.map +1 -0
  19. package/dist/src/commands.d.ts +67 -27
  20. package/dist/src/commands.js +41 -27
  21. package/dist/src/commands.js.map +1 -1
  22. package/dist/src/events.d.ts +47 -30
  23. package/dist/src/events.js +42 -36
  24. package/dist/src/events.js.map +1 -1
  25. package/dist/src/example_data.d.ts +1 -0
  26. package/dist/src/example_data.js +33 -0
  27. package/dist/src/example_data.js.map +1 -1
  28. package/dist/src/helpers/openai.d.ts +12 -1
  29. package/dist/src/helpers/openai.js +168 -68
  30. package/dist/src/helpers/openai.js.map +1 -1
  31. package/dist/src/index.d.ts +6 -121
  32. package/dist/src/index.js +249 -483
  33. package/dist/src/index.js.map +1 -1
  34. package/dist/src/logging.d.ts +2 -1
  35. package/dist/src/logging.js +32 -7
  36. package/dist/src/logging.js.map +1 -1
  37. package/dist/src/telemetry.d.ts +23 -0
  38. package/dist/src/telemetry.js +98 -0
  39. package/dist/src/telemetry.js.map +1 -0
  40. package/dist/src/utils.d.ts +3 -0
  41. package/dist/src/utils.js +28 -0
  42. package/dist/src/utils.js.map +1 -0
  43. package/examples/biome.json +5 -0
  44. package/examples/credit-card-activation.ts +20 -26
  45. package/examples/property-insurance.ts +6 -16
  46. package/examples/scheduling-outbound.ts +80 -0
  47. package/examples/{thai_palace.ts → thai-palace.ts} +10 -13
  48. package/package.json +7 -5
  49. package/src/action_item.ts +53 -13
  50. package/src/call-controller.ts +451 -0
  51. package/src/commands.ts +58 -42
  52. package/src/events.ts +66 -51
  53. package/src/example_data.ts +42 -0
  54. package/src/helpers/openai.ts +73 -18
  55. package/src/index.ts +81 -403
  56. package/src/logging.ts +39 -7
  57. package/src/telemetry.ts +125 -0
  58. package/src/utils.ts +32 -0
  59. package/dist/examples/thai_palace.js +0 -79
  60. package/dist/examples/thai_palace.js.map +0 -1
  61. /package/dist/examples/{thai_palace.d.ts → thai-palace.d.ts} +0 -0
@@ -1,34 +1,47 @@
1
1
  import * as z from "zod";
2
- export declare const fieldItemType: z.ZodUnion<z.ZodLiteral<"text" | "integer" | "date" | "datetime" | "multiple_choice">[]>;
3
- export type FieldItemType = z.input<typeof fieldItemType>;
4
- export declare const fieldItem: z.ZodObject<{
2
+ export declare const FieldItemType: z.ZodUnion<z.ZodLiteral<"text" | "integer" | "date" | "datetime" | "multiple_choice" | "calendar_slot">[]>;
3
+ export type FieldItemType = z.input<typeof FieldItemType>;
4
+ export type ChoiceGenerator = (query: string) => Promise<[string[], string[]]>;
5
+ export declare const FieldItem: z.ZodObject<{
5
6
  item_type: z.ZodLiteral<"field">;
6
7
  key: z.ZodString;
7
8
  description: z.ZodString;
8
- field_type: z.ZodUnion<z.ZodLiteral<"text" | "integer" | "date" | "datetime" | "multiple_choice">[]>;
9
+ field_type: z.ZodUnion<z.ZodLiteral<"text" | "integer" | "date" | "datetime" | "multiple_choice" | "calendar_slot">[]>;
9
10
  required: z.ZodDefault<z.ZodBoolean>;
10
11
  choices: z.ZodDefault<z.ZodArray<z.ZodString>>;
12
+ choiceGenerator: z.ZodOptional<z.ZodCustom<ChoiceGenerator, ChoiceGenerator>>;
11
13
  }, z.core.$strip>;
12
- export type Field = z.input<typeof fieldItem>;
13
- export declare const sayItem: z.ZodObject<{
14
+ export type FieldItem = z.input<typeof FieldItem>;
15
+ export declare const SerializableFieldItem: z.ZodObject<{
16
+ item_type: z.ZodLiteral<"field">;
17
+ key: z.ZodString;
18
+ description: z.ZodString;
19
+ field_type: z.ZodUnion<z.ZodLiteral<"text" | "integer" | "date" | "datetime" | "multiple_choice" | "calendar_slot">[]>;
20
+ required: z.ZodDefault<z.ZodBoolean>;
21
+ choices: z.ZodDefault<z.ZodArray<z.ZodString>>;
22
+ is_search_field: z.ZodDefault<z.ZodBoolean>;
23
+ }, z.core.$strip>;
24
+ export type SerializableFieldItem = z.input<typeof SerializableFieldItem>;
25
+ export declare const SayItem: z.ZodObject<{
14
26
  item_type: z.ZodLiteral<"say">;
15
27
  statement: z.ZodString;
16
28
  key: z.ZodDefault<z.ZodString>;
17
29
  }, z.core.$strip>;
18
- export type Say = z.input<typeof sayItem>;
19
- export declare const todoItem: z.ZodObject<{
30
+ export type SayItem = z.input<typeof SayItem>;
31
+ export declare const TodoItem: z.ZodObject<{
20
32
  item_type: z.ZodLiteral<"todo">;
21
33
  description: z.ZodString;
22
34
  key: z.ZodDefault<z.ZodString>;
23
35
  }, z.core.$strip>;
24
- export type Todo = z.input<typeof todoItem>;
25
- export declare const actionItem: z.ZodUnion<readonly [z.ZodObject<{
36
+ export type TodoItem = z.input<typeof TodoItem>;
37
+ export declare const ActionItem: z.ZodUnion<readonly [z.ZodObject<{
26
38
  item_type: z.ZodLiteral<"field">;
27
39
  key: z.ZodString;
28
40
  description: z.ZodString;
29
- field_type: z.ZodUnion<z.ZodLiteral<"text" | "integer" | "date" | "datetime" | "multiple_choice">[]>;
41
+ field_type: z.ZodUnion<z.ZodLiteral<"text" | "integer" | "date" | "datetime" | "multiple_choice" | "calendar_slot">[]>;
30
42
  required: z.ZodDefault<z.ZodBoolean>;
31
43
  choices: z.ZodDefault<z.ZodArray<z.ZodString>>;
44
+ is_search_field: z.ZodDefault<z.ZodBoolean>;
32
45
  }, z.core.$strip>, z.ZodObject<{
33
46
  item_type: z.ZodLiteral<"say">;
34
47
  statement: z.ZodString;
@@ -38,4 +51,13 @@ export declare const actionItem: z.ZodUnion<readonly [z.ZodObject<{
38
51
  description: z.ZodString;
39
52
  key: z.ZodDefault<z.ZodString>;
40
53
  }, z.core.$strip>]>;
41
- export type ActionItem = z.input<typeof actionItem>;
54
+ export type ActionItem = z.input<typeof ActionItem>;
55
+ export declare function Field(options: {
56
+ key: string;
57
+ description: string;
58
+ fieldType: FieldItemType;
59
+ required?: boolean;
60
+ choices?: string[];
61
+ choiceGenerator?: ChoiceGenerator;
62
+ }): FieldItem;
63
+ export declare function Say(statement: string): SayItem;
@@ -1,29 +1,56 @@
1
1
  import * as z from "zod";
2
- export const fieldItemType = z.union(["text", "date", "datetime", "integer", "multiple_choice"].map((val) => z.literal(val)));
3
- export const fieldItem = z
2
+ export const FieldItemType = z.union(["text", "date", "datetime", "integer", "multiple_choice", "calendar_slot"].map((val) => z.literal(val)));
3
+ export const FieldItem = z
4
4
  .object({
5
5
  item_type: z.literal("field"),
6
6
  key: z.string(),
7
7
  description: z.string(),
8
- field_type: fieldItemType,
8
+ field_type: FieldItemType,
9
9
  required: z.boolean().default(true),
10
10
  choices: z.array(z.string()).default([]),
11
+ choiceGenerator: z.custom((val) => typeof val === "function").optional(),
11
12
  })
12
13
  .refine((field) => {
13
- if (field.field_type == "multiple_choice" && field.choices.length > 10) {
14
+ if (field.field_type === "multiple_choice" && field.choices.length > 10) {
14
15
  process.emitWarning("Performance degrades with large number of choices for multiple choice field.", "ACTION_ITEM");
15
16
  }
16
17
  return true;
17
18
  });
18
- export const sayItem = z.object({
19
+ export const SerializableFieldItem = z.object({
20
+ item_type: z.literal("field"),
21
+ key: z.string(),
22
+ description: z.string(),
23
+ field_type: FieldItemType,
24
+ required: z.boolean().default(true),
25
+ choices: z.array(z.string()).default([]),
26
+ is_search_field: z.boolean().default(false),
27
+ });
28
+ export const SayItem = z.object({
19
29
  item_type: z.literal("say"),
20
30
  statement: z.string(),
21
31
  key: z.string().default(() => Math.random().toString(16).substring(2, 6)),
22
32
  });
23
- export const todoItem = z.object({
33
+ export const TodoItem = z.object({
24
34
  item_type: z.literal("todo"),
25
35
  description: z.string(),
26
36
  key: z.string().default(() => Math.random().toString(16).substring(2, 6)),
27
37
  });
28
- export const actionItem = z.union([fieldItem, sayItem, todoItem]);
38
+ export const ActionItem = z.union([SerializableFieldItem, SayItem, TodoItem]);
39
+ export function Field(options) {
40
+ return FieldItem.parse({
41
+ item_type: "field",
42
+ key: options.key,
43
+ description: options.description,
44
+ field_type: options.fieldType,
45
+ required: options.required,
46
+ choices: options.choices,
47
+ choiceGenerator: options.choiceGenerator,
48
+ });
49
+ }
50
+ export function Say(statement) {
51
+ return SayItem.parse({
52
+ item_type: "say",
53
+ statement: statement,
54
+ });
55
+ }
29
56
  //# sourceMappingURL=action_item.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"action_item.js","sourceRoot":"","sources":["../../src/action_item.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CACjC,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,iBAAiB,CAAW,CAAC,GAAG,CACvE,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CACxB,CACF,CAAC;AAGF,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC;KACvB,MAAM,CAAC;IACN,SAAS,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;IAC7B,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;IACf,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;IACvB,UAAU,EAAE,aA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,CAAC,CAAC,KAAK,CAAC,CAAC,qBAAqB,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC;AAG9E,MAAM,UAAU,KAAK,CAAC,OAOrB;IACC,OAAO,SAAS,CAAC,KAAK,CAAC;QACrB,SAAS,EAAE,OAAO;QAClB,GAAG,EAAE,OAAO,CAAC,GAAG;QAChB,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,UAAU,EAAE,OAAO,CAAC,SAAS;QAC7B,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,eAAe,EAAE,OAAO,CAAC,eAAe;KACzC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,GAAG,CAAC,SAAiB;IACnC,OAAO,OAAO,CAAC,KAAK,CAAC;QACnB,SAAS,EAAE,KAAK;QAChB,SAAS,EAAE,SAAS;KACrB,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,137 @@
1
+ import { type Logger } from "./logging.ts";
2
+ import { type Command } from "./commands.ts";
3
+ import type { GuavaEvent, CallerSpeechEvent, AgentSpeechEvent } from "./events.ts";
4
+ import { type FieldItem, type SayItem } from "./action_item.ts";
5
+ export type TaskObjective = {
6
+ objective: string;
7
+ } | {
8
+ objective?: string;
9
+ checklist: (FieldItem | SayItem | string)[];
10
+ };
11
+ export type ReachPersonOutcome = {
12
+ key: string;
13
+ onOutcome: () => void;
14
+ description?: string;
15
+ nextActionPreview?: string;
16
+ };
17
+ type ReachPersonOptions = {
18
+ onSuccess: () => void;
19
+ onFailure: () => void;
20
+ greeting?: string;
21
+ } | {
22
+ outcomes: ReachPersonOutcome[];
23
+ greeting?: string;
24
+ };
25
+ /**
26
+ * Interface between Guava services and user-supplied code
27
+ */
28
+ export declare class CallController {
29
+ private _commandQueue;
30
+ private _on_complete_current_task?;
31
+ private _current_task_id?;
32
+ /**
33
+ * @protected
34
+ * @description logger used to emit diagnostics
35
+ */
36
+ protected logger: Logger;
37
+ private _drain?;
38
+ private _fieldValues;
39
+ private _searchFunctionsByKey;
40
+ constructor(logger?: Logger);
41
+ /**
42
+ * @description Supply a function used to consume commands from the internal command queue.
43
+ *
44
+ * The function is expected to remove from the argument array commands that it has handled (iterating
45
+ * through the result of `Array.splice(0)` is sufficient)
46
+ */
47
+ setDrain(newDrain: (_: Command[]) => Promise<void>): void;
48
+ /**
49
+ * @description [inbound] receive a call, and process further.
50
+ */
51
+ protected acceptCall(): Promise<void>;
52
+ /**
53
+ * @description read a span of text verbatim
54
+ */
55
+ protected readScript(script: string): Promise<void>;
56
+ /**
57
+ * @description [inbound] reject a call
58
+ */
59
+ protected rejectCall(): Promise<void>;
60
+ protected addInfo(_info: string): Promise<void>;
61
+ /**
62
+ * @description read a span of text non-verbatim
63
+ */
64
+ protected sendInstruction(instruction: string): Promise<void>;
65
+ /**
66
+ * @description provide identifiers the agent will use to identify the virtual agent
67
+ */
68
+ protected setPersona(args: {
69
+ organizationName?: string;
70
+ agentName?: string;
71
+ agentPurpose?: string;
72
+ voice?: string;
73
+ }): Promise<void>;
74
+ /**
75
+ * @description direct the agent to collect information
76
+ * @param goal {} an objective string and/or a checklist of information to collect
77
+ * @param on_complete {} a callback to call once the information is available from the agent
78
+ * @param args {} arguments to pass through to the `on_complete` callback
79
+ */
80
+ protected setTask(goal: TaskObjective, on_complete?: (...c: any[]) => void, ...args: any[]): void;
81
+ /**
82
+ * @description direct the agent to collect information, continuing execution once the agent has collected the information
83
+ * @param goal {} an objective string and/or a checklist of information to collect
84
+ */
85
+ protected awaitTask(goal: TaskObjective): Promise<void>;
86
+ /**
87
+ * @description retrieve a piece of information that the agent has collected
88
+ * @param key {string} key of the field checklist item
89
+ */
90
+ protected getField(key: string): unknown;
91
+ /**
92
+ * @description [inbound] hang up an accepted call
93
+ */
94
+ protected hangup(final_instructions?: string): Promise<void>;
95
+ /**
96
+ * @description helper for reaching a specific contact on an outbound call and recording their availability.
97
+ */
98
+ protected reachPerson(contactFullName: string, options: ReachPersonOptions): void;
99
+ /**
100
+ * @description transfer an accepted call
101
+ */
102
+ protected transfer(to_number: string, transfer_message?: string): void;
103
+ private sendCommand;
104
+ private flush;
105
+ onEvent(event: GuavaEvent): Promise<void>;
106
+ /**
107
+ * @description called when an inbound call is received. The overriding function must start
108
+ * with `await super.onIncomingCall(from_number)`
109
+ */
110
+ onIncomingCall(from_number?: string): Promise<void>;
111
+ /**
112
+ * @description called when a call is connected by the API, whether inbound or outbound
113
+ */
114
+ onCallStart(): Promise<void>;
115
+ /**
116
+ * @description called when the caller speaks to the agent.
117
+ */
118
+ onCallerSpeech(event: CallerSpeechEvent): Promise<void>;
119
+ /**
120
+ * @description called when the agent speaks to the caller.
121
+ */
122
+ onAgentSpeech(event: AgentSpeechEvent): Promise<void>;
123
+ /**
124
+ * @description called when the caller expresses a task they wish to execute
125
+ */
126
+ onIntent(intent: string): Promise<string | null>;
127
+ /**
128
+ * @description called when the agent needs to respond to a question that it doesn't know
129
+ * the answer to.
130
+ */
131
+ onQuestion(question: string): Promise<string>;
132
+ /**
133
+ * @description called when the bot session has ended.
134
+ */
135
+ onSessionDone(): void;
136
+ }
137
+ export {};