@anuma/sdk 8.2.0 → 9.0.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/dist/index.cjs CHANGED
@@ -2293,11 +2293,17 @@ async function generateEmbeddingsBatch(texts, headers, baseUrl, model, onUsage,
2293
2293
  }
2294
2294
  return response.data.data.map((item) => item.embedding ?? []);
2295
2295
  }
2296
- async function generateEmbeddings(texts, options) {
2296
+ async function generateEmbeddings(texts, options, signal) {
2297
+ signal?.throwIfAborted();
2297
2298
  if (texts.length === 0) return [];
2298
2299
  const total = options.totalTimeoutMs;
2299
- if (total === void 0) return embedMany(texts, options, void 0);
2300
- return withDeadline((signal) => embedMany(texts, options, signal), total, "embedding batch");
2300
+ if (total === void 0) return embedMany(texts, options, signal);
2301
+ return withDeadline(
2302
+ (inner) => embedMany(texts, options, inner),
2303
+ total,
2304
+ "embedding batch",
2305
+ signal
2306
+ );
2301
2307
  }
2302
2308
  async function embedMany(texts, options, outer) {
2303
2309
  const { baseUrl = BASE_URL, model, batchSize, cache } = options;
package/dist/index.mjs CHANGED
@@ -2089,11 +2089,17 @@ async function generateEmbeddingsBatch(texts, headers, baseUrl, model, onUsage,
2089
2089
  }
2090
2090
  return response.data.data.map((item) => item.embedding ?? []);
2091
2091
  }
2092
- async function generateEmbeddings(texts, options) {
2092
+ async function generateEmbeddings(texts, options, signal) {
2093
+ signal?.throwIfAborted();
2093
2094
  if (texts.length === 0) return [];
2094
2095
  const total = options.totalTimeoutMs;
2095
- if (total === void 0) return embedMany(texts, options, void 0);
2096
- return withDeadline((signal) => embedMany(texts, options, signal), total, "embedding batch");
2096
+ if (total === void 0) return embedMany(texts, options, signal);
2097
+ return withDeadline(
2098
+ (inner) => embedMany(texts, options, inner),
2099
+ total,
2100
+ "embedding batch",
2101
+ signal
2102
+ );
2097
2103
  }
2098
2104
  async function embedMany(texts, options, outer) {
2099
2105
  const { baseUrl = BASE_URL, model, batchSize, cache } = options;