@mozaik-ai/core 0.9.3 → 2.0.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 +51 -214
- package/dist/index.d.mts +116 -106
- package/dist/index.d.ts +116 -106
- package/dist/index.js +175 -1059
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +167 -1045
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,132 +1,142 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
readonly units: WorkUnit[];
|
|
6
|
-
constructor(mode: "parallel" | "sequential", units: WorkUnit[]);
|
|
7
|
-
execute(hook?: ExecutionHook): Promise<any>;
|
|
1
|
+
declare abstract class ContextItem {
|
|
2
|
+
abstract readonly type: string;
|
|
3
|
+
getType(): string;
|
|
4
|
+
abstract toJSON(): any;
|
|
8
5
|
}
|
|
9
6
|
|
|
10
|
-
declare class
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
7
|
+
declare class Context {
|
|
8
|
+
readonly id: string;
|
|
9
|
+
readonly projectId: string;
|
|
10
|
+
readonly items: ContextItem[];
|
|
11
|
+
constructor(id: string, projectId: string, items: ContextItem[]);
|
|
12
|
+
addItem(item: ContextItem): Context;
|
|
13
|
+
addItems(items: ContextItem[]): Context;
|
|
14
|
+
getItems(): ContextItem[];
|
|
15
|
+
static create(projectId: string): Context;
|
|
16
|
+
static rehydrate(data: {
|
|
17
|
+
id: string;
|
|
18
|
+
projectId: string;
|
|
19
|
+
items: ContextItem[];
|
|
20
|
+
}): Context;
|
|
21
|
+
toJSON(): any;
|
|
17
22
|
}
|
|
18
23
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
afterWorkflow(wf: Workflow, result: any): void;
|
|
22
|
-
beforeTask(task: Task): void;
|
|
23
|
-
afterTask(task: Task, result: any): void;
|
|
24
|
+
declare abstract class Content {
|
|
25
|
+
abstract readonly type: string;
|
|
24
26
|
}
|
|
25
27
|
|
|
26
|
-
declare
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
declare class InputText extends Content {
|
|
29
|
+
readonly text: string;
|
|
30
|
+
readonly type = "input_text";
|
|
31
|
+
private constructor();
|
|
32
|
+
static create(text: string): InputText;
|
|
33
|
+
static rehydrate(data: {
|
|
34
|
+
text: string;
|
|
35
|
+
}): InputText;
|
|
36
|
+
toJSON(): any[];
|
|
29
37
|
}
|
|
30
38
|
|
|
31
|
-
|
|
32
|
-
type
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
content: string | Array<TextPart | ImagePart>;
|
|
39
|
+
declare class UserMessage extends ContextItem {
|
|
40
|
+
readonly type = "message";
|
|
41
|
+
readonly role = "user";
|
|
42
|
+
readonly content: InputText;
|
|
43
|
+
private constructor();
|
|
44
|
+
static create(text: string): UserMessage;
|
|
45
|
+
static rehydrate(data: {
|
|
46
|
+
text: string;
|
|
47
|
+
}): UserMessage;
|
|
48
|
+
toJSON(): any;
|
|
42
49
|
}
|
|
43
50
|
|
|
44
|
-
declare
|
|
45
|
-
type
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
invoke: (args: any) => Promise<any>;
|
|
51
|
+
declare class DeveloperMessage extends ContextItem {
|
|
52
|
+
readonly type = "message";
|
|
53
|
+
readonly role = "developer";
|
|
54
|
+
readonly content: InputText;
|
|
55
|
+
private constructor();
|
|
56
|
+
toJSON(): any;
|
|
57
|
+
static create(text: string): DeveloperMessage;
|
|
58
|
+
static rehydrate(data: {
|
|
59
|
+
text: string;
|
|
60
|
+
}): DeveloperMessage;
|
|
55
61
|
}
|
|
56
62
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
declare enum ReasoningEffort {
|
|
66
|
-
NONE = "none",
|
|
67
|
-
LOW = "low",
|
|
68
|
-
MEDIUM = "medium",
|
|
69
|
-
HIGH = "high",
|
|
70
|
-
MAX = "max"
|
|
63
|
+
declare class OutputText extends Content {
|
|
64
|
+
readonly text: string;
|
|
65
|
+
readonly type = "output_text";
|
|
66
|
+
private constructor();
|
|
67
|
+
static rehydrate(data: {
|
|
68
|
+
text: string;
|
|
69
|
+
}): OutputText;
|
|
70
|
+
toJSON(): any[];
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
declare
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
build(): any;
|
|
73
|
+
declare class ModelMessage extends ContextItem {
|
|
74
|
+
readonly type = "message";
|
|
75
|
+
readonly role = "assistant";
|
|
76
|
+
readonly content: OutputText;
|
|
77
|
+
private constructor();
|
|
78
|
+
static rehydrate(data: {
|
|
79
|
+
text: string;
|
|
80
|
+
}): ModelMessage;
|
|
81
|
+
toJSON(): any;
|
|
83
82
|
}
|
|
84
83
|
|
|
85
|
-
declare
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
84
|
+
declare class FunctionCall extends ContextItem {
|
|
85
|
+
readonly type = "function_call";
|
|
86
|
+
readonly callId: string;
|
|
87
|
+
readonly name: string;
|
|
88
|
+
readonly args: string;
|
|
89
|
+
private constructor();
|
|
90
|
+
static rehydrate(data: {
|
|
91
|
+
callId: string;
|
|
92
|
+
name: string;
|
|
93
|
+
args: string;
|
|
94
|
+
}): FunctionCall;
|
|
95
|
+
toJSON(): any;
|
|
90
96
|
}
|
|
91
97
|
|
|
92
|
-
declare
|
|
93
|
-
|
|
98
|
+
declare class SummaryText extends Content {
|
|
99
|
+
readonly text: string;
|
|
100
|
+
readonly type = "summary_text";
|
|
101
|
+
private constructor();
|
|
102
|
+
static rehydrate(data: {
|
|
103
|
+
text: string;
|
|
104
|
+
}): SummaryText;
|
|
105
|
+
toJSON(): Record<string, any>;
|
|
94
106
|
}
|
|
95
107
|
|
|
96
|
-
declare class
|
|
97
|
-
readonly
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
108
|
+
declare class Reasoning extends ContextItem {
|
|
109
|
+
readonly type = "reasoning";
|
|
110
|
+
readonly content: InputText | undefined;
|
|
111
|
+
readonly encryptedContent: string | undefined;
|
|
112
|
+
readonly summary: SummaryText[];
|
|
113
|
+
private constructor();
|
|
114
|
+
static rehydrate(data: {
|
|
115
|
+
content: InputText | undefined;
|
|
116
|
+
encryptedContent: string | undefined;
|
|
117
|
+
summary: SummaryText[];
|
|
118
|
+
}): Reasoning;
|
|
119
|
+
toJSON(): any;
|
|
101
120
|
}
|
|
102
121
|
|
|
103
|
-
declare class
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
setMessages(messages: Message[]): void;
|
|
109
|
-
setTask(task: string): void;
|
|
110
|
-
setStructuredOutput(schema: ZodObject<any>): void;
|
|
111
|
-
act(task?: string): Promise<any>;
|
|
122
|
+
declare abstract class GenerativeModel {
|
|
123
|
+
abstract mapContextToRequest(context: Context): any[];
|
|
124
|
+
abstract extractContextItems(response: any): ContextItem[];
|
|
125
|
+
abstract infer(request: any): Promise<any>;
|
|
126
|
+
call(context: Context): Promise<ContextItem[]>;
|
|
112
127
|
}
|
|
113
128
|
|
|
114
|
-
declare class
|
|
115
|
-
|
|
116
|
-
|
|
129
|
+
declare class FunctionCallOutput extends ContextItem {
|
|
130
|
+
readonly type = "function_call_output";
|
|
131
|
+
readonly callId: string;
|
|
132
|
+
readonly output: InputText[];
|
|
133
|
+
private constructor();
|
|
134
|
+
static create(callId: string, output: InputText[]): FunctionCallOutput;
|
|
135
|
+
static rehydrate(data: {
|
|
136
|
+
callId: string;
|
|
137
|
+
output: InputText[];
|
|
138
|
+
}): FunctionCallOutput;
|
|
139
|
+
toJSON(): any;
|
|
117
140
|
}
|
|
118
141
|
|
|
119
|
-
|
|
120
|
-
inputTokens: number;
|
|
121
|
-
outputTokens: number;
|
|
122
|
-
model: string;
|
|
123
|
-
};
|
|
124
|
-
type MozaikResponse = {
|
|
125
|
-
data: any;
|
|
126
|
-
usage: {
|
|
127
|
-
entries: UsageEntry[];
|
|
128
|
-
totalUsdCost: number;
|
|
129
|
-
};
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
export { type Message, type Model, MozaikAgent, type MozaikRequest, type MozaikResponse, PlanningAgent, Task, type Tool, WorkUnit, Workflow };
|
|
142
|
+
export { Context, ContextItem, DeveloperMessage, FunctionCall, FunctionCallOutput, GenerativeModel, ModelMessage, Reasoning, UserMessage };
|