livekit-agents-plugin-mistralai 0.0.1

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/LICENSE ADDED
@@ -0,0 +1,17 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ Copyright 2025 LiveKit, Inc.
6
+
7
+ Licensed under the Apache License, Version 2.0 (the "License");
8
+ you may not use this file except in compliance with the License.
9
+ You may obtain a copy of the License at
10
+
11
+ http://www.apache.org/licenses/LICENSE-2.0
12
+
13
+ Unless required by applicable law or agreed to in writing, software
14
+ distributed under the License is distributed on an "AS IS" BASIS,
15
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ See the License for the specific language governing permissions and
17
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,93 @@
1
+ # MistralAI Plugin for LiveKit Agents
2
+
3
+ Support for MistralAI LLM and STT models in LiveKit Agents (Node.js/TypeScript).
4
+
5
+ See [https://docs.livekit.io/agents/integrations/mistral/](https://docs.livekit.io/agents/integrations/mistral/) for more information.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ npm install livekit-agents-plugin-mistralai
11
+ ```
12
+
13
+ ## Pre-requisites
14
+
15
+ You'll need an API key from MistralAI. It can be set as an environment variable:
16
+
17
+ ```bash
18
+ export MISTRAL_API_KEY=your_api_key_here
19
+ ```
20
+
21
+ ## Usage
22
+
23
+ ### LLM (Language Model)
24
+
25
+ ```typescript
26
+ import { LLM } from 'livekit-agents-plugin-mistralai';
27
+ import { AgentSession, ChatContext } from '@livekit/agents';
28
+
29
+ // Create an LLM instance
30
+ const llm = new LLM({
31
+ model: 'ministral-8b-2410',
32
+ apiKey: process.env.MISTRAL_API_KEY, // or set MISTRAL_API_KEY env var
33
+ temperature: 0.7,
34
+ maxCompletionTokens: 1000,
35
+ });
36
+
37
+ // Use with AgentSession
38
+ const session = new AgentSession({
39
+ llm: llm,
40
+ // ... other options
41
+ });
42
+ ```
43
+
44
+ ### STT (Speech-to-Text)
45
+
46
+ ```typescript
47
+ import { STT } from 'livekit-agents-plugin-mistralai';
48
+ import { AgentSession } from '@livekit/agents';
49
+
50
+ // Create an STT instance
51
+ const stt = new STT({
52
+ model: 'voxtral-mini-latest',
53
+ language: 'en',
54
+ apiKey: process.env.MISTRAL_API_KEY, // or set MISTRAL_API_KEY env var
55
+ });
56
+
57
+ // Use with AgentSession
58
+ const session = new AgentSession({
59
+ stt: stt,
60
+ // ... other options
61
+ });
62
+ ```
63
+
64
+ ## Supported Models
65
+
66
+ ### Chat Models (LLM)
67
+ - `mistral-medium-latest`
68
+ - `mistral-large-latest`
69
+ - `mistral-medium-2508`
70
+ - `mistral-large-2411`
71
+ - `mistral-medium-2505`
72
+ - `ministral-3b-2410`
73
+ - `ministral-8b-2410`
74
+ - `mistral-large-2512`
75
+ - `ministral-14b-2512`
76
+ - `ministral-8b-2512`
77
+ - `ministral-3b-2512`
78
+ - `mistral-small-2407`
79
+
80
+ ### STT Models
81
+ - `voxtral-small-2507`
82
+ - `voxtral-mini-2507`
83
+ - `voxtral-mini-latest`
84
+ - `voxtral-small-latest`
85
+
86
+ ## License
87
+
88
+ Apache-2.0
89
+
90
+ ## Links
91
+
92
+ - [LiveKit Agents Documentation](https://docs.livekit.io/agents/)
93
+ - [MistralAI Documentation](https://docs.mistral.ai/)
@@ -0,0 +1,6 @@
1
+ /** LiveKit plugin for Mistral AI models. Supports Chat and STT models */
2
+ export { LLM, type MistralLLMOptions } from './llm.js';
3
+ export { STT, type MistralSTTOptions } from './stt.js';
4
+ export { type ChatModels, type STTModels } from './models.js';
5
+ export declare const __version__ = "1.3.10";
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAcA,yEAAyE;AAEzE,OAAO,EAAE,GAAG,EAAE,KAAK,iBAAiB,EAAE,MAAM,UAAU,CAAC;AACvD,OAAO,EAAE,GAAG,EAAE,KAAK,iBAAiB,EAAE,MAAM,UAAU,CAAC;AACvD,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAE9D,eAAO,MAAM,WAAW,WAAW,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,18 @@
1
+ // Copyright 2025 LiveKit, Inc.
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+ /** LiveKit plugin for Mistral AI models. Supports Chat and STT models */
15
+ export { LLM } from './llm.js';
16
+ export { STT } from './stt.js';
17
+ export const __version__ = '1.3.10';
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,yEAAyE;AAEzE,OAAO,EAAE,GAAG,EAA0B,MAAM,UAAU,CAAC;AACvD,OAAO,EAAE,GAAG,EAA0B,MAAM,UAAU,CAAC;AAGvD,MAAM,CAAC,MAAM,WAAW,GAAG,QAAQ,CAAC"}
package/dist/llm.d.ts ADDED
@@ -0,0 +1,38 @@
1
+ import type { Mistral } from '@mistralai/mistralai';
2
+ import type { APIConnectOptions } from '@livekit/agents';
3
+ import { llm } from '@livekit/agents';
4
+ import type { ChatModels } from './models.js';
5
+ export interface MistralLLMOptions {
6
+ model?: string | ChatModels;
7
+ apiKey?: string;
8
+ client?: Mistral;
9
+ temperature?: number;
10
+ maxCompletionTokens?: number;
11
+ }
12
+ export declare class LLM extends llm.LLM {
13
+ #private;
14
+ constructor({ model, apiKey, client, temperature, maxCompletionTokens, }?: MistralLLMOptions);
15
+ label(): string;
16
+ get model(): string;
17
+ chat({ chatCtx, toolCtx, connOptions, parallelToolCalls, toolChoice, extraKwargs, }: {
18
+ chatCtx: llm.ChatContext;
19
+ toolCtx?: llm.ToolContext;
20
+ connOptions?: APIConnectOptions;
21
+ parallelToolCalls?: boolean;
22
+ toolChoice?: llm.ToolChoice;
23
+ extraKwargs?: Record<string, unknown>;
24
+ }): LLMStream;
25
+ }
26
+ export declare class LLMStream extends llm.LLMStream {
27
+ #private;
28
+ constructor(llm: LLM, { model, client, chatCtx, toolCtx, connOptions, extraKwargs, }: {
29
+ model: string | ChatModels;
30
+ client: Mistral;
31
+ chatCtx: llm.ChatContext;
32
+ toolCtx?: llm.ToolContext;
33
+ connOptions: APIConnectOptions;
34
+ extraKwargs: Record<string, unknown>;
35
+ });
36
+ protected run(): Promise<void>;
37
+ }
38
+ //# sourceMappingURL=llm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"llm.d.ts","sourceRoot":"","sources":["../src/llm.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAEpD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAKL,GAAG,EAEJ,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAQ9C,MAAM,WAAW,iBAAiB;IAChC,KAAK,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO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
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+ import { Mistral as MistralClient } from '@mistralai/mistralai';
15
+ import { APIConnectionError, APIStatusError, APITimeoutError, DEFAULT_API_CONNECT_OPTIONS, llm, shortuuid, } from '@livekit/agents';
16
+ // Mistral LLM Class
17
+ export class LLM extends llm.LLM {
18
+ #opts;
19
+ #client;
20
+ constructor({ model = 'ministral-8b-2410', apiKey, client, temperature, maxCompletionTokens, } = {}) {
21
+ super();
22
+ const apiKeyValue = apiKey ?? process.env.MISTRAL_API_KEY;
23
+ if (!apiKeyValue && !client) {
24
+ throw new Error('MistralAI API key is required. Set MISTRAL_API_KEY environment variable or pass apiKey in options.');
25
+ }
26
+ this.#opts = {
27
+ model,
28
+ temperature,
29
+ maxCompletionTokens,
30
+ };
31
+ this.#client =
32
+ client ||
33
+ new MistralClient({
34
+ apiKey: apiKeyValue,
35
+ });
36
+ }
37
+ label() {
38
+ return 'mistralai.LLM';
39
+ }
40
+ get model() {
41
+ return this.#opts.model;
42
+ }
43
+ chat({ chatCtx, toolCtx, connOptions = DEFAULT_API_CONNECT_OPTIONS, parallelToolCalls, toolChoice, extraKwargs, }) {
44
+ const extras = { ...extraKwargs };
45
+ if (this.#opts.maxCompletionTokens !== undefined) {
46
+ extras.max_completion_tokens = this.#opts.maxCompletionTokens;
47
+ }
48
+ if (this.#opts.temperature !== undefined) {
49
+ extras.temperature = this.#opts.temperature;
50
+ }
51
+ if (parallelToolCalls !== undefined) {
52
+ extras.parallel_tool_calls = parallelToolCalls;
53
+ }
54
+ if (toolChoice !== undefined) {
55
+ extras.tool_choice = toolChoice;
56
+ }
57
+ return new LLMStream(this, {
58
+ model: this.#opts.model,
59
+ client: this.#client,
60
+ chatCtx,
61
+ toolCtx,
62
+ connOptions,
63
+ extraKwargs: extras,
64
+ });
65
+ }
66
+ }
67
+ // Mistral LLM Stream
68
+ export class LLMStream extends llm.LLMStream {
69
+ #model;
70
+ #client;
71
+ #llm;
72
+ #extraKwargs;
73
+ constructor(llm, { model, client, chatCtx, toolCtx, connOptions, extraKwargs, }) {
74
+ super(llm, { chatCtx, toolCtx, connOptions });
75
+ this.#model = model;
76
+ this.#client = client;
77
+ this.#llm = llm;
78
+ this.#extraKwargs = extraKwargs;
79
+ }
80
+ async run() {
81
+ let retryable = true;
82
+ try {
83
+ // Convert chat context to MistralAI format
84
+ const [messages] = (await this.chatCtx.toProviderFormat('openai'));
85
+ // Convert tools to MistralAI format
86
+ const tools = this.toolCtx ? this.#convertTools(this.toolCtx) : undefined;
87
+ // Map OpenAI format messages to MistralAI format
88
+ const mistralMessages = messages.map((msg) => ({
89
+ role: msg.role === 'assistant' ? 'assistant' : msg.role === 'system' ? 'system' : 'user',
90
+ content: typeof msg.content === 'string' ? msg.content : msg.content.map((c) => c.text).join('\n'),
91
+ }));
92
+ const stream = await this.#client.chat.stream({
93
+ model: this.#model,
94
+ messages: mistralMessages,
95
+ tools: tools,
96
+ ...this.#extraKwargs,
97
+ });
98
+ for await (const event of stream) {
99
+ // MistralAI SDK returns events with a data property containing choices
100
+ const data = event.data || event;
101
+ if (!data.choices || data.choices.length === 0) {
102
+ continue;
103
+ }
104
+ const choice = data.choices[0];
105
+ const chatChunk = this.#parseChoice(data.id || `mistral_${Date.now()}`, choice);
106
+ if (chatChunk !== null) {
107
+ retryable = false;
108
+ this.queue.put(chatChunk);
109
+ }
110
+ }
111
+ }
112
+ catch (error) {
113
+ const err = error;
114
+ if (err.status === 408 || err.status === 504 || err.code === 408 || err.code === 504) {
115
+ throw new APITimeoutError({
116
+ message: err.message || 'Request timeout',
117
+ options: { retryable },
118
+ });
119
+ }
120
+ if (err.status && err.status >= 400 && err.status < 500) {
121
+ throw new APIStatusError({
122
+ message: err.message || 'Client error',
123
+ options: {
124
+ statusCode: err.status,
125
+ retryable: false,
126
+ },
127
+ });
128
+ }
129
+ if (err.status && err.status >= 500) {
130
+ throw new APIStatusError({
131
+ message: err.message || 'Server error',
132
+ options: {
133
+ statusCode: err.status,
134
+ retryable,
135
+ },
136
+ });
137
+ }
138
+ throw new APIConnectionError({
139
+ message: err.message || 'Connection error',
140
+ options: { retryable },
141
+ });
142
+ }
143
+ }
144
+ #convertTools(toolCtx) {
145
+ const tools = [];
146
+ for (const [name, tool] of Object.entries(toolCtx)) {
147
+ tools.push({
148
+ type: 'function',
149
+ function: {
150
+ name,
151
+ description: tool.description || '',
152
+ parameters: tool.parameters || {},
153
+ },
154
+ });
155
+ }
156
+ return tools;
157
+ }
158
+ #parseChoice(id, choice) {
159
+ const chunk = { id };
160
+ if (choice.delta?.content && typeof choice.delta.content === 'string') {
161
+ chunk.delta = {
162
+ role: 'assistant',
163
+ content: choice.delta.content,
164
+ };
165
+ }
166
+ if (choice.delta?.tool_calls || choice.delta?.toolCalls) {
167
+ const toolCalls = choice.delta.tool_calls || choice.delta.toolCalls || [];
168
+ if (toolCalls.length > 0) {
169
+ if (!chunk.delta) {
170
+ chunk.delta = { role: 'assistant' };
171
+ }
172
+ chunk.delta.toolCalls = toolCalls.map((tool) => {
173
+ const functionCall = tool.function || {};
174
+ let arguments_ = functionCall.arguments;
175
+ if (typeof arguments_ !== 'string') {
176
+ arguments_ = JSON.stringify(arguments_ || {});
177
+ }
178
+ return llm.FunctionCall.create({
179
+ callId: tool.id || shortuuid('tool_call_'),
180
+ name: functionCall.name || '',
181
+ args: arguments_,
182
+ });
183
+ });
184
+ }
185
+ }
186
+ if (choice.usage) {
187
+ chunk.usage = {
188
+ promptTokens: choice.usage.prompt_tokens || choice.usage.promptTokens || 0,
189
+ completionTokens: choice.usage.completion_tokens || choice.usage.completionTokens || 0,
190
+ promptCachedTokens: choice.usage.prompt_cached_tokens || choice.usage.promptCachedTokens || 0,
191
+ totalTokens: choice.usage.total_tokens || choice.usage.totalTokens || 0,
192
+ };
193
+ }
194
+ return chunk.delta || chunk.usage ? chunk : null;
195
+ }
196
+ }
197
+ //# sourceMappingURL=llm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"llm.js","sourceRoot":"","sources":["../src/llm.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAGjC,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAEhE,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,eAAe,EACf,2BAA2B,EAC3B,GAAG,EACH,SAAS,GACV,MAAM,iBAAiB,CAAC;AAiBzB,oBAAoB;AACpB,MAAM,OAAO,GAAI,SAAQ,GAAG,CAAC,GAAG;IAC9B,KAAK,CAAa;IAClB,OAAO,CAAU;IAEjB,YAAY,EACV,KAAK,GAAG,mBAAmB,EAC3B,MAAM,EACN,MAAM,EACN,WAAW,EACX,mBAAmB,MACE,EAAE;QACvB,KAAK,EAAE,CAAC;QAER,MAAM,WAAW,GAAG,MAAM,IAAI,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC;QAC1D,IAAI,CAAC,WAAW,IAAI,CAAC,MAAM,EAAE,CAAC;YAC5B,MAAM,IAAI,KAAK,CACb,oGAAoG,CACrG,CAAC;QACJ,CAAC;QAED,IAAI,CAAC,KAAK,GAAG;YACX,KAAK;YACL,WAAW;YACX,mBAAmB;SACpB,CAAC;QAEF,IAAI,CAAC,OAAO;YACV,MAAM;gBACN,IAAI,aAAa,CAAC;oBAChB,MAAM,EAAE,WAAW;iBACpB,CAAC,C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;gBACZ,YAAY,EAAE,MAAM,CAAC,KAAK,CAAC,aAAa,IAAI,MAAM,CAAC,KAAK,CAAC,YAAY,IAAI,CAAC;gBAC1E,gBAAgB,EAAE,MAAM,CAAC,KAAK,CAAC,iBAAiB,IAAI,MAAM,CAAC,KAAK,CAAC,gBAAgB,IAAI,CAAC;gBACtF,kBAAkB,EAAE,MAAM,CAAC,KAAK,CAAC,oBAAoB,IAAI,MAAM,CAAC,KAAK,CAAC,kBAAkB,IAAI,CAAC;gBAC7F,WAAW,EAAE,MAAM,CAAC,KAAK,CAAC,YAAY,IAAI,MAAM,CAAC,KAAK,CAAC,WAAW,IAAI,CAAC;aACxE,CAAC;QACJ,CAAC;QAED,OAAO,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;IACnD,CAAC;CACF"}
@@ -0,0 +1,3 @@
1
+ export type ChatModels = 'mistral-medium-latest' | 'mistral-large-latest' | 'mistral-medium-2508' | 'mistral-large-2411' | 'mistral-medium-2505' | 'ministral-3b-2410' | 'ministral-8b-2410' | 'mistral-large-2411' | 'mistral-large-2512' | 'ministral-14b-2512' | 'ministral-8b-2512' | 'ministral-3b-2512' | 'mistral-small-2407';
2
+ export type STTModels = 'voxtral-small-2507' | 'voxtral-mini-2507' | 'voxtral-mini-latest' | 'voxtral-small-latest';
3
+ //# sourceMappingURL=models.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../src/models.ts"],"names":[],"mappings":"AAcA,MAAM,MAAM,UAAU,GAClB,uBAAuB,GACvB,sBAAsB,GACtB,qBAAqB,GACrB,oBAAoB,GACpB,qBAAqB,GACrB,mBAAmB,GACnB,mBAAmB,GACnB,oBAAoB,GACpB,oBAAoB,GACpB,oBAAoB,GACpB,mBAAmB,GACnB,mBAAmB,GACnB,oBAAoB,CAAC;AAEzB,MAAM,MAAM,SAAS,GACjB,oBAAoB,GACpB,mBAAmB,GACnB,qBAAqB,GACrB,sBAAsB,CAAC"}
package/dist/models.js ADDED
@@ -0,0 +1,15 @@
1
+ // Copyright 2025 LiveKit, Inc.
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+ export {};
15
+ //# sourceMappingURL=models.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"models.js","sourceRoot":"","sources":["../src/models.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC"}
package/dist/stt.d.ts ADDED
@@ -0,0 +1,32 @@
1
+ import type { Mistral } from '@mistralai/mistralai';
2
+ import { stt } from '@livekit/agents';
3
+ import type { AudioFrame } from '@livekit/rtc-node';
4
+ import type { STTModels } from './models.js';
5
+ export interface MistralSTTOptions {
6
+ language?: string;
7
+ model?: STTModels | string;
8
+ apiKey?: string;
9
+ client?: Mistral;
10
+ }
11
+ export declare class STT extends stt.STT {
12
+ #private;
13
+ /**
14
+ * Create a new instance of MistralAI STT.
15
+ *
16
+ * @param options - Configuration options for the STT instance
17
+ * @param options.language - The language code to use for transcription (e.g., "en" for English). Defaults to "en".
18
+ * @param options.model - The MistralAI model to use for transcription. Defaults to "voxtral-mini-latest".
19
+ * @param options.apiKey - Your MistralAI API key. If not provided, will use the MISTRAL_API_KEY environment variable.
20
+ * @param options.client - Optional pre-configured MistralAI client instance.
21
+ */
22
+ constructor({ language, model, apiKey, client }?: MistralSTTOptions);
23
+ label: string;
24
+ get model(): string;
25
+ updateOptions({ model, language, }: {
26
+ model?: STTModels | string;
27
+ language?: string;
28
+ }): void;
29
+ _recognize(buffer: Array<AudioFrame>, abortSignal?: AbortSignal): Promise<stt.SpeechEvent>;
30
+ stream(): stt.SpeechStream;
31
+ }
32
+ //# sourceMappingURL=stt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stt.d.ts","sourceRoot":"","sources":["../src/stt.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAGpD,OAAO,EAKL,GAAG,EACJ,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAO7C,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,qBAAa,GAAI,SAAQ,GAAG,CAAC,GAAG;;IAI9B;;;;;;;;OAQG;gBACS,EAAE,QAAe,EAAE,KAA6B,EAAE,MAAM,EAAE,MAAM,EAAE,GAAE,iBAAsB;IAyBtG,KAAK,SAAmB;IAExB,IAAI,KAAK,IAAI,MAAM,CAElB;IAED,aAAa,CAAC,EACZ,KAAK,EACL,QAAQ,GACT,EAAE;QACD,KAAK,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC;QAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,GAAG,IAAI;IAgBF,UAAU,CACd,MAAM,EAAE,KAAK,CAAC,UAAU,CAAC,EACzB,WAAW,CAAC,EAAE,WAAW,GACxB,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC;IA0E3B,MAAM,IAAI,GAAG,CAAC,YAAY;CAyB3B"}
package/dist/stt.js ADDED
@@ -0,0 +1,155 @@
1
+ // Copyright 2025 LiveKit, Inc.
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+ import { Mistral as MistralClient } from '@mistralai/mistralai';
15
+ import { APIConnectionError, APIStatusError, APITimeoutError, mergeFrames, stt, } from '@livekit/agents';
16
+ export class STT extends stt.STT {
17
+ #opts;
18
+ #client;
19
+ /**
20
+ * Create a new instance of MistralAI STT.
21
+ *
22
+ * @param options - Configuration options for the STT instance
23
+ * @param options.language - The language code to use for transcription (e.g., "en" for English). Defaults to "en".
24
+ * @param options.model - The MistralAI model to use for transcription. Defaults to "voxtral-mini-latest".
25
+ * @param options.apiKey - Your MistralAI API key. If not provided, will use the MISTRAL_API_KEY environment variable.
26
+ * @param options.client - Optional pre-configured MistralAI client instance.
27
+ */
28
+ constructor({ language = 'en', model = 'voxtral-mini-latest', apiKey, client } = {}) {
29
+ super({
30
+ streaming: false,
31
+ interimResults: false,
32
+ });
33
+ const apiKeyValue = apiKey ?? process.env.MISTRAL_API_KEY;
34
+ if (!apiKeyValue && !client) {
35
+ throw new Error('MistralAI API key is required. Set MISTRAL_API_KEY environment variable or pass apiKey in options.');
36
+ }
37
+ this.#opts = {
38
+ language,
39
+ model,
40
+ };
41
+ this.#client =
42
+ client ||
43
+ new MistralClient({
44
+ apiKey: apiKeyValue,
45
+ });
46
+ }
47
+ label = 'mistralai.STT';
48
+ get model() {
49
+ return this.#opts.model;
50
+ }
51
+ updateOptions({ model, language, }) {
52
+ /**
53
+ * Update the options for the STT.
54
+ *
55
+ * @param options - Options to update
56
+ * @param options.language - The language to transcribe in.
57
+ * @param options.model - The model to use for transcription.
58
+ */
59
+ if (model !== undefined) {
60
+ this.#opts.model = model;
61
+ }
62
+ if (language !== undefined) {
63
+ this.#opts.language = language;
64
+ }
65
+ }
66
+ async _recognize(buffer, abortSignal) {
67
+ try {
68
+ // Merge audio frames
69
+ const mergedFrame = mergeFrames(buffer);
70
+ // Convert audio frame to WAV format
71
+ const wavBuffer = this.#createWav(mergedFrame);
72
+ // Create a File-like object for the MistralAI API
73
+ // Use File API (available in Node.js 18+) or create a compatible object
74
+ let audioFile;
75
+ if (typeof File !== 'undefined') {
76
+ audioFile = new File([wavBuffer], 'audio.wav', { type: 'audio/wav' });
77
+ }
78
+ else {
79
+ // Fallback for older Node.js versions
80
+ audioFile = new Blob([wavBuffer], { type: 'audio/wav' });
81
+ }
82
+ // MistralAI transcription API call
83
+ const resp = await this.#client.audio.transcriptions.create({
84
+ model: this.#opts.model,
85
+ file: audioFile,
86
+ language: this.#opts.language || undefined,
87
+ timestamp_granularities: ['segment'],
88
+ });
89
+ // Extract segments if available
90
+ const segments = resp.segments || [];
91
+ return {
92
+ type: stt.SpeechEventType.FINAL_TRANSCRIPT,
93
+ alternatives: [
94
+ {
95
+ text: resp.text || '',
96
+ language: this.#opts.language,
97
+ startTime: segments.length > 0 ? segments[0].start || 0 : 0,
98
+ endTime: segments.length > 0 ? segments[segments.length - 1].end || 0 : 0,
99
+ confidence: 0,
100
+ },
101
+ ],
102
+ };
103
+ }
104
+ catch (error) {
105
+ const err = error;
106
+ if (err.status === 408 ||
107
+ err.status === 504 ||
108
+ err.statusCode === 408 ||
109
+ err.statusCode === 504 ||
110
+ err.code === 408 ||
111
+ err.code === 504) {
112
+ throw new APITimeoutError({
113
+ message: err.message || 'Request timeout',
114
+ });
115
+ }
116
+ if (err.status || err.statusCode) {
117
+ const statusCode = err.status || err.statusCode || 500;
118
+ throw new APIStatusError({
119
+ message: err.message || 'API error',
120
+ options: {
121
+ statusCode,
122
+ retryable: statusCode >= 500,
123
+ },
124
+ });
125
+ }
126
+ throw new APIConnectionError({
127
+ message: err.message || 'Connection error',
128
+ });
129
+ }
130
+ }
131
+ stream() {
132
+ throw new Error('Streaming is not supported on MistralAI STT');
133
+ }
134
+ #createWav(frame) {
135
+ const bitsPerSample = 16;
136
+ const byteRate = (frame.sampleRate * frame.channels * bitsPerSample) / 8;
137
+ const blockAlign = (frame.channels * bitsPerSample) / 8;
138
+ const header = Buffer.alloc(44);
139
+ header.write('RIFF', 0);
140
+ header.writeUInt32LE(36 + frame.data.byteLength, 4);
141
+ header.write('WAVE', 8);
142
+ header.write('fmt ', 12);
143
+ header.writeUInt32LE(16, 16);
144
+ header.writeUInt16LE(1, 20);
145
+ header.writeUInt16LE(frame.channels, 22);
146
+ header.writeUInt32LE(frame.sampleRate, 24);
147
+ header.writeUInt32LE(byteRate, 28);
148
+ header.writeUInt16LE(blockAlign, 32);
149
+ header.writeUInt16LE(16, 34);
150
+ header.write('data', 36);
151
+ header.writeUInt32LE(frame.data.byteLength, 40);
152
+ return Buffer.concat([header, Buffer.from(frame.data.buffer)]);
153
+ }
154
+ }
155
+ //# sourceMappingURL=stt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stt.js","sourceRoot":"","sources":["../src/stt.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAGjC,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAEhE,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,eAAe,EACf,WAAW,EACX,GAAG,GACJ,MAAM,iBAAiB,CAAC;AAgBzB,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+ {
2
+ "name": "livekit-agents-plugin-mistralai",
3
+ "version": "0.0.1",
4
+ "description": "LiveKit Agents Plugin for MistralAI services - LLM and STT support",
5
+ "main": "./dist/index.js",
6
+ "types": "./dist/index.d.ts",
7
+ "type": "module",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "default": "./dist/index.js"
12
+ }
13
+ },
14
+ "scripts": {
15
+ "build": "tsc",
16
+ "prepublishOnly": "npm run build",
17
+ "clean": "rm -rf dist"
18
+ },
19
+ "keywords": [
20
+ "voice",
21
+ "ai",
22
+ "realtime",
23
+ "audio",
24
+ "video",
25
+ "livekit",
26
+ "mistral",
27
+ "mistralai",
28
+ "llm",
29
+ "stt"
30
+ ],
31
+ "author": {
32
+ "name": "Tobias Brandenberg",
33
+ "email": "info@simpelwerk.de",
34
+ "url": "https://www.simpelwerk.de"
35
+ },
36
+ "license": "Apache-2.0",
37
+ "repository": {
38
+ "type": "git",
39
+ "url": "git+https://github.com/simpelwerk/livekit-agents-plugin-mistralai.git"
40
+ },
41
+ "devDependencies": {
42
+ "@types/node": "^20.0.0",
43
+ "typescript": "^5.0.0"
44
+ },
45
+ "engines": {
46
+ "node": ">=18.0.0"
47
+ },
48
+ "files": [
49
+ "dist",
50
+ "README.md",
51
+ "LICENSE"
52
+ ],
53
+ "peerDependencies": {
54
+ "@livekit/agents": "^1.0.32",
55
+ "@livekit/rtc-node": "^0.13.23",
56
+ "@mistralai/mistralai": "^1.11.0"
57
+ }
58
+ }