@llumiverse/common 0.23.0-dev.20251201 → 0.24.0-dev.202601221707

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 (92) hide show
  1. package/lib/cjs/capability/azure_foundry.js +160 -0
  2. package/lib/cjs/capability/azure_foundry.js.map +1 -0
  3. package/lib/cjs/capability/bedrock.js +158 -0
  4. package/lib/cjs/capability/bedrock.js.map +1 -0
  5. package/lib/cjs/capability/openai.js +95 -0
  6. package/lib/cjs/capability/openai.js.map +1 -0
  7. package/lib/cjs/capability/vertexai.js +80 -0
  8. package/lib/cjs/capability/vertexai.js.map +1 -0
  9. package/lib/cjs/capability.js +82 -0
  10. package/lib/cjs/capability.js.map +1 -0
  11. package/lib/cjs/index.js +25 -0
  12. package/lib/cjs/index.js.map +1 -0
  13. package/lib/cjs/options/azure_foundry.js +428 -0
  14. package/lib/cjs/options/azure_foundry.js.map +1 -0
  15. package/lib/cjs/options/bedrock.js +462 -0
  16. package/lib/cjs/options/bedrock.js.map +1 -0
  17. package/lib/cjs/options/fallback.js +35 -0
  18. package/lib/cjs/options/fallback.js.map +1 -0
  19. package/lib/cjs/options/groq.js +37 -0
  20. package/lib/cjs/options/groq.js.map +1 -0
  21. package/lib/cjs/options/openai.js +126 -0
  22. package/lib/cjs/options/openai.js.map +1 -0
  23. package/lib/cjs/options/vertexai.js +503 -0
  24. package/lib/cjs/options/vertexai.js.map +1 -0
  25. package/lib/cjs/options.js +30 -0
  26. package/lib/cjs/options.js.map +1 -0
  27. package/lib/cjs/package.json +3 -0
  28. package/lib/cjs/types.js +195 -0
  29. package/lib/cjs/types.js.map +1 -0
  30. package/lib/esm/capability/azure_foundry.js +157 -0
  31. package/lib/esm/capability/azure_foundry.js.map +1 -0
  32. package/lib/esm/capability/bedrock.js +155 -0
  33. package/lib/esm/capability/bedrock.js.map +1 -0
  34. package/lib/esm/capability/openai.js +92 -0
  35. package/lib/esm/capability/openai.js.map +1 -0
  36. package/lib/esm/capability/vertexai.js +77 -0
  37. package/lib/esm/capability/vertexai.js.map +1 -0
  38. package/lib/esm/capability.js +77 -0
  39. package/lib/esm/capability.js.map +1 -0
  40. package/lib/esm/index.js +9 -0
  41. package/lib/esm/index.js.map +1 -0
  42. package/lib/esm/options/azure_foundry.js +424 -0
  43. package/lib/esm/options/azure_foundry.js.map +1 -0
  44. package/lib/esm/options/bedrock.js +458 -0
  45. package/lib/esm/options/bedrock.js.map +1 -0
  46. package/lib/esm/options/fallback.js +32 -0
  47. package/lib/esm/options/fallback.js.map +1 -0
  48. package/lib/esm/options/groq.js +34 -0
  49. package/lib/esm/options/groq.js.map +1 -0
  50. package/lib/esm/options/openai.js +123 -0
  51. package/lib/esm/options/openai.js.map +1 -0
  52. package/lib/esm/options/vertexai.js +498 -0
  53. package/lib/esm/options/vertexai.js.map +1 -0
  54. package/lib/esm/options.js +27 -0
  55. package/lib/esm/options.js.map +1 -0
  56. package/lib/esm/types.js +192 -0
  57. package/lib/esm/types.js.map +1 -0
  58. package/lib/types/capability/azure_foundry.d.ts +7 -0
  59. package/lib/types/capability/azure_foundry.d.ts.map +1 -0
  60. package/lib/types/capability/bedrock.d.ts +7 -0
  61. package/lib/types/capability/bedrock.d.ts.map +1 -0
  62. package/lib/types/capability/openai.d.ts +13 -0
  63. package/lib/types/capability/openai.d.ts.map +1 -0
  64. package/lib/types/capability/vertexai.d.ts +11 -0
  65. package/lib/types/capability/vertexai.d.ts.map +1 -0
  66. package/lib/types/capability.d.ts +5 -0
  67. package/lib/types/capability.d.ts.map +1 -0
  68. package/lib/types/index.d.ts +9 -0
  69. package/lib/types/index.d.ts.map +1 -0
  70. package/lib/types/options/azure_foundry.d.ts +52 -0
  71. package/lib/types/options/azure_foundry.d.ts.map +1 -0
  72. package/lib/types/options/bedrock.d.ts +52 -0
  73. package/lib/types/options/bedrock.d.ts.map +1 -0
  74. package/lib/types/options/fallback.d.ts +13 -0
  75. package/lib/types/options/fallback.d.ts.map +1 -0
  76. package/lib/types/options/groq.d.ts +12 -0
  77. package/lib/types/options/groq.d.ts.map +1 -0
  78. package/lib/types/options/openai.d.ts +21 -0
  79. package/lib/types/options/openai.d.ts.map +1 -0
  80. package/lib/types/options/vertexai.d.ts +74 -0
  81. package/lib/types/options/vertexai.d.ts.map +1 -0
  82. package/lib/types/options.d.ts +3 -0
  83. package/lib/types/options.d.ts.map +1 -0
  84. package/lib/types/types.d.ts +443 -0
  85. package/lib/types/types.d.ts.map +1 -0
  86. package/package.json +2 -2
  87. package/src/capability/azure_foundry.ts +1 -0
  88. package/src/capability/bedrock.ts +98 -128
  89. package/src/capability/openai.ts +43 -68
  90. package/src/capability/vertexai.ts +15 -36
  91. package/src/capability.ts +19 -2
  92. package/src/types.ts +53 -2
package/src/types.ts CHANGED
@@ -8,6 +8,7 @@ import { VertexAIOptions } from './options/vertexai.js';
8
8
 
9
9
  export enum Providers {
10
10
  openai = 'openai',
11
+ openai_compatible = 'openai_compatible',
11
12
  azure_openai = 'azure_openai',
12
13
  azure_foundry = 'azure_foundry',
13
14
  huggingface_ie = 'huggingface_ie',
@@ -17,7 +18,8 @@ export enum Providers {
17
18
  togetherai = 'togetherai',
18
19
  mistralai = 'mistralai',
19
20
  groq = 'groq',
20
- watsonx = 'watsonx'
21
+ watsonx = 'watsonx',
22
+ xai = 'xai'
21
23
  }
22
24
 
23
25
  export interface ProviderParams {
@@ -113,6 +115,21 @@ export const ProviderList: Record<Providers, ProviderParams> = {
113
115
  requiresEndpointUrl: true,
114
116
  supportSearch: false
115
117
  },
118
+ xai: {
119
+ id: Providers.xai,
120
+ name: "xAI (Grok)",
121
+ requiresApiKey: true,
122
+ requiresEndpointUrl: false,
123
+ supportSearch: false
124
+ },
125
+ openai_compatible: {
126
+ id: Providers.openai_compatible,
127
+ name: "OpenAI Compatible",
128
+ requiresApiKey: true,
129
+ requiresEndpointUrl: true,
130
+ endpointPlaceholder: "https://api.example.com/v1",
131
+ supportSearch: false
132
+ },
116
133
  }
117
134
 
118
135
  // ============== Embeddings ===============
@@ -184,11 +201,17 @@ export interface CompletionChunkObject {
184
201
  result: CompletionResult[];
185
202
  token_usage?: ExecutionTokenUsage;
186
203
  finish_reason?: "stop" | "length" | string;
204
+ /**
205
+ * Tool calls returned by the model during streaming.
206
+ * Each chunk may contain partial tool call information that needs to be aggregated.
207
+ */
208
+ tool_use?: ToolUse[];
187
209
  }
188
210
 
189
211
  export interface ToolDefinition {
190
212
  name: string,
191
213
  description?: string,
214
+ default?: boolean,
192
215
  input_schema: {
193
216
  type: 'object';
194
217
  properties?: JSONSchema | null | undefined;
@@ -202,7 +225,12 @@ export interface ToolDefinition {
202
225
  export interface ToolUse<ParamsT = JSONObject> {
203
226
  id: string,
204
227
  tool_name: string,
205
- tool_input: ParamsT | null
228
+ tool_input: ParamsT | null,
229
+ /**
230
+ * Gemini thinking models require thought_signature to be passed back with tool results.
231
+ * This preserves the model's reasoning state during multi-turn tool use.
232
+ */
233
+ thought_signature?: string,
206
234
  }
207
235
 
208
236
  export interface Completion {
@@ -349,6 +377,24 @@ export interface ExecutionOptions extends StatelessExecutionOptions {
349
377
  * that can be passed here to restore the context when a new prompt is sent to the model.
350
378
  */
351
379
  conversation?: unknown | null;
380
+ /**
381
+ * Number of turns to keep images in conversation history before stripping them.
382
+ * - 0 (default): Strip images immediately after each turn
383
+ * - 1: Keep images for current turn only, strip in next turn
384
+ * - N: Keep images for N turns before stripping
385
+ * - undefined: Same as 0, strip immediately
386
+ *
387
+ * Images are stripped to prevent JSON.stringify corruption (Uint8Array) and reduce storage bloat (base64).
388
+ */
389
+ stripImagesAfterTurns?: number;
390
+
391
+ /**
392
+ * Maximum tokens to keep for text content in tool results.
393
+ * Text exceeding this limit will be truncated with a "[Content truncated...]" marker.
394
+ * - undefined/0: No text truncation (default)
395
+ * - N > 0: Truncate text to approximately N tokens (using ~4 chars/token estimate)
396
+ */
397
+ stripTextMaxTokens?: number;
352
398
  }
353
399
 
354
400
  //Common names to share between different models
@@ -446,6 +492,11 @@ export interface PromptSegment {
446
492
  * The tool use id if the segment is a tool response
447
493
  */
448
494
  tool_use_id?: string;
495
+ /**
496
+ * Gemini thinking models require thought_signature to be passed back with tool results.
497
+ * This should be copied from the ToolUse.thought_signature when sending tool responses.
498
+ */
499
+ thought_signature?: string;
449
500
  files?: DataSource[]
450
501
  }
451
502