gitlab-ai-provider 6.4.2 → 6.6.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/CHANGELOG.md +10 -0
- package/dist/gitlab-ai-provider-6.6.0.tgz +0 -0
- package/dist/index.d.mts +11 -1
- package/dist/index.d.ts +11 -1
- package/dist/index.js +30 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +30 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/gitlab-ai-provider-6.4.2.tgz +0 -0
package/dist/index.mjs
CHANGED
|
@@ -282,7 +282,17 @@ var GitLabAnthropicLanguageModel = class {
|
|
|
282
282
|
}
|
|
283
283
|
}
|
|
284
284
|
/**
|
|
285
|
-
* Convert AI SDK prompt to Anthropic messages format
|
|
285
|
+
* Convert AI SDK prompt to Anthropic messages format.
|
|
286
|
+
*
|
|
287
|
+
* Cache breakpoints (`cache_control: { type: "ephemeral" }`) are placed on:
|
|
288
|
+
* 1. The system prompt content block — static across all turns.
|
|
289
|
+
* 2. The last content block of the second-to-last message — the boundary
|
|
290
|
+
* between conversation history and the current turn.
|
|
291
|
+
*
|
|
292
|
+
* This lets Anthropic cache the system prompt and the accumulated
|
|
293
|
+
* conversation prefix, so each new turn only pays for the new content.
|
|
294
|
+
*
|
|
295
|
+
* @see https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching
|
|
286
296
|
*/
|
|
287
297
|
convertPrompt(prompt) {
|
|
288
298
|
let systemMessage;
|
|
@@ -354,7 +364,23 @@ ${message.content}` : message.content;
|
|
|
354
364
|
}
|
|
355
365
|
}
|
|
356
366
|
}
|
|
357
|
-
|
|
367
|
+
const system = systemMessage ? [
|
|
368
|
+
{
|
|
369
|
+
type: "text",
|
|
370
|
+
text: systemMessage,
|
|
371
|
+
cache_control: { type: "ephemeral" }
|
|
372
|
+
}
|
|
373
|
+
] : void 0;
|
|
374
|
+
if (messages.length >= 2) {
|
|
375
|
+
const penultimate = messages[messages.length - 2];
|
|
376
|
+
if (Array.isArray(penultimate.content)) {
|
|
377
|
+
const lastBlock = penultimate.content[penultimate.content.length - 1];
|
|
378
|
+
lastBlock.cache_control = {
|
|
379
|
+
type: "ephemeral"
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
return { system, messages };
|
|
358
384
|
}
|
|
359
385
|
/**
|
|
360
386
|
* Convert Anthropic finish reason to AI SDK format
|
|
@@ -714,6 +740,7 @@ import OpenAI from "openai";
|
|
|
714
740
|
// src/model-mappings.ts
|
|
715
741
|
var MODEL_MAPPINGS = {
|
|
716
742
|
// Anthropic models
|
|
743
|
+
"duo-chat-opus-4-7": { provider: "anthropic", model: "claude-opus-4-7" },
|
|
717
744
|
"duo-chat-opus-4-6": { provider: "anthropic", model: "claude-opus-4-6" },
|
|
718
745
|
"duo-chat-sonnet-4-6": { provider: "anthropic", model: "claude-sonnet-4-6" },
|
|
719
746
|
"duo-chat-opus-4-5": { provider: "anthropic", model: "claude-opus-4-5-20251101" },
|
|
@@ -1582,7 +1609,7 @@ var GitLabOpenAILanguageModel = class {
|
|
|
1582
1609
|
import WebSocket from "isomorphic-ws";
|
|
1583
1610
|
|
|
1584
1611
|
// src/version.ts
|
|
1585
|
-
var VERSION = true ? "6.
|
|
1612
|
+
var VERSION = true ? "6.5.0" : "0.0.0-dev";
|
|
1586
1613
|
|
|
1587
1614
|
// src/gitlab-workflow-types.ts
|
|
1588
1615
|
var WorkflowType = /* @__PURE__ */ ((WorkflowType2) => {
|