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