@adaptic/lumic-utils 1.0.3 → 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.
@@ -914,7 +914,7 @@ const makeResponsesAPICall = async (input, options = {}) => {
914
914
  // llm-call.ts
915
915
  const DEFAULT_OPTIONS = {
916
916
  model: DEFAULT_MODEL,
917
- temperature: 0,
917
+ temperature: 1,
918
918
  developerPrompt: DEFAULT_DEVELOPER_PROMPT,
919
919
  parallel_tool_calls: false,
920
920
  };
@@ -1005,7 +1005,7 @@ async function makeResponsesCall(input, options = {}) {
1005
1005
  };
1006
1006
  // Only include temperature if the model supports it
1007
1007
  if (supportsTemperature(normalizedModel)) {
1008
- responsesOptions.temperature = 0.2;
1008
+ responsesOptions.temperature = 1;
1009
1009
  }
1010
1010
  // Configure response format
1011
1011
  if (responseFormat === 'json') {
@@ -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": {