@llumiverse/common 0.23.0-dev.20251201 → 0.24.0

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 +442 -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 +52 -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,6 +201,11 @@ 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 {
@@ -202,7 +224,12 @@ export interface ToolDefinition {
202
224
  export interface ToolUse<ParamsT = JSONObject> {
203
225
  id: string,
204
226
  tool_name: string,
205
- tool_input: ParamsT | null
227
+ tool_input: ParamsT | null,
228
+ /**
229
+ * Gemini thinking models require thought_signature to be passed back with tool results.
230
+ * This preserves the model's reasoning state during multi-turn tool use.
231
+ */
232
+ thought_signature?: string,
206
233
  }
207
234
 
208
235
  export interface Completion {
@@ -349,6 +376,24 @@ export interface ExecutionOptions extends StatelessExecutionOptions {
349
376
  * that can be passed here to restore the context when a new prompt is sent to the model.
350
377
  */
351
378
  conversation?: unknown | null;
379
+ /**
380
+ * Number of turns to keep images in conversation history before stripping them.
381
+ * - 0 (default): Strip images immediately after each turn
382
+ * - 1: Keep images for current turn only, strip in next turn
383
+ * - N: Keep images for N turns before stripping
384
+ * - undefined: Same as 0, strip immediately
385
+ *
386
+ * Images are stripped to prevent JSON.stringify corruption (Uint8Array) and reduce storage bloat (base64).
387
+ */
388
+ stripImagesAfterTurns?: number;
389
+
390
+ /**
391
+ * Maximum tokens to keep for text content in tool results.
392
+ * Text exceeding this limit will be truncated with a "[Content truncated...]" marker.
393
+ * - undefined/0: No text truncation (default)
394
+ * - N > 0: Truncate text to approximately N tokens (using ~4 chars/token estimate)
395
+ */
396
+ stripTextMaxTokens?: number;
352
397
  }
353
398
 
354
399
  //Common names to share between different models
@@ -446,6 +491,11 @@ export interface PromptSegment {
446
491
  * The tool use id if the segment is a tool response
447
492
  */
448
493
  tool_use_id?: string;
494
+ /**
495
+ * Gemini thinking models require thought_signature to be passed back with tool results.
496
+ * This should be copied from the ToolUse.thought_signature when sending tool responses.
497
+ */
498
+ thought_signature?: string;
449
499
  files?: DataSource[]
450
500
  }
451
501