@mate-academy/llm-gateway 7.3.0 → 7.4.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.
- package/README.md +31 -0
- package/dist/LLMService.constants.d.ts +12 -0
- package/dist/LLMService.typedefs.d.ts +39 -1
- package/dist/LLMService.typedefs.js.map +1 -1
- package/dist/providers/GoogleGenerativeAI/GoogleGenerativeAI.constants.d.ts +12 -0
- package/dist/providers/GoogleGenerativeAI/GoogleGenerativeAI.constants.js +12 -3
- package/dist/providers/GoogleGenerativeAI/GoogleGenerativeAI.constants.js.map +1 -1
- package/dist/providers/GoogleGenerativeAI/services/GoogleGenerativeAIAssistance.service.d.ts +15 -0
- package/dist/providers/GoogleGenerativeAI/services/GoogleGenerativeAIAssistance.service.js +116 -25
- package/dist/providers/GoogleGenerativeAI/services/GoogleGenerativeAIAssistance.service.js.map +1 -1
- package/dist/providers/GoogleGenerativeAI/services/GoogleGenerativeAISpeechToText.service.js +2 -3
- package/dist/providers/GoogleGenerativeAI/services/GoogleGenerativeAISpeechToText.service.js.map +1 -1
- package/dist/providers/LLMAPI/services/LLMAPIAssistance.service.d.ts +7 -0
- package/dist/providers/LLMAPI/services/LLMAPIAssistance.service.js +57 -15
- package/dist/providers/LLMAPI/services/LLMAPIAssistance.service.js.map +1 -1
- package/dist/providers/LLMAPI/services/LLMAPISpeechToText.service.d.ts +11 -4
- package/dist/providers/LLMAPI/services/LLMAPISpeechToText.service.js +15 -63
- package/dist/providers/LLMAPI/services/LLMAPISpeechToText.service.js.map +1 -1
- package/dist/providers/LLMAPI/services/LLMAPITextToSpeech.service.d.ts +14 -4
- package/dist/providers/LLMAPI/services/LLMAPITextToSpeech.service.js +16 -53
- package/dist/providers/LLMAPI/services/LLMAPITextToSpeech.service.js.map +1 -1
- package/dist/providers/OpenAI/services/OpenAIAssistance.service.d.ts +1 -0
- package/dist/providers/OpenAI/services/OpenAIAssistance.service.js +16 -1
- package/dist/providers/OpenAI/services/OpenAIAssistance.service.js.map +1 -1
- package/dist/providers/OpenAI/services/OpenAISpeechToText.service.d.ts +11 -4
- package/dist/providers/OpenAI/services/OpenAISpeechToText.service.js +24 -71
- package/dist/providers/OpenAI/services/OpenAISpeechToText.service.js.map +1 -1
- package/dist/providers/OpenAI/services/OpenAITextToSpeech.service.d.ts +7 -4
- package/dist/providers/OpenAI/services/OpenAITextToSpeech.service.js +15 -61
- package/dist/providers/OpenAI/services/OpenAITextToSpeech.service.js.map +1 -1
- package/dist/providers/OpenAICompatible/OpenAICompatibleSpeechToText.service.d.ts +22 -0
- package/dist/providers/OpenAICompatible/OpenAICompatibleSpeechToText.service.js +79 -0
- package/dist/providers/OpenAICompatible/OpenAICompatibleSpeechToText.service.js.map +1 -0
- package/dist/providers/OpenAICompatible/OpenAICompatibleTextToSpeech.service.d.ts +22 -0
- package/dist/providers/OpenAICompatible/OpenAICompatibleTextToSpeech.service.js +67 -0
- package/dist/providers/OpenAICompatible/OpenAICompatibleTextToSpeech.service.js.map +1 -0
- package/dist/utilities/tools/LLMTool.d.ts +2 -2
- package/dist/utilities/tools/LLMTool.js.map +1 -1
- package/dist/utilities/tools/index.d.ts +1 -0
- package/dist/utilities/tools/index.js +3 -1
- package/dist/utilities/tools/index.js.map +1 -1
- package/dist/utilities/tools/normalizeToolResult.d.ts +15 -0
- package/dist/utilities/tools/normalizeToolResult.js +18 -0
- package/dist/utilities/tools/normalizeToolResult.js.map +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -943,9 +943,40 @@ Interface for chat/assistance services with file handling capabilities.
|
|
|
943
943
|
- `chatId`: The ID of the chat to send the message to
|
|
944
944
|
- `storageId`: Optional storage ID to use for file context
|
|
945
945
|
- `schema`: Optional schema for structured output (supports type-safe JSON responses)
|
|
946
|
+
- `tools`: Optional array of tool definitions (built with `LLMTool.create`) the model may call during the turn
|
|
947
|
+
- `maxToolIterations`: Optional cap on the number of tool-call rounds
|
|
946
948
|
- `reporterContext`: Context data passed to reporter for metrics tracking (required if reporter is configured with a defined context type)
|
|
947
949
|
- `countTokens(messages, model)`: Count tokens in messages for context management
|
|
948
950
|
|
|
951
|
+
#### Tool-returned Images
|
|
952
|
+
|
|
953
|
+
A tool's `execute` may return either a plain `string` (text-only, the legacy
|
|
954
|
+
behavior) or an `LLMStructuredToolResult` to surface images the model can
|
|
955
|
+
actually see:
|
|
956
|
+
|
|
957
|
+
```typescript
|
|
958
|
+
const screenshotTool = LLMTool.create({
|
|
959
|
+
name: 'get_node_screenshot',
|
|
960
|
+
description: 'Renders a screenshot of a design node.',
|
|
961
|
+
parameters: LLMSchema.object({ nodeId: LLMSchema.string() }),
|
|
962
|
+
execute: async ({ nodeId }) => ({
|
|
963
|
+
content: `Rendered a screenshot of node ${nodeId}.`,
|
|
964
|
+
images: [{ url: imageUrl, detail: 'high', label: `Node ${nodeId}` }],
|
|
965
|
+
}),
|
|
966
|
+
});
|
|
967
|
+
```
|
|
968
|
+
|
|
969
|
+
`content` always becomes the tool/function-result message. Each provider
|
|
970
|
+
then surfaces `images` the way its API allows:
|
|
971
|
+
|
|
972
|
+
- **OpenAI** (Responses API) and **Gemini 3** (`multimodalToolResults`
|
|
973
|
+
capability) embed the images natively in the function-result message.
|
|
974
|
+
- **LLMAPI** (Chat Completions) and **Gemini 2.5** cannot carry images in a
|
|
975
|
+
tool-result message, so the gateway appends the images as a separate user
|
|
976
|
+
message right after the tool results.
|
|
977
|
+
|
|
978
|
+
`LLMToolResultImage.url` accepts an `https` URL or a base64 `data:` URL.
|
|
979
|
+
|
|
949
980
|
### LLMSpeechToTextService
|
|
950
981
|
|
|
951
982
|
Interface for converting speech audio to text.
|
|
@@ -1483,6 +1483,7 @@ export declare const LLM_SERVICE_MODELS: {
|
|
|
1483
1483
|
readonly reasoning: true;
|
|
1484
1484
|
readonly webSearch: true;
|
|
1485
1485
|
readonly stt: true;
|
|
1486
|
+
readonly multimodalToolResults: true;
|
|
1486
1487
|
};
|
|
1487
1488
|
};
|
|
1488
1489
|
readonly "gemini-3.1-flash-lite-preview": {
|
|
@@ -1509,6 +1510,7 @@ export declare const LLM_SERVICE_MODELS: {
|
|
|
1509
1510
|
readonly reasoning: false;
|
|
1510
1511
|
readonly webSearch: false;
|
|
1511
1512
|
readonly stt: true;
|
|
1513
|
+
readonly multimodalToolResults: true;
|
|
1512
1514
|
};
|
|
1513
1515
|
};
|
|
1514
1516
|
readonly "gemini-3.1-pro-preview": {
|
|
@@ -1538,6 +1540,7 @@ export declare const LLM_SERVICE_MODELS: {
|
|
|
1538
1540
|
readonly reasoning: true;
|
|
1539
1541
|
readonly webSearch: true;
|
|
1540
1542
|
readonly stt: true;
|
|
1543
|
+
readonly multimodalToolResults: true;
|
|
1541
1544
|
};
|
|
1542
1545
|
};
|
|
1543
1546
|
}, import("./providers").GoogleGenerativeAIModelNames.GEMINI_2_5_FLASH | import("./providers").GoogleGenerativeAIModelNames.GEMINI_2_5_FLASH_LITE | import("./providers").GoogleGenerativeAIModelNames.GEMINI_2_5_PRO | import("./providers").GoogleGenerativeAIModelNames.GEMINI_3_FLASH_PREVIEW | import("./providers").GoogleGenerativeAIModelNames.GEMINI_3_1_FLASH_LITE_PREVIEW | import("./providers").GoogleGenerativeAIModelNames.GEMINI_3_1_PRO_PREVIEW>;
|
|
@@ -1695,6 +1698,7 @@ export declare const LLM_SERVICE_MODELS: {
|
|
|
1695
1698
|
readonly reasoning: true;
|
|
1696
1699
|
readonly webSearch: true;
|
|
1697
1700
|
readonly stt: true;
|
|
1701
|
+
readonly multimodalToolResults: true;
|
|
1698
1702
|
};
|
|
1699
1703
|
};
|
|
1700
1704
|
readonly "gemini-3.1-flash-lite-preview": {
|
|
@@ -1721,6 +1725,7 @@ export declare const LLM_SERVICE_MODELS: {
|
|
|
1721
1725
|
readonly reasoning: false;
|
|
1722
1726
|
readonly webSearch: false;
|
|
1723
1727
|
readonly stt: true;
|
|
1728
|
+
readonly multimodalToolResults: true;
|
|
1724
1729
|
};
|
|
1725
1730
|
};
|
|
1726
1731
|
readonly "gemini-3.1-pro-preview": {
|
|
@@ -1750,6 +1755,7 @@ export declare const LLM_SERVICE_MODELS: {
|
|
|
1750
1755
|
readonly reasoning: true;
|
|
1751
1756
|
readonly webSearch: true;
|
|
1752
1757
|
readonly stt: true;
|
|
1758
|
+
readonly multimodalToolResults: true;
|
|
1753
1759
|
};
|
|
1754
1760
|
};
|
|
1755
1761
|
}, import("./providers").GoogleGenerativeAIModelNames.GEMINI_2_5_FLASH | import("./providers").GoogleGenerativeAIModelNames.GEMINI_2_5_FLASH_LITE | import("./providers").GoogleGenerativeAIModelNames.GEMINI_2_5_PRO | import("./providers").GoogleGenerativeAIModelNames.GEMINI_3_FLASH_PREVIEW | import("./providers").GoogleGenerativeAIModelNames.GEMINI_3_1_FLASH_LITE_PREVIEW | import("./providers").GoogleGenerativeAIModelNames.GEMINI_3_1_PRO_PREVIEW>;
|
|
@@ -1907,6 +1913,7 @@ export declare const LLM_SERVICE_MODELS: {
|
|
|
1907
1913
|
readonly reasoning: true;
|
|
1908
1914
|
readonly webSearch: true;
|
|
1909
1915
|
readonly stt: true;
|
|
1916
|
+
readonly multimodalToolResults: true;
|
|
1910
1917
|
};
|
|
1911
1918
|
};
|
|
1912
1919
|
readonly "gemini-3.1-flash-lite-preview": {
|
|
@@ -1933,6 +1940,7 @@ export declare const LLM_SERVICE_MODELS: {
|
|
|
1933
1940
|
readonly reasoning: false;
|
|
1934
1941
|
readonly webSearch: false;
|
|
1935
1942
|
readonly stt: true;
|
|
1943
|
+
readonly multimodalToolResults: true;
|
|
1936
1944
|
};
|
|
1937
1945
|
};
|
|
1938
1946
|
readonly "gemini-3.1-pro-preview": {
|
|
@@ -1962,6 +1970,7 @@ export declare const LLM_SERVICE_MODELS: {
|
|
|
1962
1970
|
readonly reasoning: true;
|
|
1963
1971
|
readonly webSearch: true;
|
|
1964
1972
|
readonly stt: true;
|
|
1973
|
+
readonly multimodalToolResults: true;
|
|
1965
1974
|
};
|
|
1966
1975
|
};
|
|
1967
1976
|
}, import("./providers").GoogleGenerativeAIModelNames.GEMINI_2_5_FLASH | import("./providers").GoogleGenerativeAIModelNames.GEMINI_2_5_FLASH_LITE | import("./providers").GoogleGenerativeAIModelNames.GEMINI_2_5_PRO | import("./providers").GoogleGenerativeAIModelNames.GEMINI_3_FLASH_PREVIEW | import("./providers").GoogleGenerativeAIModelNames.GEMINI_3_1_FLASH_LITE_PREVIEW | import("./providers").GoogleGenerativeAIModelNames.GEMINI_3_1_PRO_PREVIEW>;
|
|
@@ -2119,6 +2128,7 @@ export declare const LLM_SERVICE_MODELS: {
|
|
|
2119
2128
|
readonly reasoning: true;
|
|
2120
2129
|
readonly webSearch: true;
|
|
2121
2130
|
readonly stt: true;
|
|
2131
|
+
readonly multimodalToolResults: true;
|
|
2122
2132
|
};
|
|
2123
2133
|
};
|
|
2124
2134
|
readonly "gemini-3.1-flash-lite-preview": {
|
|
@@ -2145,6 +2155,7 @@ export declare const LLM_SERVICE_MODELS: {
|
|
|
2145
2155
|
readonly reasoning: false;
|
|
2146
2156
|
readonly webSearch: false;
|
|
2147
2157
|
readonly stt: true;
|
|
2158
|
+
readonly multimodalToolResults: true;
|
|
2148
2159
|
};
|
|
2149
2160
|
};
|
|
2150
2161
|
readonly "gemini-3.1-pro-preview": {
|
|
@@ -2174,6 +2185,7 @@ export declare const LLM_SERVICE_MODELS: {
|
|
|
2174
2185
|
readonly reasoning: true;
|
|
2175
2186
|
readonly webSearch: true;
|
|
2176
2187
|
readonly stt: true;
|
|
2188
|
+
readonly multimodalToolResults: true;
|
|
2177
2189
|
};
|
|
2178
2190
|
};
|
|
2179
2191
|
}, import("./providers").GoogleGenerativeAIModelNames.GEMINI_2_5_FLASH_PREVIEW_TTS | import("./providers").GoogleGenerativeAIModelNames.GEMINI_2_5_PRO_PREVIEW_TTS>;
|
|
@@ -79,6 +79,12 @@ export interface LLMModelCapabilities {
|
|
|
79
79
|
structuredOutputs?: boolean;
|
|
80
80
|
tts?: boolean;
|
|
81
81
|
stt?: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Whether the model's tool/function-result message can natively carry
|
|
84
|
+
* images. When absent or false, providers surface tool-returned images
|
|
85
|
+
* through a separate user message instead.
|
|
86
|
+
*/
|
|
87
|
+
multimodalToolResults?: boolean;
|
|
82
88
|
}
|
|
83
89
|
/**
|
|
84
90
|
* Configuration parameters that control LLM generation behavior.
|
|
@@ -394,11 +400,43 @@ export type LLMAssistInNewChatOptions<Provider extends LLMProviders, Reporter ex
|
|
|
394
400
|
tools?: LLMToolDefinition[];
|
|
395
401
|
maxToolIterations?: number;
|
|
396
402
|
};
|
|
403
|
+
/**
|
|
404
|
+
* An image returned by a tool's `execute` for the model to see.
|
|
405
|
+
*/
|
|
406
|
+
export interface LLMToolResultImage {
|
|
407
|
+
/** Image location. An https URL, or a data URL for inline bytes. */
|
|
408
|
+
url: string;
|
|
409
|
+
/** Vision detail hint passed to providers that accept it. */
|
|
410
|
+
detail?: 'auto' | 'low' | 'high';
|
|
411
|
+
/**
|
|
412
|
+
* MIME type of the image. Defaults to `image/png`. Used by providers that
|
|
413
|
+
* require raw bytes (Gemini) when fetching and re-encoding the image.
|
|
414
|
+
*/
|
|
415
|
+
mimeType?: string;
|
|
416
|
+
/** Optional caption rendered next to the image for the model. */
|
|
417
|
+
label?: string;
|
|
418
|
+
}
|
|
419
|
+
/**
|
|
420
|
+
* Structured result a tool's `execute` may return when it needs to surface
|
|
421
|
+
* images alongside text. The `content` string always becomes the
|
|
422
|
+
* tool/function-result message; `images` are surfaced to the model the way
|
|
423
|
+
* each provider's API allows.
|
|
424
|
+
*/
|
|
425
|
+
export interface LLMStructuredToolResult {
|
|
426
|
+
content: string;
|
|
427
|
+
images?: LLMToolResultImage[];
|
|
428
|
+
}
|
|
429
|
+
/**
|
|
430
|
+
* What a tool's `execute` may return. A plain `string` keeps the legacy
|
|
431
|
+
* text-only behaviour; an `LLMStructuredToolResult` additionally carries
|
|
432
|
+
* images.
|
|
433
|
+
*/
|
|
434
|
+
export type LLMToolResult = string | LLMStructuredToolResult;
|
|
397
435
|
export interface LLMToolDefinition<Schema extends LLMSchemaInterface = LLMSchemaInterface> {
|
|
398
436
|
name: string;
|
|
399
437
|
description: string;
|
|
400
438
|
parameters: Schema;
|
|
401
|
-
execute: (args: InferSchema<Schema>) => Promise<
|
|
439
|
+
execute: (args: InferSchema<Schema>) => Promise<LLMToolResult> | LLMToolResult;
|
|
402
440
|
}
|
|
403
441
|
/**
|
|
404
442
|
* Function type for counting tokens in messages for a specific provider's model.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LLMService.typedefs.js","sourceRoot":"","sources":["../src/LLMService.typedefs.ts"],"names":[],"mappings":";;;AAkCA;;GAEG;AACH,IAAY,YAIX;AAJD,WAAY,YAAY;IACtB,iCAAiB,CAAA;IACjB,yDAAyC,CAAA;IACzC,iCAAiB,CAAA;AACnB,CAAC,EAJW,YAAY,4BAAZ,YAAY,QAIvB;AAoBD;;GAEG;AACH,IAAY,WAKX;AALD,WAAY,WAAW;IACrB,wCAAyB,CAAA;IACzB,wCAAyB,CAAA;IACzB,8CAA+B,CAAA;IAC/B,8CAA+B,CAAA;AACjC,CAAC,EALW,WAAW,2BAAX,WAAW,QAKtB;
|
|
1
|
+
{"version":3,"file":"LLMService.typedefs.js","sourceRoot":"","sources":["../src/LLMService.typedefs.ts"],"names":[],"mappings":";;;AAkCA;;GAEG;AACH,IAAY,YAIX;AAJD,WAAY,YAAY;IACtB,iCAAiB,CAAA;IACjB,yDAAyC,CAAA;IACzC,iCAAiB,CAAA;AACnB,CAAC,EAJW,YAAY,4BAAZ,YAAY,QAIvB;AAoBD;;GAEG;AACH,IAAY,WAKX;AALD,WAAY,WAAW;IACrB,wCAAyB,CAAA;IACzB,wCAAyB,CAAA;IACzB,8CAA+B,CAAA;IAC/B,8CAA+B,CAAA;AACjC,CAAC,EALW,WAAW,2BAAX,WAAW,QAKtB;AAiLD;;GAEG;AACH,IAAY,QAGX;AAHD,WAAY,QAAQ;IAClB,yBAAa,CAAA;IACb,mCAAuB,CAAA;AACzB,CAAC,EAHW,QAAQ,wBAAR,QAAQ,QAGnB;AAED;;GAEG;AACH,IAAY,qBAIX;AAJD,WAAY,qBAAqB;IAC/B,sCAAa,CAAA;IACb,gDAAuB,CAAA;IACvB,kDAAyB,CAAA;AAC3B,CAAC,EAJW,qBAAqB,qCAArB,qBAAqB,QAIhC;AA4HD;;GAEG;AACH,IAAY,sBAeX;AAfD,WAAY,sBAAsB;IAChC,iDAAuB,CAAA;IACvB,mDAAyB,CAAA;IACzB,iDAAuB,CAAA;IACvB,iDAAuB,CAAA;IACvB,mDAAyB,CAAA;IACzB,yDAA+B,CAAA;IAC/B,iDAAuB,CAAA;IACvB,mDAAyB,CAAA;IACzB,oDAA0B,CAAA;IAC1B,iDAAuB,CAAA;IACvB,mDAAyB,CAAA;IACzB,iDAAuB,CAAA;IACvB,mDAAyB,CAAA;IACzB,iDAAuB,CAAA;AACzB,CAAC,EAfW,sBAAsB,sCAAtB,sBAAsB,QAejC"}
|
|
@@ -158,6 +158,7 @@ export declare const GOOGLE_AI_MODELS: {
|
|
|
158
158
|
readonly reasoning: true;
|
|
159
159
|
readonly webSearch: true;
|
|
160
160
|
readonly stt: true;
|
|
161
|
+
readonly multimodalToolResults: true;
|
|
161
162
|
};
|
|
162
163
|
};
|
|
163
164
|
readonly "gemini-3.1-flash-lite-preview": {
|
|
@@ -184,6 +185,7 @@ export declare const GOOGLE_AI_MODELS: {
|
|
|
184
185
|
readonly reasoning: false;
|
|
185
186
|
readonly webSearch: false;
|
|
186
187
|
readonly stt: true;
|
|
188
|
+
readonly multimodalToolResults: true;
|
|
187
189
|
};
|
|
188
190
|
};
|
|
189
191
|
readonly "gemini-3.1-pro-preview": {
|
|
@@ -213,6 +215,7 @@ export declare const GOOGLE_AI_MODELS: {
|
|
|
213
215
|
readonly reasoning: true;
|
|
214
216
|
readonly webSearch: true;
|
|
215
217
|
readonly stt: true;
|
|
218
|
+
readonly multimodalToolResults: true;
|
|
216
219
|
};
|
|
217
220
|
};
|
|
218
221
|
}, GoogleGenerativeAIModelNames.GEMINI_2_5_FLASH | GoogleGenerativeAIModelNames.GEMINI_2_5_FLASH_LITE | GoogleGenerativeAIModelNames.GEMINI_2_5_PRO | GoogleGenerativeAIModelNames.GEMINI_3_FLASH_PREVIEW | GoogleGenerativeAIModelNames.GEMINI_3_1_FLASH_LITE_PREVIEW | GoogleGenerativeAIModelNames.GEMINI_3_1_PRO_PREVIEW>;
|
|
@@ -370,6 +373,7 @@ export declare const GOOGLE_AI_MODELS: {
|
|
|
370
373
|
readonly reasoning: true;
|
|
371
374
|
readonly webSearch: true;
|
|
372
375
|
readonly stt: true;
|
|
376
|
+
readonly multimodalToolResults: true;
|
|
373
377
|
};
|
|
374
378
|
};
|
|
375
379
|
readonly "gemini-3.1-flash-lite-preview": {
|
|
@@ -396,6 +400,7 @@ export declare const GOOGLE_AI_MODELS: {
|
|
|
396
400
|
readonly reasoning: false;
|
|
397
401
|
readonly webSearch: false;
|
|
398
402
|
readonly stt: true;
|
|
403
|
+
readonly multimodalToolResults: true;
|
|
399
404
|
};
|
|
400
405
|
};
|
|
401
406
|
readonly "gemini-3.1-pro-preview": {
|
|
@@ -425,6 +430,7 @@ export declare const GOOGLE_AI_MODELS: {
|
|
|
425
430
|
readonly reasoning: true;
|
|
426
431
|
readonly webSearch: true;
|
|
427
432
|
readonly stt: true;
|
|
433
|
+
readonly multimodalToolResults: true;
|
|
428
434
|
};
|
|
429
435
|
};
|
|
430
436
|
}, GoogleGenerativeAIModelNames.GEMINI_2_5_FLASH | GoogleGenerativeAIModelNames.GEMINI_2_5_FLASH_LITE | GoogleGenerativeAIModelNames.GEMINI_2_5_PRO | GoogleGenerativeAIModelNames.GEMINI_3_FLASH_PREVIEW | GoogleGenerativeAIModelNames.GEMINI_3_1_FLASH_LITE_PREVIEW | GoogleGenerativeAIModelNames.GEMINI_3_1_PRO_PREVIEW>;
|
|
@@ -582,6 +588,7 @@ export declare const GOOGLE_AI_MODELS: {
|
|
|
582
588
|
readonly reasoning: true;
|
|
583
589
|
readonly webSearch: true;
|
|
584
590
|
readonly stt: true;
|
|
591
|
+
readonly multimodalToolResults: true;
|
|
585
592
|
};
|
|
586
593
|
};
|
|
587
594
|
readonly "gemini-3.1-flash-lite-preview": {
|
|
@@ -608,6 +615,7 @@ export declare const GOOGLE_AI_MODELS: {
|
|
|
608
615
|
readonly reasoning: false;
|
|
609
616
|
readonly webSearch: false;
|
|
610
617
|
readonly stt: true;
|
|
618
|
+
readonly multimodalToolResults: true;
|
|
611
619
|
};
|
|
612
620
|
};
|
|
613
621
|
readonly "gemini-3.1-pro-preview": {
|
|
@@ -637,6 +645,7 @@ export declare const GOOGLE_AI_MODELS: {
|
|
|
637
645
|
readonly reasoning: true;
|
|
638
646
|
readonly webSearch: true;
|
|
639
647
|
readonly stt: true;
|
|
648
|
+
readonly multimodalToolResults: true;
|
|
640
649
|
};
|
|
641
650
|
};
|
|
642
651
|
}, GoogleGenerativeAIModelNames.GEMINI_2_5_FLASH | GoogleGenerativeAIModelNames.GEMINI_2_5_FLASH_LITE | GoogleGenerativeAIModelNames.GEMINI_2_5_PRO | GoogleGenerativeAIModelNames.GEMINI_3_FLASH_PREVIEW | GoogleGenerativeAIModelNames.GEMINI_3_1_FLASH_LITE_PREVIEW | GoogleGenerativeAIModelNames.GEMINI_3_1_PRO_PREVIEW>;
|
|
@@ -794,6 +803,7 @@ export declare const GOOGLE_AI_MODELS: {
|
|
|
794
803
|
readonly reasoning: true;
|
|
795
804
|
readonly webSearch: true;
|
|
796
805
|
readonly stt: true;
|
|
806
|
+
readonly multimodalToolResults: true;
|
|
797
807
|
};
|
|
798
808
|
};
|
|
799
809
|
readonly "gemini-3.1-flash-lite-preview": {
|
|
@@ -820,6 +830,7 @@ export declare const GOOGLE_AI_MODELS: {
|
|
|
820
830
|
readonly reasoning: false;
|
|
821
831
|
readonly webSearch: false;
|
|
822
832
|
readonly stt: true;
|
|
833
|
+
readonly multimodalToolResults: true;
|
|
823
834
|
};
|
|
824
835
|
};
|
|
825
836
|
readonly "gemini-3.1-pro-preview": {
|
|
@@ -849,6 +860,7 @@ export declare const GOOGLE_AI_MODELS: {
|
|
|
849
860
|
readonly reasoning: true;
|
|
850
861
|
readonly webSearch: true;
|
|
851
862
|
readonly stt: true;
|
|
863
|
+
readonly multimodalToolResults: true;
|
|
852
864
|
};
|
|
853
865
|
};
|
|
854
866
|
}, GoogleGenerativeAIModelNames.GEMINI_2_5_FLASH_PREVIEW_TTS | GoogleGenerativeAIModelNames.GEMINI_2_5_PRO_PREVIEW_TTS>;
|
|
@@ -150,7 +150,10 @@ const GOOGLE_AI_AVAILABLE_MODELS = {
|
|
|
150
150
|
getPriceForAudioOutput: () => 0,
|
|
151
151
|
currency: 'USD',
|
|
152
152
|
},
|
|
153
|
-
capabilities: {
|
|
153
|
+
capabilities: {
|
|
154
|
+
vision: true, tools: true, reasoning: true, webSearch: true,
|
|
155
|
+
stt: true, multimodalToolResults: true,
|
|
156
|
+
},
|
|
154
157
|
},
|
|
155
158
|
[GoogleGenerativeAI_typedefs_1.GoogleGenerativeAIModelNames.GEMINI_3_1_FLASH_LITE_PREVIEW]: {
|
|
156
159
|
name: GoogleGenerativeAI_typedefs_1.GoogleGenerativeAIModelNames.GEMINI_3_1_FLASH_LITE_PREVIEW,
|
|
@@ -170,7 +173,10 @@ const GOOGLE_AI_AVAILABLE_MODELS = {
|
|
|
170
173
|
getPriceForAudioOutput: () => 0,
|
|
171
174
|
currency: 'USD',
|
|
172
175
|
},
|
|
173
|
-
capabilities: {
|
|
176
|
+
capabilities: {
|
|
177
|
+
vision: true, tools: true, reasoning: false, webSearch: false,
|
|
178
|
+
stt: true, multimodalToolResults: true,
|
|
179
|
+
},
|
|
174
180
|
},
|
|
175
181
|
[GoogleGenerativeAI_typedefs_1.GoogleGenerativeAIModelNames.GEMINI_3_1_PRO_PREVIEW]: {
|
|
176
182
|
name: GoogleGenerativeAI_typedefs_1.GoogleGenerativeAIModelNames.GEMINI_3_1_PRO_PREVIEW,
|
|
@@ -218,7 +224,10 @@ const GOOGLE_AI_AVAILABLE_MODELS = {
|
|
|
218
224
|
getPriceForAudioOutput: () => 0,
|
|
219
225
|
currency: 'USD',
|
|
220
226
|
},
|
|
221
|
-
capabilities: {
|
|
227
|
+
capabilities: {
|
|
228
|
+
vision: true, tools: true, reasoning: true, webSearch: true,
|
|
229
|
+
stt: true, multimodalToolResults: true,
|
|
230
|
+
},
|
|
222
231
|
},
|
|
223
232
|
};
|
|
224
233
|
exports.GOOGLE_AI_MODELS = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GoogleGenerativeAI.constants.js","sourceRoot":"","sources":["../../../src/providers/GoogleGenerativeAI/GoogleGenerativeAI.constants.ts"],"names":[],"mappings":";;;AAAA,+DAM+B;AAE/B,+EAA6E;AAC7E,yCAA8C;AAC9C,sEAKiD;AACjD,mEAAoD;AAEvC,QAAA,wBAAwB,GAAG,MAAM,CAAC;AAE/C,MAAM,0BAA0B,GAAG;IACjC,CAAC,0DAA4B,CAAC,gBAAgB,CAAC,EAAE;QAC/C,IAAI,EAAE,0DAA4B,CAAC,gBAAgB;QACnD,MAAM,EAAE;YACN,cAAc,EAAE,SAAS;YACzB,eAAe,EAAE,MAAM;SACxB;QACD,MAAM,EAAE;YACN,WAAW,EAAE,GAAG;SACjB;QACD,OAAO,EAAE;YACP,oBAAoB,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,GAAG,GAAG,MAAM,GAAG,SAAS;YAC1D,qBAAqB,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,GAAG,GAAG,MAAM,GAAG,SAAS;YAC3D,0BAA0B,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,GAAG,MAAM,GAAG,SAAS;YACjE,qBAAqB,EAAE,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC,GAAG,YAAY,GAAG,SAAS;YACrE,2BAA2B,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,EAAE,CAAC,EAAE,GAAG,YAAY,GAAG,SAAS;YACvE,QAAQ,EAAE,KAAK;SAChB;QACD,YAAY,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE;KAC7F;IACD,CAAC,0DAA4B,CAAC,sBAAsB,CAAC,EAAE;QACrD,IAAI,EAAE,0DAA4B,CAAC,sBAAsB;QACzD,MAAM,EAAE;YACN,cAAc,EAAE,SAAS;YACzB,eAAe,EAAE,MAAM;SACxB;QACD,MAAM,EAAE;YACN,WAAW,EAAE,CAAC;YACd,cAAc,EAAE;gBACd,aAAa,EAAE,qBAAa,CAAC,GAAG;aACjC;SACF;QACD,OAAO,EAAE;YACP,oBAAoB,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,GAAG,GAAG,MAAM,GAAG,SAAS;YAC1D,qBAAqB,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,GAAG,MAAM,GAAG,SAAS;YACzD,0BAA0B,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,GAAG,MAAM,GAAG,SAAS;YACjE,qBAAqB,EAAE,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC,GAAG,YAAY,GAAG,SAAS;YACrE,2BAA2B,EAAE,CAAC,YAAY,EAAE,EAAE,CAAC,GAAG,GAAG,YAAY,GAAG,SAAS;YAC7E,sBAAsB,EAAE,GAAG,EAAE,CAAC,CAAC;YAC/B,QAAQ,EAAE,KAAK;SAChB;QACD,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"GoogleGenerativeAI.constants.js","sourceRoot":"","sources":["../../../src/providers/GoogleGenerativeAI/GoogleGenerativeAI.constants.ts"],"names":[],"mappings":";;;AAAA,+DAM+B;AAE/B,+EAA6E;AAC7E,yCAA8C;AAC9C,sEAKiD;AACjD,mEAAoD;AAEvC,QAAA,wBAAwB,GAAG,MA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0DAA4B,CAAC,sBAAsB;QACnD,0DAA4B,CAAC,6BAA6B;QAC1D,0DAA4B,CAAC,sBAAsB;KACpD,CACF;IACD,CAAC,iCAAW,CAAC,YAAY,CAAC,EAAE,IAAA,uBAAI,EAC9B,0BAA0B,EAC1B;QACE,0DAA4B,CAAC,4BAA4B;QACzD,0DAA4B,CAAC,0BAA0B;KACxD,CACF;CAIF,CAAC;AAEW,QAAA,0BAA0B,GAAG;IACxC,CAAC,iCAAW,CAAC,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,CAAC,CACvD,IAAI,8CAAmC,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAC,CACnE;IACD,CAAC,iCAAW,CAAC,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,CAAC,CACvD,IAAI,8CAAmC,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAC,CACnE;IACD,CAAC,iCAAW,CAAC,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,CAAC,CACzD,IAAI,gDAAqC,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAC,CACrE;IACD,CAAC,iCAAW,CAAC,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,CAAC,CACzD,IAAI,gDAAqC,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAC,CACrE;CASF,CAAC"}
|
package/dist/providers/GoogleGenerativeAI/services/GoogleGenerativeAIAssistance.service.d.ts
CHANGED
|
@@ -31,5 +31,20 @@ export declare class GoogleGenerativeAIAssistanceService<Reporter extends LLMRep
|
|
|
31
31
|
private convertCustomToolsToGoogle;
|
|
32
32
|
private executeGoogleToolLoop;
|
|
33
33
|
private executeGoogleFunctionCalls;
|
|
34
|
+
private executeSingleGoogleFunctionCall;
|
|
35
|
+
/**
|
|
36
|
+
* Gemini 3 models accept image bytes inside `functionResponse.parts`. Each
|
|
37
|
+
* image blob carries a unique `displayName` the `response` payload then
|
|
38
|
+
* references via `{ $ref: displayName }`.
|
|
39
|
+
*/
|
|
40
|
+
private buildNativeFunctionResponsePart;
|
|
41
|
+
/**
|
|
42
|
+
* Gemini 2.5 models cannot carry images in a function response, so image
|
|
43
|
+
* bytes are appended as sibling user-content parts after every function
|
|
44
|
+
* response in the same message.
|
|
45
|
+
*/
|
|
46
|
+
private buildAppendedFunctionResponseParts;
|
|
47
|
+
private buildInlineImageParts;
|
|
48
|
+
private fetchToolImageBlob;
|
|
34
49
|
countTokens(messages: LLMAssistanceMessage[], model: LLMModel<LLMProviders.GoogleGenerativeAI>): Promise<number>;
|
|
35
50
|
}
|
|
@@ -5,6 +5,7 @@ const uuid_1 = require("uuid");
|
|
|
5
5
|
const genai_1 = require("@google/genai");
|
|
6
6
|
const LLMService_typedefs_1 = require("../../../LLMService.typedefs");
|
|
7
7
|
const serializeError_1 = require("../../../utilities/serializeError");
|
|
8
|
+
const tools_1 = require("../../../utilities/tools");
|
|
8
9
|
const services_1 = require("../../../services");
|
|
9
10
|
const GoogleGenerativeAI_typedefs_1 = require("../../../providers/GoogleGenerativeAI/GoogleGenerativeAI.typedefs");
|
|
10
11
|
const GoogleGenerativeAI_entity_1 = require("../../../providers/GoogleGenerativeAI/GoogleGenerativeAI.entity");
|
|
@@ -289,6 +290,7 @@ class GoogleGenerativeAIAssistanceService extends services_1.LLMAssistanceServic
|
|
|
289
290
|
?? LLMService_constants_1.DEFAULT_MAX_TOOL_ITERATIONS,
|
|
290
291
|
abortSignal,
|
|
291
292
|
config: sendMessageConfig,
|
|
293
|
+
multimodalToolResults: model.capabilities?.multimodalToolResults === true,
|
|
292
294
|
});
|
|
293
295
|
const responseText = toolLoopResult.response.text ?? '';
|
|
294
296
|
const { totalUsage } = toolLoopResult;
|
|
@@ -354,6 +356,7 @@ class GoogleGenerativeAIAssistanceService extends services_1.LLMAssistanceServic
|
|
|
354
356
|
?? LLMService_constants_1.DEFAULT_MAX_TOOL_ITERATIONS,
|
|
355
357
|
abortSignal,
|
|
356
358
|
config: sendMessageConfig,
|
|
359
|
+
multimodalToolResults: model.capabilities?.multimodalToolResults === true,
|
|
357
360
|
});
|
|
358
361
|
let finalResponseText;
|
|
359
362
|
let totalUsage = toolLoopResult.totalUsage;
|
|
@@ -517,7 +520,7 @@ class GoogleGenerativeAIAssistanceService extends services_1.LLMAssistanceServic
|
|
|
517
520
|
return [{ functionDeclarations }];
|
|
518
521
|
}
|
|
519
522
|
async executeGoogleToolLoop(params) {
|
|
520
|
-
const { chatSession, tools, maxIterations, abortSignal, config, } = params;
|
|
523
|
+
const { chatSession, tools, maxIterations, abortSignal, config, multimodalToolResults, } = params;
|
|
521
524
|
let currentResponse = params.response;
|
|
522
525
|
const totalUsage = this.extractUsageFromResponse(currentResponse);
|
|
523
526
|
for (let iteration = 0; iteration < maxIterations; iteration++) {
|
|
@@ -531,7 +534,7 @@ class GoogleGenerativeAIAssistanceService extends services_1.LLMAssistanceServic
|
|
|
531
534
|
name: part.functionCall?.name ?? '',
|
|
532
535
|
args: (part.functionCall?.args ?? {}),
|
|
533
536
|
}));
|
|
534
|
-
const functionResponseParts = await this.executeGoogleFunctionCalls(calls, tools);
|
|
537
|
+
const functionResponseParts = await this.executeGoogleFunctionCalls(calls, tools, multimodalToolResults);
|
|
535
538
|
abortSignal?.throwIfAborted();
|
|
536
539
|
currentResponse =
|
|
537
540
|
await chatSession.sendMessage({
|
|
@@ -551,33 +554,121 @@ class GoogleGenerativeAIAssistanceService extends services_1.LLMAssistanceServic
|
|
|
551
554
|
totalUsage,
|
|
552
555
|
};
|
|
553
556
|
}
|
|
554
|
-
async executeGoogleFunctionCalls(calls, tools) {
|
|
555
|
-
const
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
557
|
+
async executeGoogleFunctionCalls(calls, tools, multimodalToolResults) {
|
|
558
|
+
const executedCalls = await Promise.all(calls.map((call) => this.executeSingleGoogleFunctionCall(call, tools)));
|
|
559
|
+
if (multimodalToolResults) {
|
|
560
|
+
return Promise.all(executedCalls.map((executedCall) => this.buildNativeFunctionResponsePart(executedCall)));
|
|
561
|
+
}
|
|
562
|
+
return this.buildAppendedFunctionResponseParts(executedCalls);
|
|
563
|
+
}
|
|
564
|
+
async executeSingleGoogleFunctionCall(call, tools) {
|
|
565
|
+
const matchingTool = tools.find((tool) => tool.name === call.name);
|
|
566
|
+
if (!matchingTool) {
|
|
567
|
+
return {
|
|
568
|
+
name: call.name,
|
|
569
|
+
result: {
|
|
570
|
+
content: `Error: Unknown tool "${call.name}"`,
|
|
571
|
+
images: [],
|
|
572
|
+
},
|
|
573
|
+
};
|
|
574
|
+
}
|
|
575
|
+
try {
|
|
576
|
+
const rawResult = await matchingTool.execute(call.args);
|
|
577
|
+
return {
|
|
578
|
+
name: call.name,
|
|
579
|
+
result: (0, tools_1.normalizeToolResult)(rawResult),
|
|
580
|
+
};
|
|
581
|
+
}
|
|
582
|
+
catch (executionError) {
|
|
583
|
+
const message = executionError instanceof Error
|
|
584
|
+
? executionError.message
|
|
585
|
+
: String(executionError);
|
|
586
|
+
return {
|
|
587
|
+
name: call.name,
|
|
588
|
+
result: {
|
|
589
|
+
content: `Error: ${message}`,
|
|
590
|
+
images: [],
|
|
591
|
+
},
|
|
592
|
+
};
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
/**
|
|
596
|
+
* Gemini 3 models accept image bytes inside `functionResponse.parts`. Each
|
|
597
|
+
* image blob carries a unique `displayName` the `response` payload then
|
|
598
|
+
* references via `{ $ref: displayName }`.
|
|
599
|
+
*/
|
|
600
|
+
async buildNativeFunctionResponsePart(executedCall) {
|
|
601
|
+
const { name, result } = executedCall;
|
|
602
|
+
if (result.images.length === 0) {
|
|
603
|
+
return {
|
|
573
604
|
functionResponse: {
|
|
574
|
-
name
|
|
575
|
-
response: { result },
|
|
605
|
+
name,
|
|
606
|
+
response: { result: result.content },
|
|
576
607
|
},
|
|
577
608
|
};
|
|
578
|
-
|
|
609
|
+
}
|
|
610
|
+
const imageBlobs = await Promise.all(result.images.map((image, index) => this.fetchToolImageBlob(image, `${name}_image_${index + 1}`)));
|
|
611
|
+
return {
|
|
612
|
+
functionResponse: {
|
|
613
|
+
name,
|
|
614
|
+
response: {
|
|
615
|
+
result: result.content,
|
|
616
|
+
images: imageBlobs.map((blob) => ({
|
|
617
|
+
...(blob.label && { label: blob.label }),
|
|
618
|
+
$ref: blob.displayName,
|
|
619
|
+
})),
|
|
620
|
+
},
|
|
621
|
+
parts: imageBlobs.map((blob) => ({
|
|
622
|
+
inlineData: {
|
|
623
|
+
mimeType: blob.mimeType,
|
|
624
|
+
data: blob.data,
|
|
625
|
+
displayName: blob.displayName,
|
|
626
|
+
},
|
|
627
|
+
})),
|
|
628
|
+
},
|
|
629
|
+
};
|
|
630
|
+
}
|
|
631
|
+
/**
|
|
632
|
+
* Gemini 2.5 models cannot carry images in a function response, so image
|
|
633
|
+
* bytes are appended as sibling user-content parts after every function
|
|
634
|
+
* response in the same message.
|
|
635
|
+
*/
|
|
636
|
+
async buildAppendedFunctionResponseParts(executedCalls) {
|
|
637
|
+
const functionResponseParts = executedCalls.map(({ name, result }) => ({
|
|
638
|
+
functionResponse: {
|
|
639
|
+
name,
|
|
640
|
+
response: { result: result.content },
|
|
641
|
+
},
|
|
579
642
|
}));
|
|
580
|
-
|
|
643
|
+
const images = executedCalls.flatMap(({ result }) => result.images);
|
|
644
|
+
const imageParts = await Promise.all(images.map((image) => this.buildInlineImageParts(image)));
|
|
645
|
+
return [
|
|
646
|
+
...functionResponseParts,
|
|
647
|
+
...imageParts.flat(),
|
|
648
|
+
];
|
|
649
|
+
}
|
|
650
|
+
async buildInlineImageParts(image) {
|
|
651
|
+
const blob = await this.fetchToolImageBlob(image);
|
|
652
|
+
const imagePart = {
|
|
653
|
+
inlineData: {
|
|
654
|
+
mimeType: blob.mimeType,
|
|
655
|
+
data: blob.data,
|
|
656
|
+
},
|
|
657
|
+
};
|
|
658
|
+
if (!blob.label) {
|
|
659
|
+
return [imagePart];
|
|
660
|
+
}
|
|
661
|
+
return [{ text: blob.label }, imagePart];
|
|
662
|
+
}
|
|
663
|
+
async fetchToolImageBlob(image, displayName) {
|
|
664
|
+
const response = await fetch(image.url);
|
|
665
|
+
const arrayBuffer = await response.arrayBuffer();
|
|
666
|
+
return {
|
|
667
|
+
mimeType: image.mimeType ?? 'image/png',
|
|
668
|
+
data: Buffer.from(arrayBuffer).toString('base64'),
|
|
669
|
+
displayName,
|
|
670
|
+
label: image.label,
|
|
671
|
+
};
|
|
581
672
|
}
|
|
582
673
|
async countTokens(messages, model) {
|
|
583
674
|
const countTokensFn = GoogleGenerativeAI_entity_1.GoogleGenerativeAIEntity.getCountTokensFn(this.instance);
|