@mate-academy/llm-gateway 8.9.0 → 8.11.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 +64 -3
- package/dist/LLMService.constants.d.ts +178 -268
- package/dist/LLMService.typedefs.d.ts +70 -1
- package/dist/LLMService.typedefs.js +14 -1
- package/dist/LLMService.typedefs.js.map +1 -1
- package/dist/client/agentRun.typedefs.d.ts +7 -3
- package/dist/client/agentRunner.d.ts +2 -2
- package/dist/client/agentRunner.js +1 -1
- package/dist/client/agentRunner.js.map +1 -1
- package/dist/client/llmClient.typedefs.d.ts +14 -1
- package/dist/client/llmClient.typedefs.js.map +1 -1
- package/dist/client/plainMessages.d.ts +10 -2
- package/dist/client/plainMessages.js +25 -0
- package/dist/client/plainMessages.js.map +1 -1
- package/dist/providers/GoogleGenerativeAI/GoogleGenerativeAI.entity.d.ts +11 -1
- package/dist/providers/GoogleGenerativeAI/GoogleGenerativeAI.entity.js +66 -0
- package/dist/providers/GoogleGenerativeAI/GoogleGenerativeAI.entity.js.map +1 -1
- package/dist/providers/GoogleGenerativeAI/services/GoogleGenerativeAIAssistance.service.js +1 -1
- package/dist/providers/GoogleGenerativeAI/services/GoogleGenerativeAIAssistance.service.js.map +1 -1
- package/dist/providers/LLMAPI/LLMAPI.constants.d.ts +464 -336
- package/dist/providers/LLMAPI/LLMAPI.constants.js +121 -152
- package/dist/providers/LLMAPI/LLMAPI.constants.js.map +1 -1
- package/dist/providers/LLMAPI/LLMAPI.entity.d.ts +24 -1
- package/dist/providers/LLMAPI/LLMAPI.entity.js +128 -0
- package/dist/providers/LLMAPI/LLMAPI.entity.js.map +1 -1
- package/dist/providers/LLMAPI/LLMAPI.typedefs.js +1 -1
- package/dist/providers/LLMAPI/LLMAPI.typedefs.js.map +1 -1
- package/dist/providers/LLMAPI/LLMAPI.voices.d.ts +14 -0
- package/dist/providers/LLMAPI/LLMAPI.voices.js +30 -7
- package/dist/providers/LLMAPI/LLMAPI.voices.js.map +1 -1
- package/dist/providers/LLMAPI/services/LLMAPIAssistance.service.d.ts +0 -11
- package/dist/providers/LLMAPI/services/LLMAPIAssistance.service.js +8 -51
- package/dist/providers/LLMAPI/services/LLMAPIAssistance.service.js.map +1 -1
- package/dist/providers/LLMAPI/services/LLMAPISpeechToText.service.d.ts +2 -2
- package/dist/providers/LLMAPI/services/LLMAPISpeechToText.service.js +4 -3
- package/dist/providers/LLMAPI/services/LLMAPISpeechToText.service.js.map +1 -1
- package/dist/providers/LLMAPI/utilities/geminiToolHistory.d.ts +17 -0
- package/dist/providers/LLMAPI/utilities/geminiToolHistory.js +41 -0
- package/dist/providers/LLMAPI/utilities/geminiToolHistory.js.map +1 -0
- package/dist/providers/LLMAPI/utilities/index.d.ts +1 -0
- package/dist/providers/LLMAPI/utilities/index.js +6 -1
- package/dist/providers/LLMAPI/utilities/index.js.map +1 -1
- package/dist/providers/OpenAI/services/OpenAIAssistance.service.d.ts +1 -0
- package/dist/providers/OpenAI/services/OpenAIAssistance.service.js +6 -49
- package/dist/providers/OpenAI/services/OpenAIAssistance.service.js.map +1 -1
- package/dist/providers/OpenAI/services/OpenAISpeechToText.service.d.ts +1 -1
- package/dist/providers/OpenAI/services/OpenAISpeechToText.service.js +1 -1
- package/dist/providers/OpenAI/services/OpenAISpeechToText.service.js.map +1 -1
- package/dist/providers/OpenAI/services/buildResponsesHistoryInput.d.ts +20 -0
- package/dist/providers/OpenAI/services/buildResponsesHistoryInput.js +107 -0
- package/dist/providers/OpenAI/services/buildResponsesHistoryInput.js.map +1 -0
- package/dist/providers/OpenAICompatible/OpenAICompatibleSpeechToText.service.d.ts +1 -1
- package/dist/providers/OpenAICompatible/OpenAICompatibleSpeechToText.service.js +1 -1
- package/dist/providers/OpenAICompatible/OpenAICompatibleSpeechToText.service.js.map +1 -1
- package/dist/utilities/audio.d.ts +1 -0
- package/dist/utilities/audio.js +12 -0
- package/dist/utilities/audio.js.map +1 -0
- package/dist/utilities/history/LLMHistoryEntries.d.ts +34 -0
- package/dist/utilities/history/LLMHistoryEntries.js +113 -0
- package/dist/utilities/history/LLMHistoryEntries.js.map +1 -0
- package/dist/utilities/history/history.constants.d.ts +7 -0
- package/dist/utilities/history/history.constants.js +12 -0
- package/dist/utilities/history/history.constants.js.map +1 -0
- package/dist/utilities/history/index.d.ts +2 -0
- package/dist/utilities/history/index.js +19 -0
- package/dist/utilities/history/index.js.map +1 -0
- package/dist/utilities/index.d.ts +1 -0
- package/dist/utilities/index.js +1 -0
- package/dist/utilities/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -338,6 +338,60 @@ if (turn.stopReason === LLMToolLoopStopReasons.TerminalTool) {
|
|
|
338
338
|
events — so parallel tool calls and repeated delegations reconstruct into an
|
|
339
339
|
unambiguous run tree. Listeners may be async; a throw or rejection is logged
|
|
340
340
|
and never affects the run.
|
|
341
|
+
- **Full-fidelity history.** `history` restores the conversation as it happened,
|
|
342
|
+
not a prose retelling of it. An entry is a plain message
|
|
343
|
+
(`{ role, text }`), a past tool round
|
|
344
|
+
(`{ type: LLMHistoryEntryTypes.ToolCall, calls, text? }`), the result that
|
|
345
|
+
answered one of its calls
|
|
346
|
+
(`{ type: LLMHistoryEntryTypes.ToolResult, toolCallId, result }`), or
|
|
347
|
+
mid-conversation context (`{ type: LLMHistoryEntryTypes.Context, text }`).
|
|
348
|
+
Each maps to the provider's own representation, so a resumed run reads its
|
|
349
|
+
own past calls as calls. The union is additive — an existing
|
|
350
|
+
`LLMPlainMessage[]` is already a valid history and maps exactly as before.
|
|
351
|
+
|
|
352
|
+
```typescript
|
|
353
|
+
await llm.runAgent(agent, {
|
|
354
|
+
variables,
|
|
355
|
+
input: userMessage,
|
|
356
|
+
history: [
|
|
357
|
+
{ role: 'user', text: 'Rewrite the flaky-selectors theory' },
|
|
358
|
+
{ type: LLMHistoryEntryTypes.Context, text: carriedPlan },
|
|
359
|
+
{
|
|
360
|
+
type: LLMHistoryEntryTypes.ToolCall,
|
|
361
|
+
text: 'Looking it up.',
|
|
362
|
+
calls: [{
|
|
363
|
+
id: 'call-1',
|
|
364
|
+
name: 'find_content',
|
|
365
|
+
arguments: { query: 'flaky selectors' },
|
|
366
|
+
}],
|
|
367
|
+
},
|
|
368
|
+
{
|
|
369
|
+
type: LLMHistoryEntryTypes.ToolResult,
|
|
370
|
+
toolCallId: 'call-1',
|
|
371
|
+
result: 'theory-1',
|
|
372
|
+
},
|
|
373
|
+
],
|
|
374
|
+
});
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
Per provider: LLMAPI replays a round as an assistant message carrying
|
|
378
|
+
`tool_calls` plus `tool`-role results and context as a mid-conversation
|
|
379
|
+
`system` message; OpenAI replays `function_call` / `function_call_output`
|
|
380
|
+
items and context as a `developer` item; Gemini replays a `model` turn of
|
|
381
|
+
`functionCall` parts answered by a `user` turn of `functionResponse` parts,
|
|
382
|
+
and — having no mid-conversation system role — carries context as a user
|
|
383
|
+
turn. On Gemini a restored call carries no `thought_signature`, so it replays
|
|
384
|
+
under the documented validator-bypass marker, and a multi-call round is split
|
|
385
|
+
into sequential single-call turns exactly as the live loop records one; a
|
|
386
|
+
call that kept its signature passes it in `signature` and it is echoed
|
|
387
|
+
verbatim.
|
|
388
|
+
|
|
389
|
+
A call the history leaves unanswered is answered by the package with a real
|
|
390
|
+
tool result carrying `LLM_UNANSWERED_TOOL_CALL_RESULT` — every provider
|
|
391
|
+
rejects an unanswered call, so the repair is native rather than left to the
|
|
392
|
+
caller to fake in prose. A result naming no preceding call, a second result
|
|
393
|
+
for an already-answered call, and a round that called nothing are dropped.
|
|
394
|
+
Same-role entries need no merging: the contract carries the structure.
|
|
341
395
|
- **Intermediate narration.** When the model returns visible assistant text
|
|
342
396
|
alongside tool calls in a round that will continue, that text is emitted as
|
|
343
397
|
`agent_message` (attributed to the emitting run, so a subagent's narration
|
|
@@ -1404,7 +1458,10 @@ Interface for chat/assistance services with file handling capabilities.
|
|
|
1404
1458
|
- `createChat(options)`: Create a new chat/conversation
|
|
1405
1459
|
- `model`: The LLM model to use
|
|
1406
1460
|
- `instructions`: Optional initial instructions for the conversation
|
|
1407
|
-
- `history`: Optional conversation history
|
|
1461
|
+
- `history`: Optional conversation history — an `LLMHistoryEntry[]` of plain
|
|
1462
|
+
messages, past tool calls (`LLMHistoryToolCallEntry`), their results
|
|
1463
|
+
(`LLMHistoryToolResultEntry`) and mid-conversation context
|
|
1464
|
+
(`LLMHistoryContextEntry`), each mapped to the provider's native shape
|
|
1408
1465
|
- `files`: Optional array of uploaded files
|
|
1409
1466
|
- `storageId`: Optional storage ID to use
|
|
1410
1467
|
- `deleteChat(chatId)`: Delete a chat
|
|
@@ -2113,8 +2170,8 @@ describe('Custom LLM Integration Test', () => {
|
|
|
2113
2170
|
The `LLMAPIModelNames` enum and `LLMAPI_AVAILABLE_MODELS` map drift as
|
|
2114
2171
|
LLMAPI adds/renames models. The pipeline in
|
|
2115
2172
|
[`scripts/sync-llmapi-models/`](scripts/sync-llmapi-models/README.md)
|
|
2116
|
-
reconciles them against `GET https://api.llmapi.ai/v1/models`
|
|
2117
|
-
rules:
|
|
2173
|
+
reconciles them against `GET https://api.llmapi.ai/v1/models` and the audio
|
|
2174
|
+
catalog at `GET https://api.llmapi.ai/audio-models` under these rules:
|
|
2118
2175
|
|
|
2119
2176
|
- Unscoped aliases are always present; scoped aliases (`openai/…`, `azure/…`,
|
|
2120
2177
|
`nebius/…`) only when LLMAPI advertises 2+ providers for that model.
|
|
@@ -2123,6 +2180,10 @@ rules:
|
|
|
2123
2180
|
existing and new route, including provider-specific overrides.
|
|
2124
2181
|
- `maxOutputTokens` and any missing `maxInputTokens` are researched from
|
|
2125
2182
|
provider docs via web-search sub-agents.
|
|
2183
|
+
- TTS/STT limits and pricing, batch/streaming STT classification,
|
|
2184
|
+
purpose-specific model maps, and default voice mappings are refreshed from
|
|
2185
|
+
the audio catalog. Streaming-only STT models are exported separately and are
|
|
2186
|
+
not exposed through the file-based `SpeechToText` service.
|
|
2126
2187
|
|
|
2127
2188
|
See the linked README for the full classify → research → apply workflow.
|
|
2128
2189
|
|