@adaptic/lumic-utils 1.0.4 → 1.0.5

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
@@ -67,11 +67,11 @@ const DEFAULT_DEVELOPER_PROMPT = `
67
67
  `;
68
68
  /** Token costs in USD per 1M tokens. Last updated Feb 2025. */
69
69
  const openAiModelCosts = {
70
- 'GPT-5': {
70
+ 'gpt-5': {
71
71
  inputCost: 2.5 / 1_000_000,
72
72
  outputCost: 10 / 1_000_000,
73
73
  },
74
- 'GPT-5-mini': {
74
+ 'gpt-5-mini': {
75
75
  inputCost: 0.15 / 1_000_000,
76
76
  outputCost: 0.6 / 1_000_000,
77
77
  },
@@ -415,8 +415,8 @@ function initializeOpenAI(apiKey) {
415
415
  });
416
416
  }
417
417
  /**
418
- * Fixes broken JSON by sending it to the OpenAI GPT-5 model as a chat completion.
419
- * The GPT-5 model is a large language model that can understand and generate code,
418
+ * Fixes broken JSON by sending it to the OpenAI gpt-5 model as a chat completion.
419
+ * The gpt-5 model is a large language model that can understand and generate code,
420
420
  * including JSON. The returned JSON is the fixed version of the input JSON.
421
421
  * If the model fails to return valid JSON, an error is thrown.
422
422
  * @param jsonStr - the broken JSON to fix
@@ -430,7 +430,7 @@ async function fixJsonWithAI(jsonStr, apiKey) {
430
430
  openai = initializeOpenAI(apiKey);
431
431
  }
432
432
  const completion = await openai.chat.completions.create({
433
- model: 'GPT-5-mini',
433
+ model: 'gpt-5-mini',
434
434
  messages: [
435
435
  {
436
436
  role: 'system',
@@ -562,11 +562,11 @@ const DEFAULT_OPTIONS$1 = {
562
562
  * @returns True if the model supports structured output formats, false otherwise.
563
563
  */
564
564
  function isStructuredOutputCompatibleModel(model) {
565
- return ['GPT-5', 'GPT-5-mini', 'o3-mini', 'o1', 'gpt-4.1', 'gpt-4.1-mini', 'o4-mini', 'gpt-4.1-nano', 'o3'].includes(model);
565
+ return ['gpt-5', 'gpt-5-mini', 'o3-mini', 'o1', 'gpt-4.1', 'gpt-4.1-mini', 'o4-mini', 'gpt-4.1-nano', 'o3'].includes(model);
566
566
  }
567
567
  /** Checks if a given model supports JSON mode, also known as json_object mode - the precursor to structured outputs */
568
568
  function supportsJsonMode(model) {
569
- return ['GPT-5', 'GPT-5-mini', 'o3-mini', 'gpt-4.1', 'gpt-4.1-mini', 'o4-mini', 'gpt-4.1-nano', 'o3'].includes(model);
569
+ return ['gpt-5', 'gpt-5-mini', 'o3-mini', 'gpt-4.1', 'gpt-4.1-mini', 'o4-mini', 'gpt-4.1-nano', 'o3'].includes(model);
570
570
  }
571
571
  /**
572
572
  * Checks if the given model supports the "developer" prompt option. NOTE: this is through experimentation, last done 6 Feb 2025. It is not properly documented.
@@ -574,7 +574,7 @@ function supportsJsonMode(model) {
574
574
  * @returns True if the model supports the developerPrompt option, false otherwise.
575
575
  */
576
576
  function supportsDeveloperPrompt(model) {
577
- return ['GPT-5', 'GPT-5-mini', 'o3-mini', 'o1', 'o4-mini', 'gpt-4.1', 'gpt-4.1-mini', 'o4-mini', 'gpt-4.1-nano', 'o3'].includes(model);
577
+ return ['gpt-5', 'gpt-5-mini', 'o3-mini', 'o1', 'o4-mini', 'gpt-4.1', 'gpt-4.1-mini', 'o4-mini', 'gpt-4.1-nano', 'o3'].includes(model);
578
578
  }
579
579
  /**
580
580
  * Checks if the given model supports the temperature parameter. Reasoning models (o1*, o3*, o4*) do not support temperature.
@@ -10788,7 +10788,7 @@ const tools = [
10788
10788
  "type": "function",
10789
10789
  "function": {
10790
10790
  "name": "fixJsonWithAI",
10791
- "description": "Fixes broken JSON by sending it to the OpenAI GPT-5 model as a chat completion. The GPT-5 model is a large language model that can understand and generate code, including JSON. The returned JSON is the fixed version of the input JSON. If the model fails to return valid JSON, an error is thrown.",
10791
+ "description": "Fixes broken JSON by sending it to the OpenAI gpt-5 model as a chat completion. The gpt-5 model is a large language model that can understand and generate code, including JSON. The returned JSON is the fixed version of the input JSON. If the model fails to return valid JSON, an error is thrown.",
10792
10792
  "parameters": {
10793
10793
  "type": "object",
10794
10794
  "properties": {
package/dist/index.mjs CHANGED
@@ -47,11 +47,11 @@ const DEFAULT_DEVELOPER_PROMPT = `
47
47
  `;
48
48
  /** Token costs in USD per 1M tokens. Last updated Feb 2025. */
49
49
  const openAiModelCosts = {
50
- 'GPT-5': {
50
+ 'gpt-5': {
51
51
  inputCost: 2.5 / 1_000_000,
52
52
  outputCost: 10 / 1_000_000,
53
53
  },
54
- 'GPT-5-mini': {
54
+ 'gpt-5-mini': {
55
55
  inputCost: 0.15 / 1_000_000,
56
56
  outputCost: 0.6 / 1_000_000,
57
57
  },
@@ -395,8 +395,8 @@ function initializeOpenAI(apiKey) {
395
395
  });
396
396
  }
397
397
  /**
398
- * Fixes broken JSON by sending it to the OpenAI GPT-5 model as a chat completion.
399
- * The GPT-5 model is a large language model that can understand and generate code,
398
+ * Fixes broken JSON by sending it to the OpenAI gpt-5 model as a chat completion.
399
+ * The gpt-5 model is a large language model that can understand and generate code,
400
400
  * including JSON. The returned JSON is the fixed version of the input JSON.
401
401
  * If the model fails to return valid JSON, an error is thrown.
402
402
  * @param jsonStr - the broken JSON to fix
@@ -410,7 +410,7 @@ async function fixJsonWithAI(jsonStr, apiKey) {
410
410
  openai = initializeOpenAI(apiKey);
411
411
  }
412
412
  const completion = await openai.chat.completions.create({
413
- model: 'GPT-5-mini',
413
+ model: 'gpt-5-mini',
414
414
  messages: [
415
415
  {
416
416
  role: 'system',
@@ -542,11 +542,11 @@ const DEFAULT_OPTIONS$1 = {
542
542
  * @returns True if the model supports structured output formats, false otherwise.
543
543
  */
544
544
  function isStructuredOutputCompatibleModel(model) {
545
- return ['GPT-5', 'GPT-5-mini', 'o3-mini', 'o1', 'gpt-4.1', 'gpt-4.1-mini', 'o4-mini', 'gpt-4.1-nano', 'o3'].includes(model);
545
+ return ['gpt-5', 'gpt-5-mini', 'o3-mini', 'o1', 'gpt-4.1', 'gpt-4.1-mini', 'o4-mini', 'gpt-4.1-nano', 'o3'].includes(model);
546
546
  }
547
547
  /** Checks if a given model supports JSON mode, also known as json_object mode - the precursor to structured outputs */
548
548
  function supportsJsonMode(model) {
549
- return ['GPT-5', 'GPT-5-mini', 'o3-mini', 'gpt-4.1', 'gpt-4.1-mini', 'o4-mini', 'gpt-4.1-nano', 'o3'].includes(model);
549
+ return ['gpt-5', 'gpt-5-mini', 'o3-mini', 'gpt-4.1', 'gpt-4.1-mini', 'o4-mini', 'gpt-4.1-nano', 'o3'].includes(model);
550
550
  }
551
551
  /**
552
552
  * Checks if the given model supports the "developer" prompt option. NOTE: this is through experimentation, last done 6 Feb 2025. It is not properly documented.
@@ -554,7 +554,7 @@ function supportsJsonMode(model) {
554
554
  * @returns True if the model supports the developerPrompt option, false otherwise.
555
555
  */
556
556
  function supportsDeveloperPrompt(model) {
557
- return ['GPT-5', 'GPT-5-mini', 'o3-mini', 'o1', 'o4-mini', 'gpt-4.1', 'gpt-4.1-mini', 'o4-mini', 'gpt-4.1-nano', 'o3'].includes(model);
557
+ return ['gpt-5', 'gpt-5-mini', 'o3-mini', 'o1', 'o4-mini', 'gpt-4.1', 'gpt-4.1-mini', 'o4-mini', 'gpt-4.1-nano', 'o3'].includes(model);
558
558
  }
559
559
  /**
560
560
  * Checks if the given model supports the temperature parameter. Reasoning models (o1*, o3*, o4*) do not support temperature.
@@ -10768,7 +10768,7 @@ const tools = [
10768
10768
  "type": "function",
10769
10769
  "function": {
10770
10770
  "name": "fixJsonWithAI",
10771
- "description": "Fixes broken JSON by sending it to the OpenAI GPT-5 model as a chat completion. The GPT-5 model is a large language model that can understand and generate code, including JSON. The returned JSON is the fixed version of the input JSON. If the model fails to return valid JSON, an error is thrown.",
10771
+ "description": "Fixes broken JSON by sending it to the OpenAI gpt-5 model as a chat completion. The gpt-5 model is a large language model that can understand and generate code, including JSON. The returned JSON is the fixed version of the input JSON. If the model fails to return valid JSON, an error is thrown.",
10772
10772
  "parameters": {
10773
10773
  "type": "object",
10774
10774
  "properties": {
@@ -1,7 +1,7 @@
1
1
  import { JsonValue } from '../types';
2
2
  /**
3
- * Fixes broken JSON by sending it to the OpenAI GPT-5 model as a chat completion.
4
- * The GPT-5 model is a large language model that can understand and generate code,
3
+ * Fixes broken JSON by sending it to the OpenAI gpt-5 model as a chat completion.
4
+ * The gpt-5 model is a large language model that can understand and generate code,
5
5
  * including JSON. The returned JSON is the fixed version of the input JSON.
6
6
  * If the model fails to return valid JSON, an error is thrown.
7
7
  * @param jsonStr - the broken JSON to fix
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adaptic/lumic-utils",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "NPM repo set of utility functions usable across the entire organisation.",
5
5
  "always-build-npm": false,
6
6
  "type": "module",