@adaptic/lumic-utils 1.0.8 → 1.0.10

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 (87) hide show
  1. package/dist/{index-Cstek604.js → index-CcXQeJz8.js} +22 -182
  2. package/dist/index-CcXQeJz8.js.map +1 -0
  3. package/dist/{index-DZZCd-1T.js → index-CcgbRft2.js} +22 -182
  4. package/dist/index-CcgbRft2.js.map +1 -0
  5. package/dist/index.cjs +11417 -122
  6. package/dist/index.cjs.map +1 -1
  7. package/dist/index.mjs +11399 -39
  8. package/dist/index.mjs.map +1 -1
  9. package/dist/test.cjs +7 -24
  10. package/dist/test.cjs.map +1 -1
  11. package/dist/test.mjs +7 -24
  12. package/dist/test.mjs.map +1 -1
  13. package/dist/types/aws-types.ts +1 -1
  14. package/dist/types/functions/aws-lambda.d.ts +1 -1
  15. package/dist/types/functions/aws-s3-utils.d.ts +2 -2
  16. package/dist/types/functions/google-sheets.d.ts +4 -4
  17. package/dist/types/functions/json-llm-tools.d.ts +3 -25
  18. package/dist/types/functions/llm-call.d.ts +2 -2
  19. package/dist/types/functions/llm-deepseek.d.ts +1 -1
  20. package/dist/types/functions/llm-openai.d.ts +2 -3
  21. package/dist/types/functions/llm-utils.d.ts +1 -24
  22. package/dist/types/functions/slack-utils.d.ts +4 -3
  23. package/dist/types/functions/utils.d.ts +14 -2
  24. package/dist/types/functions/zip-utils.d.ts +10 -12
  25. package/dist/types/google-types.ts +3 -6
  26. package/dist/types/index.d.ts +0 -30
  27. package/dist/types/index.ts +1 -1
  28. package/dist/types/openai-types.ts +6 -165
  29. package/dist/types/types/aws-types.d.ts +1 -1
  30. package/dist/types/types/google-types.d.ts +3 -5
  31. package/dist/types/types/index.d.ts +1 -1
  32. package/dist/types/types/openai-types.d.ts +3 -149
  33. package/dist/types/utils/aws-initialise.d.ts +1 -6
  34. package/package.json +3 -2
  35. package/dist/apollo-client.client-DE7JUXjy.js +0 -3693
  36. package/dist/apollo-client.client-DE7JUXjy.js.map +0 -1
  37. package/dist/apollo-client.client-DlG4HsFm.js +0 -3704
  38. package/dist/apollo-client.client-DlG4HsFm.js.map +0 -1
  39. package/dist/apollo-client.server-D1QJea5_.js +0 -16319
  40. package/dist/apollo-client.server-D1QJea5_.js.map +0 -1
  41. package/dist/apollo-client.server-uqalq3yp.js +0 -16321
  42. package/dist/apollo-client.server-uqalq3yp.js.map +0 -1
  43. package/dist/index-Bd84zcTQ.js +0 -74944
  44. package/dist/index-Bd84zcTQ.js.map +0 -1
  45. package/dist/index-CZKOqrJ4.js +0 -75137
  46. package/dist/index-CZKOqrJ4.js.map +0 -1
  47. package/dist/index-CsKfs4nG.js +0 -12108
  48. package/dist/index-CsKfs4nG.js.map +0 -1
  49. package/dist/index-Cstek604.js.map +0 -1
  50. package/dist/index-DZZCd-1T.js.map +0 -1
  51. package/dist/index-aP9ow8_W.js +0 -12271
  52. package/dist/index-aP9ow8_W.js.map +0 -1
  53. package/dist/types/config/__tests__/secrets.test.d.ts +0 -1
  54. package/dist/types/config/secrets.d.ts +0 -186
  55. package/dist/types/errors/__tests__/errors.test.d.ts +0 -1
  56. package/dist/types/errors/index.d.ts +0 -77
  57. package/dist/types/functions/__tests__/aws-lambda.test.d.ts +0 -1
  58. package/dist/types/functions/__tests__/aws-s3-utils.test.d.ts +0 -1
  59. package/dist/types/functions/__tests__/json-llm-tools.test.d.ts +0 -1
  60. package/dist/types/functions/__tests__/json-tools.test.d.ts +0 -1
  61. package/dist/types/functions/__tests__/slack-utils.test.d.ts +0 -1
  62. package/dist/types/schemas/aws-schemas.d.ts +0 -210
  63. package/dist/types/schemas/google-sheets-schemas.d.ts +0 -32
  64. package/dist/types/schemas/index.d.ts +0 -17
  65. package/dist/types/schemas/openai-schemas.d.ts +0 -834
  66. package/dist/types/schemas/perplexity-schemas.d.ts +0 -338
  67. package/dist/types/schemas/validation-helpers.d.ts +0 -33
  68. package/dist/types/utils/__tests__/circuit-breaker.test.d.ts +0 -1
  69. package/dist/types/utils/__tests__/correlation.test.d.ts +0 -1
  70. package/dist/types/utils/__tests__/input-validator.test.d.ts +0 -1
  71. package/dist/types/utils/__tests__/llm-cost-tracker.test.d.ts +0 -1
  72. package/dist/types/utils/__tests__/logger.test.d.ts +0 -1
  73. package/dist/types/utils/__tests__/metrics.test.d.ts +0 -1
  74. package/dist/types/utils/__tests__/retry.test.d.ts +0 -1
  75. package/dist/types/utils/__tests__/sanitizer.test.d.ts +0 -1
  76. package/dist/types/utils/__tests__/timeouts.test.d.ts +0 -1
  77. package/dist/types/utils/circuit-breaker.d.ts +0 -99
  78. package/dist/types/utils/correlation.d.ts +0 -43
  79. package/dist/types/utils/health-check.d.ts +0 -50
  80. package/dist/types/utils/input-validator.d.ts +0 -51
  81. package/dist/types/utils/llm-cost-tracker.d.ts +0 -174
  82. package/dist/types/utils/logger.d.ts +0 -8
  83. package/dist/types/utils/metrics.d.ts +0 -61
  84. package/dist/types/utils/rate-limiter.d.ts +0 -85
  85. package/dist/types/utils/retry.d.ts +0 -58
  86. package/dist/types/utils/sanitizer.d.ts +0 -30
  87. package/dist/types/utils/timeouts.d.ts +0 -44
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Creates a zip file containing the contents of the provided directory.
3
- * The zip file is created in the configured temp directory (default: os.tmpdir()).
4
- * The source directory must be within an allowed path (configurable via LUMIC_ALLOWED_UPLOAD_PATHS).
3
+ * The zip file is created in the /tmp directory.
4
+ * The source directory must be located in the /tmp directory.
5
5
  * The zip file name is the same as the source directory name with a .zip extension.
6
6
  * If a node_modules directory exists in the source directory,
7
7
  * it is added separately to ensure it is included in the zip file.
@@ -14,27 +14,25 @@ export declare function createZipFile(sourceDir: string): Promise<string>;
14
14
  /**
15
15
  * Extracts a zip archive into a specified directory.
16
16
  *
17
- * Both the zip file path and destination path must be within an allowed path
18
- * (configurable via LUMIC_ALLOWED_UPLOAD_PATHS, defaults to os.tmpdir()).
17
+ * Both the zip file path and destination path must start with /tmp/.
19
18
  *
20
- * @param zipPath The path of the zip file to extract.
21
- * @param destPath The path of the directory to extract the zip file into.
19
+ * @param zipPath The path of the zip file to extract. Must start with /tmp/.
20
+ * @param destPath The path of the directory to extract the zip file into. Must start with /tmp/.
22
21
  * @returns The path of the extracted directory.
23
- * @throws If the paths are not within allowed paths.
22
+ * @throws If the zip file or destination path does not start with /tmp/.
24
23
  * @throws If there is an error extracting the zip file.
25
24
  */
26
25
  export declare function extractZipFile(zipPath: string, destPath: string): Promise<string>;
27
26
  /**
28
27
  * Adds a file or directory to an existing zip file.
29
28
  *
30
- * The zip file path and item path must be within an allowed path
31
- * (configurable via LUMIC_ALLOWED_UPLOAD_PATHS, defaults to os.tmpdir()).
29
+ * The zip file path and item path must start with /tmp/.
32
30
  *
33
- * @param zipFilePath The path of the zip file to add the item to.
34
- * @param itemPath The path of the item to add to the zip file.
31
+ * @param zipFilePath The path of the zip file to add the item to. Must start with /tmp/.
32
+ * @param itemPath The path of the item to add to the zip file. Must start with /tmp/.
35
33
  * @param destPath Optional. The destination path inside the zip file to add the item to. Defaults to the root of the zip file.
36
34
  * @returns The path of the updated zip file.
37
- * @throws If the paths are not within allowed paths.
35
+ * @throws If the zip file or item path does not start with /tmp/.
38
36
  * @throws If there is an error adding the item to the zip file.
39
37
  */
40
38
  export declare function addToZipFile(zipFilePath: string, itemPath: string, destPath?: string): Promise<string>;
@@ -13,19 +13,16 @@ export interface GoogleSheetRange {
13
13
  endCell: GoogleSheetCell;
14
14
  }
15
15
 
16
- /** Represents a primitive value that can be stored in a Google Sheet cell */
17
- export type GoogleSheetCellValue = string | number | boolean | null;
18
-
19
16
  export interface GoogleSheetResponse {
20
17
  success: boolean;
21
18
  error?: string;
22
- data?: unknown;
19
+ data?: any;
23
20
  }
24
21
 
25
22
  export interface GoogleSheetAddRowResponse extends GoogleSheetResponse {
26
23
  data?: {
27
24
  rowNumber: number;
28
- values: GoogleSheetCellValue[];
25
+ values: any[];
29
26
  };
30
27
  }
31
28
 
@@ -38,7 +35,7 @@ export interface GoogleSheetAddSheetResponse extends GoogleSheetResponse {
38
35
 
39
36
  export interface GoogleSheetCellResponse extends GoogleSheetResponse {
40
37
  data?: {
41
- value: GoogleSheetCellValue;
38
+ value: any;
42
39
  };
43
40
  }
44
41
 
@@ -14,37 +14,7 @@ import { createPDFFromMarkdown } from './functions/pdf-create';
14
14
  import { addRow, addSheet, writeCell, getCell, writeArray } from './functions/google-sheets';
15
15
  import { parseResponse } from './functions/llm-utils';
16
16
  import { tools } from './llm-tools';
17
- import { LumicLogger, setLumicLogger, getLumicLogger } from './utils/logger';
18
- import { sanitizeForLog, sanitizeError, sanitizeAWSAuth, sanitizeObject } from './utils/sanitizer';
19
17
  export * from './types';
20
- export * from './errors';
21
- export * from './utils/timeouts';
22
- export { LumicLogger, setLumicLogger, getLumicLogger };
23
- export { sanitizeForLog, sanitizeError, sanitizeAWSAuth, sanitizeObject };
24
- export { getSecrets, resetSecrets, requireSecret } from './config/secrets';
25
- export type { LumicSecrets } from './config/secrets';
26
- export { withRetry } from './utils/retry';
27
- export type { RetryConfig } from './utils/retry';
28
- export { CircuitBreaker, CircuitBreakerState, CircuitBreakerOpenError, DEFAULT_CIRCUIT_BREAKER_CONFIG, } from './utils/circuit-breaker';
29
- export type { CircuitBreakerConfig, CircuitBreakerStateChangeCallback, } from './utils/circuit-breaker';
30
- export { validateSlackChannel, validateS3Key, validateGoogleSheetsRange, } from './utils/input-validator';
31
- export type { ValidationResult } from './utils/input-validator';
32
- export { LLMCostTracker, getLLMCostTracker, setLLMCostTracker, resetLLMCostTracker, } from './utils/llm-cost-tracker';
33
- export type { LLMUsageRecord, ImageUsageRecord, ModelCostSummary, ImageCostSummary, CostSummary, FormattedCostSummary, } from './utils/llm-cost-tracker';
34
- export { setMetricsCollector, getMetricsCollector, resetMetricsCollector, withMetrics, } from './utils/metrics';
35
- export type { MetricsCollector } from './utils/metrics';
36
- export { generateCorrelationId, getCorrelationId, getCorrelationContext, withCorrelationId, getCorrelationHeaders, } from './utils/correlation';
37
- export type { CorrelationContext } from './utils/correlation';
38
- export { TokenBucketRateLimiter, RATE_LIMIT_PROFILES, getRateLimiter, resetAllRateLimiters, withRateLimit, } from './utils/rate-limiter';
39
- export type { RateLimiterConfig } from './utils/rate-limiter';
40
- export { checkIntegrationHealth } from './utils/health-check';
41
- export type { IntegrationHealthStatus, HealthCheckResult, } from './utils/health-check';
42
- export { ParseJsonOptions } from './functions/llm-utils';
43
- export { FixJsonWithAIOptions } from './functions/json-llm-tools';
44
- export { SUPPORTED_MODELS, isValidModel, getModelCapabilities } from './types/openai-types';
45
- export type { SupportedModel, OpenAIModel, DeepseekModel, LLMModel } from './types/openai-types';
46
- export { openAIChatCompletionSchema, openAIImageResponseSchema, validateOpenAIChatCompletion, safeValidateOpenAIChatCompletion, perplexityResponseSchema, validatePerplexityResponse, safeValidatePerplexityResponse, googleSheetsValueRangeSchema, validateGoogleSheetsResponse, safeValidateGoogleSheetsResponse, s3ListObjectsSchema, s3GetObjectSchema, lambdaInvokeResponseSchema, validateS3ListObjects, safeValidateS3ListObjects, validateLambdaResponse, safeValidateLambdaResponse, createValidator, createSafeValidator, } from './schemas';
47
- export type { ValidationResult as SchemaValidationResult } from './schemas';
48
18
  interface LumicUtilities {
49
19
  llm: {
50
20
  call: typeof makeLLMCall;
@@ -27,7 +27,7 @@ export type InvocationType = 'RequestResponse' | 'Event' | 'DryRun';
27
27
 
28
28
  export interface LambdaResponse {
29
29
  statusCode: number;
30
- [key: string]: unknown;
30
+ [key: string]: any;
31
31
  }
32
32
 
33
33
  // Export types from sendMessageToSlack
@@ -1,176 +1,22 @@
1
1
  // openai-types.ts
2
2
  import { ChatCompletionMessageParam, ChatCompletionTool, ChatCompletionMessageToolCall } from 'openai/resources/chat/completions';
3
- import { ImageGenerateParams } from 'openai/resources/images';
4
-
5
- /**
6
- * Model capability configuration
7
- */
8
- interface ModelCapabilities {
9
- provider: 'openai' | 'deepseek';
10
- supportsTools: boolean;
11
- supportsJson: boolean;
12
- supportsStructuredOutput: boolean;
13
- supportsDeveloperPrompt: boolean;
14
- supportsTemperature: boolean;
15
- isReasoningModel: boolean;
16
- }
17
-
18
- /**
19
- * Supported models with their capabilities
20
- */
21
- export const SUPPORTED_MODELS = {
22
- // OpenAI GPT-5 series
23
- 'gpt-5': {
24
- provider: 'openai',
25
- supportsTools: true,
26
- supportsJson: true,
27
- supportsStructuredOutput: true,
28
- supportsDeveloperPrompt: true,
29
- supportsTemperature: true,
30
- isReasoningModel: false,
31
- },
32
- 'gpt-5-mini': {
33
- provider: 'openai',
34
- supportsTools: true,
35
- supportsJson: true,
36
- supportsStructuredOutput: true,
37
- supportsDeveloperPrompt: true,
38
- supportsTemperature: true,
39
- isReasoningModel: false,
40
- },
41
- // OpenAI GPT-4.1 series
42
- 'gpt-4.1': {
43
- provider: 'openai',
44
- supportsTools: true,
45
- supportsJson: true,
46
- supportsStructuredOutput: true,
47
- supportsDeveloperPrompt: true,
48
- supportsTemperature: true,
49
- isReasoningModel: false,
50
- },
51
- 'gpt-4.1-mini': {
52
- provider: 'openai',
53
- supportsTools: true,
54
- supportsJson: true,
55
- supportsStructuredOutput: true,
56
- supportsDeveloperPrompt: true,
57
- supportsTemperature: true,
58
- isReasoningModel: false,
59
- },
60
- 'gpt-4.1-nano': {
61
- provider: 'openai',
62
- supportsTools: true,
63
- supportsJson: true,
64
- supportsStructuredOutput: true,
65
- supportsDeveloperPrompt: true,
66
- supportsTemperature: true,
67
- isReasoningModel: false,
68
- },
69
- // OpenAI reasoning models (o-series)
70
- 'o1': {
71
- provider: 'openai',
72
- supportsTools: true,
73
- supportsJson: false,
74
- supportsStructuredOutput: true,
75
- supportsDeveloperPrompt: true,
76
- supportsTemperature: false,
77
- isReasoningModel: true,
78
- },
79
- 'o1-mini': {
80
- provider: 'openai',
81
- supportsTools: true,
82
- supportsJson: false,
83
- supportsStructuredOutput: false,
84
- supportsDeveloperPrompt: false,
85
- supportsTemperature: false,
86
- isReasoningModel: true,
87
- },
88
- 'o3': {
89
- provider: 'openai',
90
- supportsTools: true,
91
- supportsJson: false,
92
- supportsStructuredOutput: true,
93
- supportsDeveloperPrompt: true,
94
- supportsTemperature: false,
95
- isReasoningModel: true,
96
- },
97
- 'o3-mini': {
98
- provider: 'openai',
99
- supportsTools: true,
100
- supportsJson: true,
101
- supportsStructuredOutput: true,
102
- supportsDeveloperPrompt: true,
103
- supportsTemperature: false,
104
- isReasoningModel: true,
105
- },
106
- 'o4-mini': {
107
- provider: 'openai',
108
- supportsTools: true,
109
- supportsJson: false,
110
- supportsStructuredOutput: true,
111
- supportsDeveloperPrompt: true,
112
- supportsTemperature: false,
113
- isReasoningModel: true,
114
- },
115
- // Deepseek models
116
- 'deepseek-chat': {
117
- provider: 'deepseek',
118
- supportsTools: true,
119
- supportsJson: true,
120
- supportsStructuredOutput: false,
121
- supportsDeveloperPrompt: true,
122
- supportsTemperature: true,
123
- isReasoningModel: false,
124
- },
125
- 'deepseek-reasoner': {
126
- provider: 'deepseek',
127
- supportsTools: false,
128
- supportsJson: false,
129
- supportsStructuredOutput: false,
130
- supportsDeveloperPrompt: true,
131
- supportsTemperature: true,
132
- isReasoningModel: true,
133
- },
134
- } as const satisfies Record<string, ModelCapabilities>;
135
-
136
- /**
137
- * Represents all supported LLM models
138
- */
139
- export type SupportedModel = keyof typeof SUPPORTED_MODELS;
3
+ import { ImageGenerateParams, ImageModel } from 'openai/resources/images';
140
4
 
141
5
  /**
142
6
  * Represents OpenAI models
143
7
  */
144
- export type OpenAIModel = Extract<SupportedModel, 'gpt-5' | 'gpt-5-mini' | 'gpt-4.1' | 'gpt-4.1-mini' | 'gpt-4.1-nano' | 'o1' | 'o1-mini' | 'o3' | 'o3-mini' | 'o4-mini'>;
145
8
 
9
+ export type OpenAIModel = 'gpt-5' | 'gpt-5-mini' | 'gpt-5-nano' | 'gpt-4.1' | 'gpt-4.1-mini' | 'gpt-4.1-nano'
146
10
  /**
147
11
  * Represents Deepseek models
148
12
  */
149
- export type DeepseekModel = Extract<SupportedModel, 'deepseek-chat' | 'deepseek-reasoner'>;
13
+ export type DeepseekModel = 'deepseek-chat' | 'deepseek-reasoner';
150
14
 
151
15
  /**
152
16
  * Represents all supported LLM models
153
17
  */
154
18
  export type LLMModel = OpenAIModel | DeepseekModel;
155
19
 
156
- /**
157
- * Type guard to check if a string is a valid supported model
158
- * @param model The model name to validate
159
- * @returns True if the model is supported
160
- */
161
- export function isValidModel(model: string): model is SupportedModel {
162
- return model in SUPPORTED_MODELS;
163
- }
164
-
165
- /**
166
- * Get capabilities for a supported model
167
- * @param model The model to get capabilities for
168
- * @returns Model capabilities object
169
- */
170
- export function getModelCapabilities(model: SupportedModel): Readonly<ModelCapabilities> {
171
- return SUPPORTED_MODELS[model];
172
- }
173
-
174
20
  /**
175
21
  * Represents the usage of the LLM.
176
22
  */
@@ -203,11 +49,6 @@ export interface LLMOptions {
203
49
  parallel_tool_calls?: boolean;
204
50
  service_tier?: 'auto' | 'default';
205
51
  apiKey?: string;
206
- /**
207
- * Request timeout in milliseconds. Overrides the default LLM_TIMEOUT_MS (120000ms).
208
- * Applied to the OpenAI/Deepseek SDK client for the request.
209
- */
210
- timeout?: number;
211
52
  }
212
53
 
213
54
  /**
@@ -222,11 +63,11 @@ export interface LLMResponse<T> {
222
63
  /**
223
64
  * Represents the format of the OpenAI response.
224
65
  */
225
- export type OpenAIResponseFormat = 'text' | 'json' | {
226
- type: 'json_schema';
66
+ export type OpenAIResponseFormat = 'text' | 'json' | {
67
+ type: 'json_schema';
227
68
  schema: {
228
69
  type: 'object';
229
- properties: Record<string, unknown>;
70
+ properties: Record<string, any>;
230
71
  required?: string[];
231
72
  }
232
73
  };
@@ -29,7 +29,7 @@ export interface SaveToS3Response {
29
29
  }
30
30
  export interface LoadFromS3Response {
31
31
  success: boolean;
32
- content?: unknown;
32
+ content?: any;
33
33
  error?: string;
34
34
  }
35
35
  export interface CheckBucketResponse {
@@ -10,17 +10,15 @@ export interface GoogleSheetRange {
10
10
  startCell: GoogleSheetCell;
11
11
  endCell: GoogleSheetCell;
12
12
  }
13
- /** Represents a primitive value that can be stored in a Google Sheet cell */
14
- export type GoogleSheetCellValue = string | number | boolean | null;
15
13
  export interface GoogleSheetResponse {
16
14
  success: boolean;
17
15
  error?: string;
18
- data?: unknown;
16
+ data?: any;
19
17
  }
20
18
  export interface GoogleSheetAddRowResponse extends GoogleSheetResponse {
21
19
  data?: {
22
20
  rowNumber: number;
23
- values: GoogleSheetCellValue[];
21
+ values: any[];
24
22
  };
25
23
  }
26
24
  export interface GoogleSheetAddSheetResponse extends GoogleSheetResponse {
@@ -31,7 +29,7 @@ export interface GoogleSheetAddSheetResponse extends GoogleSheetResponse {
31
29
  }
32
30
  export interface GoogleSheetCellResponse extends GoogleSheetResponse {
33
31
  data?: {
34
- value: GoogleSheetCellValue;
32
+ value: any;
35
33
  };
36
34
  }
37
35
  export interface GoogleSheetWriteArrayResponse extends GoogleSheetResponse {
@@ -20,7 +20,7 @@ export interface PerplexityResponse {
20
20
  export type InvocationType = 'RequestResponse' | 'Event' | 'DryRun';
21
21
  export interface LambdaResponse {
22
22
  statusCode: number;
23
- [key: string]: unknown;
23
+ [key: string]: any;
24
24
  }
25
25
  export interface SlackApiResponse {
26
26
  ok: boolean;
@@ -1,158 +1,17 @@
1
1
  import { ChatCompletionMessageParam, ChatCompletionTool, ChatCompletionMessageToolCall } from 'openai/resources/chat/completions';
2
2
  import { ImageGenerateParams } from 'openai/resources/images';
3
- /**
4
- * Model capability configuration
5
- */
6
- interface ModelCapabilities {
7
- provider: 'openai' | 'deepseek';
8
- supportsTools: boolean;
9
- supportsJson: boolean;
10
- supportsStructuredOutput: boolean;
11
- supportsDeveloperPrompt: boolean;
12
- supportsTemperature: boolean;
13
- isReasoningModel: boolean;
14
- }
15
- /**
16
- * Supported models with their capabilities
17
- */
18
- export declare const SUPPORTED_MODELS: {
19
- readonly 'gpt-5': {
20
- readonly provider: "openai";
21
- readonly supportsTools: true;
22
- readonly supportsJson: true;
23
- readonly supportsStructuredOutput: true;
24
- readonly supportsDeveloperPrompt: true;
25
- readonly supportsTemperature: true;
26
- readonly isReasoningModel: false;
27
- };
28
- readonly 'gpt-5-mini': {
29
- readonly provider: "openai";
30
- readonly supportsTools: true;
31
- readonly supportsJson: true;
32
- readonly supportsStructuredOutput: true;
33
- readonly supportsDeveloperPrompt: true;
34
- readonly supportsTemperature: true;
35
- readonly isReasoningModel: false;
36
- };
37
- readonly 'gpt-4.1': {
38
- readonly provider: "openai";
39
- readonly supportsTools: true;
40
- readonly supportsJson: true;
41
- readonly supportsStructuredOutput: true;
42
- readonly supportsDeveloperPrompt: true;
43
- readonly supportsTemperature: true;
44
- readonly isReasoningModel: false;
45
- };
46
- readonly 'gpt-4.1-mini': {
47
- readonly provider: "openai";
48
- readonly supportsTools: true;
49
- readonly supportsJson: true;
50
- readonly supportsStructuredOutput: true;
51
- readonly supportsDeveloperPrompt: true;
52
- readonly supportsTemperature: true;
53
- readonly isReasoningModel: false;
54
- };
55
- readonly 'gpt-4.1-nano': {
56
- readonly provider: "openai";
57
- readonly supportsTools: true;
58
- readonly supportsJson: true;
59
- readonly supportsStructuredOutput: true;
60
- readonly supportsDeveloperPrompt: true;
61
- readonly supportsTemperature: true;
62
- readonly isReasoningModel: false;
63
- };
64
- readonly o1: {
65
- readonly provider: "openai";
66
- readonly supportsTools: true;
67
- readonly supportsJson: false;
68
- readonly supportsStructuredOutput: true;
69
- readonly supportsDeveloperPrompt: true;
70
- readonly supportsTemperature: false;
71
- readonly isReasoningModel: true;
72
- };
73
- readonly 'o1-mini': {
74
- readonly provider: "openai";
75
- readonly supportsTools: true;
76
- readonly supportsJson: false;
77
- readonly supportsStructuredOutput: false;
78
- readonly supportsDeveloperPrompt: false;
79
- readonly supportsTemperature: false;
80
- readonly isReasoningModel: true;
81
- };
82
- readonly o3: {
83
- readonly provider: "openai";
84
- readonly supportsTools: true;
85
- readonly supportsJson: false;
86
- readonly supportsStructuredOutput: true;
87
- readonly supportsDeveloperPrompt: true;
88
- readonly supportsTemperature: false;
89
- readonly isReasoningModel: true;
90
- };
91
- readonly 'o3-mini': {
92
- readonly provider: "openai";
93
- readonly supportsTools: true;
94
- readonly supportsJson: true;
95
- readonly supportsStructuredOutput: true;
96
- readonly supportsDeveloperPrompt: true;
97
- readonly supportsTemperature: false;
98
- readonly isReasoningModel: true;
99
- };
100
- readonly 'o4-mini': {
101
- readonly provider: "openai";
102
- readonly supportsTools: true;
103
- readonly supportsJson: false;
104
- readonly supportsStructuredOutput: true;
105
- readonly supportsDeveloperPrompt: true;
106
- readonly supportsTemperature: false;
107
- readonly isReasoningModel: true;
108
- };
109
- readonly 'deepseek-chat': {
110
- readonly provider: "deepseek";
111
- readonly supportsTools: true;
112
- readonly supportsJson: true;
113
- readonly supportsStructuredOutput: false;
114
- readonly supportsDeveloperPrompt: true;
115
- readonly supportsTemperature: true;
116
- readonly isReasoningModel: false;
117
- };
118
- readonly 'deepseek-reasoner': {
119
- readonly provider: "deepseek";
120
- readonly supportsTools: false;
121
- readonly supportsJson: false;
122
- readonly supportsStructuredOutput: false;
123
- readonly supportsDeveloperPrompt: true;
124
- readonly supportsTemperature: true;
125
- readonly isReasoningModel: true;
126
- };
127
- };
128
- /**
129
- * Represents all supported LLM models
130
- */
131
- export type SupportedModel = keyof typeof SUPPORTED_MODELS;
132
3
  /**
133
4
  * Represents OpenAI models
134
5
  */
135
- export type OpenAIModel = Extract<SupportedModel, 'gpt-5' | 'gpt-5-mini' | 'gpt-4.1' | 'gpt-4.1-mini' | 'gpt-4.1-nano' | 'o1' | 'o1-mini' | 'o3' | 'o3-mini' | 'o4-mini'>;
6
+ export type OpenAIModel = 'gpt-5' | 'gpt-5-mini' | 'gpt-5-nano' | 'gpt-4.1' | 'gpt-4.1-mini' | 'gpt-4.1-nano';
136
7
  /**
137
8
  * Represents Deepseek models
138
9
  */
139
- export type DeepseekModel = Extract<SupportedModel, 'deepseek-chat' | 'deepseek-reasoner'>;
10
+ export type DeepseekModel = 'deepseek-chat' | 'deepseek-reasoner';
140
11
  /**
141
12
  * Represents all supported LLM models
142
13
  */
143
14
  export type LLMModel = OpenAIModel | DeepseekModel;
144
- /**
145
- * Type guard to check if a string is a valid supported model
146
- * @param model The model name to validate
147
- * @returns True if the model is supported
148
- */
149
- export declare function isValidModel(model: string): model is SupportedModel;
150
- /**
151
- * Get capabilities for a supported model
152
- * @param model The model to get capabilities for
153
- * @returns Model capabilities object
154
- */
155
- export declare function getModelCapabilities(model: SupportedModel): Readonly<ModelCapabilities>;
156
15
  /**
157
16
  * Represents the usage of the LLM.
158
17
  */
@@ -184,11 +43,6 @@ export interface LLMOptions {
184
43
  parallel_tool_calls?: boolean;
185
44
  service_tier?: 'auto' | 'default';
186
45
  apiKey?: string;
187
- /**
188
- * Request timeout in milliseconds. Overrides the default LLM_TIMEOUT_MS (120000ms).
189
- * Applied to the OpenAI/Deepseek SDK client for the request.
190
- */
191
- timeout?: number;
192
46
  }
193
47
  /**
194
48
  * Represents the response from the LLM.
@@ -205,7 +59,7 @@ export type OpenAIResponseFormat = 'text' | 'json' | {
205
59
  type: 'json_schema';
206
60
  schema: {
207
61
  type: 'object';
208
- properties: Record<string, unknown>;
62
+ properties: Record<string, any>;
209
63
  required?: string[];
210
64
  };
211
65
  };
@@ -18,9 +18,4 @@ interface AWSAuth {
18
18
  declare const validateEnvironmentVars: () => ValidationResult;
19
19
  declare const initialiseS3Client: (auth?: AWSAuth | null) => S3Client;
20
20
  declare const initialiseLambdaClient: (auth?: AWSAuth | null) => Lambda;
21
- /**
22
- * Clears all cached AWS client instances.
23
- * Useful for testing or when credentials need to be refreshed.
24
- */
25
- declare const clearClientCache: () => void;
26
- export { validateEnvironmentVars, initialiseS3Client, initialiseLambdaClient, clearClientCache, AWSAuth };
21
+ export { validateEnvironmentVars, initialiseS3Client, initialiseLambdaClient, AWSAuth };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adaptic/lumic-utils",
3
- "version": "1.0.8",
3
+ "version": "1.0.10",
4
4
  "description": "NPM repo set of utility functions usable across the entire organisation.",
5
5
  "always-build-npm": false,
6
6
  "type": "module",
@@ -22,7 +22,7 @@
22
22
  "build": "npm run clean && npm run build:js && npm run build:tools && npm run build:types",
23
23
  "build:js": "rollup -c",
24
24
  "build:tools": "node --loader ts-node/esm compile-tool-definitions.ts",
25
- "build:types": "mkdir -p dist/types && cp -r src/types/* dist/types/",
25
+ "build:types": "tsc --emitDeclarationOnly --declaration --declarationDir dist/types",
26
26
  "test": "vitest run",
27
27
  "test:watch": "vitest",
28
28
  "test:legacy": "npm run build && node dist/test.mjs",
@@ -37,6 +37,7 @@
37
37
  "license": "Ask yo mamma",
38
38
  "dependencies": {
39
39
  "@adaptic/utils": "^0.1.1",
40
+ "@anthropic-ai/sdk": "^0.80.0",
40
41
  "@aws-sdk/client-lambda": "^3.840.0",
41
42
  "@aws-sdk/client-s3": "^3.842.0",
42
43
  "@googleapis/sheets": "^10.0.1",