@llumiverse/common 0.22.0 → 0.23.0-dev-20251118

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 (65) hide show
  1. package/lib/cjs/capability/azure_foundry.js +1 -0
  2. package/lib/cjs/capability/azure_foundry.js.map +1 -1
  3. package/lib/cjs/capability/bedrock.js +7 -2
  4. package/lib/cjs/capability/bedrock.js.map +1 -1
  5. package/lib/cjs/capability/openai.js +2 -0
  6. package/lib/cjs/capability/openai.js.map +1 -1
  7. package/lib/cjs/capability/vertexai.js +1 -0
  8. package/lib/cjs/capability/vertexai.js.map +1 -1
  9. package/lib/cjs/capability.js +7 -0
  10. package/lib/cjs/capability.js.map +1 -1
  11. package/lib/cjs/options/azure_foundry.js +3 -0
  12. package/lib/cjs/options/azure_foundry.js.map +1 -1
  13. package/lib/cjs/options/bedrock.js +62 -0
  14. package/lib/cjs/options/bedrock.js.map +1 -1
  15. package/lib/cjs/options/openai.js +3 -0
  16. package/lib/cjs/options/openai.js.map +1 -1
  17. package/lib/cjs/options/vertexai.js +98 -2
  18. package/lib/cjs/options/vertexai.js.map +1 -1
  19. package/lib/cjs/types.js +1 -1
  20. package/lib/cjs/types.js.map +1 -1
  21. package/lib/esm/capability/azure_foundry.js +1 -0
  22. package/lib/esm/capability/azure_foundry.js.map +1 -1
  23. package/lib/esm/capability/bedrock.js +7 -2
  24. package/lib/esm/capability/bedrock.js.map +1 -1
  25. package/lib/esm/capability/openai.js +2 -0
  26. package/lib/esm/capability/openai.js.map +1 -1
  27. package/lib/esm/capability/vertexai.js +1 -0
  28. package/lib/esm/capability/vertexai.js.map +1 -1
  29. package/lib/esm/capability.js +7 -0
  30. package/lib/esm/capability.js.map +1 -1
  31. package/lib/esm/options/azure_foundry.js +3 -0
  32. package/lib/esm/options/azure_foundry.js.map +1 -1
  33. package/lib/esm/options/bedrock.js +62 -0
  34. package/lib/esm/options/bedrock.js.map +1 -1
  35. package/lib/esm/options/openai.js +3 -0
  36. package/lib/esm/options/openai.js.map +1 -1
  37. package/lib/esm/options/vertexai.js +98 -2
  38. package/lib/esm/options/vertexai.js.map +1 -1
  39. package/lib/esm/types.js +1 -1
  40. package/lib/esm/types.js.map +1 -1
  41. package/lib/tsconfig.tsbuildinfo +1 -0
  42. package/lib/types/capability/azure_foundry.d.ts.map +1 -1
  43. package/lib/types/capability/bedrock.d.ts.map +1 -1
  44. package/lib/types/capability/openai.d.ts.map +1 -1
  45. package/lib/types/capability/vertexai.d.ts.map +1 -1
  46. package/lib/types/capability.d.ts.map +1 -1
  47. package/lib/types/options/azure_foundry.d.ts.map +1 -1
  48. package/lib/types/options/bedrock.d.ts +13 -2
  49. package/lib/types/options/bedrock.d.ts.map +1 -1
  50. package/lib/types/options/openai.d.ts.map +1 -1
  51. package/lib/types/options/vertexai.d.ts +1 -0
  52. package/lib/types/options/vertexai.d.ts.map +1 -1
  53. package/lib/types/types.d.ts +39 -14
  54. package/lib/types/types.d.ts.map +1 -1
  55. package/package.json +77 -77
  56. package/src/capability/azure_foundry.ts +1 -0
  57. package/src/capability/bedrock.ts +7 -2
  58. package/src/capability/openai.ts +2 -0
  59. package/src/capability/vertexai.ts +1 -0
  60. package/src/capability.ts +7 -0
  61. package/src/options/azure_foundry.ts +3 -0
  62. package/src/options/bedrock.ts +78 -2
  63. package/src/options/openai.ts +3 -0
  64. package/src/options/vertexai.ts +109 -6
  65. package/src/types.ts +48 -22
package/src/types.ts CHANGED
@@ -64,7 +64,7 @@ export const ProviderList: Record<Providers, ProviderParams> = {
64
64
  replicate:
65
65
  {
66
66
  id: Providers.replicate,
67
- name: "Repicate",
67
+ name: "Replicate",
68
68
  requiresApiKey: true,
69
69
  requiresEndpointUrl: false,
70
70
  supportSearch: true,
@@ -152,20 +152,40 @@ export interface EmbeddingsResult {
152
152
  export interface ResultValidationError {
153
153
  code: 'validation_error' | 'json_error' | 'content_policy_violation';
154
154
  message: string;
155
- data?: string;
155
+ data?: CompletionResult[];
156
156
  }
157
157
 
158
- //ResultT should be either JSONObject or string
158
+ // ============== Result Types ===============
159
+
160
+ export interface BaseResult {
161
+ type: "text" | "json" | "image";
162
+ value: any;
163
+ }
164
+
165
+ export interface TextResult extends BaseResult {
166
+ type: "text";
167
+ value: string;
168
+ }
169
+
170
+ export interface JsonResult extends BaseResult {
171
+ type: "json";
172
+ }
173
+
174
+ export interface ImageResult extends BaseResult {
175
+ type: "image";
176
+ value: string; // base64 data url or real url
177
+ }
178
+
179
+ export type CompletionResult = TextResult | JsonResult | ImageResult;
180
+
181
+
159
182
  //Internal structure used in driver implementation.
160
- export interface CompletionChunkObject<ResultT = any> {
161
- result: ResultT;
183
+ export interface CompletionChunkObject {
184
+ result: CompletionResult[];
162
185
  token_usage?: ExecutionTokenUsage;
163
186
  finish_reason?: "stop" | "length" | string;
164
187
  }
165
188
 
166
- //Internal structure used in driver implementation.
167
- export type CompletionChunk = CompletionChunkObject | string;
168
-
169
189
  export interface ToolDefinition {
170
190
  name: string,
171
191
  description?: string,
@@ -185,10 +205,9 @@ export interface ToolUse<ParamsT = JSONObject> {
185
205
  tool_input: ParamsT | null
186
206
  }
187
207
 
188
- //ResultT should be either JSONObject or string
189
- export interface Completion<ResultT = any> {
208
+ export interface Completion {
190
209
  // the driver impl must return the result and optionally the token_usage. the execution time is computed by the extended abstract driver
191
- result: ResultT;
210
+ result: CompletionResult[];
192
211
  token_usage?: ExecutionTokenUsage;
193
212
  /**
194
213
  * Contains the tools from which the model awaits information.
@@ -216,12 +235,6 @@ export interface Completion<ResultT = any> {
216
235
  conversation?: unknown;
217
236
  }
218
237
 
219
- export interface ImageGeneration {
220
-
221
- images?: string[];
222
-
223
- }
224
-
225
238
  export interface ExecutionResponse<PromptT = any> extends Completion {
226
239
  prompt: PromptT;
227
240
  /**
@@ -239,11 +252,24 @@ export interface CompletionStream<PromptT = any> extends AsyncIterable<string> {
239
252
  completion: ExecutionResponse<PromptT> | undefined;
240
253
  }
241
254
 
255
+ /**
256
+ * Minimal logger interface for LLM drivers.
257
+ * Follows pino v10 signature: supports message-only or object-first (never message-first).
258
+ * - Message-only: logger.info("message")
259
+ * - Object-first: logger.info({ data }, "message")
260
+ * - PREVENTS: logger.info("message", { data }) - compile error (objects not allowed in ...args)
261
+ *
262
+ * Additional args must be primitives (string | number | boolean) for string interpolation.
263
+ */
242
264
  export interface Logger {
243
- debug: (...obj: any[]) => void;
244
- info: (...obj: any[]) => void;
245
- warn: (...obj: any[]) => void;
246
- error: (...obj: any[]) => void;
265
+ debug(msg: string, ...args: (string | number | boolean)[]): void;
266
+ debug<T>(obj: T, msg?: T extends string ? never : string, ...args: (string | number | boolean)[]): void;
267
+ info(msg: string, ...args: (string | number | boolean)[]): void;
268
+ info<T>(obj: T, msg?: T extends string ? never : string, ...args: (string | number | boolean)[]): void;
269
+ warn(msg: string, ...args: (string | number | boolean)[]): void;
270
+ warn<T>(obj: T, msg?: T extends string ? never : string, ...args: (string | number | boolean)[]): void;
271
+ error(msg: string, ...args: (string | number | boolean)[]): void;
272
+ error<T>(obj: T, msg?: T extends string ? never : string, ...args: (string | number | boolean)[]): void;
247
273
  }
248
274
 
249
275
  export interface DriverOptions {
@@ -533,7 +559,7 @@ export interface TrainingOptions {
533
559
 
534
560
  export interface TrainingPromptOptions {
535
561
  segments: PromptSegment[];
536
- completion: string | JSONObject;
562
+ completion: CompletionResult[]
537
563
  model: string; // the model to train
538
564
  schema?: JSONSchema; // the result schema f any
539
565
  }