modelfusion 0.30.0 → 0.30.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.
@@ -59,8 +59,10 @@ function embedText(model, text, options) {
59
59
  input: text,
60
60
  model,
61
61
  options,
62
- generateResponse: (options) => model.generateEmbeddingResponse([text], options),
63
- extractOutputValue: (result) => model.extractEmbeddings(result)[0],
62
+ generateResponse: async (options) => [
63
+ await model.generateEmbeddingResponse([text], options),
64
+ ],
65
+ extractOutputValue: (result) => model.extractEmbeddings(result[0])[0],
64
66
  });
65
67
  }
66
68
  exports.embedText = embedText;
@@ -24,4 +24,4 @@ export declare function embedTexts<RESPONSE, SETTINGS extends TextEmbeddingModel
24
24
  * "At first, Nox didn't know what to do with the pup."
25
25
  * );
26
26
  */
27
- export declare function embedText<RESPONSE, SETTINGS extends TextEmbeddingModelSettings>(model: TextEmbeddingModel<RESPONSE, SETTINGS>, text: string, options?: ModelFunctionOptions<SETTINGS>): ModelFunctionPromise<Vector, RESPONSE>;
27
+ export declare function embedText<RESPONSE, SETTINGS extends TextEmbeddingModelSettings>(model: TextEmbeddingModel<RESPONSE, SETTINGS>, text: string, options?: ModelFunctionOptions<SETTINGS>): ModelFunctionPromise<Vector, RESPONSE[]>;
@@ -55,7 +55,9 @@ export function embedText(model, text, options) {
55
55
  input: text,
56
56
  model,
57
57
  options,
58
- generateResponse: (options) => model.generateEmbeddingResponse([text], options),
59
- extractOutputValue: (result) => model.extractEmbeddings(result)[0],
58
+ generateResponse: async (options) => [
59
+ await model.generateEmbeddingResponse([text], options),
60
+ ],
61
+ extractOutputValue: (result) => model.extractEmbeddings(result[0])[0],
60
62
  });
61
63
  }
@@ -121,7 +121,7 @@ class OpenAITextEmbeddingModel extends AbstractModel_js_1.AbstractModel {
121
121
  return this.callAPI(texts, options);
122
122
  }
123
123
  extractEmbeddings(response) {
124
- return [response.data[0].embedding];
124
+ return response.data.map((data) => data.embedding);
125
125
  }
126
126
  withSettings(additionalSettings) {
127
127
  return new OpenAITextEmbeddingModel(Object.assign({}, this.settings, additionalSettings));
@@ -113,7 +113,7 @@ export class OpenAITextEmbeddingModel extends AbstractModel {
113
113
  return this.callAPI(texts, options);
114
114
  }
115
115
  extractEmbeddings(response) {
116
- return [response.data[0].embedding];
116
+ return response.data.map((data) => data.embedding);
117
117
  }
118
118
  withSettings(additionalSettings) {
119
119
  return new OpenAITextEmbeddingModel(Object.assign({}, this.settings, additionalSettings));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "modelfusion",
3
3
  "description": "Build multimodal applications, chatbots, and agents with JavaScript and TypeScript.",
4
- "version": "0.30.0",
4
+ "version": "0.30.1",
5
5
  "author": "Lars Grammel",
6
6
  "license": "MIT",
7
7
  "keywords": [