modelfusion 0.114.0 → 0.114.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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## v0.114.1 - 2024-01-05
4
+
5
+ ### Fixed
6
+
7
+ - Together AI text generation and text streaming using OpenAI-compatible chat models.
8
+
3
9
  ## v0.114.0 - 2024-01-05
4
10
 
5
11
  ### Added
@@ -219,7 +219,7 @@ const openAIChatResponseSchema = zod_1.z.object({
219
219
  }))
220
220
  .optional(),
221
221
  }),
222
- index: zod_1.z.number(),
222
+ index: zod_1.z.number().optional(), // optional for OpenAI compatible models
223
223
  logprobs: zod_1.z.nullable(zod_1.z.any()),
224
224
  finish_reason: zod_1.z
225
225
  .enum([
@@ -279,7 +279,7 @@ const openaiChatChunkSchema = zod_1.z.object({
279
279
  index: zod_1.z.number(),
280
280
  })),
281
281
  created: zod_1.z.number(),
282
- model: zod_1.z.string(),
282
+ model: zod_1.z.string().optional(), // optional for OpenAI compatible models
283
283
  system_fingerprint: zod_1.z.string().optional().nullable(),
284
284
  });
285
285
  exports.OpenAIChatResponseFormat = {
@@ -117,7 +117,7 @@ export declare abstract class AbstractOpenAIChatModel<SETTINGS extends AbstractO
117
117
  id: string;
118
118
  }[] | undefined;
119
119
  };
120
- index: number;
120
+ index?: number | undefined;
121
121
  logprobs?: any;
122
122
  finish_reason?: "length" | "stop" | "function_call" | "tool_calls" | "content_filter" | null | undefined;
123
123
  }[];
@@ -161,7 +161,7 @@ export declare abstract class AbstractOpenAIChatModel<SETTINGS extends AbstractO
161
161
  id: string;
162
162
  }[] | undefined;
163
163
  };
164
- index: number;
164
+ index?: number | undefined;
165
165
  logprobs?: any;
166
166
  finish_reason?: "length" | "stop" | "function_call" | "tool_calls" | "content_filter" | null | undefined;
167
167
  }[];
@@ -205,7 +205,7 @@ export declare abstract class AbstractOpenAIChatModel<SETTINGS extends AbstractO
205
205
  id: string;
206
206
  }[] | undefined;
207
207
  };
208
- index: number;
208
+ index?: number | undefined;
209
209
  logprobs?: any;
210
210
  finish_reason?: "length" | "stop" | "function_call" | "tool_calls" | "content_filter" | null | undefined;
211
211
  }[];
@@ -224,7 +224,6 @@ export declare abstract class AbstractOpenAIChatModel<SETTINGS extends AbstractO
224
224
  private translateFinishReason;
225
225
  doStreamText(prompt: OpenAIChatPrompt, options: FunctionCallOptions): Promise<AsyncIterable<import("../../index.js").Delta<{
226
226
  object: "chat.completion.chunk";
227
- model: string;
228
227
  id: string;
229
228
  created: number;
230
229
  choices: {
@@ -247,6 +246,7 @@ export declare abstract class AbstractOpenAIChatModel<SETTINGS extends AbstractO
247
246
  index: number;
248
247
  finish_reason?: "length" | "stop" | "function_call" | "tool_calls" | "content_filter" | null | undefined;
249
248
  }[];
249
+ model?: string | undefined;
250
250
  system_fingerprint?: string | null | undefined;
251
251
  }>>>;
252
252
  extractTextDelta(delta: unknown): string | undefined;
@@ -278,7 +278,7 @@ export declare abstract class AbstractOpenAIChatModel<SETTINGS extends AbstractO
278
278
  id: string;
279
279
  }[] | undefined;
280
280
  };
281
- index: number;
281
+ index?: number | undefined;
282
282
  logprobs?: any;
283
283
  finish_reason?: "length" | "stop" | "function_call" | "tool_calls" | "content_filter" | null | undefined;
284
284
  }[];
@@ -322,7 +322,7 @@ export declare abstract class AbstractOpenAIChatModel<SETTINGS extends AbstractO
322
322
  id: string;
323
323
  }[] | undefined;
324
324
  };
325
- index: number;
325
+ index?: number | undefined;
326
326
  logprobs?: any;
327
327
  finish_reason?: "length" | "stop" | "function_call" | "tool_calls" | "content_filter" | null | undefined;
328
328
  }[];
@@ -421,7 +421,7 @@ declare const openAIChatResponseSchema: z.ZodObject<{
421
421
  id: string;
422
422
  }[] | undefined;
423
423
  }>;
424
- index: z.ZodNumber;
424
+ index: z.ZodOptional<z.ZodNumber>;
425
425
  logprobs: z.ZodNullable<z.ZodAny>;
426
426
  finish_reason: z.ZodNullable<z.ZodOptional<z.ZodEnum<["stop", "length", "tool_calls", "content_filter", "function_call"]>>>;
427
427
  }, "strip", z.ZodTypeAny, {
@@ -441,7 +441,7 @@ declare const openAIChatResponseSchema: z.ZodObject<{
441
441
  id: string;
442
442
  }[] | undefined;
443
443
  };
444
- index: number;
444
+ index?: number | undefined;
445
445
  logprobs?: any;
446
446
  finish_reason?: "length" | "stop" | "function_call" | "tool_calls" | "content_filter" | null | undefined;
447
447
  }, {
@@ -461,7 +461,7 @@ declare const openAIChatResponseSchema: z.ZodObject<{
461
461
  id: string;
462
462
  }[] | undefined;
463
463
  };
464
- index: number;
464
+ index?: number | undefined;
465
465
  logprobs?: any;
466
466
  finish_reason?: "length" | "stop" | "function_call" | "tool_calls" | "content_filter" | null | undefined;
467
467
  }>, "many">;
@@ -509,7 +509,7 @@ declare const openAIChatResponseSchema: z.ZodObject<{
509
509
  id: string;
510
510
  }[] | undefined;
511
511
  };
512
- index: number;
512
+ index?: number | undefined;
513
513
  logprobs?: any;
514
514
  finish_reason?: "length" | "stop" | "function_call" | "tool_calls" | "content_filter" | null | undefined;
515
515
  }[];
@@ -541,7 +541,7 @@ declare const openAIChatResponseSchema: z.ZodObject<{
541
541
  id: string;
542
542
  }[] | undefined;
543
543
  };
544
- index: number;
544
+ index?: number | undefined;
545
545
  logprobs?: any;
546
546
  finish_reason?: "length" | "stop" | "function_call" | "tool_calls" | "content_filter" | null | undefined;
547
547
  }[];
@@ -666,11 +666,10 @@ declare const openaiChatChunkSchema: z.ZodObject<{
666
666
  finish_reason?: "length" | "stop" | "function_call" | "tool_calls" | "content_filter" | null | undefined;
667
667
  }>, "many">;
668
668
  created: z.ZodNumber;
669
- model: z.ZodString;
669
+ model: z.ZodOptional<z.ZodString>;
670
670
  system_fingerprint: z.ZodNullable<z.ZodOptional<z.ZodString>>;
671
671
  }, "strip", z.ZodTypeAny, {
672
672
  object: "chat.completion.chunk";
673
- model: string;
674
673
  id: string;
675
674
  created: number;
676
675
  choices: {
@@ -693,10 +692,10 @@ declare const openaiChatChunkSchema: z.ZodObject<{
693
692
  index: number;
694
693
  finish_reason?: "length" | "stop" | "function_call" | "tool_calls" | "content_filter" | null | undefined;
695
694
  }[];
695
+ model?: string | undefined;
696
696
  system_fingerprint?: string | null | undefined;
697
697
  }, {
698
698
  object: "chat.completion.chunk";
699
- model: string;
700
699
  id: string;
701
700
  created: number;
702
701
  choices: {
@@ -719,6 +718,7 @@ declare const openaiChatChunkSchema: z.ZodObject<{
719
718
  index: number;
720
719
  finish_reason?: "length" | "stop" | "function_call" | "tool_calls" | "content_filter" | null | undefined;
721
720
  }[];
721
+ model?: string | undefined;
722
722
  system_fingerprint?: string | null | undefined;
723
723
  }>;
724
724
  export type OpenAIChatChunk = z.infer<typeof openaiChatChunkSchema>;
@@ -759,7 +759,7 @@ export declare const OpenAIChatResponseFormat: {
759
759
  id: string;
760
760
  }[] | undefined;
761
761
  };
762
- index: number;
762
+ index?: number | undefined;
763
763
  logprobs?: any;
764
764
  finish_reason?: "length" | "stop" | "function_call" | "tool_calls" | "content_filter" | null | undefined;
765
765
  }[];
@@ -775,7 +775,6 @@ export declare const OpenAIChatResponseFormat: {
775
775
  response: Response;
776
776
  }) => Promise<AsyncIterable<import("../../index.js").Delta<{
777
777
  object: "chat.completion.chunk";
778
- model: string;
779
778
  id: string;
780
779
  created: number;
781
780
  choices: {
@@ -798,6 +797,7 @@ export declare const OpenAIChatResponseFormat: {
798
797
  index: number;
799
798
  finish_reason?: "length" | "stop" | "function_call" | "tool_calls" | "content_filter" | null | undefined;
800
799
  }[];
800
+ model?: string | undefined;
801
801
  system_fingerprint?: string | null | undefined;
802
802
  }>>>;
803
803
  };
@@ -215,7 +215,7 @@ const openAIChatResponseSchema = z.object({
215
215
  }))
216
216
  .optional(),
217
217
  }),
218
- index: z.number(),
218
+ index: z.number().optional(), // optional for OpenAI compatible models
219
219
  logprobs: z.nullable(z.any()),
220
220
  finish_reason: z
221
221
  .enum([
@@ -275,7 +275,7 @@ const openaiChatChunkSchema = z.object({
275
275
  index: z.number(),
276
276
  })),
277
277
  created: z.number(),
278
- model: z.string(),
278
+ model: z.string().optional(), // optional for OpenAI compatible models
279
279
  system_fingerprint: z.string().optional().nullable(),
280
280
  });
281
281
  export const OpenAIChatResponseFormat = {
@@ -154,7 +154,7 @@ OpenAIChatSettings> {
154
154
  id: string;
155
155
  }[] | undefined;
156
156
  };
157
- index: number;
157
+ index?: number | undefined;
158
158
  logprobs?: any;
159
159
  finish_reason?: "length" | "stop" | "function_call" | "tool_calls" | "content_filter" | null | undefined;
160
160
  }[];
@@ -171,7 +171,6 @@ OpenAIChatSettings> {
171
171
  doStreamStructure(schema: Schema<unknown> & JsonSchemaProducer, prompt: Parameters<PROMPT_TEMPLATE["format"]>[0], // first argument of the function
172
172
  options: FunctionCallOptions): Promise<AsyncIterable<import("../../index.js").Delta<{
173
173
  object: "chat.completion.chunk";
174
- model: string;
175
174
  id: string;
176
175
  created: number;
177
176
  choices: {
@@ -194,6 +193,7 @@ OpenAIChatSettings> {
194
193
  index: number;
195
194
  finish_reason?: "length" | "stop" | "function_call" | "tool_calls" | "content_filter" | null | undefined;
196
195
  }[];
196
+ model?: string | undefined;
197
197
  system_fingerprint?: string | null | undefined;
198
198
  }>>>;
199
199
  extractStructureTextDelta(delta: unknown): string | undefined;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "modelfusion",
3
3
  "description": "The TypeScript library for building AI applications.",
4
- "version": "0.114.0",
4
+ "version": "0.114.1",
5
5
  "author": "Lars Grammel",
6
6
  "license": "MIT",
7
7
  "keywords": [