modelfusion 0.48.0 → 0.49.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.
Files changed (108) hide show
  1. package/README.md +30 -45
  2. package/model-function/AsyncIterableResultPromise.cjs +5 -5
  3. package/model-function/AsyncIterableResultPromise.d.ts +3 -3
  4. package/model-function/AsyncIterableResultPromise.js +5 -5
  5. package/model-function/Model.d.ts +1 -1
  6. package/model-function/ModelCallEvent.d.ts +5 -7
  7. package/model-function/embed/embed.cjs +3 -3
  8. package/model-function/embed/embed.js +3 -3
  9. package/model-function/{executeCall.cjs → executeStandardCall.cjs} +3 -3
  10. package/model-function/{executeCall.d.ts → executeStandardCall.d.ts} +1 -1
  11. package/model-function/{executeCall.js → executeStandardCall.js} +1 -1
  12. package/model-function/executeStreamCall.cjs +132 -0
  13. package/model-function/executeStreamCall.d.ts +20 -0
  14. package/model-function/executeStreamCall.js +128 -0
  15. package/model-function/generate-image/generateImage.cjs +2 -2
  16. package/model-function/generate-image/generateImage.js +2 -2
  17. package/model-function/generate-speech/SpeechGenerationEvent.d.ts +27 -0
  18. package/model-function/generate-speech/SpeechGenerationModel.d.ts +15 -0
  19. package/model-function/generate-speech/generateSpeech.cjs +24 -0
  20. package/model-function/generate-speech/generateSpeech.d.ts +8 -0
  21. package/model-function/generate-speech/generateSpeech.js +20 -0
  22. package/model-function/generate-speech/index.cjs +20 -0
  23. package/model-function/generate-speech/index.d.ts +4 -0
  24. package/model-function/generate-speech/index.js +4 -0
  25. package/model-function/generate-speech/streamSpeech.cjs +34 -0
  26. package/model-function/generate-speech/streamSpeech.d.ts +8 -0
  27. package/model-function/generate-speech/streamSpeech.js +30 -0
  28. package/model-function/generate-structure/generateStructure.cjs +2 -2
  29. package/model-function/generate-structure/generateStructure.js +2 -2
  30. package/model-function/generate-structure/generateStructureOrText.cjs +2 -2
  31. package/model-function/generate-structure/generateStructureOrText.js +2 -2
  32. package/model-function/generate-structure/index.cjs +27 -0
  33. package/model-function/generate-structure/index.d.ts +11 -0
  34. package/model-function/generate-structure/index.js +11 -0
  35. package/model-function/generate-structure/streamStructure.cjs +28 -136
  36. package/model-function/generate-structure/streamStructure.js +27 -135
  37. package/model-function/generate-text/TextGenerationEvent.d.ts +6 -0
  38. package/model-function/generate-text/generateText.cjs +3 -3
  39. package/model-function/generate-text/generateText.d.ts +1 -1
  40. package/model-function/generate-text/generateText.js +3 -3
  41. package/model-function/generate-text/index.cjs +0 -1
  42. package/model-function/generate-text/index.d.ts +0 -1
  43. package/model-function/generate-text/index.js +0 -1
  44. package/model-function/generate-text/streamText.cjs +21 -128
  45. package/model-function/generate-text/streamText.js +20 -127
  46. package/model-function/generate-text/trimChatPrompt.cjs +1 -1
  47. package/model-function/generate-text/trimChatPrompt.d.ts +1 -1
  48. package/model-function/generate-text/trimChatPrompt.js +1 -1
  49. package/model-function/{transcribe-speech/transcribe.cjs → generate-transcription/generateTranscription.cjs} +6 -6
  50. package/model-function/{transcribe-speech/transcribe.d.ts → generate-transcription/generateTranscription.d.ts} +2 -2
  51. package/model-function/{transcribe-speech/transcribe.js → generate-transcription/generateTranscription.js} +4 -4
  52. package/model-function/index.cjs +5 -20
  53. package/model-function/index.d.ts +5 -20
  54. package/model-function/index.js +5 -20
  55. package/model-provider/elevenlabs/{ElevenLabsSpeechSynthesisModel.cjs → ElevenLabsSpeechModel.cjs} +6 -6
  56. package/model-provider/elevenlabs/{ElevenLabsSpeechSynthesisModel.d.ts → ElevenLabsSpeechModel.d.ts} +8 -8
  57. package/model-provider/elevenlabs/{ElevenLabsSpeechSynthesisModel.js → ElevenLabsSpeechModel.js} +4 -4
  58. package/model-provider/elevenlabs/index.cjs +1 -1
  59. package/model-provider/elevenlabs/index.d.ts +1 -1
  60. package/model-provider/elevenlabs/index.js +1 -1
  61. package/model-provider/huggingface/HuggingFaceImageDescriptionModel.cjs +21 -2
  62. package/model-provider/huggingface/HuggingFaceImageDescriptionModel.d.ts +11 -6
  63. package/model-provider/huggingface/HuggingFaceImageDescriptionModel.js +21 -2
  64. package/model-provider/lmnt/{LmntSpeechSynthesisModel.cjs → LmntSpeechModel.cjs} +5 -5
  65. package/model-provider/lmnt/LmntSpeechModel.d.ts +26 -0
  66. package/model-provider/lmnt/{LmntSpeechSynthesisModel.js → LmntSpeechModel.js} +3 -3
  67. package/model-provider/lmnt/index.cjs +1 -1
  68. package/model-provider/lmnt/index.d.ts +1 -1
  69. package/model-provider/lmnt/index.js +1 -1
  70. package/model-provider/openai/{OpenAITextGenerationModel.cjs → OpenAICompletionModel.cjs} +17 -17
  71. package/model-provider/openai/{OpenAITextGenerationModel.d.ts → OpenAICompletionModel.d.ts} +25 -25
  72. package/model-provider/openai/{OpenAITextGenerationModel.js → OpenAICompletionModel.js} +12 -12
  73. package/model-provider/openai/OpenAICostCalculator.cjs +3 -3
  74. package/model-provider/openai/OpenAICostCalculator.js +3 -3
  75. package/model-provider/openai/OpenAITranscriptionModel.d.ts +1 -1
  76. package/model-provider/openai/TikTokenTokenizer.d.ts +2 -2
  77. package/model-provider/openai/index.cjs +1 -1
  78. package/model-provider/openai/index.d.ts +1 -1
  79. package/model-provider/openai/index.js +1 -1
  80. package/package.json +1 -1
  81. package/model-function/describe-image/ImageDescriptionEvent.d.ts +0 -18
  82. package/model-function/describe-image/ImageDescriptionModel.d.ts +0 -10
  83. package/model-function/describe-image/describeImage.cjs +0 -26
  84. package/model-function/describe-image/describeImage.d.ts +0 -9
  85. package/model-function/describe-image/describeImage.js +0 -22
  86. package/model-function/generate-text/TextStreamingEvent.cjs +0 -2
  87. package/model-function/generate-text/TextStreamingEvent.d.ts +0 -7
  88. package/model-function/generate-text/TextStreamingEvent.js +0 -1
  89. package/model-function/synthesize-speech/SpeechSynthesisEvent.cjs +0 -2
  90. package/model-function/synthesize-speech/SpeechSynthesisEvent.d.ts +0 -21
  91. package/model-function/synthesize-speech/SpeechSynthesisEvent.js +0 -1
  92. package/model-function/synthesize-speech/SpeechSynthesisModel.cjs +0 -2
  93. package/model-function/synthesize-speech/SpeechSynthesisModel.d.ts +0 -15
  94. package/model-function/synthesize-speech/SpeechSynthesisModel.js +0 -1
  95. package/model-function/synthesize-speech/synthesizeSpeech.cjs +0 -67
  96. package/model-function/synthesize-speech/synthesizeSpeech.d.ts +0 -14
  97. package/model-function/synthesize-speech/synthesizeSpeech.js +0 -63
  98. package/model-provider/lmnt/LmntSpeechSynthesisModel.d.ts +0 -26
  99. /package/model-function/{describe-image/ImageDescriptionEvent.cjs → generate-speech/SpeechGenerationEvent.cjs} +0 -0
  100. /package/model-function/{describe-image/ImageDescriptionEvent.js → generate-speech/SpeechGenerationEvent.js} +0 -0
  101. /package/model-function/{describe-image/ImageDescriptionModel.cjs → generate-speech/SpeechGenerationModel.cjs} +0 -0
  102. /package/model-function/{describe-image/ImageDescriptionModel.js → generate-speech/SpeechGenerationModel.js} +0 -0
  103. /package/model-function/{transcribe-speech → generate-transcription}/TranscriptionEvent.cjs +0 -0
  104. /package/model-function/{transcribe-speech → generate-transcription}/TranscriptionEvent.d.ts +0 -0
  105. /package/model-function/{transcribe-speech → generate-transcription}/TranscriptionEvent.js +0 -0
  106. /package/model-function/{transcribe-speech → generate-transcription}/TranscriptionModel.cjs +0 -0
  107. /package/model-function/{transcribe-speech → generate-transcription}/TranscriptionModel.d.ts +0 -0
  108. /package/model-function/{transcribe-speech → generate-transcription}/TranscriptionModel.js +0 -0
@@ -0,0 +1,128 @@
1
+ import { nanoid as createId } from "nanoid";
2
+ import { FunctionEventSource } from "../core/FunctionEventSource.js";
3
+ import { getGlobalFunctionLogging } from "../core/GlobalFunctionLogging.js";
4
+ import { getGlobalFunctionObservers } from "../core/GlobalFunctionObservers.js";
5
+ import { AbortError } from "../core/api/AbortError.js";
6
+ import { getFunctionCallLogger } from "../core/getFunctionCallLogger.js";
7
+ import { getRun } from "../core/getRun.js";
8
+ import { startDurationMeasurement } from "../util/DurationMeasurement.js";
9
+ import { runSafe } from "../util/runSafe.js";
10
+ export async function executeStreamCall({ model, options, input, functionType, startStream, processDelta, processFinished, getResult, }) {
11
+ const run = await getRun(options?.run);
12
+ const settings = model.settings;
13
+ const eventSource = new FunctionEventSource({
14
+ observers: [
15
+ ...getFunctionCallLogger(options?.logging ?? getGlobalFunctionLogging()),
16
+ ...getGlobalFunctionObservers(),
17
+ ...(settings.observers ?? []),
18
+ ...(run?.functionObserver != null ? [run.functionObserver] : []),
19
+ ...(options?.observers ?? []),
20
+ ],
21
+ errorHandler: run?.errorHandler,
22
+ });
23
+ const durationMeasurement = startDurationMeasurement();
24
+ const startMetadata = {
25
+ functionType,
26
+ callId: `call-${createId()}`,
27
+ runId: run?.runId,
28
+ sessionId: run?.sessionId,
29
+ userId: run?.userId,
30
+ functionId: options?.functionId,
31
+ model: model.modelInformation,
32
+ settings: model.settingsForEvent,
33
+ input,
34
+ timestamp: durationMeasurement.startDate,
35
+ startTimestamp: durationMeasurement.startDate,
36
+ };
37
+ eventSource.notify({
38
+ eventType: "started",
39
+ ...startMetadata,
40
+ });
41
+ const result = await runSafe(async () => {
42
+ const deltaIterable = await startStream({
43
+ functionId: options?.functionId,
44
+ logging: options?.logging,
45
+ observers: options?.observers,
46
+ run,
47
+ });
48
+ return (async function* () {
49
+ for await (const event of deltaIterable) {
50
+ if (event?.type === "error") {
51
+ const error = event.error;
52
+ const finishMetadata = {
53
+ eventType: "finished",
54
+ ...startMetadata,
55
+ finishTimestamp: new Date(),
56
+ durationInMs: durationMeasurement.durationInMs,
57
+ };
58
+ eventSource.notify(error instanceof AbortError
59
+ ? {
60
+ ...finishMetadata,
61
+ result: { status: "abort" },
62
+ }
63
+ : {
64
+ ...finishMetadata,
65
+ result: { status: "error", error },
66
+ });
67
+ throw error;
68
+ }
69
+ if (event?.type === "delta") {
70
+ const value = processDelta(event);
71
+ if (value !== undefined) {
72
+ yield value;
73
+ }
74
+ }
75
+ }
76
+ if (processFinished != null) {
77
+ const value = processFinished();
78
+ if (value !== undefined) {
79
+ yield value;
80
+ }
81
+ }
82
+ const finishMetadata = {
83
+ eventType: "finished",
84
+ ...startMetadata,
85
+ finishTimestamp: new Date(),
86
+ durationInMs: durationMeasurement.durationInMs,
87
+ };
88
+ eventSource.notify({
89
+ ...finishMetadata,
90
+ result: {
91
+ status: "success",
92
+ ...getResult(),
93
+ },
94
+ });
95
+ })();
96
+ });
97
+ if (!result.ok) {
98
+ const finishMetadata = {
99
+ eventType: "finished",
100
+ ...startMetadata,
101
+ finishTimestamp: new Date(),
102
+ durationInMs: durationMeasurement.durationInMs,
103
+ };
104
+ if (result.isAborted) {
105
+ eventSource.notify({
106
+ ...finishMetadata,
107
+ eventType: "finished",
108
+ result: {
109
+ status: "abort",
110
+ },
111
+ });
112
+ throw new AbortError();
113
+ }
114
+ eventSource.notify({
115
+ ...finishMetadata,
116
+ eventType: "finished",
117
+ result: {
118
+ status: "error",
119
+ error: result.error,
120
+ },
121
+ });
122
+ throw result.error;
123
+ }
124
+ return {
125
+ value: result.value,
126
+ metadata: startMetadata,
127
+ };
128
+ }
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.generateImage = void 0;
4
- const executeCall_js_1 = require("../executeCall.cjs");
4
+ const executeStandardCall_js_1 = require("../executeStandardCall.cjs");
5
5
  const ImageGenerationPromise_js_1 = require("./ImageGenerationPromise.cjs");
6
6
  /**
7
7
  * Generates a base64-encoded image using a prompt.
@@ -19,7 +19,7 @@ const ImageGenerationPromise_js_1 = require("./ImageGenerationPromise.cjs");
19
19
  * );
20
20
  */
21
21
  function generateImage(model, prompt, options) {
22
- return new ImageGenerationPromise_js_1.ImageGenerationPromise((0, executeCall_js_1.executeCall)({
22
+ return new ImageGenerationPromise_js_1.ImageGenerationPromise((0, executeStandardCall_js_1.executeStandardCall)({
23
23
  functionType: "image-generation",
24
24
  input: prompt,
25
25
  model,
@@ -1,4 +1,4 @@
1
- import { executeCall } from "../executeCall.js";
1
+ import { executeStandardCall } from "../executeStandardCall.js";
2
2
  import { ImageGenerationPromise } from "./ImageGenerationPromise.js";
3
3
  /**
4
4
  * Generates a base64-encoded image using a prompt.
@@ -16,7 +16,7 @@ import { ImageGenerationPromise } from "./ImageGenerationPromise.js";
16
16
  * );
17
17
  */
18
18
  export function generateImage(model, prompt, options) {
19
- return new ImageGenerationPromise(executeCall({
19
+ return new ImageGenerationPromise(executeStandardCall({
20
20
  functionType: "image-generation",
21
21
  input: prompt,
22
22
  model,
@@ -0,0 +1,27 @@
1
+ /// <reference types="node" />
2
+ import { BaseModelCallFinishedEvent, BaseModelCallStartedEvent } from "../ModelCallEvent.js";
3
+ export interface SpeechGenerationStartedEvent extends BaseModelCallStartedEvent {
4
+ functionType: "speech-generation";
5
+ input: string;
6
+ }
7
+ export type SpeechGenerationFinishedEventResult = {
8
+ status: "success";
9
+ response: unknown;
10
+ value: Buffer;
11
+ } | {
12
+ status: "error";
13
+ error: unknown;
14
+ } | {
15
+ status: "abort";
16
+ };
17
+ export interface SpeechGenerationFinishedEvent extends BaseModelCallFinishedEvent {
18
+ functionType: "speech-generation";
19
+ input: string;
20
+ result: SpeechGenerationFinishedEventResult;
21
+ }
22
+ export interface SpeechStreamingStartedEvent extends BaseModelCallStartedEvent {
23
+ functionType: "speech-streaming";
24
+ }
25
+ export interface SpeechStreamingFinishedEvent extends BaseModelCallFinishedEvent {
26
+ functionType: "speech-streaming";
27
+ }
@@ -0,0 +1,15 @@
1
+ /// <reference types="node" />
2
+ import { FunctionOptions } from "../../core/FunctionOptions.js";
3
+ import { Delta } from "../Delta.js";
4
+ import { Model, ModelSettings } from "../Model.js";
5
+ export interface SpeechGenerationModelSettings extends ModelSettings {
6
+ }
7
+ export interface SpeechGenerationModel<SETTINGS extends SpeechGenerationModelSettings = SpeechGenerationModelSettings> extends Model<SETTINGS> {
8
+ /**
9
+ * Generates an mp3 audio buffer that contains the speech for the given text.
10
+ */
11
+ doGenerateSpeechStandard(text: string, options?: FunctionOptions): PromiseLike<Buffer>;
12
+ }
13
+ export interface StreamingSpeechGenerationModel<SETTINGS extends SpeechGenerationModelSettings = SpeechGenerationModelSettings> extends SpeechGenerationModel<SETTINGS> {
14
+ doGenerateSpeechStreamDuplex(textStream: AsyncIterable<string>, options?: FunctionOptions): PromiseLike<AsyncIterable<Delta<Buffer>>>;
15
+ }
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.generateSpeech = void 0;
4
+ const ModelFunctionPromise_js_1 = require("../ModelFunctionPromise.cjs");
5
+ const executeStandardCall_js_1 = require("../executeStandardCall.cjs");
6
+ /**
7
+ * Synthesizes speech from text.
8
+ */
9
+ function generateSpeech(model, text, options) {
10
+ return new ModelFunctionPromise_js_1.ModelFunctionPromise((0, executeStandardCall_js_1.executeStandardCall)({
11
+ functionType: "speech-generation",
12
+ input: text,
13
+ model,
14
+ options,
15
+ generateResponse: async (options) => {
16
+ const response = await model.doGenerateSpeechStandard(text, options);
17
+ return {
18
+ response,
19
+ extractedValue: response,
20
+ };
21
+ },
22
+ }));
23
+ }
24
+ exports.generateSpeech = generateSpeech;
@@ -0,0 +1,8 @@
1
+ /// <reference types="node" />
2
+ import { FunctionOptions } from "../../core/FunctionOptions.js";
3
+ import { ModelFunctionPromise } from "../ModelFunctionPromise.js";
4
+ import { SpeechGenerationModel, SpeechGenerationModelSettings } from "./SpeechGenerationModel.js";
5
+ /**
6
+ * Synthesizes speech from text.
7
+ */
8
+ export declare function generateSpeech(model: SpeechGenerationModel<SpeechGenerationModelSettings>, text: string, options?: FunctionOptions): ModelFunctionPromise<Buffer>;
@@ -0,0 +1,20 @@
1
+ import { ModelFunctionPromise } from "../ModelFunctionPromise.js";
2
+ import { executeStandardCall } from "../executeStandardCall.js";
3
+ /**
4
+ * Synthesizes speech from text.
5
+ */
6
+ export function generateSpeech(model, text, options) {
7
+ return new ModelFunctionPromise(executeStandardCall({
8
+ functionType: "speech-generation",
9
+ input: text,
10
+ model,
11
+ options,
12
+ generateResponse: async (options) => {
13
+ const response = await model.doGenerateSpeechStandard(text, options);
14
+ return {
15
+ response,
16
+ extractedValue: response,
17
+ };
18
+ },
19
+ }));
20
+ }
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./SpeechGenerationEvent.cjs"), exports);
18
+ __exportStar(require("./SpeechGenerationModel.cjs"), exports);
19
+ __exportStar(require("./generateSpeech.cjs"), exports);
20
+ __exportStar(require("./streamSpeech.cjs"), exports);
@@ -0,0 +1,4 @@
1
+ export * from "./SpeechGenerationEvent.js";
2
+ export * from "./SpeechGenerationModel.js";
3
+ export * from "./generateSpeech.js";
4
+ export * from "./streamSpeech.js";
@@ -0,0 +1,4 @@
1
+ export * from "./SpeechGenerationEvent.js";
2
+ export * from "./SpeechGenerationModel.js";
3
+ export * from "./generateSpeech.js";
4
+ export * from "./streamSpeech.js";
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.streamSpeech = void 0;
4
+ const AsyncQueue_js_1 = require("../../event-source/AsyncQueue.cjs");
5
+ const AsyncIterableResultPromise_js_1 = require("../AsyncIterableResultPromise.cjs");
6
+ const executeStreamCall_js_1 = require("../executeStreamCall.cjs");
7
+ /**
8
+ * Synthesizes speech from text.
9
+ */
10
+ function streamSpeech(model, text, options) {
11
+ let textStream;
12
+ // simulate a stream with a single value for a string input:
13
+ if (typeof text === "string") {
14
+ const queue = new AsyncQueue_js_1.AsyncQueue();
15
+ queue.push(text);
16
+ queue.close();
17
+ textStream = queue;
18
+ }
19
+ else {
20
+ textStream = text;
21
+ }
22
+ return new AsyncIterableResultPromise_js_1.AsyncIterableResultPromise((0, executeStreamCall_js_1.executeStreamCall)({
23
+ functionType: "speech-streaming",
24
+ input: text,
25
+ model,
26
+ options,
27
+ startStream: async (options) => model.doGenerateSpeechStreamDuplex(textStream, options),
28
+ processDelta: (delta) => {
29
+ return delta.valueDelta;
30
+ },
31
+ getResult: () => ({}),
32
+ }));
33
+ }
34
+ exports.streamSpeech = streamSpeech;
@@ -0,0 +1,8 @@
1
+ /// <reference types="node" />
2
+ import { FunctionOptions } from "../../core/FunctionOptions.js";
3
+ import { AsyncIterableResultPromise } from "../AsyncIterableResultPromise.js";
4
+ import { StreamingSpeechGenerationModel, SpeechGenerationModelSettings } from "./SpeechGenerationModel.js";
5
+ /**
6
+ * Synthesizes speech from text.
7
+ */
8
+ export declare function streamSpeech(model: StreamingSpeechGenerationModel<SpeechGenerationModelSettings>, text: AsyncIterable<string> | string, options?: FunctionOptions): AsyncIterableResultPromise<Buffer>;
@@ -0,0 +1,30 @@
1
+ import { AsyncQueue } from "../../event-source/AsyncQueue.js";
2
+ import { AsyncIterableResultPromise } from "../AsyncIterableResultPromise.js";
3
+ import { executeStreamCall } from "../executeStreamCall.js";
4
+ /**
5
+ * Synthesizes speech from text.
6
+ */
7
+ export function streamSpeech(model, text, options) {
8
+ let textStream;
9
+ // simulate a stream with a single value for a string input:
10
+ if (typeof text === "string") {
11
+ const queue = new AsyncQueue();
12
+ queue.push(text);
13
+ queue.close();
14
+ textStream = queue;
15
+ }
16
+ else {
17
+ textStream = text;
18
+ }
19
+ return new AsyncIterableResultPromise(executeStreamCall({
20
+ functionType: "speech-streaming",
21
+ input: text,
22
+ model,
23
+ options,
24
+ startStream: async (options) => model.doGenerateSpeechStreamDuplex(textStream, options),
25
+ processDelta: (delta) => {
26
+ return delta.valueDelta;
27
+ },
28
+ getResult: () => ({}),
29
+ }));
30
+ }
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.generateStructure = void 0;
4
- const executeCall_js_1 = require("../executeCall.cjs");
4
+ const executeStandardCall_js_1 = require("../executeStandardCall.cjs");
5
5
  const ModelFunctionPromise_js_1 = require("../ModelFunctionPromise.cjs");
6
6
  const StructureValidationError_js_1 = require("./StructureValidationError.cjs");
7
7
  function generateStructure(model, structureDefinition, prompt, options) {
@@ -9,7 +9,7 @@ function generateStructure(model, structureDefinition, prompt, options) {
9
9
  const expandedPrompt = typeof prompt === "function"
10
10
  ? prompt(structureDefinition)
11
11
  : prompt;
12
- return new ModelFunctionPromise_js_1.ModelFunctionPromise((0, executeCall_js_1.executeCall)({
12
+ return new ModelFunctionPromise_js_1.ModelFunctionPromise((0, executeStandardCall_js_1.executeStandardCall)({
13
13
  functionType: "structure-generation",
14
14
  input: expandedPrompt,
15
15
  model,
@@ -1,4 +1,4 @@
1
- import { executeCall } from "../executeCall.js";
1
+ import { executeStandardCall } from "../executeStandardCall.js";
2
2
  import { ModelFunctionPromise } from "../ModelFunctionPromise.js";
3
3
  import { StructureValidationError } from "./StructureValidationError.js";
4
4
  export function generateStructure(model, structureDefinition, prompt, options) {
@@ -6,7 +6,7 @@ export function generateStructure(model, structureDefinition, prompt, options) {
6
6
  const expandedPrompt = typeof prompt === "function"
7
7
  ? prompt(structureDefinition)
8
8
  : prompt;
9
- return new ModelFunctionPromise(executeCall({
9
+ return new ModelFunctionPromise(executeStandardCall({
10
10
  functionType: "structure-generation",
11
11
  input: expandedPrompt,
12
12
  model,
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.generateStructureOrText = void 0;
4
- const executeCall_js_1 = require("../executeCall.cjs");
4
+ const executeStandardCall_js_1 = require("../executeStandardCall.cjs");
5
5
  const ModelFunctionPromise_js_1 = require("../ModelFunctionPromise.cjs");
6
6
  const NoSuchStructureError_js_1 = require("./NoSuchStructureError.cjs");
7
7
  const StructureValidationError_js_1 = require("./StructureValidationError.cjs");
@@ -10,7 +10,7 @@ function generateStructureOrText(model, structureDefinitions, prompt, options) {
10
10
  const expandedPrompt = typeof prompt === "function"
11
11
  ? prompt(structureDefinitions)
12
12
  : prompt;
13
- return new ModelFunctionPromise_js_1.ModelFunctionPromise((0, executeCall_js_1.executeCall)({
13
+ return new ModelFunctionPromise_js_1.ModelFunctionPromise((0, executeStandardCall_js_1.executeStandardCall)({
14
14
  functionType: "structure-or-text-generation",
15
15
  input: expandedPrompt,
16
16
  model,
@@ -1,4 +1,4 @@
1
- import { executeCall } from "../executeCall.js";
1
+ import { executeStandardCall } from "../executeStandardCall.js";
2
2
  import { ModelFunctionPromise } from "../ModelFunctionPromise.js";
3
3
  import { NoSuchStructureError } from "./NoSuchStructureError.js";
4
4
  import { StructureValidationError } from "./StructureValidationError.js";
@@ -7,7 +7,7 @@ export function generateStructureOrText(model, structureDefinitions, prompt, opt
7
7
  const expandedPrompt = typeof prompt === "function"
8
8
  ? prompt(structureDefinitions)
9
9
  : prompt;
10
- return new ModelFunctionPromise(executeCall({
10
+ return new ModelFunctionPromise(executeStandardCall({
11
11
  functionType: "structure-or-text-generation",
12
12
  input: expandedPrompt,
13
13
  model,
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./NoSuchStructureError.cjs"), exports);
18
+ __exportStar(require("./StructureFromTextGenerationModel.cjs"), exports);
19
+ __exportStar(require("./StructureGenerationEvent.cjs"), exports);
20
+ __exportStar(require("./StructureGenerationModel.cjs"), exports);
21
+ __exportStar(require("./StructureOrTextGenerationModel.cjs"), exports);
22
+ __exportStar(require("./StructureParseError.cjs"), exports);
23
+ __exportStar(require("./StructureStreamingEvent.cjs"), exports);
24
+ __exportStar(require("./StructureValidationError.cjs"), exports);
25
+ __exportStar(require("./generateStructure.cjs"), exports);
26
+ __exportStar(require("./generateStructureOrText.cjs"), exports);
27
+ __exportStar(require("./streamStructure.cjs"), exports);
@@ -0,0 +1,11 @@
1
+ export * from "./NoSuchStructureError.js";
2
+ export * from "./StructureFromTextGenerationModel.js";
3
+ export * from "./StructureGenerationEvent.js";
4
+ export * from "./StructureGenerationModel.js";
5
+ export * from "./StructureOrTextGenerationModel.js";
6
+ export * from "./StructureParseError.js";
7
+ export * from "./StructureStreamingEvent.js";
8
+ export * from "./StructureValidationError.js";
9
+ export * from "./generateStructure.js";
10
+ export * from "./generateStructureOrText.js";
11
+ export * from "./streamStructure.js";
@@ -0,0 +1,11 @@
1
+ export * from "./NoSuchStructureError.js";
2
+ export * from "./StructureFromTextGenerationModel.js";
3
+ export * from "./StructureGenerationEvent.js";
4
+ export * from "./StructureGenerationModel.js";
5
+ export * from "./StructureOrTextGenerationModel.js";
6
+ export * from "./StructureParseError.js";
7
+ export * from "./StructureStreamingEvent.js";
8
+ export * from "./StructureValidationError.js";
9
+ export * from "./generateStructure.js";
10
+ export * from "./generateStructureOrText.js";
11
+ export * from "./streamStructure.js";