@llumiverse/drivers 1.1.0 → 1.2.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/lib/cjs/bedrock/index.js +49 -62
- package/lib/cjs/bedrock/index.js.map +1 -1
- package/lib/cjs/groq/index.js +7 -5
- package/lib/cjs/groq/index.js.map +1 -1
- package/lib/cjs/huggingface_ie.js +4 -4
- package/lib/cjs/huggingface_ie.js.map +1 -1
- package/lib/cjs/mistral/index.js +5 -5
- package/lib/cjs/mistral/index.js.map +1 -1
- package/lib/cjs/openai/index.js +35 -8
- package/lib/cjs/openai/index.js.map +1 -1
- package/lib/cjs/replicate.js +4 -4
- package/lib/cjs/replicate.js.map +1 -1
- package/lib/cjs/shared/claude-thinking.js +60 -0
- package/lib/cjs/shared/claude-thinking.js.map +1 -0
- package/lib/cjs/togetherai/index.js +4 -4
- package/lib/cjs/togetherai/index.js.map +1 -1
- package/lib/cjs/vertexai/models/claude.js +18 -16
- package/lib/cjs/vertexai/models/claude.js.map +1 -1
- package/lib/cjs/vertexai/models/gemini.js +58 -10
- package/lib/cjs/vertexai/models/gemini.js.map +1 -1
- package/lib/cjs/vertexai/models/imagen.js +2 -2
- package/lib/cjs/vertexai/models/imagen.js.map +1 -1
- package/lib/cjs/watsonx/index.js +4 -4
- package/lib/cjs/watsonx/index.js.map +1 -1
- package/lib/esm/bedrock/index.js +49 -62
- package/lib/esm/bedrock/index.js.map +1 -1
- package/lib/esm/groq/index.js +7 -5
- package/lib/esm/groq/index.js.map +1 -1
- package/lib/esm/huggingface_ie.js +5 -5
- package/lib/esm/huggingface_ie.js.map +1 -1
- package/lib/esm/mistral/index.js +5 -5
- package/lib/esm/mistral/index.js.map +1 -1
- package/lib/esm/openai/index.js +36 -9
- package/lib/esm/openai/index.js.map +1 -1
- package/lib/esm/replicate.js +4 -4
- package/lib/esm/replicate.js.map +1 -1
- package/lib/esm/shared/claude-thinking.js +57 -0
- package/lib/esm/shared/claude-thinking.js.map +1 -0
- package/lib/esm/togetherai/index.js +4 -4
- package/lib/esm/togetherai/index.js.map +1 -1
- package/lib/esm/vertexai/models/claude.js +19 -17
- package/lib/esm/vertexai/models/claude.js.map +1 -1
- package/lib/esm/vertexai/models/gemini.js +58 -10
- package/lib/esm/vertexai/models/gemini.js.map +1 -1
- package/lib/esm/vertexai/models/imagen.js +2 -2
- package/lib/esm/vertexai/models/imagen.js.map +1 -1
- package/lib/esm/watsonx/index.js +4 -4
- package/lib/esm/watsonx/index.js.map +1 -1
- package/lib/types/bedrock/index.d.ts +6 -6
- package/lib/types/bedrock/index.d.ts.map +1 -1
- package/lib/types/groq/index.d.ts +1 -1
- package/lib/types/groq/index.d.ts.map +1 -1
- package/lib/types/huggingface_ie.d.ts +1 -1
- package/lib/types/huggingface_ie.d.ts.map +1 -1
- package/lib/types/mistral/index.d.ts +2 -2
- package/lib/types/mistral/index.d.ts.map +1 -1
- package/lib/types/openai/index.d.ts +1 -1
- package/lib/types/openai/index.d.ts.map +1 -1
- package/lib/types/replicate.d.ts +1 -1
- package/lib/types/replicate.d.ts.map +1 -1
- package/lib/types/shared/claude-thinking.d.ts +36 -0
- package/lib/types/shared/claude-thinking.d.ts.map +1 -0
- package/lib/types/togetherai/index.d.ts +1 -1
- package/lib/types/togetherai/index.d.ts.map +1 -1
- package/lib/types/vertexai/models/claude.d.ts +4 -4
- package/lib/types/vertexai/models/claude.d.ts.map +1 -1
- package/lib/types/vertexai/models/gemini.d.ts.map +1 -1
- package/lib/types/watsonx/index.d.ts +1 -1
- package/lib/types/watsonx/index.d.ts.map +1 -1
- package/package.json +11 -11
- package/src/bedrock/index.ts +75 -87
- package/src/groq/index.ts +9 -8
- package/src/huggingface_ie.ts +5 -5
- package/src/mistral/index.ts +6 -6
- package/src/openai/index.ts +46 -16
- package/src/replicate.ts +5 -5
- package/src/shared/claude-thinking.ts +88 -0
- package/src/togetherai/index.ts +5 -5
- package/src/vertexai/models/claude.ts +32 -27
- package/src/vertexai/models/gemini.ts +57 -11
- package/src/vertexai/models/imagen.ts +2 -2
- package/src/watsonx/index.ts +5 -5
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { OutputConfig, ThinkingConfigParam } from "@anthropic-ai/sdk/resources/messages.js";
|
|
2
|
+
/**
|
|
3
|
+
* Common Claude model options relevant to thinking/effort configuration.
|
|
4
|
+
* Works with both VertexAIClaudeOptions and BedrockClaudeOptions.
|
|
5
|
+
*/
|
|
6
|
+
export interface ClaudeThinkingInput {
|
|
7
|
+
thinking_budget_tokens?: number;
|
|
8
|
+
effort?: NonNullable<OutputConfig['effort']>;
|
|
9
|
+
/** Controls whether thinking content is included in the response. Does not enable thinking. */
|
|
10
|
+
include_thoughts?: boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Result of resolving Claude thinking and effort configuration.
|
|
14
|
+
*/
|
|
15
|
+
export interface ClaudeThinkingResult {
|
|
16
|
+
/** Thinking/reasoning config to include in the API payload. */
|
|
17
|
+
thinking: ThinkingConfigParam | undefined;
|
|
18
|
+
/** Output config (effort) to include in the API payload, if applicable. */
|
|
19
|
+
outputConfig: OutputConfig | undefined;
|
|
20
|
+
/** Whether sampling parameters (temperature, top_p, top_k) should be stripped. */
|
|
21
|
+
hasSamplingRestriction: boolean;
|
|
22
|
+
/** Whether the model supports thinking at all (>= Claude 3.7). */
|
|
23
|
+
supportsThinking: boolean;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Resolve thinking and effort configuration for a Claude model.
|
|
27
|
+
*
|
|
28
|
+
* - Extended thinking: enabled by setting `thinking_budget_tokens`.
|
|
29
|
+
* - Adaptive thinking: enabled by setting `effort` on models that support it (Opus 4.6+, Sonnet 4.6+).
|
|
30
|
+
* - `include_thoughts`: display-only; does not enable thinking.
|
|
31
|
+
*
|
|
32
|
+
* @param model - The model identifier string
|
|
33
|
+
* @param options - User-provided Claude options (thinking_budget_tokens, effort, include_thoughts)
|
|
34
|
+
*/
|
|
35
|
+
export declare function resolveClaudeThinking(model: string, options?: ClaudeThinkingInput): ClaudeThinkingResult;
|
|
36
|
+
//# sourceMappingURL=claude-thinking.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-thinking.d.ts","sourceRoot":"","sources":["../../../src/shared/claude-thinking.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAOjG;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAChC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,MAAM,CAAC,EAAE,WAAW,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC7C,+FAA+F;IAC/F,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACjC,+DAA+D;IAC/D,QAAQ,EAAE,mBAAmB,GAAG,SAAS,CAAC;IAC1C,2EAA2E;IAC3E,YAAY,EAAE,YAAY,GAAG,SAAS,CAAC;IACvC,kFAAkF;IAClF,sBAAsB,EAAE,OAAO,CAAC;IAChC,kEAAkE;IAClE,gBAAgB,EAAE,OAAO,CAAC;CAC7B;AAED;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,oBAAoB,CA6CxG"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AbstractDriver, AIModel, Completion, CompletionChunkObject, DriverOptions, EmbeddingsResult, ExecutionOptions } from "@llumiverse/core";
|
|
2
2
|
import { FetchClient } from "@vertesia/api-fetch-client";
|
|
3
3
|
interface TogetherAIDriverOptions extends DriverOptions {
|
|
4
4
|
apiKey: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/togetherai/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/togetherai/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAE,aAAa,EAAE,gBAAgB,EAAE,gBAAgB,EAAuB,MAAM,kBAAkB,CAAC;AAEtK,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAGzD,UAAU,uBAAwB,SAAQ,aAAa;IACnD,MAAM,EAAE,MAAM,CAAC;CAClB;AAED,qBAAa,gBAAiB,SAAQ,cAAc,CAAC,uBAAuB,EAAE,MAAM,CAAC;IACjF,MAAM,CAAC,QAAQ,SAAgB;IAC/B,QAAQ,SAA6B;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,WAAW,CAAC;gBAEb,OAAO,EAAE,uBAAuB;IAQ5C,iBAAiB,GAAI,SAAS,gBAAgB,KAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,GAAG,CAAA;KAAE,GAAG,SAAS,CAMzF;IAEK,qBAAqB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,UAAU,CAAC;IA0CrF,2BAA2B,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,aAAa,CAAC,qBAAqB,CAAC,CAAC;IA4CrH,UAAU,IAAI,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;IAiB9C,kBAAkB,IAAI,OAAO,CAAC,OAAO,CAAC;IAGtC,kBAAkB,IAAI,OAAO,CAAC,gBAAgB,CAAC;CAIlD"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ContentBlock, MessageParam, TextBlockParam } from "@anthropic-ai/sdk/resources/index.js";
|
|
2
|
-
import { AIModel, Completion, CompletionChunkObject, ExecutionOptions, LlumiverseError, LlumiverseErrorContext, PromptSegment, ToolUse } from "@llumiverse/core";
|
|
3
|
-
import { VertexAIDriver } from "../index.js";
|
|
4
|
-
import { ModelDefinition } from "../models.js";
|
|
1
|
+
import type { ContentBlock, MessageParam, TextBlockParam } from "@anthropic-ai/sdk/resources/index.js";
|
|
2
|
+
import { type AIModel, type Completion, type CompletionChunkObject, type ExecutionOptions, LlumiverseError, type LlumiverseErrorContext, type PromptSegment, type ToolUse } from "@llumiverse/core";
|
|
3
|
+
import type { VertexAIDriver } from "../index.js";
|
|
4
|
+
import type { ModelDefinition } from "../models.js";
|
|
5
5
|
export declare const ANTHROPIC_REGIONS: Record<string, string>;
|
|
6
6
|
export declare const NON_GLOBAL_ANTHROPIC_MODELS: string[];
|
|
7
7
|
interface ClaudePrompt {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claude.d.ts","sourceRoot":"","sources":["../../../../src/vertexai/models/claude.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,YAAY,EAAmE,YAAY,EAAE,cAAc,EAAwB,MAAM,sCAAsC,CAAC;
|
|
1
|
+
{"version":3,"file":"claude.d.ts","sourceRoot":"","sources":["../../../../src/vertexai/models/claude.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,YAAY,EAAmE,YAAY,EAAE,cAAc,EAAwB,MAAM,sCAAsC,CAAC;AAG9L,OAAO,EACH,KAAK,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,qBAAqB,EAAE,KAAK,gBAAgB,EAKhF,eAAe,EAAE,KAAK,sBAAsB,EAEhC,KAAK,aAAa,EAG9B,KAAK,OAAO,EAGf,MAAM,kBAAkB,CAAC;AAG1B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEpD,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAIpD,CAAA;AAED,eAAO,MAAM,2BAA2B,UAGvC,CAAC;AAEF,UAAU,YAAY;IAClB,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,MAAM,CAAC,EAAE,cAAc,EAAE,CAAC;CAC7B;AA+BD,wBAAgB,YAAY,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,OAAO,EAAE,GAAG,SAAS,CAc3E;AA8FD,qBAAa,qBAAsB,YAAW,eAAe,CAAC,YAAY,CAAC;IAEvE,KAAK,EAAE,OAAO,CAAA;gBAEF,OAAO,EAAE,MAAM;IAUrB,YAAY,CAAC,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,aAAa,EAAE,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,YAAY,CAAC;IAuGlH,qBAAqB,CAAC,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,UAAU,CAAC;IA2DnH,2BAA2B,CAAC,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,aAAa,CAAC,qBAAqB,CAAC,CAAC;IAkIzJ;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,qBAAqB,CACjB,OAAO,EAAE,cAAc,EACvB,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,sBAAsB,GAChC,eAAe;IA8DlB;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAQ3B;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,OAAO,CAAC,sBAAsB;CAuCjC;AAYD;;;;;;GAMG;AACH,wBAAgB,4BAA4B,CAAC,QAAQ,EAAE,YAAY,EAAE,GAAG,YAAY,EAAE,CA6CrF;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,YAAY,EAAE,YAAY,GAAG,SAAS,GAAG,IAAI,EAAE,MAAM,EAAE,YAAY,GAAG,YAAY,CAgBpH;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,YAAY,EAAE,GAAG,YAAY,EAAE,CA+BzE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,YAAY,EAAE,GAAG,YAAY,EAAE,CA2E3E;AAqID;;GAEG;AACH,wBAAgB,+BAA+B,CAAC,QAAQ,EAAE,YAAY,EAAE,GAAG,OAAO,CAUjF;AAED;;;;GAIG;AACH,wBAAgB,6BAA6B,CAAC,QAAQ,EAAE,YAAY,EAAE,GAAG,YAAY,EAAE,CA8CtF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gemini.d.ts","sourceRoot":"","sources":["../../../../src/vertexai/models/gemini.ts"],"names":[],"mappings":"AACA,OAAO,EACH,KAAK,OAAO,EACZ,KAAK,oCAAoC,EAM5C,MAAM,eAAe,CAAC;AACvB,OAAO,EACH,KAAK,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,qBAAqB,EAAyB,KAAK,gBAAgB,EACvG,KAAK,mBAAmB,EAKP,eAAe,EAAE,KAAK,sBAAsB,EAC7D,KAAK,aAAa,EAOrB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AACzE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AA2KpD,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,SAAS,GAAG,OAAO,EAAE,CA2B/E;
|
|
1
|
+
{"version":3,"file":"gemini.d.ts","sourceRoot":"","sources":["../../../../src/vertexai/models/gemini.ts"],"names":[],"mappings":"AACA,OAAO,EACH,KAAK,OAAO,EACZ,KAAK,oCAAoC,EAM5C,MAAM,eAAe,CAAC;AACvB,OAAO,EACH,KAAK,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,qBAAqB,EAAyB,KAAK,gBAAgB,EACvG,KAAK,mBAAmB,EAKP,eAAe,EAAE,KAAK,sBAAsB,EAC7D,KAAK,aAAa,EAOrB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AACzE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AA2KpD,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,SAAS,GAAG,OAAO,EAAE,CA2B/E;AAqHD,qBAAa,qBAAsB,YAAW,eAAe,CAAC,qBAAqB,CAAC;IAEhF,KAAK,EAAE,OAAO,CAAA;gBAEF,OAAO,EAAE,MAAM;IAUrB,YAAY,CAAC,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,aAAa,EAAE,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,qBAAqB,CAAC;IA+HjI,yBAAyB,CAAC,aAAa,EAAE,oCAAoC,GAAG,SAAS,GAAG,mBAAmB;IA+BzG,qBAAqB,CAAC,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,qBAAqB,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,UAAU,CAAC;IA4G5H,2BAA2B,CAAC,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,qBAAqB,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,aAAa,CAAC,qBAAqB,CAAC,CAAC;IAkFlK;;;;;;;;;;;;;;;;;;;OAmBG;IACH,qBAAqB,CACjB,OAAO,EAAE,cAAc,EACvB,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,sBAAsB,GAChC,eAAe;IAwClB;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAUxB;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,OAAO,CAAC,sBAAsB;IAgB9B;;;;OAIG;IACH,OAAO,CAAC,gBAAgB;CAkB3B;AAGD;;;;GAIG;AACH,wBAAgB,gCAAgC,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,OAAO,EAAE,CAsB/E"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AbstractDriver, AIModel, Completion, CompletionChunkObject, DriverOptions, EmbeddingsOptions, EmbeddingsResult, ExecutionOptions } from "@llumiverse/core";
|
|
2
2
|
import { FetchClient } from "@vertesia/api-fetch-client";
|
|
3
3
|
import { WatsonAuthToken } from "./interfaces.js";
|
|
4
4
|
interface WatsonxDriverOptions extends DriverOptions {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/watsonx/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/watsonx/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAE,aAAa,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,gBAAgB,EAAuB,MAAM,kBAAkB,CAAC;AAEzL,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAuD,eAAe,EAA2G,MAAM,iBAAiB,CAAC;AAEhN,UAAU,oBAAqB,SAAQ,aAAa;IAChD,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACvB;AAID,qBAAa,aAAc,SAAQ,cAAc,CAAC,oBAAoB,EAAE,MAAM,CAAC;IAC3E,MAAM,CAAC,QAAQ,SAAa;IAC5B,QAAQ,SAA0B;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,WAAW,EAAE,WAAW,CAAA;gBAEZ,OAAO,EAAE,oBAAoB;IAQnC,qBAAqB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,UAAU,CAAC;IAmCrF,2BAA2B,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,aAAa,CAAC,qBAAqB,CAAC,CAAC;IAwCrH,UAAU,IAAI,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;IAoBxC,YAAY,IAAI,OAAO,CAAC,MAAM,CAAC;IAwB/B,kBAAkB,IAAI,OAAO,CAAC,OAAO,CAAC;IAStC,kBAAkB,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAwBlF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@llumiverse/drivers",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "LLM driver implementations. Currently supported are: openai, huggingface, bedrock, replicate.",
|
|
6
6
|
"files": [
|
|
@@ -48,14 +48,14 @@
|
|
|
48
48
|
"vitest": "^4.0.18"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@anthropic-ai/sdk": "^0.
|
|
52
|
-
"@anthropic-ai/vertex-sdk": "^0.
|
|
53
|
-
"@aws-sdk/client-bedrock": "^3.
|
|
54
|
-
"@aws-sdk/client-bedrock-runtime": "^3.
|
|
55
|
-
"@aws-sdk/client-s3": "^3.
|
|
56
|
-
"@aws-sdk/credential-providers": "^3.
|
|
57
|
-
"@aws-sdk/lib-storage": "^3.
|
|
58
|
-
"@aws-sdk/types": "^3.973.
|
|
51
|
+
"@anthropic-ai/sdk": "^0.91.1",
|
|
52
|
+
"@anthropic-ai/vertex-sdk": "^0.16.0",
|
|
53
|
+
"@aws-sdk/client-bedrock": "^3.1033.0",
|
|
54
|
+
"@aws-sdk/client-bedrock-runtime": "^3.1033.0",
|
|
55
|
+
"@aws-sdk/client-s3": "^3.1033.0",
|
|
56
|
+
"@aws-sdk/credential-providers": "^3.1033.0",
|
|
57
|
+
"@aws-sdk/lib-storage": "^3.1033.0",
|
|
58
|
+
"@aws-sdk/types": "^3.973.8",
|
|
59
59
|
"@azure-rest/ai-inference": "1.0.0-beta.6",
|
|
60
60
|
"@azure/ai-projects": "1.0.0-beta.10",
|
|
61
61
|
"@azure/core-auth": "^1.10.1",
|
|
@@ -73,8 +73,8 @@
|
|
|
73
73
|
"node-web-stream-adapters": "^0.2.1",
|
|
74
74
|
"openai": "^6.33.0",
|
|
75
75
|
"replicate": "^1.4.0",
|
|
76
|
-
"@llumiverse/
|
|
77
|
-
"@llumiverse/
|
|
76
|
+
"@llumiverse/core": "1.2.0",
|
|
77
|
+
"@llumiverse/common": "1.2.0"
|
|
78
78
|
},
|
|
79
79
|
"ts_dual_module": {
|
|
80
80
|
"outDir": "lib"
|
package/src/bedrock/index.ts
CHANGED
|
@@ -1,47 +1,50 @@
|
|
|
1
1
|
import {
|
|
2
|
-
Bedrock, CreateModelCustomizationJobCommand, FoundationModelSummary, GetModelCustomizationJobCommand,
|
|
3
|
-
GetModelCustomizationJobCommandOutput, ModelCustomizationJobStatus, ModelModality, StopModelCustomizationJobCommand
|
|
2
|
+
Bedrock, CreateModelCustomizationJobCommand, type FoundationModelSummary, GetModelCustomizationJobCommand,
|
|
3
|
+
type GetModelCustomizationJobCommandOutput, ModelCustomizationJobStatus, ModelModality, StopModelCustomizationJobCommand
|
|
4
4
|
} from "@aws-sdk/client-bedrock";
|
|
5
|
-
import { BedrockRuntime, ContentBlock, ConverseRequest, ConverseResponse, ConverseStreamOutput, InferenceConfiguration, Message, Tool } from "@aws-sdk/client-bedrock-runtime";
|
|
5
|
+
import { BedrockRuntime, type ContentBlock, type ConverseRequest, type ConverseResponse, type ConverseStreamOutput, type InferenceConfiguration, type Message, type Tool } from "@aws-sdk/client-bedrock-runtime";
|
|
6
6
|
import { S3Client } from "@aws-sdk/client-s3";
|
|
7
|
-
import { AwsCredentialIdentity, Provider } from "@aws-sdk/types";
|
|
7
|
+
import type { AwsCredentialIdentity, Provider } from "@aws-sdk/types";
|
|
8
8
|
import {
|
|
9
|
-
AbstractDriver, AIModel,
|
|
10
|
-
BedrockClaudeOptions,
|
|
11
|
-
BedrockGptOssOptions,
|
|
12
|
-
BedrockPalmyraOptions,
|
|
13
|
-
Completion, CompletionChunkObject,
|
|
14
|
-
CompletionResult,
|
|
15
|
-
DataSource,
|
|
9
|
+
AbstractDriver, type AIModel,
|
|
10
|
+
type BedrockClaudeOptions,
|
|
11
|
+
type BedrockGptOssOptions,
|
|
12
|
+
type BedrockPalmyraOptions,
|
|
13
|
+
type Completion, type CompletionChunkObject,
|
|
14
|
+
type CompletionResult,
|
|
15
|
+
type DataSource,
|
|
16
16
|
deserializeBinaryFromStorage,
|
|
17
|
-
DriverOptions,
|
|
18
|
-
|
|
17
|
+
type DriverOptions,
|
|
18
|
+
type EmbeddingsOptions, type EmbeddingsResult,
|
|
19
|
+
type ExecutionOptions, type ExecutionTokenUsage,
|
|
19
20
|
getConversationMeta,
|
|
20
21
|
getMaxTokensLimitBedrock,
|
|
21
22
|
getModelCapabilities,
|
|
22
23
|
incrementConversationTurn,
|
|
23
|
-
|
|
24
|
+
isClaudeVersionGTE,
|
|
25
|
+
LlumiverseError, type LlumiverseErrorContext,
|
|
24
26
|
modelModalitiesToArray,
|
|
25
|
-
ModelOptions,
|
|
26
|
-
NovaCanvasOptions,
|
|
27
|
-
PromptSegment,
|
|
28
|
-
StatelessExecutionOptions,
|
|
27
|
+
type ModelOptions,
|
|
28
|
+
type NovaCanvasOptions,
|
|
29
|
+
type PromptSegment,
|
|
30
|
+
type StatelessExecutionOptions,
|
|
29
31
|
stripBinaryFromConversation,
|
|
30
32
|
stripHeartbeatsFromConversation,
|
|
31
|
-
TextFallbackOptions, ToolDefinition, ToolUse, TrainingJob, TrainingJobStatus, TrainingOptions,
|
|
33
|
+
type TextFallbackOptions, type ToolDefinition, type ToolUse, type TrainingJob, TrainingJobStatus, type TrainingOptions,
|
|
32
34
|
truncateLargeTextInConversation
|
|
33
35
|
} from "@llumiverse/core";
|
|
34
36
|
import { transformAsyncIterator } from "@llumiverse/core/async";
|
|
35
|
-
import { formatNovaPrompt, NovaMessagesPrompt } from "@llumiverse/core/formatters";
|
|
37
|
+
import { formatNovaPrompt, type NovaMessagesPrompt } from "@llumiverse/core/formatters";
|
|
36
38
|
import { LRUCache } from "mnemonist";
|
|
39
|
+
import { resolveClaudeThinking } from "../shared/claude-thinking.js";
|
|
37
40
|
import { converseConcatMessages, converseJSONprefill, converseSystemToMessages, formatConversePrompt } from "./converse.js";
|
|
38
41
|
import { formatNovaImageGenerationPayload, NovaImageGenerationTaskType } from "./nova-image-payload.js";
|
|
39
42
|
import { forceUploadFile } from "./s3.js";
|
|
40
43
|
import {
|
|
41
44
|
formatTwelvelabsPegasusPrompt,
|
|
42
|
-
TwelvelabsMarengoRequest,
|
|
43
|
-
TwelvelabsMarengoResponse,
|
|
44
|
-
TwelvelabsPegasusRequest
|
|
45
|
+
type TwelvelabsMarengoRequest,
|
|
46
|
+
type TwelvelabsMarengoResponse,
|
|
47
|
+
type TwelvelabsPegasusRequest
|
|
45
48
|
} from "./twelvelabs.js";
|
|
46
49
|
|
|
47
50
|
const supportStreamingCache = new LRUCache<string, boolean>(4096);
|
|
@@ -107,42 +110,6 @@ function maxTokenFallbackClaude(option: StatelessExecutionOptions): number {
|
|
|
107
110
|
}
|
|
108
111
|
}
|
|
109
112
|
|
|
110
|
-
/**
|
|
111
|
-
* Parse Claude model version from model string.
|
|
112
|
-
* @param modelString - The model identifier string
|
|
113
|
-
* @returns An object with major and minor version numbers, or null if not parseable
|
|
114
|
-
*/
|
|
115
|
-
function parseClaudeVersion(modelString: string): { major: number; minor: number } | null {
|
|
116
|
-
// Match pattern: claude-[optional variant]-{major}-[optional 1-2 digit minor]
|
|
117
|
-
// The minor version is limited to 1-2 digits to avoid matching dates (YYYYMMDD format)
|
|
118
|
-
const match = modelString.match(/claude-(?:[a-z]+-)?(\d+)(?:-(\d{1,2}))?(?:-|\b)/);
|
|
119
|
-
if (match) {
|
|
120
|
-
return {
|
|
121
|
-
major: parseInt(match[1], 10),
|
|
122
|
-
minor: match[2] ? parseInt(match[2], 10) : 0
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
return null;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* Check if a Claude model version is greater than or equal to a target version.
|
|
130
|
-
* @returns true if the model version is >= target version, false otherwise
|
|
131
|
-
*/
|
|
132
|
-
function isClaudeVersionGTE(modelString: string, targetMajor: number, targetMinor: number): boolean {
|
|
133
|
-
const version = parseClaudeVersion(modelString);
|
|
134
|
-
if (!version) {
|
|
135
|
-
return false;
|
|
136
|
-
}
|
|
137
|
-
if (version.major > targetMajor) {
|
|
138
|
-
return true;
|
|
139
|
-
}
|
|
140
|
-
if (version.major === targetMajor && version.minor >= targetMinor) {
|
|
141
|
-
return true;
|
|
142
|
-
}
|
|
143
|
-
return false;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
113
|
export type BedrockPrompt = NovaMessagesPrompt | ConverseRequest | TwelvelabsPegasusRequest;
|
|
147
114
|
|
|
148
115
|
type BedrockSystemBlock = NonNullable<ConverseRequest['system']>[number];
|
|
@@ -176,7 +143,7 @@ export class BedrockDriver extends AbstractDriver<BedrockDriverOptions, BedrockP
|
|
|
176
143
|
}
|
|
177
144
|
|
|
178
145
|
getService(region: string = this.options.region) {
|
|
179
|
-
if (!this._service || this._service_region
|
|
146
|
+
if (!this._service || this._service_region !== region) {
|
|
180
147
|
this._service = new Bedrock({
|
|
181
148
|
region: region,
|
|
182
149
|
credentials: this.options.credentials,
|
|
@@ -513,7 +480,7 @@ export class BedrockDriver extends AbstractDriver<BedrockDriverOptions, BedrockP
|
|
|
513
480
|
let canStream: boolean = false;
|
|
514
481
|
let error: any = null;
|
|
515
482
|
const region = this.extractRegion(model, this.options.region);
|
|
516
|
-
if (type
|
|
483
|
+
if (type === BedrockModelType.FoundationModel || type === BedrockModelType.Unknown) {
|
|
517
484
|
try {
|
|
518
485
|
const response = await this.getService(region).getFoundationModel({
|
|
519
486
|
modelIdentifier: model
|
|
@@ -524,7 +491,7 @@ export class BedrockDriver extends AbstractDriver<BedrockDriverOptions, BedrockP
|
|
|
524
491
|
error = e;
|
|
525
492
|
}
|
|
526
493
|
}
|
|
527
|
-
if (type
|
|
494
|
+
if (type === BedrockModelType.InferenceProfile || type === BedrockModelType.Unknown) {
|
|
528
495
|
try {
|
|
529
496
|
const response = await this.getService(region).getInferenceProfile({
|
|
530
497
|
inferenceProfileIdentifier: model
|
|
@@ -535,7 +502,7 @@ export class BedrockDriver extends AbstractDriver<BedrockDriverOptions, BedrockP
|
|
|
535
502
|
error = e;
|
|
536
503
|
}
|
|
537
504
|
}
|
|
538
|
-
if (type
|
|
505
|
+
if (type === BedrockModelType.CustomModel || type === BedrockModelType.Unknown) {
|
|
539
506
|
try {
|
|
540
507
|
const response = await this.getService(region).getCustomModel({
|
|
541
508
|
modelIdentifier: model
|
|
@@ -711,7 +678,7 @@ export class BedrockDriver extends AbstractDriver<BedrockDriverOptions, BedrockP
|
|
|
711
678
|
return tools;
|
|
712
679
|
}, []);
|
|
713
680
|
//If no tools were used, set to undefined
|
|
714
|
-
if (tool_use && tool_use.length
|
|
681
|
+
if (tool_use && tool_use.length === 0) {
|
|
715
682
|
tool_use = undefined;
|
|
716
683
|
}
|
|
717
684
|
|
|
@@ -874,6 +841,10 @@ export class BedrockDriver extends AbstractDriver<BedrockDriverOptions, BedrockP
|
|
|
874
841
|
let additionalField = {};
|
|
875
842
|
let supportsJSONPrefill = false;
|
|
876
843
|
|
|
844
|
+
// Resolve thinking, effort, and sampling restrictions using shared Claude helper
|
|
845
|
+
const claudeThinking = resolveClaudeThinking(options.model, options.model_options as BedrockClaudeOptions | undefined);
|
|
846
|
+
const hasSamplingRestriction = claudeThinking.hasSamplingRestriction;
|
|
847
|
+
|
|
877
848
|
if (options.model.includes("amazon")) {
|
|
878
849
|
supportsJSONPrefill = true;
|
|
879
850
|
//Titan models also exists but does not support any additional options
|
|
@@ -882,18 +853,22 @@ export class BedrockDriver extends AbstractDriver<BedrockDriverOptions, BedrockP
|
|
|
882
853
|
}
|
|
883
854
|
} else if (options.model.includes("claude")) {
|
|
884
855
|
const claude_options = model_options as ModelOptions as BedrockClaudeOptions;
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
856
|
+
// Thinking is active when extended (budget set) or adaptive (effort set) thinking is enabled.
|
|
857
|
+
// JSON prefill is incompatible with active thinking.
|
|
858
|
+
const thinkingActive = claudeThinking.thinking != null && claudeThinking.thinking.type !== "disabled";
|
|
859
|
+
supportsJSONPrefill = !thinkingActive
|
|
860
|
+
|
|
861
|
+
// Claude 3.7+ supports thinking — use shared helper for reasoning_config
|
|
862
|
+
if (claudeThinking.supportsThinking) {
|
|
863
|
+
if (claudeThinking.thinking) {
|
|
864
|
+
additionalField = {
|
|
865
|
+
...additionalField,
|
|
866
|
+
reasoning_config: claudeThinking.thinking,
|
|
867
|
+
};
|
|
868
|
+
}
|
|
869
|
+
// For Claude 3.7 with extended thinking + high output, add beta header
|
|
870
|
+
if (claudeThinking.thinking?.type === "enabled" &&
|
|
871
|
+
options.model.includes("claude-3-7-sonnet") &&
|
|
897
872
|
((claude_options.max_tokens ?? 0) > 64000 || (claude_options.thinking_budget_tokens ?? 0) > 64000)) {
|
|
898
873
|
additionalField = {
|
|
899
874
|
...additionalField,
|
|
@@ -901,15 +876,25 @@ export class BedrockDriver extends AbstractDriver<BedrockDriverOptions, BedrockP
|
|
|
901
876
|
};
|
|
902
877
|
}
|
|
903
878
|
}
|
|
879
|
+
// Add effort parameter via output_config (Opus 4.5+, Sonnet 4.6+, all 4.7+)
|
|
880
|
+
if (claudeThinking.outputConfig) {
|
|
881
|
+
additionalField = {
|
|
882
|
+
...additionalField,
|
|
883
|
+
output_config: claudeThinking.outputConfig
|
|
884
|
+
};
|
|
885
|
+
}
|
|
904
886
|
// Claude 4.6 and later versions don't support JSON prefill
|
|
905
887
|
if (isClaudeVersionGTE(options.model, 4, 6)) {
|
|
906
888
|
supportsJSONPrefill = false;
|
|
907
889
|
}
|
|
908
|
-
//Needs max_tokens to be set
|
|
890
|
+
// Needs max_tokens to be set
|
|
909
891
|
if (!model_options.max_tokens) {
|
|
910
892
|
model_options.max_tokens = maxTokenFallbackClaude(options);
|
|
911
893
|
}
|
|
912
|
-
|
|
894
|
+
// Only models without sampling restrictions support top_k
|
|
895
|
+
if (!hasSamplingRestriction) {
|
|
896
|
+
additionalField = { ...additionalField, top_k: model_options.top_k };
|
|
897
|
+
}
|
|
913
898
|
} else if (options.model.includes("meta")) {
|
|
914
899
|
//LLaMA models support no additional options
|
|
915
900
|
} else if (options.model.includes("mistral")) {
|
|
@@ -917,7 +902,7 @@ export class BedrockDriver extends AbstractDriver<BedrockDriverOptions, BedrockP
|
|
|
917
902
|
if (options.model.includes("7b")) {
|
|
918
903
|
additionalField = { top_k: model_options.top_k };
|
|
919
904
|
//Does not support system messages
|
|
920
|
-
if (prompt.system && prompt.system?.length
|
|
905
|
+
if (prompt.system && prompt.system?.length !== 0) {
|
|
921
906
|
prompt.messages?.push(converseSystemToMessages(prompt.system));
|
|
922
907
|
prompt.system = undefined;
|
|
923
908
|
prompt.messages = converseConcatMessages(prompt.messages);
|
|
@@ -935,7 +920,7 @@ export class BedrockDriver extends AbstractDriver<BedrockDriverOptions, BedrockP
|
|
|
935
920
|
frequencyPenalty: { scale: model_options.frequency_penalty },
|
|
936
921
|
};
|
|
937
922
|
//Does not support system messages
|
|
938
|
-
if (prompt.system && prompt.system?.length
|
|
923
|
+
if (prompt.system && prompt.system?.length !== 0) {
|
|
939
924
|
prompt.messages?.push(converseSystemToMessages(prompt.system));
|
|
940
925
|
prompt.system = undefined;
|
|
941
926
|
prompt.messages = converseConcatMessages(prompt.messages);
|
|
@@ -954,7 +939,7 @@ export class BedrockDriver extends AbstractDriver<BedrockDriverOptions, BedrockP
|
|
|
954
939
|
// Command non-R
|
|
955
940
|
additionalField = { k: model_options.top_k };
|
|
956
941
|
//Does not support system messages
|
|
957
|
-
if (prompt.system && prompt.system?.length
|
|
942
|
+
if (prompt.system && prompt.system?.length !== 0) {
|
|
958
943
|
prompt.messages?.push(converseSystemToMessages(prompt.system));
|
|
959
944
|
prompt.system = undefined;
|
|
960
945
|
prompt.messages = converseConcatMessages(prompt.messages);
|
|
@@ -1002,10 +987,13 @@ export class BedrockDriver extends AbstractDriver<BedrockDriverOptions, BedrockP
|
|
|
1002
987
|
// Clean undefined values from additionalField since AWS Bedrock requires valid JSON
|
|
1003
988
|
// and will throw an exception for unrecognized parameters
|
|
1004
989
|
const cleanedAdditionalFields = removeUndefinedValues(additionalField);
|
|
990
|
+
// Models with sampling parameter restrictions don't support temperature/top_p - exclude them from inference config
|
|
1005
991
|
const cleanedModelOptions = removeUndefinedValues({
|
|
1006
992
|
maxTokens: model_options.max_tokens,
|
|
1007
|
-
|
|
1008
|
-
|
|
993
|
+
...(hasSamplingRestriction ? {} : {
|
|
994
|
+
temperature: model_options.temperature,
|
|
995
|
+
topP: model_options.temperature != null ? undefined : model_options.top_p,
|
|
996
|
+
}),
|
|
1009
997
|
stopSequences: model_options.stop_sequence,
|
|
1010
998
|
} satisfies InferenceConfiguration);
|
|
1011
999
|
|
|
@@ -1093,8 +1081,8 @@ export class BedrockDriver extends AbstractDriver<BedrockDriverOptions, BedrockP
|
|
|
1093
1081
|
}
|
|
1094
1082
|
|
|
1095
1083
|
async requestImageGeneration(prompt: NovaMessagesPrompt, options: ExecutionOptions): Promise<Completion> {
|
|
1096
|
-
if (options.model_options?._option_id !== "bedrock-nova-canvas") {
|
|
1097
|
-
this.logger.
|
|
1084
|
+
if (options.model_options?._option_id !== undefined && options.model_options?._option_id !== "bedrock-nova-canvas") {
|
|
1085
|
+
this.logger.debug({ options: options.model_options }, "Unexpected option id");
|
|
1098
1086
|
}
|
|
1099
1087
|
const model_options = options.model_options as NovaCanvasOptions;
|
|
1100
1088
|
|
|
@@ -1753,9 +1741,9 @@ function formatAmazonModalities(modalities: ModelModality[]): string[] {
|
|
|
1753
1741
|
standardizedModalities.push("image");
|
|
1754
1742
|
} else if (modality === ModelModality.EMBEDDING) {
|
|
1755
1743
|
standardizedModalities.push("embedding");
|
|
1756
|
-
} else if (modality
|
|
1744
|
+
} else if (modality === "SPEECH") {
|
|
1757
1745
|
standardizedModalities.push("audio");
|
|
1758
|
-
} else if (modality
|
|
1746
|
+
} else if (modality === "VIDEO") {
|
|
1759
1747
|
standardizedModalities.push("video");
|
|
1760
1748
|
} else {
|
|
1761
1749
|
// Handle other modalities as needed
|
package/src/groq/index.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AbstractDriver, AIModel, Completion, CompletionChunkObject, DriverOptions, EmbeddingsOptions, EmbeddingsResult, ExecutionOptions, PromptSegment, TextFallbackOptions, ToolDefinition, ToolUse } from "@llumiverse/core";
|
|
2
2
|
import { transformAsyncIterator } from "@llumiverse/core/async";
|
|
3
|
-
import { formatOpenAILikeMultimodalPrompt } from "../openai/openai_format.js";
|
|
4
|
-
|
|
5
3
|
import Groq from "groq-sdk";
|
|
6
|
-
import type OpenAI from "openai";
|
|
7
4
|
import type { ChatCompletionMessageParam, ChatCompletionTool } from "groq-sdk/resources/chat/completions";
|
|
8
5
|
import type { FunctionParameters } from "groq-sdk/resources/shared";
|
|
6
|
+
import type OpenAI from "openai";
|
|
7
|
+
import { formatOpenAILikeMultimodalPrompt } from "../openai/openai_format.js";
|
|
9
8
|
|
|
10
9
|
type ResponseInputItem = OpenAI.Responses.ResponseInputItem;
|
|
11
10
|
type EasyInputMessage = OpenAI.Responses.EasyInputMessage;
|
|
@@ -107,8 +106,10 @@ export class GroqDriver extends AbstractDriver<GroqDriverOptions, ChatCompletion
|
|
|
107
106
|
}
|
|
108
107
|
|
|
109
108
|
async requestTextCompletion(messages: ChatCompletionMessageParam[], options: ExecutionOptions): Promise<Completion> {
|
|
110
|
-
if (options.model_options?._option_id !==
|
|
111
|
-
|
|
109
|
+
if (options.model_options?._option_id !== undefined &&
|
|
110
|
+
options.model_options?._option_id !== "text-fallback" &&
|
|
111
|
+
options.model_options?._option_id !== "groq-deepseek-thinking") {
|
|
112
|
+
this.logger.debug({ options: options.model_options }, "Unexpected option id");
|
|
112
113
|
}
|
|
113
114
|
options.model_options = options.model_options as TextFallbackOptions;
|
|
114
115
|
|
|
@@ -163,8 +164,8 @@ export class GroqDriver extends AbstractDriver<GroqDriverOptions, ChatCompletion
|
|
|
163
164
|
}
|
|
164
165
|
|
|
165
166
|
async requestTextCompletionStream(messages: ChatCompletionMessageParam[], options: ExecutionOptions): Promise<AsyncIterable<CompletionChunkObject>> {
|
|
166
|
-
if (options.model_options?._option_id !== "text-fallback") {
|
|
167
|
-
this.logger.
|
|
167
|
+
if (options.model_options?._option_id !== undefined && options.model_options?._option_id !== "text-fallback") {
|
|
168
|
+
this.logger.debug({ options: options.model_options }, "Unexpected option id");
|
|
168
169
|
}
|
|
169
170
|
options.model_options = options.model_options as TextFallbackOptions;
|
|
170
171
|
|
package/src/huggingface_ie.ts
CHANGED
|
@@ -3,9 +3,9 @@ import {
|
|
|
3
3
|
TextGenerationStreamOutput,
|
|
4
4
|
} from "@huggingface/inference";
|
|
5
5
|
import {
|
|
6
|
+
AbstractDriver,
|
|
6
7
|
AIModel,
|
|
7
8
|
AIModelStatus,
|
|
8
|
-
AbstractDriver,
|
|
9
9
|
CompletionChunkObject,
|
|
10
10
|
DriverOptions,
|
|
11
11
|
EmbeddingsResult,
|
|
@@ -68,8 +68,8 @@ export class HuggingFaceIEDriver extends AbstractDriver<HuggingFaceIEDriverOptio
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
async requestTextCompletionStream(prompt: string, options: ExecutionOptions) {
|
|
71
|
-
if (options.model_options?._option_id !== "text-fallback") {
|
|
72
|
-
this.logger.
|
|
71
|
+
if (options.model_options?._option_id !== undefined && options.model_options?._option_id !== "text-fallback") {
|
|
72
|
+
this.logger.debug({ options: options.model_options }, "Unexpected option id");
|
|
73
73
|
}
|
|
74
74
|
options.model_options = options.model_options as TextFallbackOptions;
|
|
75
75
|
|
|
@@ -100,8 +100,8 @@ export class HuggingFaceIEDriver extends AbstractDriver<HuggingFaceIEDriverOptio
|
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
async requestTextCompletion(prompt: string, options: ExecutionOptions) {
|
|
103
|
-
if (options.model_options?._option_id !== "text-fallback") {
|
|
104
|
-
this.logger.
|
|
103
|
+
if (options.model_options?._option_id !== undefined && options.model_options?._option_id !== "text-fallback") {
|
|
104
|
+
this.logger.debug({ options: options.model_options }, "Unexpected option id");
|
|
105
105
|
}
|
|
106
106
|
options.model_options = options.model_options as TextFallbackOptions;
|
|
107
107
|
|
package/src/mistral/index.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AbstractDriver, AIModel, Completion, CompletionChunkObject, DriverOptions, EmbeddingsOptions, EmbeddingsResult, ExecutionOptions, PromptSegment, TextFallbackOptions } from "@llumiverse/core";
|
|
2
2
|
import { transformSSEStream } from "@llumiverse/core/async";
|
|
3
3
|
import { getJSONSafetyNotice } from "@llumiverse/core/formatters";
|
|
4
|
-
import { formatOpenAILikeTextPrompt, OpenAITextMessage } from "../openai/openai_format.js";
|
|
5
4
|
import { FetchClient } from "@vertesia/api-fetch-client";
|
|
5
|
+
import { formatOpenAILikeTextPrompt, OpenAITextMessage } from "../openai/openai_format.js";
|
|
6
6
|
import { ChatCompletionResponse, CompletionRequestParams, ListModelsResponse, ResponseFormat } from "./types.js";
|
|
7
7
|
|
|
8
8
|
//TODO retry on 429
|
|
@@ -63,8 +63,8 @@ export class MistralAIDriver extends AbstractDriver<MistralAIDriverOptions, Open
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
async requestTextCompletion(messages: OpenAITextMessage[], options: ExecutionOptions): Promise<Completion> {
|
|
66
|
-
if (options.model_options?._option_id !== "text-fallback") {
|
|
67
|
-
this.logger.
|
|
66
|
+
if (options.model_options?._option_id !== undefined && options.model_options?._option_id !== "text-fallback") {
|
|
67
|
+
this.logger.debug({ options: options.model_options }, "Unexpected option id");
|
|
68
68
|
}
|
|
69
69
|
options.model_options = options.model_options as TextFallbackOptions;
|
|
70
70
|
|
|
@@ -97,8 +97,8 @@ export class MistralAIDriver extends AbstractDriver<MistralAIDriverOptions, Open
|
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
async requestTextCompletionStream(messages: OpenAITextMessage[], options: ExecutionOptions): Promise<AsyncIterable<CompletionChunkObject>> {
|
|
100
|
-
if (options.model_options?._option_id !== "text-fallback") {
|
|
101
|
-
this.logger.
|
|
100
|
+
if (options.model_options?._option_id !== undefined && options.model_options?._option_id !== "text-fallback") {
|
|
101
|
+
this.logger.debug({ options: options.model_options }, "Unexpected option id");
|
|
102
102
|
}
|
|
103
103
|
options.model_options = options.model_options as TextFallbackOptions;
|
|
104
104
|
|