@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.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.
@@ -894,7 +894,7 @@ const makeResponsesAPICall = async (input, options = {}) => {
894
894
  // llm-call.ts
895
895
  const DEFAULT_OPTIONS = {
896
896
  model: DEFAULT_MODEL,
897
- temperature: 0,
897
+ temperature: 1,
898
898
  developerPrompt: DEFAULT_DEVELOPER_PROMPT,
899
899
  parallel_tool_calls: false,
900
900
  };
@@ -985,7 +985,7 @@ async function makeResponsesCall(input, options = {}) {
985
985
  };
986
986
  // Only include temperature if the model supports it
987
987
  if (supportsTemperature(normalizedModel)) {
988
- responsesOptions.temperature = 0.2;
988
+ responsesOptions.temperature = 1;
989
989
  }
990
990
  // Configure response format
991
991
  if (responseFormat === 'json') {
@@ -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": {