@adaptic/utils 0.0.1023 → 0.0.1024
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/dist/index.cjs +29 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +29 -1
- package/dist/index.mjs.map +1 -1
- package/dist/types/__tests__/llm/client/support/transports.d.ts +3 -0
- package/dist/types/__tests__/llm/client/support/transports.d.ts.map +1 -1
- package/dist/types/llm/alias-client.d.ts.map +1 -1
- package/dist/types/llm/fallback-chain.d.ts +7 -0
- package/dist/types/llm/fallback-chain.d.ts.map +1 -1
- package/dist/types/llm/transports/direct.d.ts.map +1 -1
- package/dist/types/llm/types.d.ts +20 -0
- package/dist/types/llm/types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -63740,6 +63740,8 @@ async function runLeg(leg, params, execution) {
|
|
|
63740
63740
|
content: execution.content,
|
|
63741
63741
|
responseFormat: execution.responseFormat,
|
|
63742
63742
|
params,
|
|
63743
|
+
developerPrompt: execution.developerPrompt,
|
|
63744
|
+
context: execution.context,
|
|
63743
63745
|
signal: controller.signal,
|
|
63744
63746
|
correlationId: execution.correlationId,
|
|
63745
63747
|
}), budgetMs);
|
|
@@ -64939,8 +64941,16 @@ function createDirectTransport(config) {
|
|
|
64939
64941
|
throw new DirectTransportRefusedError(route.routeKey, "the route names no lumic_model, so there is no registered model to call directly");
|
|
64940
64942
|
}
|
|
64941
64943
|
const call = await config.resolveCaller();
|
|
64944
|
+
// `developerPrompt` and `context` are named options on lumic's own call
|
|
64945
|
+
// surface, not body parameters, so they are forwarded explicitly rather
|
|
64946
|
+
// than through `request.params` — which transports send verbatim and which
|
|
64947
|
+
// therefore never carried them.
|
|
64942
64948
|
const result = await call(request.content, request.responseFormat, {
|
|
64943
64949
|
...request.params,
|
|
64950
|
+
...(request.developerPrompt !== undefined
|
|
64951
|
+
? { developerPrompt: request.developerPrompt }
|
|
64952
|
+
: {}),
|
|
64953
|
+
...(request.context !== undefined ? { context: request.context } : {}),
|
|
64944
64954
|
model: route.lumicModel,
|
|
64945
64955
|
signal: request.signal,
|
|
64946
64956
|
timeout: route.timeoutMs,
|
|
@@ -65188,7 +65198,21 @@ function createGatewayTransport(config) {
|
|
|
65188
65198
|
*/
|
|
65189
65199
|
function buildMessages(request) {
|
|
65190
65200
|
const content = typeof request.content === "string" ? request.content : [...request.content];
|
|
65191
|
-
|
|
65201
|
+
const messages = [];
|
|
65202
|
+
// Order is the contract: the developer instruction must precede the history it
|
|
65203
|
+
// governs, and the history must precede the turn it is the memory for. A
|
|
65204
|
+
// transport that emitted only the final turn would not be sending a shorter
|
|
65205
|
+
// prompt — it would be asking a different question, of an unprompted model.
|
|
65206
|
+
if (request.developerPrompt !== undefined && request.developerPrompt !== "") {
|
|
65207
|
+
messages.push({ role: "system", content: request.developerPrompt });
|
|
65208
|
+
}
|
|
65209
|
+
if (request.context !== undefined) {
|
|
65210
|
+
for (const turn of request.context) {
|
|
65211
|
+
messages.push(turn);
|
|
65212
|
+
}
|
|
65213
|
+
}
|
|
65214
|
+
messages.push({ role: "user", content });
|
|
65215
|
+
return messages;
|
|
65192
65216
|
}
|
|
65193
65217
|
/**
|
|
65194
65218
|
* Interpret the model's content according to the requested format.
|
|
@@ -65410,6 +65434,8 @@ async function callLLMByAlias(content, responseFormat = "text", options) {
|
|
|
65410
65434
|
legs: prepareLegs(chain, options, responseFormat, gateway),
|
|
65411
65435
|
content: boundContent,
|
|
65412
65436
|
responseFormat,
|
|
65437
|
+
developerPrompt: options.developerPrompt,
|
|
65438
|
+
context: options.context,
|
|
65413
65439
|
breakers,
|
|
65414
65440
|
correlationId: options.correlationId,
|
|
65415
65441
|
callerSignal: options.signal,
|
|
@@ -65442,6 +65468,8 @@ async function callLLMByAlias(content, responseFormat = "text", options) {
|
|
|
65442
65468
|
legs: prepareLegs({ ...chain, routes: closedLegs }, options, responseFormat, direct),
|
|
65443
65469
|
content: boundContent,
|
|
65444
65470
|
responseFormat,
|
|
65471
|
+
developerPrompt: options.developerPrompt,
|
|
65472
|
+
context: options.context,
|
|
65445
65473
|
breakers,
|
|
65446
65474
|
correlationId: options.correlationId,
|
|
65447
65475
|
callerSignal: options.signal,
|