@mozaik-ai/core 4.0.0-beta.9 → 4.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/README.md +267 -231
- package/dist/index.d.mts +47 -37
- package/dist/index.d.ts +47 -37
- package/dist/index.js +11 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +10 -10
package/dist/index.mjs
CHANGED
|
@@ -558,20 +558,20 @@ var AgentLoop = class _AgentLoop {
|
|
|
558
558
|
this.interceptionHandler = interceptionHandler;
|
|
559
559
|
}
|
|
560
560
|
async run(message, loopVisitor) {
|
|
561
|
+
var _a;
|
|
561
562
|
let transition = {
|
|
562
563
|
nextStateId: "context_update",
|
|
563
564
|
input: message
|
|
564
565
|
};
|
|
565
566
|
while (transition.nextStateId !== "idle") {
|
|
566
|
-
const isInterceptionSatisfied = this.interceptionHandler.isSatisfiedBy(transition);
|
|
567
|
-
if (isInterceptionSatisfied) {
|
|
567
|
+
const isInterceptionSatisfied = (_a = this.interceptionHandler) == null ? void 0 : _a.isSatisfiedBy(transition);
|
|
568
|
+
if (isInterceptionSatisfied && this.interceptionHandler) {
|
|
568
569
|
loopVisitor.visitInterceptionStarted(transition);
|
|
569
570
|
transition = await this.interceptionHandler.handle(transition);
|
|
570
571
|
loopVisitor.visitInterceptionFinished(transition);
|
|
571
|
-
} else {
|
|
572
|
-
const execution = await this.stateExecutor.execute(transition, loopVisitor);
|
|
573
|
-
transition = this.transitionResolver.resolve(execution);
|
|
574
572
|
}
|
|
573
|
+
const execution = await this.stateExecutor.execute(transition, loopVisitor);
|
|
574
|
+
transition = this.transitionResolver.resolve(execution);
|
|
575
575
|
}
|
|
576
576
|
}
|
|
577
577
|
getLoopId() {
|
|
@@ -943,7 +943,7 @@ var AnthropicMessagesMapper = class {
|
|
|
943
943
|
if (inferenceInput.structuredOutput) {
|
|
944
944
|
outputConfig.format = {
|
|
945
945
|
type: "json_schema",
|
|
946
|
-
|
|
946
|
+
schema: inferenceInput.structuredOutput.schema
|
|
947
947
|
};
|
|
948
948
|
}
|
|
949
949
|
if (inferenceInput.reasoningEffort) {
|
|
@@ -1066,7 +1066,7 @@ var AnthropicMessagesMapper = class {
|
|
|
1066
1066
|
);
|
|
1067
1067
|
}
|
|
1068
1068
|
}
|
|
1069
|
-
return { items, rowResponse: response };
|
|
1069
|
+
return { items, tokenUsage: this.extractTokenUsage(response), rowResponse: response };
|
|
1070
1070
|
}
|
|
1071
1071
|
};
|
|
1072
1072
|
|
|
@@ -1254,6 +1254,7 @@ var OpenAIResponsesMapper = class {
|
|
|
1254
1254
|
}
|
|
1255
1255
|
return {
|
|
1256
1256
|
items,
|
|
1257
|
+
tokenUsage: this.extractTokenUsage(response),
|
|
1257
1258
|
rowResponse: response
|
|
1258
1259
|
};
|
|
1259
1260
|
}
|
|
@@ -1442,7 +1443,7 @@ var GeminiGenerateContentMapper = class {
|
|
|
1442
1443
|
);
|
|
1443
1444
|
}
|
|
1444
1445
|
}
|
|
1445
|
-
return { items, rowResponse: response };
|
|
1446
|
+
return { items, tokenUsage: this.extractTokenUsage(response), rowResponse: response };
|
|
1446
1447
|
}
|
|
1447
1448
|
};
|
|
1448
1449
|
|
|
@@ -1565,7 +1566,7 @@ var OpenAIChatCompletionsMapper = class {
|
|
|
1565
1566
|
const items = [];
|
|
1566
1567
|
const message = (_b = (_a = response.choices) == null ? void 0 : _a[0]) == null ? void 0 : _b.message;
|
|
1567
1568
|
if (!message) {
|
|
1568
|
-
return { items: [], rowResponse: response };
|
|
1569
|
+
return { items: [], tokenUsage: this.extractTokenUsage(response), rowResponse: response };
|
|
1569
1570
|
}
|
|
1570
1571
|
if (message.reasoning_content) {
|
|
1571
1572
|
items.push(
|
|
@@ -1588,7 +1589,7 @@ var OpenAIChatCompletionsMapper = class {
|
|
|
1588
1589
|
})
|
|
1589
1590
|
);
|
|
1590
1591
|
}
|
|
1591
|
-
return { items, rowResponse: response };
|
|
1592
|
+
return { items, tokenUsage: this.extractTokenUsage(response), rowResponse: response };
|
|
1592
1593
|
}
|
|
1593
1594
|
};
|
|
1594
1595
|
|