@discomedia/utils 1.0.45 → 1.0.50

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 (35) hide show
  1. package/README.md +10 -1
  2. package/dist/index-frontend.cjs +83 -7
  3. package/dist/index-frontend.cjs.map +1 -1
  4. package/dist/index-frontend.mjs +83 -7
  5. package/dist/index-frontend.mjs.map +1 -1
  6. package/dist/index.cjs +83 -7
  7. package/dist/index.cjs.map +1 -1
  8. package/dist/index.mjs +83 -7
  9. package/dist/index.mjs.map +1 -1
  10. package/dist/package.json +3 -3
  11. package/dist/test.js +1029 -6085
  12. package/dist/test.js.map +1 -1
  13. package/dist/types/alpaca-trading-api.d.ts +2 -13
  14. package/dist/types/alpaca-trading-api.d.ts.map +1 -1
  15. package/dist/types/llm-config.d.ts.map +1 -1
  16. package/dist/types/llm-images.d.ts +2 -1
  17. package/dist/types/llm-images.d.ts.map +1 -1
  18. package/dist/types/llm-openai.d.ts.map +1 -1
  19. package/dist/types/market-time.d.ts.map +1 -1
  20. package/dist/types/types/alpaca-types.d.ts +13 -0
  21. package/dist/types/types/alpaca-types.d.ts.map +1 -1
  22. package/dist/types/types/llm-types.d.ts +7 -3
  23. package/dist/types/types/llm-types.d.ts.map +1 -1
  24. package/dist/types-frontend/alpaca-trading-api.d.ts +2 -13
  25. package/dist/types-frontend/alpaca-trading-api.d.ts.map +1 -1
  26. package/dist/types-frontend/llm-config.d.ts.map +1 -1
  27. package/dist/types-frontend/llm-images.d.ts +2 -1
  28. package/dist/types-frontend/llm-images.d.ts.map +1 -1
  29. package/dist/types-frontend/llm-openai.d.ts.map +1 -1
  30. package/dist/types-frontend/market-time.d.ts.map +1 -1
  31. package/dist/types-frontend/types/alpaca-types.d.ts +13 -0
  32. package/dist/types-frontend/types/alpaca-types.d.ts.map +1 -1
  33. package/dist/types-frontend/types/llm-types.d.ts +7 -3
  34. package/dist/types-frontend/types/llm-types.d.ts.map +1 -1
  35. package/package.json +3 -3
package/dist/index.mjs CHANGED
@@ -447,9 +447,10 @@ function getLastFullTradingDateImpl(currentDate = new Date()) {
447
447
  if (calendar.isEarlyCloseDay(prevMarketDay)) {
448
448
  prevCloseMinutes = MARKET_CONFIG.TIMES.EARLY_CLOSE.hour * 60 + MARKET_CONFIG.TIMES.EARLY_CLOSE.minute;
449
449
  }
450
- const year = prevMarketDay.getUTCFullYear();
451
- const month = prevMarketDay.getUTCMonth();
452
- const day = prevMarketDay.getUTCDate();
450
+ const prevNYDate = toNYTime(prevMarketDay);
451
+ const year = prevNYDate.getUTCFullYear();
452
+ const month = prevNYDate.getUTCMonth();
453
+ const day = prevNYDate.getUTCDate();
453
454
  const closeHour = Math.floor(prevCloseMinutes / 60);
454
455
  const closeMinute = prevCloseMinutes % 60;
455
456
  return fromNYTime(new Date(Date.UTC(year, month, day, closeHour, closeMinute, 0, 0)));
@@ -1085,6 +1086,10 @@ function isOpenRouterModel(model) {
1085
1086
  'openai/gpt-5-mini',
1086
1087
  'openai/gpt-5-nano',
1087
1088
  'openai/gpt-5.1',
1089
+ 'openai/gpt-5.2',
1090
+ 'openai/gpt-5.2-pro',
1091
+ 'openai/gpt-5.1-codex',
1092
+ 'openai/gpt-5.1-codex-max',
1088
1093
  'openai/gpt-oss-120b',
1089
1094
  'z.ai/glm-4.5',
1090
1095
  'z.ai/glm-4.5-air',
@@ -2450,7 +2455,7 @@ const safeJSON = (text) => {
2450
2455
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2451
2456
  const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
2452
2457
 
2453
- const VERSION = '6.9.1'; // x-release-please-version
2458
+ const VERSION = '6.10.0'; // x-release-please-version
2454
2459
 
2455
2460
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2456
2461
  const isRunningInBrowser = () => {
@@ -8291,6 +8296,17 @@ class Responses extends APIResource {
8291
8296
  cancel(responseID, options) {
8292
8297
  return this._client.post(path `/responses/${responseID}/cancel`, options);
8293
8298
  }
8299
+ /**
8300
+ * Compact conversation
8301
+ *
8302
+ * @example
8303
+ * ```ts
8304
+ * const compactedResponse = await client.responses.compact();
8305
+ * ```
8306
+ */
8307
+ compact(body = {}, options) {
8308
+ return this._client.post('/responses/compact', { body, ...options });
8309
+ }
8294
8310
  }
8295
8311
  Responses.InputItems = InputItems;
8296
8312
  Responses.InputTokens = InputTokens;
@@ -9433,6 +9449,22 @@ const openAiModelCosts = {
9433
9449
  inputCost: 1.25 / 1_000_000,
9434
9450
  outputCost: 10 / 1_000_000,
9435
9451
  },
9452
+ 'gpt-5.2': {
9453
+ inputCost: 1.5 / 1_000_000,
9454
+ outputCost: 12 / 1_000_000,
9455
+ },
9456
+ 'gpt-5.2-pro': {
9457
+ inputCost: 3 / 1_000_000,
9458
+ outputCost: 24 / 1_000_000,
9459
+ },
9460
+ 'gpt-5.1-codex': {
9461
+ inputCost: 1.1 / 1_000_000,
9462
+ outputCost: 8.8 / 1_000_000,
9463
+ },
9464
+ 'gpt-5.1-codex-max': {
9465
+ inputCost: 1.8 / 1_000_000,
9466
+ outputCost: 14.4 / 1_000_000,
9467
+ },
9436
9468
  'o4-mini': {
9437
9469
  inputCost: 1.1 / 1_000_000,
9438
9470
  outputCost: 4.4 / 1_000_000,
@@ -9894,6 +9926,10 @@ const isSupportedModel = (model) => {
9894
9926
  'gpt-5-mini',
9895
9927
  'gpt-5-nano',
9896
9928
  'gpt-5.1',
9929
+ 'gpt-5.2',
9930
+ 'gpt-5.2-pro',
9931
+ 'gpt-5.1-codex',
9932
+ 'gpt-5.1-codex-max',
9897
9933
  'o4-mini',
9898
9934
  'o3',
9899
9935
  ].includes(model);
@@ -9906,7 +9942,21 @@ const isSupportedModel = (model) => {
9906
9942
  function supportsTemperature(model) {
9907
9943
  // Reasoning models don't support temperature
9908
9944
  // GPT-5 models also do not support temperature
9909
- const reasoningAndGPT5Models = ['o1', 'o1-mini', 'o3-mini', 'o4-mini', 'o3', 'gpt-5', 'gpt-5-mini', 'gpt-5-nano', 'gpt-5.1'];
9945
+ const reasoningAndGPT5Models = [
9946
+ 'o1',
9947
+ 'o1-mini',
9948
+ 'o3-mini',
9949
+ 'o4-mini',
9950
+ 'o3',
9951
+ 'gpt-5',
9952
+ 'gpt-5-mini',
9953
+ 'gpt-5-nano',
9954
+ 'gpt-5.1',
9955
+ 'gpt-5.2',
9956
+ 'gpt-5.2-pro',
9957
+ 'gpt-5.1-codex',
9958
+ 'gpt-5.1-codex-max',
9959
+ ];
9910
9960
  return !reasoningAndGPT5Models.includes(model);
9911
9961
  }
9912
9962
  /**
@@ -9924,7 +9974,16 @@ function isReasoningModel(model) {
9924
9974
  * @returns True if the model is a GPT-5 model, false otherwise.
9925
9975
  */
9926
9976
  function isGPT5Model(model) {
9927
- const gpt5Models = ['gpt-5', 'gpt-5-mini', 'gpt-5-nano', 'gpt-5.1'];
9977
+ const gpt5Models = [
9978
+ 'gpt-5',
9979
+ 'gpt-5-mini',
9980
+ 'gpt-5-nano',
9981
+ 'gpt-5.1',
9982
+ 'gpt-5.2',
9983
+ 'gpt-5.2-pro',
9984
+ 'gpt-5.1-codex',
9985
+ 'gpt-5.1-codex-max',
9986
+ ];
9928
9987
  return gpt5Models.includes(model);
9929
9988
  }
9930
9989
  /**
@@ -10165,6 +10224,18 @@ async function makeLLMCall(input, options = {}) {
10165
10224
  return await makeResponsesAPICall(processedInput, responsesOptions);
10166
10225
  }
10167
10226
 
10227
+ const MULTIMODAL_VISION_MODELS = new Set([
10228
+ 'gpt-4o-mini',
10229
+ 'gpt-4o',
10230
+ 'gpt-5',
10231
+ 'gpt-5-mini',
10232
+ 'gpt-5-nano',
10233
+ 'gpt-5.1',
10234
+ 'gpt-5.2',
10235
+ 'gpt-5.2-pro',
10236
+ 'gpt-5.1-codex',
10237
+ 'gpt-5.1-codex-max',
10238
+ ]);
10168
10239
  /**
10169
10240
  * Makes a call to the OpenAI Images API to generate images based on a text prompt.
10170
10241
  *
@@ -10201,7 +10272,11 @@ async function makeLLMCall(input, options = {}) {
10201
10272
  * @throws Error if the API call fails or invalid parameters are provided
10202
10273
  */
10203
10274
  async function makeImagesCall(prompt, options = {}) {
10204
- const { size = 'auto', outputFormat = 'webp', compression = 50, quality = 'high', count = 1, background = 'auto', moderation = 'auto', apiKey } = options;
10275
+ const { size = 'auto', outputFormat = 'webp', compression = 50, quality = 'high', count = 1, background = 'auto', moderation = 'auto', apiKey, visionModel, } = options;
10276
+ const supportedVisionModel = visionModel && MULTIMODAL_VISION_MODELS.has(visionModel) ? visionModel : undefined;
10277
+ if (visionModel && !supportedVisionModel) {
10278
+ console.warn(`Vision model ${visionModel} is not recognized as a multimodal OpenAI model. Ignoring for image usage metadata.`);
10279
+ }
10205
10280
  // Get API key
10206
10281
  const effectiveApiKey = apiKey || process.env.OPENAI_API_KEY;
10207
10282
  if (!effectiveApiKey) {
@@ -10261,6 +10336,7 @@ async function makeImagesCall(prompt, options = {}) {
10261
10336
  provider: 'openai',
10262
10337
  model: 'gpt-image-1',
10263
10338
  cost,
10339
+ ...(supportedVisionModel ? { visionModel: supportedVisionModel } : {}),
10264
10340
  },
10265
10341
  };
10266
10342
  return enhancedResponse;