@micdrop/mistral 1.2.0 → 1.3.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.
- package/dist/index.d.mts +28 -17
- package/dist/index.d.ts +28 -17
- package/dist/index.js +246 -222
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +247 -223
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -13,10 +13,17 @@ interface MistralAgentOptions extends AgentOptions {
|
|
|
13
13
|
declare class MistralAgent extends Agent<MistralAgentOptions> {
|
|
14
14
|
private mistral;
|
|
15
15
|
constructor(options: MistralAgentOptions);
|
|
16
|
-
protected generateAnswer(stream: Writable,
|
|
16
|
+
protected generateAnswer(stream: Writable, signal: AbortSignal): Promise<void>;
|
|
17
|
+
/**
|
|
18
|
+
* Runs one request, writing its text to the stream and running its tools.
|
|
19
|
+
*
|
|
20
|
+
* It throws a plain error when the request failed before producing
|
|
21
|
+
* anything, which can then be retried, and a {@link StepInterruptedError}
|
|
22
|
+
* once something was written or done.
|
|
23
|
+
*/
|
|
24
|
+
private generateStep;
|
|
17
25
|
private buildMessages;
|
|
18
26
|
private buildTools;
|
|
19
|
-
cancel(): void;
|
|
20
27
|
}
|
|
21
28
|
|
|
22
29
|
/**
|
|
@@ -30,33 +37,37 @@ interface MistralSTTOptions {
|
|
|
30
37
|
model?: string;
|
|
31
38
|
encoding?: MistralAudioEncoding;
|
|
32
39
|
targetStreamingDelayMs?: number;
|
|
40
|
+
/** How long a connection attempt may take */
|
|
33
41
|
connectionTimeout?: number;
|
|
42
|
+
/** How long an utterance waits for its transcript once it ended */
|
|
34
43
|
transcriptionTimeout?: number;
|
|
44
|
+
/** Delay between two connection attempts */
|
|
35
45
|
retryDelay?: number;
|
|
46
|
+
/** How many attempts in a row may fail before `Failed` is emitted */
|
|
36
47
|
maxRetry?: number;
|
|
37
48
|
}
|
|
38
49
|
declare class MistralSTT extends STT {
|
|
39
50
|
private options;
|
|
40
|
-
private socket
|
|
41
|
-
private
|
|
42
|
-
private
|
|
43
|
-
private connectionTimeout?;
|
|
44
|
-
private transcriptionTimeout?;
|
|
45
|
-
private audioChunksPending;
|
|
46
|
-
private transcriptDelta;
|
|
47
|
-
private retryCount;
|
|
48
|
-
private destroyed;
|
|
51
|
+
private socket;
|
|
52
|
+
private utterances;
|
|
53
|
+
private staleFlushes;
|
|
49
54
|
constructor(options: MistralSTTOptions);
|
|
50
55
|
transcribe(audioStream: Readable): void;
|
|
51
56
|
destroy(): void;
|
|
52
|
-
private connect;
|
|
53
57
|
private getURL;
|
|
54
|
-
private
|
|
55
|
-
private
|
|
56
|
-
private
|
|
58
|
+
private getSessionUpdate;
|
|
59
|
+
private onOpen;
|
|
60
|
+
private onMessage;
|
|
61
|
+
private onFailed;
|
|
62
|
+
private endUtterance;
|
|
57
63
|
private flushAudio;
|
|
58
|
-
private
|
|
59
|
-
|
|
64
|
+
private get transcriptionTimeout();
|
|
65
|
+
/** Whether an answer to a timed out flush may still be on its way */
|
|
66
|
+
private hasStaleFlush;
|
|
67
|
+
private complete;
|
|
68
|
+
private removeUtterance;
|
|
69
|
+
private dropUtterance;
|
|
70
|
+
private sendAudioChunk;
|
|
60
71
|
}
|
|
61
72
|
|
|
62
73
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -13,10 +13,17 @@ interface MistralAgentOptions extends AgentOptions {
|
|
|
13
13
|
declare class MistralAgent extends Agent<MistralAgentOptions> {
|
|
14
14
|
private mistral;
|
|
15
15
|
constructor(options: MistralAgentOptions);
|
|
16
|
-
protected generateAnswer(stream: Writable,
|
|
16
|
+
protected generateAnswer(stream: Writable, signal: AbortSignal): Promise<void>;
|
|
17
|
+
/**
|
|
18
|
+
* Runs one request, writing its text to the stream and running its tools.
|
|
19
|
+
*
|
|
20
|
+
* It throws a plain error when the request failed before producing
|
|
21
|
+
* anything, which can then be retried, and a {@link StepInterruptedError}
|
|
22
|
+
* once something was written or done.
|
|
23
|
+
*/
|
|
24
|
+
private generateStep;
|
|
17
25
|
private buildMessages;
|
|
18
26
|
private buildTools;
|
|
19
|
-
cancel(): void;
|
|
20
27
|
}
|
|
21
28
|
|
|
22
29
|
/**
|
|
@@ -30,33 +37,37 @@ interface MistralSTTOptions {
|
|
|
30
37
|
model?: string;
|
|
31
38
|
encoding?: MistralAudioEncoding;
|
|
32
39
|
targetStreamingDelayMs?: number;
|
|
40
|
+
/** How long a connection attempt may take */
|
|
33
41
|
connectionTimeout?: number;
|
|
42
|
+
/** How long an utterance waits for its transcript once it ended */
|
|
34
43
|
transcriptionTimeout?: number;
|
|
44
|
+
/** Delay between two connection attempts */
|
|
35
45
|
retryDelay?: number;
|
|
46
|
+
/** How many attempts in a row may fail before `Failed` is emitted */
|
|
36
47
|
maxRetry?: number;
|
|
37
48
|
}
|
|
38
49
|
declare class MistralSTT extends STT {
|
|
39
50
|
private options;
|
|
40
|
-
private socket
|
|
41
|
-
private
|
|
42
|
-
private
|
|
43
|
-
private connectionTimeout?;
|
|
44
|
-
private transcriptionTimeout?;
|
|
45
|
-
private audioChunksPending;
|
|
46
|
-
private transcriptDelta;
|
|
47
|
-
private retryCount;
|
|
48
|
-
private destroyed;
|
|
51
|
+
private socket;
|
|
52
|
+
private utterances;
|
|
53
|
+
private staleFlushes;
|
|
49
54
|
constructor(options: MistralSTTOptions);
|
|
50
55
|
transcribe(audioStream: Readable): void;
|
|
51
56
|
destroy(): void;
|
|
52
|
-
private connect;
|
|
53
57
|
private getURL;
|
|
54
|
-
private
|
|
55
|
-
private
|
|
56
|
-
private
|
|
58
|
+
private getSessionUpdate;
|
|
59
|
+
private onOpen;
|
|
60
|
+
private onMessage;
|
|
61
|
+
private onFailed;
|
|
62
|
+
private endUtterance;
|
|
57
63
|
private flushAudio;
|
|
58
|
-
private
|
|
59
|
-
|
|
64
|
+
private get transcriptionTimeout();
|
|
65
|
+
/** Whether an answer to a timed out flush may still be on its way */
|
|
66
|
+
private hasStaleFlush;
|
|
67
|
+
private complete;
|
|
68
|
+
private removeUtterance;
|
|
69
|
+
private dropUtterance;
|
|
70
|
+
private sendAudioChunk;
|
|
60
71
|
}
|
|
61
72
|
|
|
62
73
|
/**
|