modelfusion 0.52.0 → 0.53.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 +0 -8
- package/core/ExecuteFunctionEvent.cjs +2 -0
- package/core/ExecuteFunctionEvent.d.ts +7 -0
- package/core/ExecuteFunctionEvent.js +1 -0
- package/core/FunctionEvent.d.ts +2 -1
- package/core/executeFunction.cjs +19 -0
- package/core/executeFunction.d.ts +2 -0
- package/core/executeFunction.js +15 -0
- package/core/index.cjs +2 -0
- package/core/index.d.ts +2 -0
- package/core/index.js +2 -0
- package/package.json +1 -1
package/README.md
CHANGED
@@ -664,11 +664,3 @@ Generate text on a Cloudflare Worker using ModelFusion and OpenAI.
|
|
664
664
|
### [Contributing Guide](https://github.com/lgrammel/modelfusion/blob/main/CONTRIBUTING.md)
|
665
665
|
|
666
666
|
Read the [ModelFusion contributing guide](https://github.com/lgrammel/modelfusion/blob/main/CONTRIBUTING.md) to learn about the development process, how to propose bugfixes and improvements, and how to build and test your changes.
|
667
|
-
|
668
|
-
```
|
669
|
-
|
670
|
-
```
|
671
|
-
|
672
|
-
```
|
673
|
-
|
674
|
-
```
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import { BaseFunctionFinishedEvent, BaseFunctionStartedEvent } from "./FunctionEvent.js";
|
2
|
+
export interface ExecuteFunctionStartedEvent extends BaseFunctionStartedEvent {
|
3
|
+
functionType: "execute-function";
|
4
|
+
}
|
5
|
+
export interface ExecuteFunctionFinishedEvent extends BaseFunctionFinishedEvent {
|
6
|
+
functionType: "execute-function";
|
7
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
package/core/FunctionEvent.d.ts
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
import { ExecuteFunctionFinishedEvent, ExecuteFunctionStartedEvent } from "./ExecuteFunctionEvent.js";
|
1
2
|
import { GuardFinishedEvent, GuardStartedEvent } from "../guard/GuardEvent.js";
|
2
3
|
import { ModelCallFinishedEvent, ModelCallStartedEvent } from "../model-function/ModelCallEvent.js";
|
3
4
|
import { RetrieveFinishedEvent, RetrieveStartedEvent } from "../retriever/RetrieveEvent.js";
|
@@ -81,4 +82,4 @@ export interface BaseFunctionFinishedEvent extends BaseFunctionEvent {
|
|
81
82
|
*/
|
82
83
|
result: BaseFunctionFinishedEventResult;
|
83
84
|
}
|
84
|
-
export type FunctionEvent = ExecuteToolStartedEvent | ExecuteToolFinishedEvent | GuardStartedEvent | GuardFinishedEvent | ModelCallStartedEvent | ModelCallFinishedEvent | RetrieveStartedEvent | RetrieveFinishedEvent | UpsertIntoVectorIndexStartedEvent | UpsertIntoVectorIndexFinishedEvent | UseToolStartedEvent | UseToolFinishedEvent | UseToolOrGenerateTextStartedEvent | UseToolOrGenerateTextFinishedEvent;
|
85
|
+
export type FunctionEvent = ExecuteFunctionStartedEvent | ExecuteFunctionFinishedEvent | ExecuteToolStartedEvent | ExecuteToolFinishedEvent | GuardStartedEvent | GuardFinishedEvent | ModelCallStartedEvent | ModelCallFinishedEvent | RetrieveStartedEvent | RetrieveFinishedEvent | UpsertIntoVectorIndexStartedEvent | UpsertIntoVectorIndexFinishedEvent | UseToolStartedEvent | UseToolFinishedEvent | UseToolOrGenerateTextStartedEvent | UseToolOrGenerateTextFinishedEvent;
|
@@ -0,0 +1,19 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.executeFunction = void 0;
|
4
|
+
const executeFunctionCall_js_1 = require("./executeFunctionCall.cjs");
|
5
|
+
async function executeFunction(fn, input, options) {
|
6
|
+
return (0, executeFunctionCall_js_1.executeFunctionCall)({
|
7
|
+
options,
|
8
|
+
input,
|
9
|
+
functionType: "execute-function",
|
10
|
+
execute: async (options) => fn(input, {
|
11
|
+
// omit functionId
|
12
|
+
logging: options?.logging,
|
13
|
+
observers: options?.observers,
|
14
|
+
run: options?.run,
|
15
|
+
parentCallId: options?.parentCallId,
|
16
|
+
}),
|
17
|
+
});
|
18
|
+
}
|
19
|
+
exports.executeFunction = executeFunction;
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import { executeFunctionCall } from "./executeFunctionCall.js";
|
2
|
+
export async function executeFunction(fn, input, options) {
|
3
|
+
return executeFunctionCall({
|
4
|
+
options,
|
5
|
+
input,
|
6
|
+
functionType: "execute-function",
|
7
|
+
execute: async (options) => fn(input, {
|
8
|
+
// omit functionId
|
9
|
+
logging: options?.logging,
|
10
|
+
observers: options?.observers,
|
11
|
+
run: options?.run,
|
12
|
+
parentCallId: options?.parentCallId,
|
13
|
+
}),
|
14
|
+
});
|
15
|
+
}
|
package/core/index.cjs
CHANGED
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
15
15
|
};
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
17
17
|
__exportStar(require("./DefaultRun.cjs"), exports);
|
18
|
+
__exportStar(require("./ExecuteFunctionEvent.cjs"), exports);
|
18
19
|
__exportStar(require("./FunctionEvent.cjs"), exports);
|
19
20
|
__exportStar(require("./FunctionEventSource.cjs"), exports);
|
20
21
|
__exportStar(require("./FunctionObserver.cjs"), exports);
|
@@ -24,5 +25,6 @@ __exportStar(require("./GlobalFunctionObservers.cjs"), exports);
|
|
24
25
|
__exportStar(require("./Run.cjs"), exports);
|
25
26
|
__exportStar(require("./Vector.cjs"), exports);
|
26
27
|
__exportStar(require("./api/index.cjs"), exports);
|
28
|
+
__exportStar(require("./executeFunction.cjs"), exports);
|
27
29
|
__exportStar(require("./getRun.cjs"), exports);
|
28
30
|
__exportStar(require("./structure/index.cjs"), exports);
|
package/core/index.d.ts
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
export * from "./DefaultRun.js";
|
2
|
+
export * from "./ExecuteFunctionEvent.js";
|
2
3
|
export * from "./FunctionEvent.js";
|
3
4
|
export * from "./FunctionEventSource.js";
|
4
5
|
export * from "./FunctionObserver.js";
|
@@ -8,5 +9,6 @@ export * from "./GlobalFunctionObservers.js";
|
|
8
9
|
export * from "./Run.js";
|
9
10
|
export * from "./Vector.js";
|
10
11
|
export * from "./api/index.js";
|
12
|
+
export * from "./executeFunction.js";
|
11
13
|
export * from "./getRun.js";
|
12
14
|
export * from "./structure/index.js";
|
package/core/index.js
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
export * from "./DefaultRun.js";
|
2
|
+
export * from "./ExecuteFunctionEvent.js";
|
2
3
|
export * from "./FunctionEvent.js";
|
3
4
|
export * from "./FunctionEventSource.js";
|
4
5
|
export * from "./FunctionObserver.js";
|
@@ -8,5 +9,6 @@ export * from "./GlobalFunctionObservers.js";
|
|
8
9
|
export * from "./Run.js";
|
9
10
|
export * from "./Vector.js";
|
10
11
|
export * from "./api/index.js";
|
12
|
+
export * from "./executeFunction.js";
|
11
13
|
export * from "./getRun.js";
|
12
14
|
export * from "./structure/index.js";
|
package/package.json
CHANGED