@mozaik-ai/core 3.10.2 → 3.11.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/README.md +34 -33
- package/dist/index.d.mts +141 -6
- package/dist/index.d.ts +141 -6
- package/dist/index.js +413 -82
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +406 -82
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -78,11 +78,11 @@ flowchart LR
|
|
|
78
78
|
|
|
79
79
|
Mozaik ships three ready-to-use participants:
|
|
80
80
|
|
|
81
|
-
| Participant
|
|
82
|
-
|
|
|
83
|
-
| `BaseHuman`
|
|
84
|
-
| `BaseAgent`
|
|
85
|
-
| `BaseObserver`
|
|
81
|
+
| Participant | Role |
|
|
82
|
+
| -------------- | -------------------------------------------------------------------------------- |
|
|
83
|
+
| `BaseHuman` | Sends messages with `sendMessage(environment, text)` |
|
|
84
|
+
| `BaseAgent` | Runs inference and function calls via `InferenceRunner` and `FunctionCallRunner` |
|
|
85
|
+
| `BaseObserver` | Listens only; no inference |
|
|
86
86
|
|
|
87
87
|
```ts
|
|
88
88
|
import {
|
|
@@ -99,18 +99,15 @@ const environment = new AgenticEnvironment()
|
|
|
99
99
|
|
|
100
100
|
const human = new BaseHuman()
|
|
101
101
|
const agent = new BaseAgent(new OpenAIInferenceRunner(), new DefaultFunctionCallRunner())
|
|
102
|
+
const observer = new BaseObserver()
|
|
102
103
|
|
|
103
104
|
human.join(environment)
|
|
104
105
|
agent.join(environment)
|
|
106
|
+
observer.join(environment)
|
|
105
107
|
|
|
106
108
|
environment.start()
|
|
107
109
|
|
|
108
|
-
const context = ModelContext.create("demo")
|
|
109
|
-
const model = new Gpt54Mini()
|
|
110
|
-
|
|
111
|
-
// Both participants produce items in parallel — neither awaits the other.
|
|
112
110
|
human.sendMessage(environment, "Hello")
|
|
113
|
-
agent.runInference(environment, context, model)
|
|
114
111
|
```
|
|
115
112
|
|
|
116
113
|
The environment fans every item out to every subscriber synchronously and without awaiting them, so a slow listener never blocks producers or other listeners.
|
|
@@ -187,18 +184,37 @@ Three things to note:
|
|
|
187
184
|
|
|
188
185
|
## Streaming and semantic events
|
|
189
186
|
|
|
190
|
-
|
|
187
|
+
When inference runs with streaming enabled (`model.setStreaming(true)` on a model that supports it), the runner does not wait for the full response. As the provider emits chunks, `OpenAIInferenceRunner` yields **`SemanticEvent`** items (`type` + `data`) and the environment delivers each one to **every** joined participant immediately — the same fan-out as messages and context items. Participants react in real time by overriding the stream handlers; no participant needs to poll or share a callback.
|
|
188
|
+
|
|
189
|
+
The producing participant receives `onInternalEvent`; everyone else receives `onExternalEvent(source, event)`:
|
|
191
190
|
|
|
192
191
|
```ts
|
|
193
|
-
|
|
194
|
-
|
|
192
|
+
import { BaseAgent, Participant, SemanticEvent } from "@mozaik-ai/core"
|
|
193
|
+
|
|
194
|
+
// Agent that runs streaming inference — can observe its own stream chunks.
|
|
195
|
+
export class StreamingAgent extends BaseAgent {
|
|
196
|
+
async onInternalEvent(event: SemanticEvent<unknown>): Promise<void> {
|
|
197
|
+
if (event.type === "response.output_text.delta") {
|
|
198
|
+
// e.g. keep a local buffer of partial output
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
195
202
|
|
|
196
|
-
|
|
197
|
-
|
|
203
|
+
// Any other participant — UI, logger, second agent — reacts to another's stream.
|
|
204
|
+
export class LiveTranscript extends Participant {
|
|
205
|
+
async onExternalEvent(source: Participant, event: SemanticEvent<unknown>): Promise<void> {
|
|
206
|
+
if (event.type === "response.output_text.delta") {
|
|
207
|
+
const { delta } = event.data as { delta: string }
|
|
208
|
+
process.stdout.write(delta)
|
|
209
|
+
}
|
|
210
|
+
}
|
|
198
211
|
|
|
199
|
-
|
|
212
|
+
// Self-emitted stream events are unused for a pure observer.
|
|
213
|
+
async onInternalEvent(): Promise<void> {}
|
|
214
|
+
}
|
|
215
|
+
```
|
|
200
216
|
|
|
201
|
-
`setStreaming(true)` on a model without `supportStreaming` throws before the API is called.
|
|
217
|
+
Enable streaming on the model before calling `runInference` as usual. `setStreaming(true)` on a model without `supportStreaming` throws before the API is called.
|
|
202
218
|
|
|
203
219
|
---
|
|
204
220
|
|
|
@@ -319,12 +335,7 @@ Humans send text with `sendMessage(environment, message)`; other participants re
|
|
|
319
335
|
An `InferenceRunner` can yield `ReasoningItem`, `FunctionCallItem`, `ModelMessageItem`, and `SemanticEvent` (when streaming).
|
|
320
336
|
|
|
321
337
|
```ts
|
|
322
|
-
import {
|
|
323
|
-
InferenceRunner,
|
|
324
|
-
ModelContext,
|
|
325
|
-
GenerativeModel,
|
|
326
|
-
OpenAIInferenceRunner,
|
|
327
|
-
} from "@mozaik-ai/core"
|
|
338
|
+
import { InferenceRunner, ModelContext, GenerativeModel, OpenAIInferenceRunner } from "@mozaik-ai/core"
|
|
328
339
|
|
|
329
340
|
// Use the bundled runner, or implement InferenceRunner for another provider.
|
|
330
341
|
const runner: InferenceRunner = new OpenAIInferenceRunner()
|
|
@@ -350,16 +361,6 @@ export class ToolRegistryFunctionCallRunner implements FunctionCallRunner {
|
|
|
350
361
|
}
|
|
351
362
|
```
|
|
352
363
|
|
|
353
|
-
### Wiring it together
|
|
354
|
-
|
|
355
|
-
```ts
|
|
356
|
-
import { BaseAgent, AgenticEnvironment, OpenAIInferenceRunner } from "@mozaik-ai/core"
|
|
357
|
-
|
|
358
|
-
const agent = new BaseAgent(new OpenAIInferenceRunner(), new ToolRegistryFunctionCallRunner(tools))
|
|
359
|
-
|
|
360
|
-
agent.join(new AgenticEnvironment())
|
|
361
|
-
```
|
|
362
|
-
|
|
363
364
|
---
|
|
364
365
|
|
|
365
366
|
## Examples
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import OpenAI from 'openai';
|
|
2
|
+
import Anthropic from '@anthropic-ai/sdk';
|
|
2
3
|
|
|
3
4
|
declare abstract class ContextItem {
|
|
4
5
|
abstract readonly type: string;
|
|
@@ -292,8 +293,8 @@ declare class SemanticEvent<T> {
|
|
|
292
293
|
declare class AgenticEnvironment {
|
|
293
294
|
protected subscribers: Participant[];
|
|
294
295
|
private isActive;
|
|
295
|
-
subscribe(
|
|
296
|
-
unsubscribe(
|
|
296
|
+
subscribe(participant: Participant): void;
|
|
297
|
+
unsubscribe(participant: Participant): void;
|
|
297
298
|
deliverFunctionCall(source: Participant, item: FunctionCallItem): void;
|
|
298
299
|
deliverModelMessage(source: Participant, item: ModelMessageItem): void;
|
|
299
300
|
deliverReasoning(source: Participant, item: ReasoningItem): void;
|
|
@@ -385,12 +386,47 @@ declare class BaseHuman extends Human {
|
|
|
385
386
|
onExternalEvent(source: Participant, item: SemanticEvent<unknown>): void;
|
|
386
387
|
}
|
|
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
|
+
|
|
388
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
|
+
*/
|
|
389
425
|
declare class OpenAIInferenceRunner implements InferenceRunner {
|
|
426
|
+
private readonly runtime;
|
|
427
|
+
constructor(runtime: ModelRuntime);
|
|
390
428
|
run(context: ModelContext, model: GenerativeModel, signal?: AbortSignal): AsyncIterable<InferenceItem>;
|
|
391
|
-
|
|
392
|
-
mapContextToRequest(context: ModelContext): any[];
|
|
393
|
-
extractContextItems(response: any): ContextItem[];
|
|
429
|
+
private isStreamingRuntime;
|
|
394
430
|
}
|
|
395
431
|
|
|
396
432
|
declare class DefaultFunctionCallRunner implements FunctionCallRunner {
|
|
@@ -441,4 +477,103 @@ declare class BaseObserver extends Observer {
|
|
|
441
477
|
onExternalEvent(source: Participant, item: SemanticEvent<unknown>): void;
|
|
442
478
|
}
|
|
443
479
|
|
|
444
|
-
|
|
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>>;
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
declare class OpenAIResponses implements ModelRuntime, StreamingRuntime {
|
|
491
|
+
private readonly client;
|
|
492
|
+
constructor();
|
|
493
|
+
infer(inferenceRequest: InferenceRequest): Promise<InferenceResponse>;
|
|
494
|
+
stream(inferenceRequest: InferenceRequest, signal?: AbortSignal): AsyncIterable<ReasoningItem | FunctionCallItem | ModelMessageItem | SemanticEvent<unknown>>;
|
|
495
|
+
private buildRequest;
|
|
496
|
+
extractTokenUsage(response: OpenAI.Responses.Response): TokenUsage | undefined;
|
|
497
|
+
mapContextToRequest(context: ModelContext): any[];
|
|
498
|
+
extractContextItems(response: any): ContextItem[];
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
declare class AnthropicMessages implements ModelRuntime {
|
|
502
|
+
private readonly client;
|
|
503
|
+
constructor();
|
|
504
|
+
infer(inferenceRequest: InferenceRequest): Promise<InferenceResponse>;
|
|
505
|
+
extractTokenUsage(response: Anthropic.Messages.Message): TokenUsage | undefined;
|
|
506
|
+
mapContextToRequest(context: ModelContext): {
|
|
507
|
+
messages: any[];
|
|
508
|
+
system?: string;
|
|
509
|
+
};
|
|
510
|
+
extractContextItems(response: Anthropic.Messages.Message): ContextItem[];
|
|
511
|
+
private addContentBlock;
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
type AnthropicReasoningEffortType = "high" | "medium" | "low" | "none";
|
|
515
|
+
|
|
516
|
+
declare class ClaudeOpus47 implements GenerativeModel {
|
|
517
|
+
readonly specification: {
|
|
518
|
+
name: string;
|
|
519
|
+
supportReasoningEffort: boolean;
|
|
520
|
+
defaultReasoningEffort: AnthropicReasoningEffortType;
|
|
521
|
+
supportStreaming: boolean;
|
|
522
|
+
contextWindowSize: number;
|
|
523
|
+
maxOutputTokens: number;
|
|
524
|
+
supportFunctionCalling: boolean;
|
|
525
|
+
};
|
|
526
|
+
private tools;
|
|
527
|
+
private streaming;
|
|
528
|
+
setStreaming(streaming: boolean): void;
|
|
529
|
+
getStreaming(): boolean;
|
|
530
|
+
setTools(tools: Tool[]): void;
|
|
531
|
+
getTools(): Tool[];
|
|
532
|
+
private readonly effort;
|
|
533
|
+
setReasoningEffort(effort: AnthropicReasoningEffortType): void;
|
|
534
|
+
getReasoningEffort(): AnthropicReasoningEffortType;
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
declare class ClaudeSonnet46 implements GenerativeModel {
|
|
538
|
+
readonly specification: {
|
|
539
|
+
name: string;
|
|
540
|
+
supportReasoningEffort: boolean;
|
|
541
|
+
defaultReasoningEffort: AnthropicReasoningEffortType;
|
|
542
|
+
supportStreaming: boolean;
|
|
543
|
+
contextWindowSize: number;
|
|
544
|
+
maxOutputTokens: number;
|
|
545
|
+
supportFunctionCalling: boolean;
|
|
546
|
+
};
|
|
547
|
+
private tools;
|
|
548
|
+
private streaming;
|
|
549
|
+
setStreaming(streaming: boolean): void;
|
|
550
|
+
getStreaming(): boolean;
|
|
551
|
+
setTools(tools: Tool[]): void;
|
|
552
|
+
getTools(): Tool[];
|
|
553
|
+
private readonly effort;
|
|
554
|
+
setReasoningEffort(effort: AnthropicReasoningEffortType): void;
|
|
555
|
+
getReasoningEffort(): AnthropicReasoningEffortType;
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
declare class ClaudeHaiku45 implements GenerativeModel {
|
|
559
|
+
readonly specification: {
|
|
560
|
+
name: string;
|
|
561
|
+
supportReasoningEffort: boolean;
|
|
562
|
+
defaultReasoningEffort: AnthropicReasoningEffortType;
|
|
563
|
+
supportStreaming: boolean;
|
|
564
|
+
contextWindowSize: number;
|
|
565
|
+
maxOutputTokens: number;
|
|
566
|
+
supportFunctionCalling: boolean;
|
|
567
|
+
};
|
|
568
|
+
private tools;
|
|
569
|
+
private streaming;
|
|
570
|
+
setStreaming(streaming: boolean): void;
|
|
571
|
+
getStreaming(): boolean;
|
|
572
|
+
setTools(tools: Tool[]): void;
|
|
573
|
+
getTools(): Tool[];
|
|
574
|
+
private readonly effort;
|
|
575
|
+
setReasoningEffort(effort: AnthropicReasoningEffortType): void;
|
|
576
|
+
getReasoningEffort(): AnthropicReasoningEffortType;
|
|
577
|
+
}
|
|
578
|
+
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import OpenAI from 'openai';
|
|
2
|
+
import Anthropic from '@anthropic-ai/sdk';
|
|
2
3
|
|
|
3
4
|
declare abstract class ContextItem {
|
|
4
5
|
abstract readonly type: string;
|
|
@@ -292,8 +293,8 @@ declare class SemanticEvent<T> {
|
|
|
292
293
|
declare class AgenticEnvironment {
|
|
293
294
|
protected subscribers: Participant[];
|
|
294
295
|
private isActive;
|
|
295
|
-
subscribe(
|
|
296
|
-
unsubscribe(
|
|
296
|
+
subscribe(participant: Participant): void;
|
|
297
|
+
unsubscribe(participant: Participant): void;
|
|
297
298
|
deliverFunctionCall(source: Participant, item: FunctionCallItem): void;
|
|
298
299
|
deliverModelMessage(source: Participant, item: ModelMessageItem): void;
|
|
299
300
|
deliverReasoning(source: Participant, item: ReasoningItem): void;
|
|
@@ -385,12 +386,47 @@ declare class BaseHuman extends Human {
|
|
|
385
386
|
onExternalEvent(source: Participant, item: SemanticEvent<unknown>): void;
|
|
386
387
|
}
|
|
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
|
+
|
|
388
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
|
+
*/
|
|
389
425
|
declare class OpenAIInferenceRunner implements InferenceRunner {
|
|
426
|
+
private readonly runtime;
|
|
427
|
+
constructor(runtime: ModelRuntime);
|
|
390
428
|
run(context: ModelContext, model: GenerativeModel, signal?: AbortSignal): AsyncIterable<InferenceItem>;
|
|
391
|
-
|
|
392
|
-
mapContextToRequest(context: ModelContext): any[];
|
|
393
|
-
extractContextItems(response: any): ContextItem[];
|
|
429
|
+
private isStreamingRuntime;
|
|
394
430
|
}
|
|
395
431
|
|
|
396
432
|
declare class DefaultFunctionCallRunner implements FunctionCallRunner {
|
|
@@ -441,4 +477,103 @@ declare class BaseObserver extends Observer {
|
|
|
441
477
|
onExternalEvent(source: Participant, item: SemanticEvent<unknown>): void;
|
|
442
478
|
}
|
|
443
479
|
|
|
444
|
-
|
|
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>>;
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
declare class OpenAIResponses implements ModelRuntime, StreamingRuntime {
|
|
491
|
+
private readonly client;
|
|
492
|
+
constructor();
|
|
493
|
+
infer(inferenceRequest: InferenceRequest): Promise<InferenceResponse>;
|
|
494
|
+
stream(inferenceRequest: InferenceRequest, signal?: AbortSignal): AsyncIterable<ReasoningItem | FunctionCallItem | ModelMessageItem | SemanticEvent<unknown>>;
|
|
495
|
+
private buildRequest;
|
|
496
|
+
extractTokenUsage(response: OpenAI.Responses.Response): TokenUsage | undefined;
|
|
497
|
+
mapContextToRequest(context: ModelContext): any[];
|
|
498
|
+
extractContextItems(response: any): ContextItem[];
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
declare class AnthropicMessages implements ModelRuntime {
|
|
502
|
+
private readonly client;
|
|
503
|
+
constructor();
|
|
504
|
+
infer(inferenceRequest: InferenceRequest): Promise<InferenceResponse>;
|
|
505
|
+
extractTokenUsage(response: Anthropic.Messages.Message): TokenUsage | undefined;
|
|
506
|
+
mapContextToRequest(context: ModelContext): {
|
|
507
|
+
messages: any[];
|
|
508
|
+
system?: string;
|
|
509
|
+
};
|
|
510
|
+
extractContextItems(response: Anthropic.Messages.Message): ContextItem[];
|
|
511
|
+
private addContentBlock;
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
type AnthropicReasoningEffortType = "high" | "medium" | "low" | "none";
|
|
515
|
+
|
|
516
|
+
declare class ClaudeOpus47 implements GenerativeModel {
|
|
517
|
+
readonly specification: {
|
|
518
|
+
name: string;
|
|
519
|
+
supportReasoningEffort: boolean;
|
|
520
|
+
defaultReasoningEffort: AnthropicReasoningEffortType;
|
|
521
|
+
supportStreaming: boolean;
|
|
522
|
+
contextWindowSize: number;
|
|
523
|
+
maxOutputTokens: number;
|
|
524
|
+
supportFunctionCalling: boolean;
|
|
525
|
+
};
|
|
526
|
+
private tools;
|
|
527
|
+
private streaming;
|
|
528
|
+
setStreaming(streaming: boolean): void;
|
|
529
|
+
getStreaming(): boolean;
|
|
530
|
+
setTools(tools: Tool[]): void;
|
|
531
|
+
getTools(): Tool[];
|
|
532
|
+
private readonly effort;
|
|
533
|
+
setReasoningEffort(effort: AnthropicReasoningEffortType): void;
|
|
534
|
+
getReasoningEffort(): AnthropicReasoningEffortType;
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
declare class ClaudeSonnet46 implements GenerativeModel {
|
|
538
|
+
readonly specification: {
|
|
539
|
+
name: string;
|
|
540
|
+
supportReasoningEffort: boolean;
|
|
541
|
+
defaultReasoningEffort: AnthropicReasoningEffortType;
|
|
542
|
+
supportStreaming: boolean;
|
|
543
|
+
contextWindowSize: number;
|
|
544
|
+
maxOutputTokens: number;
|
|
545
|
+
supportFunctionCalling: boolean;
|
|
546
|
+
};
|
|
547
|
+
private tools;
|
|
548
|
+
private streaming;
|
|
549
|
+
setStreaming(streaming: boolean): void;
|
|
550
|
+
getStreaming(): boolean;
|
|
551
|
+
setTools(tools: Tool[]): void;
|
|
552
|
+
getTools(): Tool[];
|
|
553
|
+
private readonly effort;
|
|
554
|
+
setReasoningEffort(effort: AnthropicReasoningEffortType): void;
|
|
555
|
+
getReasoningEffort(): AnthropicReasoningEffortType;
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
declare class ClaudeHaiku45 implements GenerativeModel {
|
|
559
|
+
readonly specification: {
|
|
560
|
+
name: string;
|
|
561
|
+
supportReasoningEffort: boolean;
|
|
562
|
+
defaultReasoningEffort: AnthropicReasoningEffortType;
|
|
563
|
+
supportStreaming: boolean;
|
|
564
|
+
contextWindowSize: number;
|
|
565
|
+
maxOutputTokens: number;
|
|
566
|
+
supportFunctionCalling: boolean;
|
|
567
|
+
};
|
|
568
|
+
private tools;
|
|
569
|
+
private streaming;
|
|
570
|
+
setStreaming(streaming: boolean): void;
|
|
571
|
+
getStreaming(): boolean;
|
|
572
|
+
setTools(tools: Tool[]): void;
|
|
573
|
+
getTools(): Tool[];
|
|
574
|
+
private readonly effort;
|
|
575
|
+
setReasoningEffort(effort: AnthropicReasoningEffortType): void;
|
|
576
|
+
getReasoningEffort(): AnthropicReasoningEffortType;
|
|
577
|
+
}
|
|
578
|
+
|
|
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 };
|