-
Notifications
You must be signed in to change notification settings - Fork 275
/
Copy pathconversation.d.ts
132 lines (132 loc) · 3.68 KB
/
conversation.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
/**
* Contains text and audio information about a item
* Can also be used as a delta
* @typedef {Object} ItemContentDeltaType
* @property {string} [text]
* @property {Int16Array} [audio]
* @property {string} [arguments]
* @property {string} [transcript]
*/
/**
* RealtimeConversation holds conversation history
* and performs event validation for RealtimeAPI
* @class
*/
export class RealtimeConversation {
defaultFrequency: number;
EventProcessors: {
'conversation.item.created': (event: any) => {
item: any;
delta: any;
};
'conversation.item.truncated': (event: any) => {
item: any;
delta: any;
};
'conversation.item.deleted': (event: any) => {
item: any;
delta: any;
};
'conversation.item.input_audio_transcription.completed': (event: any) => {
item: any;
delta: {
transcript: any;
};
};
'input_audio_buffer.speech_started': (event: any) => {
item: any;
delta: any;
};
'input_audio_buffer.speech_stopped': (event: any, inputAudioBuffer: any) => {
item: any;
delta: any;
};
'response.created': (event: any) => {
item: any;
delta: any;
};
'response.output_item.added': (event: any) => {
item: any;
delta: any;
};
'response.output_item.done': (event: any) => {
item: any;
delta: any;
};
'response.content_part.added': (event: any) => {
item: any;
delta: any;
};
'response.audio_transcript.delta': (event: any) => {
item: any;
delta: {
transcript: any;
};
};
'response.audio.delta': (event: any) => {
item: any;
delta: {
audio: Int16Array<ArrayBuffer>;
};
};
'response.text.delta': (event: any) => {
item: any;
delta: {
text: any;
};
};
'response.function_call_arguments.delta': (event: any) => {
item: any;
delta: {
arguments: any;
};
};
};
queuedInputAudio: Int16Array<ArrayBufferLike>;
/**
* Clears the conversation history and resets to default
* @returns {true}
*/
clear(): true;
itemLookup: {};
items: any[];
responseLookup: {};
responses: any[];
queuedSpeechItems: {};
queuedTranscriptItems: {};
/**
* Queue input audio for manual speech event
* @param {Int16Array} inputAudio
* @returns {Int16Array}
*/
queueInputAudio(inputAudio: Int16Array): Int16Array;
/**
* Process an event from the WebSocket server and compose items
* @param {Object} event
* @param {...any} args
* @returns {item: import('./client.js').ItemType | null, delta: ItemContentDeltaType | null}
*/
processEvent(event: any, ...args: any[]): item;
/**
* Retrieves a item by id
* @param {string} id
* @returns {import('./client.js').ItemType}
*/
getItem(id: string): import("./client.js").ItemType;
/**
* Retrieves all items in the conversation
* @returns {import('./client.js').ItemType[]}
*/
getItems(): import("./client.js").ItemType[];
}
/**
* Contains text and audio information about a item
* Can also be used as a delta
*/
export type ItemContentDeltaType = {
text?: string;
audio?: Int16Array;
arguments?: string;
transcript?: string;
};
//# sourceMappingURL=conversation.d.ts.map