@mozaik-ai/core 0.8.0 → 0.8.2
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 +22 -22
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Mozaik is a TypeScript library for orchestrating AI agents, supporting both manually defined and AI-generated workflows.
|
|
4
4
|
|
|
5
|
-

|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -32,19 +32,19 @@ The system supports OpenAI models (gpt-5, gpt-5-mini, gpt-5-nano, gpt-5.1) and A
|
|
|
32
32
|
|
|
33
33
|
## Features
|
|
34
34
|
|
|
35
|
-
### AI
|
|
35
|
+
### AI MozaikAgents
|
|
36
36
|
|
|
37
37
|
This feature lets developers create AI agents through a single unified request definition, making it easy to compose tasks and leverage multiple models. You can mix providers, choose the best model for each task, and build agents that work across different capabilities.
|
|
38
38
|
|
|
39
39
|
```typescript
|
|
40
40
|
import "dotenv/config"
|
|
41
|
-
import {
|
|
41
|
+
import { MozaikAgent, MozaikRequest } from "@mozaik-ai/core"
|
|
42
42
|
|
|
43
|
-
const
|
|
43
|
+
const request: MozaikRequest = {
|
|
44
44
|
model: "claude-sonnet-4.5",
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
const agent = new
|
|
47
|
+
const agent = new MozaikAgent(request)
|
|
48
48
|
const codingResponse = await agent.act("Write a React component for a todo list")
|
|
49
49
|
```
|
|
50
50
|
|
|
@@ -54,7 +54,7 @@ Structured output lets you enforce exact response formats—using schemas like Z
|
|
|
54
54
|
|
|
55
55
|
```typescript
|
|
56
56
|
import { z } from "zod"
|
|
57
|
-
import {
|
|
57
|
+
import { MozaikAgent, MozaikRequest } from "@mozaik-ai/core"
|
|
58
58
|
|
|
59
59
|
const mealPlanSchema = z.object({
|
|
60
60
|
calories: z.number(),
|
|
@@ -70,13 +70,13 @@ const mealPlanSchema = z.object({
|
|
|
70
70
|
shoppingList: z.array(z.string()),
|
|
71
71
|
})
|
|
72
72
|
|
|
73
|
-
const
|
|
73
|
+
const request: MozaikRequest = {
|
|
74
74
|
model: "gpt-5-mini",
|
|
75
75
|
task: "Create a 1-day vegetarian meal plan with breakfast, lunch, and dinner.",
|
|
76
76
|
structuredOutput: mealPlanSchema,
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
const agent = new
|
|
79
|
+
const agent = new MozaikAgent(request)
|
|
80
80
|
const response = await agent.act()
|
|
81
81
|
```
|
|
82
82
|
|
|
@@ -85,9 +85,9 @@ const response = await agent.act()
|
|
|
85
85
|
Multi-turn conversation allows developers to provide chat history so the AI agent can maintain context and generate more relevant, continuous responses.
|
|
86
86
|
|
|
87
87
|
```typescript
|
|
88
|
-
import {
|
|
88
|
+
import { MozaikAgent, MozaikRequest } from "@mozaik-ai/core"
|
|
89
89
|
|
|
90
|
-
const
|
|
90
|
+
const request: MozaikRequest = {
|
|
91
91
|
messages: [
|
|
92
92
|
{ role: "system", content: "You are a coding assistant" },
|
|
93
93
|
{ role: "user", content: "How do I sort an array in TypeScript?" },
|
|
@@ -96,7 +96,7 @@ const command: Command = {
|
|
|
96
96
|
model: "claude-haiku-4.5",
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
const agent = new
|
|
99
|
+
const agent = new MozaikAgent(request)
|
|
100
100
|
const response = await agent.act("Can you show me an example?")
|
|
101
101
|
```
|
|
102
102
|
|
|
@@ -106,7 +106,7 @@ Tool calling allows the agent to invoke real functions in your environment—let
|
|
|
106
106
|
|
|
107
107
|
```typescript
|
|
108
108
|
import { promises as fs } from "fs"
|
|
109
|
-
import {
|
|
109
|
+
import { MozaikAgent, MozaikRequest, Tool } from "@mozaik-ai/core"
|
|
110
110
|
|
|
111
111
|
const tools: Tool[] = [
|
|
112
112
|
{
|
|
@@ -127,7 +127,7 @@ const tools: Tool[] = [
|
|
|
127
127
|
},
|
|
128
128
|
]
|
|
129
129
|
|
|
130
|
-
const
|
|
130
|
+
const request: MozaikRequest = {
|
|
131
131
|
model: "gpt-5.1",
|
|
132
132
|
tools,
|
|
133
133
|
messages: [
|
|
@@ -139,7 +139,7 @@ const command: Command = {
|
|
|
139
139
|
task: "Create a two-bullet trip prep checklist for Belgrade and save it as trip-checklist.txt.",
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
-
const agent = new
|
|
142
|
+
const agent = new MozaikAgent(request)
|
|
143
143
|
await agent.act()
|
|
144
144
|
```
|
|
145
145
|
|
|
@@ -148,9 +148,9 @@ await agent.act()
|
|
|
148
148
|
Vision support allows AI agents to interpret images alongside text, enabling richer understanding and multimodal interactions.
|
|
149
149
|
|
|
150
150
|
```typescript
|
|
151
|
-
import {
|
|
151
|
+
import { MozaikAgent, MozaikRequest } from "@mozaik-ai/core"
|
|
152
152
|
|
|
153
|
-
const
|
|
153
|
+
const request: MozaikRequest = {
|
|
154
154
|
messages: [
|
|
155
155
|
{
|
|
156
156
|
role: "user",
|
|
@@ -169,7 +169,7 @@ const command: Command = {
|
|
|
169
169
|
model: "claude-opus-4.5",
|
|
170
170
|
}
|
|
171
171
|
|
|
172
|
-
const agent = new
|
|
172
|
+
const agent = new MozaikAgent(request)
|
|
173
173
|
const response = await agent.act()
|
|
174
174
|
```
|
|
175
175
|
|
|
@@ -179,18 +179,18 @@ This example demonstrates how to use standard JavaScript/TypeScript concurrency
|
|
|
179
179
|
|
|
180
180
|
```typescript
|
|
181
181
|
import "dotenv/config"
|
|
182
|
-
import {
|
|
182
|
+
import { MozaikAgent, MozaikRequest } from "@mozaik-ai/core"
|
|
183
183
|
|
|
184
|
-
const
|
|
184
|
+
const openaiRequest: MozaikRequest = {
|
|
185
185
|
model: "gpt-5",
|
|
186
186
|
}
|
|
187
187
|
|
|
188
|
-
const
|
|
188
|
+
const anthropicRequest: MozaikRequest = {
|
|
189
189
|
model: "claude-sonnet-4.5",
|
|
190
190
|
}
|
|
191
191
|
|
|
192
|
-
const openaiAgent = new
|
|
193
|
-
const anthropicAgent = new
|
|
192
|
+
const openaiAgent = new MozaikAgent(openaiRequest)
|
|
193
|
+
const anthropicAgent = new MozaikAgent(anthropicRequest)
|
|
194
194
|
|
|
195
195
|
const task = "What are the key differences between TypeScript and JavaScript?"
|
|
196
196
|
|