@mozaik-ai/core 3.11.0 → 3.13.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 CHANGED
@@ -133,6 +133,17 @@ interface StreamingCapability {
133
133
  getStreaming(): boolean;
134
134
  }
135
135
 
136
+ type StructuredOutputFormat = {
137
+ name?: string;
138
+ schema: Record<string, any>;
139
+ strict?: boolean;
140
+ };
141
+ interface StructuredOutputCapability {
142
+ setStructuredOutput(format: StructuredOutputFormat | undefined): void;
143
+ getStructuredOutput(): StructuredOutputFormat | undefined;
144
+ hasStructuredOutput(): boolean;
145
+ }
146
+
136
147
  interface FunctionTool {
137
148
  type: "function";
138
149
  name: string;
@@ -150,14 +161,16 @@ interface ToolCallingCapability {
150
161
 
151
162
  type ModelSpecification = {
152
163
  name: string;
164
+ provider: string;
153
165
  supportReasoningEffort: boolean;
154
166
  defaultReasoningEffort: string | undefined;
155
167
  supportStreaming: boolean;
156
168
  contextWindowSize: number;
157
169
  maxOutputTokens: number;
158
170
  supportFunctionCalling: boolean;
171
+ supportStructuredOutput: boolean;
159
172
  };
160
- interface GenerativeModel extends ReasoningEffort<string>, ToolCallingCapability, StreamingCapability {
173
+ interface GenerativeModel extends ReasoningEffort<string>, ToolCallingCapability, StreamingCapability, StructuredOutputCapability {
161
174
  readonly specification: ModelSpecification;
162
175
  }
163
176
 
@@ -185,64 +198,82 @@ type OpenAIReasoningEffortType = "xhigh" | "high" | "medium" | "low" | "none";
185
198
  declare class Gpt54Nano implements GenerativeModel {
186
199
  readonly specification: {
187
200
  name: string;
201
+ provider: string;
188
202
  supportReasoningEffort: boolean;
189
203
  defaultReasoningEffort: OpenAIReasoningEffortType;
190
204
  supportStreaming: boolean;
191
205
  contextWindowSize: number;
192
206
  maxOutputTokens: number;
193
207
  supportFunctionCalling: boolean;
208
+ supportStructuredOutput: boolean;
194
209
  };
195
210
  private tools;
196
- private readonly effort;
197
211
  private streaming;
212
+ private structuredOutput;
213
+ private readonly effort;
198
214
  setStreaming(streaming: boolean): void;
199
215
  getStreaming(): boolean;
200
216
  setTools(tools: Tool[]): void;
201
217
  getTools(): Tool[];
202
218
  setReasoningEffort(effort: OpenAIReasoningEffortType): void;
203
219
  getReasoningEffort(): OpenAIReasoningEffortType;
220
+ setStructuredOutput(format: StructuredOutputFormat | undefined): void;
221
+ getStructuredOutput(): StructuredOutputFormat | undefined;
222
+ hasStructuredOutput(): boolean;
204
223
  }
205
224
 
206
225
  declare class Gpt54 implements GenerativeModel {
207
226
  readonly specification: {
208
227
  name: string;
228
+ provider: string;
209
229
  supportReasoningEffort: boolean;
210
230
  defaultReasoningEffort: OpenAIReasoningEffortType;
211
231
  supportStreaming: boolean;
212
232
  contextWindowSize: number;
213
233
  maxOutputTokens: number;
214
234
  supportFunctionCalling: boolean;
235
+ supportStructuredOutput: boolean;
215
236
  };
216
237
  private tools;
217
238
  private streaming;
239
+ private structuredOutput;
240
+ private readonly effort;
218
241
  setStreaming(streaming: boolean): void;
219
242
  getStreaming(): boolean;
220
243
  setTools(tools: Tool[]): void;
221
244
  getTools(): Tool[];
222
- private readonly effort;
223
245
  setReasoningEffort(effort: OpenAIReasoningEffortType): void;
224
246
  getReasoningEffort(): OpenAIReasoningEffortType;
247
+ setStructuredOutput(format: StructuredOutputFormat | undefined): void;
248
+ getStructuredOutput(): StructuredOutputFormat | undefined;
249
+ hasStructuredOutput(): boolean;
225
250
  }
226
251
 
227
252
  declare class Gpt54Mini implements GenerativeModel {
228
253
  readonly specification: {
229
254
  name: string;
255
+ provider: string;
230
256
  supportReasoningEffort: boolean;
231
257
  defaultReasoningEffort: OpenAIReasoningEffortType;
232
258
  supportStreaming: boolean;
233
259
  contextWindowSize: number;
234
260
  maxOutputTokens: number;
235
261
  supportFunctionCalling: boolean;
262
+ supportStructuredOutput: boolean;
236
263
  };
237
264
  private tools;
238
- private readonly effort;
239
265
  private streaming;
266
+ private structuredOutput;
267
+ private readonly effort;
240
268
  setStreaming(streaming: boolean): void;
241
269
  getStreaming(): boolean;
242
270
  setReasoningEffort(effort: OpenAIReasoningEffortType): void;
243
271
  getReasoningEffort(): OpenAIReasoningEffortType;
244
272
  setTools(tools: Tool[]): void;
245
273
  getTools(): Tool[];
274
+ setStructuredOutput(format: StructuredOutputFormat | undefined): void;
275
+ getStructuredOutput(): StructuredOutputFormat | undefined;
276
+ hasStructuredOutput(): boolean;
246
277
  }
247
278
 
248
279
  declare class InputTokenDetails {
@@ -290,9 +321,29 @@ declare class SemanticEvent<T> {
290
321
  getType(): string;
291
322
  }
292
323
 
324
+ interface AgenticErrorOpts {
325
+ message: string;
326
+ stack?: string;
327
+ source?: Participant;
328
+ enviornment?: AgenticEnvironment;
329
+ }
330
+ declare class AgenticError extends Error {
331
+ private source?;
332
+ private environment?;
333
+ constructor({ message, stack, source, enviornment }: AgenticErrorOpts);
334
+ getSource(): Participant | undefined;
335
+ getEnvironment(): AgenticEnvironment | undefined;
336
+ }
337
+
338
+ interface AgenticEnvironmentOptions {
339
+ silent?: boolean;
340
+ }
293
341
  declare class AgenticEnvironment {
294
342
  protected subscribers: Participant[];
295
- private isActive;
343
+ private name?;
344
+ private options?;
345
+ private showLogs?;
346
+ constructor(name?: string, opts?: AgenticEnvironmentOptions);
296
347
  subscribe(participant: Participant): void;
297
348
  unsubscribe(participant: Participant): void;
298
349
  deliverFunctionCall(source: Participant, item: FunctionCallItem): void;
@@ -301,16 +352,25 @@ declare class AgenticEnvironment {
301
352
  deliverFunctionCallOutput(source: Participant, item: FunctionCallOutputItem): void;
302
353
  deliverMessage(source: Participant, message: string): void;
303
354
  deliverSemanticEvent(source: Participant, item: SemanticEvent<unknown>): void;
304
- start(): Promise<void>;
305
- stop(): void;
355
+ deliverError(source: Participant, error: AgenticError): void;
356
+ private getListeningParticipants;
357
+ private deliverToSubscribers;
358
+ private handleError;
306
359
  }
307
360
 
361
+ type ParticipantClassConstructor = new (...args: any[]) => Participant;
308
362
  declare abstract class Participant {
309
363
  private environments;
364
+ protected listens: ParticipantClassConstructor[];
365
+ private active;
310
366
  join(environment: AgenticEnvironment): void;
311
367
  leave(environment: AgenticEnvironment): void;
312
- protected isJoinedTo(environment: AgenticEnvironment): boolean;
368
+ isJoinedTo(environment: AgenticEnvironment): boolean;
313
369
  getEnvironments(): AgenticEnvironment[];
370
+ getListeners(): ParticipantClassConstructor[];
371
+ getEnvironmentState(environment: AgenticEnvironment): boolean | undefined;
372
+ markInactive(environment: AgenticEnvironment): void;
373
+ markActive(environment: AgenticEnvironment): void;
314
374
  abstract onParticipantJoined(participant: Participant): Promise<void> | void;
315
375
  abstract onParticipantLeft(participant: Participant): Promise<void> | void;
316
376
  abstract onJoined(): Promise<void> | void;
@@ -326,182 +386,71 @@ declare abstract class Participant {
326
386
  abstract onMessage(message: string): Promise<void> | void;
327
387
  abstract onInternalEvent(item: SemanticEvent<unknown>): Promise<void> | void;
328
388
  abstract onExternalEvent(source: Participant, item: SemanticEvent<unknown>): Promise<void> | void;
329
- }
330
-
331
- interface InferenceRunner {
332
- run(context: ModelContext, model: GenerativeModel, signal?: AbortSignal): AsyncIterable<ReasoningItem | FunctionCallItem | ModelMessageItem | SemanticEvent<unknown>>;
333
- }
334
-
335
- interface FunctionCallRunner {
336
- run(functionCallItem: FunctionCallItem, signal?: AbortSignal): AsyncIterable<FunctionCallOutputItem>;
337
- }
338
-
339
- declare abstract class Agent extends Participant {
340
- abstract executeFunctionCall(environment: AgenticEnvironment, functionCallItem: FunctionCallItem, signal?: AbortSignal): Promise<void>;
341
- abstract runInference(environment: AgenticEnvironment, context: ModelContext, model: GenerativeModel, signal?: AbortSignal): Promise<void>;
342
- }
343
-
344
- declare class BaseAgent extends Agent {
345
- private inferenceRunner;
346
- private functionCallRunner;
347
- constructor(inferenceRunner: InferenceRunner, functionCallRunner: FunctionCallRunner);
348
- onJoined(): void;
349
- onLeft(): void;
350
- onParticipantJoined(participant: Participant): void;
351
- onParticipantLeft(participant: Participant): void;
352
- onFunctionCall(item: FunctionCallItem): void;
353
- onExternalFunctionCall(source: Participant, item: FunctionCallItem): void;
354
- onFunctionCallOutput(item: FunctionCallOutputItem): void;
355
- onExternalFunctionCallOutput(source: Participant, item: FunctionCallOutputItem): void;
356
- onReasoning(item: ReasoningItem): void;
357
- onExternalReasoning(source: Participant, item: ReasoningItem): void;
358
- onModelMessage(item: ModelMessageItem): void;
359
- onExternalModelMessage(source: Participant, item: ModelMessageItem): void;
360
- onMessage(message: string): void;
361
- onInternalEvent(item: SemanticEvent<unknown>): void;
362
- onExternalEvent(source: Participant, item: SemanticEvent<unknown>): void;
363
- executeFunctionCall(environment: AgenticEnvironment, functionCallItem: FunctionCallItem, signal?: AbortSignal): Promise<void>;
364
- runInference(environment: AgenticEnvironment, context: ModelContext, model: GenerativeModel, signal?: AbortSignal): Promise<void>;
365
- }
366
-
367
- declare abstract class Human extends Participant {
368
- sendMessage(environment: AgenticEnvironment, message: string): void;
369
- }
370
-
371
- declare class BaseHuman extends Human {
372
- onJoined(): void;
373
- onLeft(): void;
374
- onParticipantJoined(participant: Participant): void;
375
- onParticipantLeft(participant: Participant): void;
376
- onMessage(message: string): void;
377
- onFunctionCall(item: FunctionCallItem): void;
378
- onFunctionCallOutput(item: FunctionCallOutputItem): void;
379
- onReasoning(item: ReasoningItem): void;
380
- onModelMessage(item: ModelMessageItem): void;
381
- onExternalFunctionCall(source: Participant, item: FunctionCallItem): void;
382
- onExternalFunctionCallOutput(source: Participant, item: FunctionCallOutputItem): void;
383
- onExternalReasoning(source: Participant, item: ReasoningItem): void;
384
- onExternalModelMessage(source: Participant, item: ModelMessageItem): void;
385
- onInternalEvent(item: SemanticEvent<unknown>): void;
386
- onExternalEvent(source: Participant, item: SemanticEvent<unknown>): void;
387
- }
388
-
389
- declare class InferenceRequest {
390
- readonly model: GenerativeModel & ReasoningEffort<string> & ToolCallingCapability;
391
- readonly context: ModelContext;
392
- constructor(model: GenerativeModel & ReasoningEffort<string> & ToolCallingCapability, context: ModelContext);
393
- }
394
-
395
- declare class InferenceResponse {
396
- readonly contextItems: ContextItem[];
397
- readonly tokenUsage?: TokenUsage;
398
- constructor(contextItems: ContextItem[], tokenUsage: TokenUsage | undefined);
399
- }
400
-
401
- /**
402
- * Provider-agnostic port for a single round of inference.
403
- *
404
- * Lives in the domain layer; concrete adapters (OpenAI Responses,
405
- * Anthropic Messages, DeepSeek Chat Completions, …) live in the
406
- * infrastructure layer and are injected into application-layer runners
407
- * through their constructor. The application layer must depend on this
408
- * interface, never on a concrete provider client.
409
- */
410
- interface ModelRuntime {
411
- infer(request: InferenceRequest): Promise<InferenceResponse>;
412
- }
413
-
414
- type InferenceItem = ReasoningItem | FunctionCallItem | ModelMessageItem | SemanticEvent<unknown>;
415
- /**
416
- * Application-layer inference runner. Provider-agnostic: it depends on
417
- * the {@link ModelRuntime} domain port and receives a concrete
418
- * infrastructure adapter (OpenAIResponses, AnthropicMessages, …)
419
- * through its constructor. The runner never instantiates a provider
420
- * client itself — wiring happens at the composition root.
421
- *
422
- * Name retained for backward compatibility; the runner works with any
423
- * `ModelRuntime`, not just OpenAI.
424
- */
425
- declare class OpenAIInferenceRunner implements InferenceRunner {
426
- private readonly runtime;
427
- constructor(runtime: ModelRuntime);
428
- run(context: ModelContext, model: GenerativeModel, signal?: AbortSignal): AsyncIterable<InferenceItem>;
429
- private isStreamingRuntime;
430
- }
431
-
432
- declare class DefaultFunctionCallRunner implements FunctionCallRunner {
433
- private readonly tools;
434
- constructor(tools: Tool[]);
435
- run(call: FunctionCallItem, signal?: AbortSignal): AsyncIterable<FunctionCallOutputItem>;
389
+ abstract onError(error: AgenticError): void;
390
+ abstract onParticipantError(source: Participant, error: AgenticError): void;
436
391
  }
437
392
 
438
393
  declare class Gpt55 implements GenerativeModel {
439
394
  readonly specification: {
440
395
  name: string;
396
+ provider: string;
441
397
  supportReasoningEffort: boolean;
442
398
  defaultReasoningEffort: OpenAIReasoningEffortType;
443
399
  supportStreaming: boolean;
444
400
  contextWindowSize: number;
445
401
  maxOutputTokens: number;
446
402
  supportFunctionCalling: boolean;
403
+ supportStructuredOutput: boolean;
447
404
  };
448
405
  private tools;
449
406
  private streaming;
407
+ private structuredOutput;
408
+ private readonly effort;
450
409
  setStreaming(streaming: boolean): void;
451
410
  getStreaming(): boolean;
452
411
  setTools(tools: Tool[]): void;
453
412
  getTools(): Tool[];
454
- private readonly effort;
455
413
  setReasoningEffort(effort: OpenAIReasoningEffortType): void;
456
414
  getReasoningEffort(): OpenAIReasoningEffortType;
415
+ setStructuredOutput(format: StructuredOutputFormat | undefined): void;
416
+ getStructuredOutput(): StructuredOutputFormat | undefined;
417
+ hasStructuredOutput(): boolean;
457
418
  }
458
419
 
459
- declare abstract class Observer extends Participant {
420
+ declare class InferenceRequest {
421
+ readonly model: GenerativeModel;
422
+ readonly context: ModelContext;
423
+ constructor(model: GenerativeModel, context: ModelContext);
460
424
  }
461
425
 
462
- declare class BaseObserver extends Observer {
463
- onFunctionCall(item: FunctionCallItem): void;
464
- onExternalFunctionCall(source: Participant, item: FunctionCallItem): void;
465
- onFunctionCallOutput(item: FunctionCallOutputItem): void;
466
- onExternalFunctionCallOutput(source: Participant, item: FunctionCallOutputItem): void;
467
- onReasoning(item: ReasoningItem): void;
468
- onExternalReasoning(source: Participant, item: ReasoningItem): void;
469
- onModelMessage(item: ModelMessageItem): void;
470
- onExternalModelMessage(source: Participant, item: ModelMessageItem): void;
471
- onMessage(message: string): void;
472
- onJoined(): void;
473
- onLeft(): void;
474
- onParticipantJoined(participant: Participant): void;
475
- onParticipantLeft(participant: Participant): void;
476
- onInternalEvent(item: SemanticEvent<unknown>): void;
477
- onExternalEvent(source: Participant, item: SemanticEvent<unknown>): void;
426
+ declare class InferenceResponse {
427
+ readonly contextItems: ContextItem[];
428
+ readonly tokenUsage?: TokenUsage;
429
+ constructor(contextItems: ContextItem[], tokenUsage: TokenUsage | undefined);
478
430
  }
479
431
 
480
- /**
481
- * Optional streaming companion to {@link ModelRuntime}. Adapters whose
482
- * provider can stream a round implement this in addition to
483
- * `ModelRuntime`; runners delegate to `stream` only when the model has
484
- * streaming enabled and the injected runtime actually implements it.
485
- */
486
- interface StreamingRuntime {
487
- stream(request: InferenceRequest, signal?: AbortSignal): AsyncIterable<ReasoningItem | FunctionCallItem | ModelMessageItem | SemanticEvent<unknown>>;
432
+ interface Endpoint {
433
+ infer(request: InferenceRequest): Promise<InferenceResponse>;
434
+ stream(request: InferenceRequest): AsyncIterable<SemanticEvent<unknown>>;
488
435
  }
489
436
 
490
- declare class OpenAIResponses implements ModelRuntime, StreamingRuntime {
437
+ declare class OpenAIResponses implements Endpoint {
491
438
  private readonly client;
492
439
  constructor();
493
440
  infer(inferenceRequest: InferenceRequest): Promise<InferenceResponse>;
494
- stream(inferenceRequest: InferenceRequest, signal?: AbortSignal): AsyncIterable<ReasoningItem | FunctionCallItem | ModelMessageItem | SemanticEvent<unknown>>;
441
+ stream(inferenceRequest: InferenceRequest, signal?: AbortSignal): AsyncIterable<SemanticEvent<unknown>>;
495
442
  private buildRequest;
496
443
  extractTokenUsage(response: OpenAI.Responses.Response): TokenUsage | undefined;
497
444
  mapContextToRequest(context: ModelContext): any[];
498
445
  extractContextItems(response: any): ContextItem[];
499
446
  }
500
447
 
501
- declare class AnthropicMessages implements ModelRuntime {
448
+ declare class AnthropicMessages implements Endpoint {
502
449
  private readonly client;
503
450
  constructor();
504
451
  infer(inferenceRequest: InferenceRequest): Promise<InferenceResponse>;
452
+ stream(inferenceRequest: InferenceRequest, signal?: AbortSignal): AsyncIterable<SemanticEvent<unknown>>;
453
+ private buildRequest;
505
454
  extractTokenUsage(response: Anthropic.Messages.Message): TokenUsage | undefined;
506
455
  mapContextToRequest(context: ModelContext): {
507
456
  messages: any[];
@@ -513,39 +462,75 @@ declare class AnthropicMessages implements ModelRuntime {
513
462
 
514
463
  type AnthropicReasoningEffortType = "high" | "medium" | "low" | "none";
515
464
 
516
- declare class ClaudeOpus47 implements GenerativeModel {
465
+ declare class ClaudeOpus48 implements GenerativeModel {
517
466
  readonly specification: {
518
467
  name: string;
468
+ provider: string;
519
469
  supportReasoningEffort: boolean;
520
470
  defaultReasoningEffort: AnthropicReasoningEffortType;
521
471
  supportStreaming: boolean;
522
472
  contextWindowSize: number;
523
473
  maxOutputTokens: number;
524
474
  supportFunctionCalling: boolean;
475
+ supportStructuredOutput: boolean;
525
476
  };
526
477
  private tools;
527
478
  private streaming;
479
+ private structuredOutput;
480
+ private readonly effort;
528
481
  setStreaming(streaming: boolean): void;
529
482
  getStreaming(): boolean;
530
483
  setTools(tools: Tool[]): void;
531
484
  getTools(): Tool[];
485
+ setReasoningEffort(effort: AnthropicReasoningEffortType): void;
486
+ getReasoningEffort(): AnthropicReasoningEffortType;
487
+ setStructuredOutput(format: StructuredOutputFormat | undefined): void;
488
+ getStructuredOutput(): StructuredOutputFormat | undefined;
489
+ hasStructuredOutput(): boolean;
490
+ }
491
+
492
+ declare class ClaudeOpus47 implements GenerativeModel {
493
+ readonly specification: {
494
+ name: string;
495
+ provider: string;
496
+ supportReasoningEffort: boolean;
497
+ defaultReasoningEffort: AnthropicReasoningEffortType;
498
+ supportStreaming: boolean;
499
+ contextWindowSize: number;
500
+ maxOutputTokens: number;
501
+ supportFunctionCalling: boolean;
502
+ supportStructuredOutput: boolean;
503
+ };
504
+ private tools;
505
+ private streaming;
506
+ private structuredOutput;
532
507
  private readonly effort;
508
+ setStreaming(streaming: boolean): void;
509
+ getStreaming(): boolean;
510
+ setTools(tools: Tool[]): void;
511
+ getTools(): Tool[];
533
512
  setReasoningEffort(effort: AnthropicReasoningEffortType): void;
534
513
  getReasoningEffort(): AnthropicReasoningEffortType;
514
+ setStructuredOutput(format: StructuredOutputFormat | undefined): void;
515
+ getStructuredOutput(): StructuredOutputFormat | undefined;
516
+ hasStructuredOutput(): boolean;
535
517
  }
536
518
 
537
519
  declare class ClaudeSonnet46 implements GenerativeModel {
538
520
  readonly specification: {
539
521
  name: string;
522
+ provider: string;
540
523
  supportReasoningEffort: boolean;
541
524
  defaultReasoningEffort: AnthropicReasoningEffortType;
542
525
  supportStreaming: boolean;
543
526
  contextWindowSize: number;
544
527
  maxOutputTokens: number;
545
528
  supportFunctionCalling: boolean;
529
+ supportStructuredOutput: boolean;
546
530
  };
547
531
  private tools;
548
532
  private streaming;
533
+ private structuredOutput;
549
534
  setStreaming(streaming: boolean): void;
550
535
  getStreaming(): boolean;
551
536
  setTools(tools: Tool[]): void;
@@ -553,27 +538,269 @@ declare class ClaudeSonnet46 implements GenerativeModel {
553
538
  private readonly effort;
554
539
  setReasoningEffort(effort: AnthropicReasoningEffortType): void;
555
540
  getReasoningEffort(): AnthropicReasoningEffortType;
541
+ setStructuredOutput(format: StructuredOutputFormat | undefined): void;
542
+ getStructuredOutput(): StructuredOutputFormat | undefined;
543
+ hasStructuredOutput(): boolean;
556
544
  }
557
545
 
558
546
  declare class ClaudeHaiku45 implements GenerativeModel {
559
547
  readonly specification: {
560
548
  name: string;
549
+ provider: string;
561
550
  supportReasoningEffort: boolean;
562
551
  defaultReasoningEffort: AnthropicReasoningEffortType;
563
552
  supportStreaming: boolean;
564
553
  contextWindowSize: number;
565
554
  maxOutputTokens: number;
566
555
  supportFunctionCalling: boolean;
556
+ supportStructuredOutput: boolean;
567
557
  };
568
558
  private tools;
569
559
  private streaming;
560
+ private structuredOutput;
561
+ private readonly effort;
570
562
  setStreaming(streaming: boolean): void;
571
563
  getStreaming(): boolean;
572
564
  setTools(tools: Tool[]): void;
573
565
  getTools(): Tool[];
574
- private readonly effort;
575
566
  setReasoningEffort(effort: AnthropicReasoningEffortType): void;
576
567
  getReasoningEffort(): AnthropicReasoningEffortType;
568
+ setStructuredOutput(format: StructuredOutputFormat | undefined): void;
569
+ getStructuredOutput(): StructuredOutputFormat | undefined;
570
+ hasStructuredOutput(): boolean;
571
+ }
572
+
573
+ /**
574
+ * DeepSeek V4 reasoning levels. `"none"` selects non-thinking mode
575
+ * (`thinking: { type: "disabled" }`); any other value enables thinking
576
+ * mode and is forwarded as the `reasoning_effort` request parameter.
577
+ */
578
+ type DeepSeekReasoningEffortType = "max" | "high" | "medium" | "low" | "none";
579
+
580
+ declare class DeepSeekV4Flash implements GenerativeModel {
581
+ readonly specification: {
582
+ name: string;
583
+ provider: string;
584
+ supportReasoningEffort: boolean;
585
+ defaultReasoningEffort: DeepSeekReasoningEffortType;
586
+ supportStreaming: boolean;
587
+ contextWindowSize: number;
588
+ maxOutputTokens: number;
589
+ supportFunctionCalling: boolean;
590
+ supportStructuredOutput: boolean;
591
+ };
592
+ private tools;
593
+ private streaming;
594
+ private structuredOutput;
595
+ private readonly effort;
596
+ setStreaming(streaming: boolean): void;
597
+ getStreaming(): boolean;
598
+ setTools(tools: Tool[]): void;
599
+ getTools(): Tool[];
600
+ setReasoningEffort(effort: DeepSeekReasoningEffortType): void;
601
+ getReasoningEffort(): DeepSeekReasoningEffortType;
602
+ setStructuredOutput(format: StructuredOutputFormat | undefined): void;
603
+ getStructuredOutput(): StructuredOutputFormat | undefined;
604
+ hasStructuredOutput(): boolean;
605
+ }
606
+
607
+ declare class DeepSeekV4Pro implements GenerativeModel {
608
+ readonly specification: {
609
+ name: string;
610
+ provider: string;
611
+ supportReasoningEffort: boolean;
612
+ defaultReasoningEffort: DeepSeekReasoningEffortType;
613
+ supportStreaming: boolean;
614
+ contextWindowSize: number;
615
+ maxOutputTokens: number;
616
+ supportFunctionCalling: boolean;
617
+ supportStructuredOutput: boolean;
618
+ };
619
+ private tools;
620
+ private streaming;
621
+ private structuredOutput;
622
+ private readonly effort;
623
+ setStreaming(streaming: boolean): void;
624
+ getStreaming(): boolean;
625
+ setTools(tools: Tool[]): void;
626
+ getTools(): Tool[];
627
+ setReasoningEffort(effort: DeepSeekReasoningEffortType): void;
628
+ getReasoningEffort(): DeepSeekReasoningEffortType;
629
+ setStructuredOutput(format: StructuredOutputFormat | undefined): void;
630
+ getStructuredOutput(): StructuredOutputFormat | undefined;
631
+ hasStructuredOutput(): boolean;
577
632
  }
578
633
 
579
- export { Agent, AgenticEnvironment, AnthropicMessages, BaseAgent, BaseHuman, BaseObserver, ClaudeHaiku45, ClaudeOpus47, ClaudeSonnet46, ContextItem, DefaultFunctionCallRunner, DeveloperMessageItem, FunctionCallItem, FunctionCallOutputItem, type FunctionCallRunner, type GenerativeModel, Gpt54, Gpt54Mini, Gpt54Nano, Gpt55, Human, InMemoryModelContextRepository, InferenceRequest, InferenceResponse, type InferenceRunner, InputTokenDetails, ModelContext, type ModelContextRepository, ModelMessageItem, type ModelRuntime, Observer, OpenAIInferenceRunner, OpenAIResponses, OutputTokenDetails, Participant, ReasoningItem, SemanticEvent, type StreamingRuntime, SystemMessageItem, TokenUsage, type Tool, UserMessageItem };
634
+ /**
635
+ * Native Gemini adapter on the `@google/genai` SDK (`generateContent` /
636
+ * `generateContentStream`). Unlike an OpenAI-compat shim this maps our
637
+ * domain context to Gemini's native `contents`/`parts` shape, system
638
+ * instruction, `functionDeclarations`, and `thinkingConfig`, and reads
639
+ * thought parts + native usage metadata back out. Another `ModelRuntime`
640
+ * — no runner or port changes.
641
+ */
642
+ declare class GeminiGenerateContent implements Endpoint {
643
+ private readonly client;
644
+ constructor();
645
+ infer(inferenceRequest: InferenceRequest): Promise<InferenceResponse>;
646
+ stream(inferenceRequest: InferenceRequest, signal?: AbortSignal): AsyncIterable<SemanticEvent<unknown>>;
647
+ private buildRequest;
648
+ extractTokenUsage(response: any): TokenUsage | undefined;
649
+ mapContextToRequest(context: ModelContext): {
650
+ contents: any[];
651
+ systemInstruction?: string;
652
+ };
653
+ extractContextItems(response: any): ContextItem[];
654
+ private parseResponse;
655
+ private addPart;
656
+ }
657
+
658
+ /**
659
+ * Gemini reasoning levels, forwarded as the `reasoning_effort` request
660
+ * parameter on the OpenAI-compatible endpoint. `"none"` only disables
661
+ * thinking on Gemini 2.5 models; Gemini 3.x always thinks, so for those
662
+ * the adapter simply omits `reasoning_effort` when set to `"none"` and
663
+ * lets the model use its default thinking level.
664
+ */
665
+ type GeminiReasoningEffortType = "high" | "medium" | "low" | "minimal" | "none";
666
+
667
+ declare class Gemini35Flash implements GenerativeModel {
668
+ readonly specification: {
669
+ name: string;
670
+ provider: string;
671
+ supportReasoningEffort: boolean;
672
+ defaultReasoningEffort: GeminiReasoningEffortType;
673
+ supportStreaming: boolean;
674
+ contextWindowSize: number;
675
+ maxOutputTokens: number;
676
+ supportFunctionCalling: boolean;
677
+ supportStructuredOutput: boolean;
678
+ };
679
+ private tools;
680
+ private streaming;
681
+ private structuredOutput;
682
+ private readonly effort;
683
+ setStreaming(streaming: boolean): void;
684
+ getStreaming(): boolean;
685
+ setTools(tools: Tool[]): void;
686
+ getTools(): Tool[];
687
+ setReasoningEffort(effort: GeminiReasoningEffortType): void;
688
+ getReasoningEffort(): GeminiReasoningEffortType;
689
+ setStructuredOutput(format: StructuredOutputFormat | undefined): void;
690
+ getStructuredOutput(): StructuredOutputFormat | undefined;
691
+ hasStructuredOutput(): boolean;
692
+ }
693
+
694
+ declare class Gemini31Pro implements GenerativeModel {
695
+ readonly specification: {
696
+ name: string;
697
+ provider: string;
698
+ supportReasoningEffort: boolean;
699
+ defaultReasoningEffort: GeminiReasoningEffortType;
700
+ supportStreaming: boolean;
701
+ contextWindowSize: number;
702
+ maxOutputTokens: number;
703
+ supportFunctionCalling: boolean;
704
+ supportStructuredOutput: boolean;
705
+ };
706
+ private tools;
707
+ private streaming;
708
+ private structuredOutput;
709
+ private readonly effort;
710
+ setStreaming(streaming: boolean): void;
711
+ getStreaming(): boolean;
712
+ setTools(tools: Tool[]): void;
713
+ getTools(): Tool[];
714
+ setReasoningEffort(effort: GeminiReasoningEffortType): void;
715
+ getReasoningEffort(): GeminiReasoningEffortType;
716
+ setStructuredOutput(format: StructuredOutputFormat | undefined): void;
717
+ getStructuredOutput(): StructuredOutputFormat | undefined;
718
+ hasStructuredOutput(): boolean;
719
+ }
720
+
721
+ /**
722
+ * Optional connection config. When omitted, the `openai` SDK reads
723
+ * `OPENAI_API_KEY` and `OPENAI_BASE_URL` from the environment, so the
724
+ * default-constructed runtime targets whatever `OPENAI_BASE_URL` points
725
+ * at (real OpenAI when unset). Provider presets (e.g. DeepSeek) pass an
726
+ * explicit base URL + credential.
727
+ */
728
+ interface OpenAICompatibleConfig {
729
+ baseURL?: string;
730
+ apiKey?: string;
731
+ /**
732
+ * Extra request-body fields merged into every `chat.completions`
733
+ * call. This is how provider-specific quirks are handled **without
734
+ * a per-provider subclass in mozaik** — the consumer supplies the
735
+ * vendor-only fields (e.g. DeepSeek's `{ thinking: { type } }`,
736
+ * safety flags, routing hints). Standard fields the runtime already
737
+ * sets (`model`, `messages`, `tools`, `reasoning_effort`) take
738
+ * precedence and are not overwritten.
739
+ */
740
+ extraBody?: Record<string, unknown>;
741
+ }
742
+ /**
743
+ * Generic adapter for any **OpenAI Chat Completions**-compatible
744
+ * endpoint — real OpenAI, DeepSeek, Xiaomi MiMo, OpenRouter, vLLM,
745
+ * Ollama, etc. It speaks `/chat/completions` (not the Responses API),
746
+ * which is the dialect third-party OpenAI-compatible providers expose.
747
+ *
748
+ * The base URL and credential are configurable; everything else (the
749
+ * `ModelContext` ⇄ chat-message conversion, tool-call round-trip, token
750
+ * usage extraction) is provider-agnostic. Provider-specific request
751
+ * shaping (e.g. DeepSeek's `thinking` field) is supplied by the
752
+ * consumer via {@link OpenAICompatibleConfig.extraBody} — mozaik stays
753
+ * generic and gains no per-provider subclasses.
754
+ *
755
+ * Was `DeepSeekChatCompletions`; generalized so consumers can point it
756
+ * at any OpenAI-compatible endpoint.
757
+ */
758
+ declare class OpenAIChatCompletions implements Endpoint {
759
+ private readonly client;
760
+ private readonly extraBody;
761
+ constructor(config?: OpenAICompatibleConfig);
762
+ infer(inferenceRequest: InferenceRequest): Promise<InferenceResponse>;
763
+ stream(inferenceRequest: InferenceRequest, signal?: AbortSignal): AsyncIterable<SemanticEvent<unknown>>;
764
+ buildRequest(inferenceRequest: InferenceRequest): any;
765
+ extractTokenUsage(response: any): TokenUsage | undefined;
766
+ mapContextToRequest(context: ModelContext): any[];
767
+ extractContextItems(response: any): ContextItem[];
768
+ }
769
+
770
+ type InferenceParams = {
771
+ model: string;
772
+ reasoningEffort?: string;
773
+ tools?: Tool[];
774
+ streaming?: boolean;
775
+ structuredOutput?: StructuredOutputFormat;
776
+ context: ModelContext;
777
+ caller: Participant;
778
+ environment: AgenticEnvironment;
779
+ signal?: AbortSignal;
780
+ };
781
+
782
+ declare class BaseParticipant extends Participant {
783
+ onFunctionCall(item: FunctionCallItem): void;
784
+ onExternalFunctionCall(source: Participant, item: FunctionCallItem): void;
785
+ onFunctionCallOutput(item: FunctionCallOutputItem): void;
786
+ onExternalFunctionCallOutput(source: Participant, item: FunctionCallOutputItem): void;
787
+ onReasoning(item: ReasoningItem): void;
788
+ onExternalReasoning(source: Participant, item: ReasoningItem): void;
789
+ onModelMessage(item: ModelMessageItem): void;
790
+ onExternalModelMessage(source: Participant, item: ModelMessageItem): void;
791
+ onMessage(message: string): void;
792
+ onJoined(): void;
793
+ onLeft(): void;
794
+ onParticipantJoined(participant: Participant): void;
795
+ onParticipantLeft(participant: Participant): void;
796
+ onInternalEvent(item: SemanticEvent<unknown>): void;
797
+ onExternalEvent(source: Participant, item: SemanticEvent<unknown>): void;
798
+ onError(error: AgenticError): void;
799
+ onParticipantError(source: Participant, error: AgenticError): void;
800
+ }
801
+
802
+ declare const runInference: (inferenceParams: InferenceParams) => void;
803
+ declare const executeFunctionCall: (environment: AgenticEnvironment, functionCallItem: FunctionCallItem, tool: Tool, caller: Participant) => void;
804
+ declare const sendMessage: (environment: AgenticEnvironment, message: string, caller: Participant) => void;
805
+
806
+ export { AgenticEnvironment, AgenticError, AnthropicMessages, BaseParticipant, ClaudeHaiku45, ClaudeOpus47, ClaudeOpus48, ClaudeSonnet46, ContextItem, DeepSeekV4Flash, DeepSeekV4Pro, DeveloperMessageItem, type Endpoint, FunctionCallItem, FunctionCallOutputItem, Gemini31Pro, Gemini35Flash, GeminiGenerateContent, type GenerativeModel, Gpt54, Gpt54Mini, Gpt54Nano, Gpt55, InMemoryModelContextRepository, InferenceRequest, InferenceResponse, InputTokenDetails, ModelContext, type ModelContextRepository, ModelMessageItem, OpenAIChatCompletions, OpenAIResponses, OutputTokenDetails, Participant, ReasoningItem, SemanticEvent, type StructuredOutputCapability, type StructuredOutputFormat, SystemMessageItem, TokenUsage, type Tool, UserMessageItem, executeFunctionCall, runInference, sendMessage };