modelfusion 0.91.0 → 0.92.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 CHANGED
@@ -40,7 +40,7 @@ Or use a template:
40
40
 
41
41
  ## Usage Examples
42
42
 
43
- > 💡
43
+ > [!TIP]
44
44
  > The basic examples are a great way to get started and to explore in parallel with the [documentation](https://modelfusion.dev/). You can find them in the [examples/basic](https://github.com/lgrammel/modelfusion/tree/main/examples/basic) folder.
45
45
 
46
46
  You can provide API keys for the different [integrations](https://modelfusion.dev/integration/model-provider/) using environment variables (e.g., `OPENAI_API_KEY`) or pass them into the model constructors as options.
@@ -636,7 +636,9 @@ ModelFusion provides an [observer framework](https://modelfusion.dev/guide/util/
636
636
  #### Global Logging Example
637
637
 
638
638
  ```ts
639
- setGlobalFunctionLogging("detailed-object"); // log full events
639
+ import { modelfusion } from "modelfusion";
640
+
641
+ modelfusion.setLogFormat("detailed-object"); // log full events
640
642
  ```
641
643
 
642
644
  ### [Server](https://modelfusion.dev/guide/server/)
@@ -1,5 +1,6 @@
1
- import { Run } from "./Run.js";
2
1
  import { FunctionObserver } from "./FunctionObserver.js";
2
+ import { LogFormat } from "./LogFormat.js";
3
+ import { Run } from "./Run.js";
3
4
  /**
4
5
  * Additional settings for ModelFusion functions.
5
6
  */
@@ -12,7 +13,7 @@ export type FunctionOptions = {
12
13
  * Optional logging to use for the function. Logs are sent to the console.
13
14
  * Overrides the global function logging setting.
14
15
  */
15
- logging?: FunctionLogging;
16
+ logging?: LogFormat;
16
17
  /**
17
18
  * Optional observers that are called when the function is invoked.
18
19
  */
@@ -27,12 +28,3 @@ export type FunctionOptions = {
27
28
  */
28
29
  parentCallId?: string | undefined;
29
30
  };
30
- /**
31
- * The logging to use for the function. Logs are sent to the console.
32
- *
33
- * - `off` or undefined: No logging.
34
- * - `basic-text`: Log the timestamp and the type of event as a single line of text.
35
- * - `detailed-object`: Log everything except the original response as an object to the console.
36
- * - `detailed-json`: Log everything except the original response as a JSON string to the console.
37
- */
38
- export type FunctionLogging = undefined | "off" | "basic-text" | "detailed-object" | "detailed-json";
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ /**
3
+ * The logging output format to use, e.g. for functions. Logs are sent to the console.
4
+ *
5
+ * - `off` or undefined: No logging.
6
+ * - `basic-text`: Log the timestamp and the type of event as a single line of text.
7
+ * - `detailed-object`: Log everything except the original response as an object to the console.
8
+ * - `detailed-json`: Log everything except the original response as a JSON string to the console.
9
+ */
10
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,9 @@
1
+ /**
2
+ * The logging output format to use, e.g. for functions. Logs are sent to the console.
3
+ *
4
+ * - `off` or undefined: No logging.
5
+ * - `basic-text`: Log the timestamp and the type of event as a single line of text.
6
+ * - `detailed-object`: Log everything except the original response as an object to the console.
7
+ * - `detailed-json`: Log everything except the original response as a JSON string to the console.
8
+ */
9
+ export type LogFormat = undefined | "off" | "basic-text" | "detailed-object" | "detailed-json";
@@ -0,0 +1,9 @@
1
+ /**
2
+ * The logging output format to use, e.g. for functions. Logs are sent to the console.
3
+ *
4
+ * - `off` or undefined: No logging.
5
+ * - `basic-text`: Log the timestamp and the type of event as a single line of text.
6
+ * - `detailed-object`: Log everything except the original response as an object to the console.
7
+ * - `detailed-json`: Log everything except the original response as a JSON string to the console.
8
+ */
9
+ export {};
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getLogFormat = exports.setLogFormat = exports.getFunctionObservers = exports.setFunctionObservers = void 0;
4
+ let globalLogFormat = undefined;
5
+ let globalFunctionObservers = [];
6
+ function setFunctionObservers(functionObservers) {
7
+ globalFunctionObservers = functionObservers;
8
+ }
9
+ exports.setFunctionObservers = setFunctionObservers;
10
+ function getFunctionObservers() {
11
+ return globalFunctionObservers;
12
+ }
13
+ exports.getFunctionObservers = getFunctionObservers;
14
+ function setLogFormat(format) {
15
+ globalLogFormat = format;
16
+ }
17
+ exports.setLogFormat = setLogFormat;
18
+ function getLogFormat() {
19
+ return globalLogFormat;
20
+ }
21
+ exports.getLogFormat = getLogFormat;
@@ -0,0 +1,6 @@
1
+ import { FunctionObserver } from "./FunctionObserver.js";
2
+ import { LogFormat } from "./LogFormat.js";
3
+ export declare function setFunctionObservers(functionObservers: FunctionObserver[]): void;
4
+ export declare function getFunctionObservers(): FunctionObserver[];
5
+ export declare function setLogFormat(format: LogFormat): void;
6
+ export declare function getLogFormat(): LogFormat;
@@ -0,0 +1,14 @@
1
+ let globalLogFormat = undefined;
2
+ let globalFunctionObservers = [];
3
+ export function setFunctionObservers(functionObservers) {
4
+ globalFunctionObservers = functionObservers;
5
+ }
6
+ export function getFunctionObservers() {
7
+ return globalFunctionObservers;
8
+ }
9
+ export function setLogFormat(format) {
10
+ globalLogFormat = format;
11
+ }
12
+ export function getLogFormat() {
13
+ return globalLogFormat;
14
+ }
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.executeFunctionCall = void 0;
4
4
  const nanoid_1 = require("nanoid");
5
5
  const FunctionEventSource_js_1 = require("./FunctionEventSource.cjs");
6
- const GlobalFunctionLogging_js_1 = require("./GlobalFunctionLogging.cjs");
7
- const GlobalFunctionObservers_js_1 = require("./GlobalFunctionObservers.cjs");
6
+ const ModelFusionConfiguration_js_1 = require("./ModelFusionConfiguration.cjs");
7
+ const ModelFusionConfiguration_js_2 = require("./ModelFusionConfiguration.cjs");
8
8
  const AbortError_js_1 = require("./api/AbortError.cjs");
9
9
  const getFunctionCallLogger_js_1 = require("./getFunctionCallLogger.cjs");
10
10
  const getRun_js_1 = require("./getRun.cjs");
@@ -14,8 +14,8 @@ async function executeFunctionCall({ options, input, functionType, execute, inpu
14
14
  const run = await (0, getRun_js_1.getRun)(options?.run);
15
15
  const eventSource = new FunctionEventSource_js_1.FunctionEventSource({
16
16
  observers: [
17
- ...(0, getFunctionCallLogger_js_1.getFunctionCallLogger)(options?.logging ?? (0, GlobalFunctionLogging_js_1.getGlobalFunctionLogging)()),
18
- ...(0, GlobalFunctionObservers_js_1.getGlobalFunctionObservers)(),
17
+ ...(0, getFunctionCallLogger_js_1.getFunctionCallLogger)(options?.logging ?? (0, ModelFusionConfiguration_js_1.getLogFormat)()),
18
+ ...(0, ModelFusionConfiguration_js_2.getFunctionObservers)(),
19
19
  ...(run?.functionObserver != null ? [run.functionObserver] : []),
20
20
  ...(options?.observers ?? []),
21
21
  ],
@@ -1,7 +1,7 @@
1
1
  import { nanoid as createId } from "nanoid";
2
2
  import { FunctionEventSource } from "./FunctionEventSource.js";
3
- import { getGlobalFunctionLogging } from "./GlobalFunctionLogging.js";
4
- import { getGlobalFunctionObservers } from "./GlobalFunctionObservers.js";
3
+ import { getLogFormat } from "./ModelFusionConfiguration.js";
4
+ import { getFunctionObservers } from "./ModelFusionConfiguration.js";
5
5
  import { AbortError } from "./api/AbortError.js";
6
6
  import { getFunctionCallLogger } from "./getFunctionCallLogger.js";
7
7
  import { getRun } from "./getRun.js";
@@ -11,8 +11,8 @@ export async function executeFunctionCall({ options, input, functionType, execut
11
11
  const run = await getRun(options?.run);
12
12
  const eventSource = new FunctionEventSource({
13
13
  observers: [
14
- ...getFunctionCallLogger(options?.logging ?? getGlobalFunctionLogging()),
15
- ...getGlobalFunctionObservers(),
14
+ ...getFunctionCallLogger(options?.logging ?? getLogFormat()),
15
+ ...getFunctionObservers(),
16
16
  ...(run?.functionObserver != null ? [run.functionObserver] : []),
17
17
  ...(options?.observers ?? []),
18
18
  ],
@@ -45,11 +45,27 @@ const detailedObjectObserver = {
45
45
  ),
46
46
  };
47
47
  }
48
- // filter all undefined properties from event for cleaner console output:
49
- event = Object.fromEntries(
50
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
51
- Object.entries(event).filter(([_, v]) => v !== undefined));
52
- console.log(event);
48
+ // filter all hard-to-read properties from event for cleaner console output:
49
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
50
+ function cleanObject(obj) {
51
+ if (obj instanceof Date || typeof obj === "string") {
52
+ return obj;
53
+ }
54
+ if (obj !== null && typeof obj === "object") {
55
+ return Object.fromEntries(Object.entries(obj)
56
+ .filter(([_, v] // eslint-disable-line @typescript-eslint/no-unused-vars
57
+ ) => v !== undefined && // filter all undefined properties
58
+ !(v instanceof Buffer) // remove all buffers
59
+ )
60
+ .map(([k, v]) => [k, cleanObject(v)])
61
+ .filter(([_, v]) => v !== undefined) // eslint-disable-line @typescript-eslint/no-unused-vars
62
+ );
63
+ }
64
+ return obj;
65
+ }
66
+ // Clean the event object
67
+ const cleanedEvent = cleanObject(event);
68
+ console.log(cleanedEvent);
53
69
  },
54
70
  };
55
71
  const detailedJsonObserver = {
@@ -41,11 +41,27 @@ const detailedObjectObserver = {
41
41
  ),
42
42
  };
43
43
  }
44
- // filter all undefined properties from event for cleaner console output:
45
- event = Object.fromEntries(
46
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
47
- Object.entries(event).filter(([_, v]) => v !== undefined));
48
- console.log(event);
44
+ // filter all hard-to-read properties from event for cleaner console output:
45
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
46
+ function cleanObject(obj) {
47
+ if (obj instanceof Date || typeof obj === "string") {
48
+ return obj;
49
+ }
50
+ if (obj !== null && typeof obj === "object") {
51
+ return Object.fromEntries(Object.entries(obj)
52
+ .filter(([_, v] // eslint-disable-line @typescript-eslint/no-unused-vars
53
+ ) => v !== undefined && // filter all undefined properties
54
+ !(v instanceof Buffer) // remove all buffers
55
+ )
56
+ .map(([k, v]) => [k, cleanObject(v)])
57
+ .filter(([_, v]) => v !== undefined) // eslint-disable-line @typescript-eslint/no-unused-vars
58
+ );
59
+ }
60
+ return obj;
61
+ }
62
+ // Clean the event object
63
+ const cleanedEvent = cleanObject(event);
64
+ console.log(cleanedEvent);
49
65
  },
50
66
  };
51
67
  const detailedJsonObserver = {
package/core/index.cjs CHANGED
@@ -10,18 +10,31 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
10
10
  if (k2 === undefined) k2 = k;
11
11
  o[k2] = m[k];
12
12
  }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
13
18
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
19
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
20
  };
21
+ var __importStar = (this && this.__importStar) || function (mod) {
22
+ if (mod && mod.__esModule) return mod;
23
+ var result = {};
24
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
+ __setModuleDefault(result, mod);
26
+ return result;
27
+ };
16
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.modelfusion = void 0;
17
30
  __exportStar(require("./DefaultRun.cjs"), exports);
18
31
  __exportStar(require("./ExecuteFunctionEvent.cjs"), exports);
19
32
  __exportStar(require("./FunctionEvent.cjs"), exports);
20
33
  __exportStar(require("./FunctionEventSource.cjs"), exports);
21
34
  __exportStar(require("./FunctionObserver.cjs"), exports);
22
35
  __exportStar(require("./FunctionOptions.cjs"), exports);
23
- __exportStar(require("./GlobalFunctionLogging.cjs"), exports);
24
- __exportStar(require("./GlobalFunctionObservers.cjs"), exports);
36
+ __exportStar(require("./LogFormat.cjs"), exports);
37
+ exports.modelfusion = __importStar(require("./ModelFusionConfiguration.cjs"));
25
38
  __exportStar(require("./Run.cjs"), exports);
26
39
  __exportStar(require("./Vector.cjs"), exports);
27
40
  __exportStar(require("./api/index.cjs"), exports);
package/core/index.d.ts CHANGED
@@ -4,8 +4,8 @@ export * from "./FunctionEvent.js";
4
4
  export * from "./FunctionEventSource.js";
5
5
  export * from "./FunctionObserver.js";
6
6
  export * from "./FunctionOptions.js";
7
- export * from "./GlobalFunctionLogging.js";
8
- export * from "./GlobalFunctionObservers.js";
7
+ export * from "./LogFormat.js";
8
+ export * as modelfusion from "./ModelFusionConfiguration.js";
9
9
  export * from "./Run.js";
10
10
  export * from "./Vector.js";
11
11
  export * from "./api/index.js";
package/core/index.js CHANGED
@@ -4,8 +4,8 @@ export * from "./FunctionEvent.js";
4
4
  export * from "./FunctionEventSource.js";
5
5
  export * from "./FunctionObserver.js";
6
6
  export * from "./FunctionOptions.js";
7
- export * from "./GlobalFunctionLogging.js";
8
- export * from "./GlobalFunctionObservers.js";
7
+ export * from "./LogFormat.js";
8
+ export * as modelfusion from "./ModelFusionConfiguration.js";
9
9
  export * from "./Run.js";
10
10
  export * from "./Vector.js";
11
11
  export * from "./api/index.js";
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.executeStandardCall = void 0;
4
4
  const nanoid_1 = require("nanoid");
5
5
  const FunctionEventSource_js_1 = require("../core/FunctionEventSource.cjs");
6
- const GlobalFunctionLogging_js_1 = require("../core/GlobalFunctionLogging.cjs");
7
- const GlobalFunctionObservers_js_1 = require("../core/GlobalFunctionObservers.cjs");
6
+ const ModelFusionConfiguration_js_1 = require("../core/ModelFusionConfiguration.cjs");
7
+ const ModelFusionConfiguration_js_2 = require("../core/ModelFusionConfiguration.cjs");
8
8
  const AbortError_js_1 = require("../core/api/AbortError.cjs");
9
9
  const getFunctionCallLogger_js_1 = require("../core/getFunctionCallLogger.cjs");
10
10
  const getRun_js_1 = require("../core/getRun.cjs");
@@ -15,8 +15,8 @@ async function executeStandardCall({ model, options, input, functionType, genera
15
15
  const settings = model.settings;
16
16
  const eventSource = new FunctionEventSource_js_1.FunctionEventSource({
17
17
  observers: [
18
- ...(0, getFunctionCallLogger_js_1.getFunctionCallLogger)(options?.logging ?? (0, GlobalFunctionLogging_js_1.getGlobalFunctionLogging)()),
19
- ...(0, GlobalFunctionObservers_js_1.getGlobalFunctionObservers)(),
18
+ ...(0, getFunctionCallLogger_js_1.getFunctionCallLogger)(options?.logging ?? (0, ModelFusionConfiguration_js_1.getLogFormat)()),
19
+ ...(0, ModelFusionConfiguration_js_2.getFunctionObservers)(),
20
20
  ...(settings.observers ?? []),
21
21
  ...(run?.functionObserver != null ? [run.functionObserver] : []),
22
22
  ...(options?.observers ?? []),
@@ -1,7 +1,7 @@
1
1
  import { nanoid as createId } from "nanoid";
2
2
  import { FunctionEventSource } from "../core/FunctionEventSource.js";
3
- import { getGlobalFunctionLogging } from "../core/GlobalFunctionLogging.js";
4
- import { getGlobalFunctionObservers } from "../core/GlobalFunctionObservers.js";
3
+ import { getLogFormat } from "../core/ModelFusionConfiguration.js";
4
+ import { getFunctionObservers } from "../core/ModelFusionConfiguration.js";
5
5
  import { AbortError } from "../core/api/AbortError.js";
6
6
  import { getFunctionCallLogger } from "../core/getFunctionCallLogger.js";
7
7
  import { getRun } from "../core/getRun.js";
@@ -12,8 +12,8 @@ export async function executeStandardCall({ model, options, input, functionType,
12
12
  const settings = model.settings;
13
13
  const eventSource = new FunctionEventSource({
14
14
  observers: [
15
- ...getFunctionCallLogger(options?.logging ?? getGlobalFunctionLogging()),
16
- ...getGlobalFunctionObservers(),
15
+ ...getFunctionCallLogger(options?.logging ?? getLogFormat()),
16
+ ...getFunctionObservers(),
17
17
  ...(settings.observers ?? []),
18
18
  ...(run?.functionObserver != null ? [run.functionObserver] : []),
19
19
  ...(options?.observers ?? []),
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.executeStreamCall = void 0;
4
4
  const nanoid_1 = require("nanoid");
5
5
  const FunctionEventSource_js_1 = require("../core/FunctionEventSource.cjs");
6
- const GlobalFunctionLogging_js_1 = require("../core/GlobalFunctionLogging.cjs");
7
- const GlobalFunctionObservers_js_1 = require("../core/GlobalFunctionObservers.cjs");
6
+ const ModelFusionConfiguration_js_1 = require("../core/ModelFusionConfiguration.cjs");
7
+ const ModelFusionConfiguration_js_2 = require("../core/ModelFusionConfiguration.cjs");
8
8
  const AbortError_js_1 = require("../core/api/AbortError.cjs");
9
9
  const getFunctionCallLogger_js_1 = require("../core/getFunctionCallLogger.cjs");
10
10
  const getRun_js_1 = require("../core/getRun.cjs");
@@ -16,8 +16,8 @@ async function executeStreamCall({ model, options, input, functionType, startStr
16
16
  const settings = model.settings;
17
17
  const eventSource = new FunctionEventSource_js_1.FunctionEventSource({
18
18
  observers: [
19
- ...(0, getFunctionCallLogger_js_1.getFunctionCallLogger)(options?.logging ?? (0, GlobalFunctionLogging_js_1.getGlobalFunctionLogging)()),
20
- ...(0, GlobalFunctionObservers_js_1.getGlobalFunctionObservers)(),
19
+ ...(0, getFunctionCallLogger_js_1.getFunctionCallLogger)(options?.logging ?? (0, ModelFusionConfiguration_js_1.getLogFormat)()),
20
+ ...(0, ModelFusionConfiguration_js_2.getFunctionObservers)(),
21
21
  ...(settings.observers ?? []),
22
22
  ...(run?.functionObserver != null ? [run.functionObserver] : []),
23
23
  ...(options?.observers ?? []),
@@ -1,7 +1,7 @@
1
1
  import { nanoid as createId } from "nanoid";
2
2
  import { FunctionEventSource } from "../core/FunctionEventSource.js";
3
- import { getGlobalFunctionLogging } from "../core/GlobalFunctionLogging.js";
4
- import { getGlobalFunctionObservers } from "../core/GlobalFunctionObservers.js";
3
+ import { getLogFormat } from "../core/ModelFusionConfiguration.js";
4
+ import { getFunctionObservers } from "../core/ModelFusionConfiguration.js";
5
5
  import { AbortError } from "../core/api/AbortError.js";
6
6
  import { getFunctionCallLogger } from "../core/getFunctionCallLogger.js";
7
7
  import { getRun } from "../core/getRun.js";
@@ -13,8 +13,8 @@ export async function executeStreamCall({ model, options, input, functionType, s
13
13
  const settings = model.settings;
14
14
  const eventSource = new FunctionEventSource({
15
15
  observers: [
16
- ...getFunctionCallLogger(options?.logging ?? getGlobalFunctionLogging()),
17
- ...getGlobalFunctionObservers(),
16
+ ...getFunctionCallLogger(options?.logging ?? getLogFormat()),
17
+ ...getFunctionObservers(),
18
18
  ...(settings.observers ?? []),
19
19
  ...(run?.functionObserver != null ? [run.functionObserver] : []),
20
20
  ...(options?.observers ?? []),
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "modelfusion",
3
3
  "description": "The TypeScript library for building multi-modal AI applications.",
4
- "version": "0.91.0",
4
+ "version": "0.92.0",
5
5
  "author": "Lars Grammel",
6
6
  "license": "MIT",
7
7
  "keywords": [
@@ -3,8 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.executeTool = void 0;
4
4
  const nanoid_1 = require("nanoid");
5
5
  const FunctionEventSource_js_1 = require("../../core/FunctionEventSource.cjs");
6
- const GlobalFunctionLogging_js_1 = require("../../core/GlobalFunctionLogging.cjs");
7
- const GlobalFunctionObservers_js_1 = require("../../core/GlobalFunctionObservers.cjs");
6
+ const ModelFusionConfiguration_js_1 = require("../../core/ModelFusionConfiguration.cjs");
8
7
  const AbortError_js_1 = require("../../core/api/AbortError.cjs");
9
8
  const getFunctionCallLogger_js_1 = require("../../core/getFunctionCallLogger.cjs");
10
9
  const getRun_js_1 = require("../../core/getRun.cjs");
@@ -22,8 +21,8 @@ async function doExecuteTool(tool, args, options) {
22
21
  const run = await (0, getRun_js_1.getRun)(options?.run);
23
22
  const eventSource = new FunctionEventSource_js_1.FunctionEventSource({
24
23
  observers: [
25
- ...(0, getFunctionCallLogger_js_1.getFunctionCallLogger)(options?.logging ?? (0, GlobalFunctionLogging_js_1.getGlobalFunctionLogging)()),
26
- ...(0, GlobalFunctionObservers_js_1.getGlobalFunctionObservers)(),
24
+ ...(0, getFunctionCallLogger_js_1.getFunctionCallLogger)(options?.logging ?? (0, ModelFusionConfiguration_js_1.getLogFormat)()),
25
+ ...(0, ModelFusionConfiguration_js_1.getFunctionObservers)(),
27
26
  ...(run?.functionObserver != null ? [run.functionObserver] : []),
28
27
  ...(options?.observers ?? []),
29
28
  ],
@@ -1,7 +1,6 @@
1
1
  import { nanoid as createId } from "nanoid";
2
2
  import { FunctionEventSource } from "../../core/FunctionEventSource.js";
3
- import { getGlobalFunctionLogging } from "../../core/GlobalFunctionLogging.js";
4
- import { getGlobalFunctionObservers } from "../../core/GlobalFunctionObservers.js";
3
+ import { getFunctionObservers, getLogFormat, } from "../../core/ModelFusionConfiguration.js";
5
4
  import { AbortError } from "../../core/api/AbortError.js";
6
5
  import { getFunctionCallLogger } from "../../core/getFunctionCallLogger.js";
7
6
  import { getRun } from "../../core/getRun.js";
@@ -18,8 +17,8 @@ async function doExecuteTool(tool, args, options) {
18
17
  const run = await getRun(options?.run);
19
18
  const eventSource = new FunctionEventSource({
20
19
  observers: [
21
- ...getFunctionCallLogger(options?.logging ?? getGlobalFunctionLogging()),
22
- ...getGlobalFunctionObservers(),
20
+ ...getFunctionCallLogger(options?.logging ?? getLogFormat()),
21
+ ...getFunctionObservers(),
23
22
  ...(run?.functionObserver != null ? [run.functionObserver] : []),
24
23
  ...(options?.observers ?? []),
25
24
  ],
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getGlobalFunctionLogging = exports.setGlobalFunctionLogging = void 0;
4
- let globalFunctionLogging = undefined;
5
- function setGlobalFunctionLogging(logLevel) {
6
- globalFunctionLogging = logLevel;
7
- }
8
- exports.setGlobalFunctionLogging = setGlobalFunctionLogging;
9
- function getGlobalFunctionLogging() {
10
- return globalFunctionLogging;
11
- }
12
- exports.getGlobalFunctionLogging = getGlobalFunctionLogging;
@@ -1,3 +0,0 @@
1
- import { FunctionLogging } from "./FunctionOptions.js";
2
- export declare function setGlobalFunctionLogging(logLevel: FunctionLogging): void;
3
- export declare function getGlobalFunctionLogging(): FunctionLogging;
@@ -1,7 +0,0 @@
1
- let globalFunctionLogging = undefined;
2
- export function setGlobalFunctionLogging(logLevel) {
3
- globalFunctionLogging = logLevel;
4
- }
5
- export function getGlobalFunctionLogging() {
6
- return globalFunctionLogging;
7
- }
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getGlobalFunctionObservers = exports.setGlobalFunctionObservers = void 0;
4
- let globalFunctionObservers = [];
5
- function setGlobalFunctionObservers(functionObservers) {
6
- globalFunctionObservers = functionObservers;
7
- }
8
- exports.setGlobalFunctionObservers = setGlobalFunctionObservers;
9
- function getGlobalFunctionObservers() {
10
- return globalFunctionObservers;
11
- }
12
- exports.getGlobalFunctionObservers = getGlobalFunctionObservers;
@@ -1,3 +0,0 @@
1
- import { FunctionObserver } from "./FunctionObserver.js";
2
- export declare function setGlobalFunctionObservers(functionObservers: FunctionObserver[]): void;
3
- export declare function getGlobalFunctionObservers(): FunctionObserver[];
@@ -1,7 +0,0 @@
1
- let globalFunctionObservers = [];
2
- export function setGlobalFunctionObservers(functionObservers) {
3
- globalFunctionObservers = functionObservers;
4
- }
5
- export function getGlobalFunctionObservers() {
6
- return globalFunctionObservers;
7
- }