@llumiverse/common 0.20.0 → 0.22.0-dev.1
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/capability/azure_foundry.js +159 -0
- package/lib/cjs/capability/azure_foundry.js.map +1 -0
- package/lib/cjs/capability/bedrock.js +5 -2
- package/lib/cjs/capability/bedrock.js.map +1 -1
- package/lib/cjs/capability/openai.js +2 -0
- package/lib/cjs/capability/openai.js.map +1 -1
- package/lib/cjs/capability/vertexai.js +1 -0
- package/lib/cjs/capability/vertexai.js.map +1 -1
- package/lib/cjs/capability.js +15 -3
- package/lib/cjs/capability.js.map +1 -1
- package/lib/cjs/options/azure_foundry.js +428 -0
- package/lib/cjs/options/azure_foundry.js.map +1 -0
- package/lib/cjs/options/bedrock.js +26 -0
- package/lib/cjs/options/bedrock.js.map +1 -1
- package/lib/cjs/options/openai.js +3 -0
- package/lib/cjs/options/openai.js.map +1 -1
- package/lib/cjs/options/vertexai.js +49 -2
- package/lib/cjs/options/vertexai.js.map +1 -1
- package/lib/cjs/options.js +16 -9
- package/lib/cjs/options.js.map +1 -1
- package/lib/cjs/types.js +146 -1
- package/lib/cjs/types.js.map +1 -1
- package/lib/esm/capability/azure_foundry.js +156 -0
- package/lib/esm/capability/azure_foundry.js.map +1 -0
- package/lib/esm/capability/bedrock.js +5 -2
- package/lib/esm/capability/bedrock.js.map +1 -1
- package/lib/esm/capability/openai.js +2 -0
- package/lib/esm/capability/openai.js.map +1 -1
- package/lib/esm/capability/vertexai.js +1 -0
- package/lib/esm/capability/vertexai.js.map +1 -1
- package/lib/esm/capability.js +15 -3
- package/lib/esm/capability.js.map +1 -1
- package/lib/esm/options/azure_foundry.js +424 -0
- package/lib/esm/options/azure_foundry.js.map +1 -0
- package/lib/esm/options/bedrock.js +26 -0
- package/lib/esm/options/bedrock.js.map +1 -1
- package/lib/esm/options/openai.js +3 -0
- package/lib/esm/options/openai.js.map +1 -1
- package/lib/esm/options/vertexai.js +49 -2
- package/lib/esm/options/vertexai.js.map +1 -1
- package/lib/esm/options.js +16 -9
- package/lib/esm/options.js.map +1 -1
- package/lib/esm/types.js +142 -0
- package/lib/esm/types.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -0
- package/lib/types/capability/azure_foundry.d.ts +7 -0
- package/lib/types/capability/azure_foundry.d.ts.map +1 -0
- package/lib/types/capability/bedrock.d.ts.map +1 -1
- package/lib/types/capability/openai.d.ts.map +1 -1
- package/lib/types/capability/vertexai.d.ts.map +1 -1
- package/lib/types/capability.d.ts +3 -3
- package/lib/types/capability.d.ts.map +1 -1
- package/lib/types/options/azure_foundry.d.ts +52 -0
- package/lib/types/options/azure_foundry.d.ts.map +1 -0
- package/lib/types/options/bedrock.d.ts +8 -2
- package/lib/types/options/bedrock.d.ts.map +1 -1
- package/lib/types/options/openai.d.ts.map +1 -1
- package/lib/types/options/vertexai.d.ts.map +1 -1
- package/lib/types/options.d.ts +2 -2
- package/lib/types/options.d.ts.map +1 -1
- package/lib/types/types.d.ts +60 -10
- package/lib/types/types.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/capability/azure_foundry.ts +180 -0
- package/src/capability/bedrock.ts +5 -2
- package/src/capability/openai.ts +2 -0
- package/src/capability/vertexai.ts +1 -0
- package/src/capability.ts +18 -7
- package/src/options/azure_foundry.ts +488 -0
- package/src/options/bedrock.ts +36 -2
- package/src/options/openai.ts +3 -0
- package/src/options/vertexai.ts +53 -6
- package/src/options.ts +17 -11
- package/src/types.ts +193 -17
package/lib/types/types.d.ts
CHANGED
|
@@ -3,6 +3,28 @@ import { TextFallbackOptions } from './options/fallback.js';
|
|
|
3
3
|
import { GroqOptions } from './options/groq.js';
|
|
4
4
|
import { OpenAiOptions } from './options/openai.js';
|
|
5
5
|
import { VertexAIOptions } from './options/vertexai.js';
|
|
6
|
+
export declare enum Providers {
|
|
7
|
+
openai = "openai",
|
|
8
|
+
azure_openai = "azure_openai",
|
|
9
|
+
azure_foundry = "azure_foundry",
|
|
10
|
+
huggingface_ie = "huggingface_ie",
|
|
11
|
+
replicate = "replicate",
|
|
12
|
+
bedrock = "bedrock",
|
|
13
|
+
vertexai = "vertexai",
|
|
14
|
+
togetherai = "togetherai",
|
|
15
|
+
mistralai = "mistralai",
|
|
16
|
+
groq = "groq",
|
|
17
|
+
watsonx = "watsonx"
|
|
18
|
+
}
|
|
19
|
+
export interface ProviderParams {
|
|
20
|
+
id: Providers;
|
|
21
|
+
name: string;
|
|
22
|
+
requiresApiKey: boolean;
|
|
23
|
+
requiresEndpointUrl: boolean;
|
|
24
|
+
endpointPlaceholder?: string;
|
|
25
|
+
supportSearch?: boolean;
|
|
26
|
+
}
|
|
27
|
+
export declare const ProviderList: Record<Providers, ProviderParams>;
|
|
6
28
|
export interface EmbeddingsOptions {
|
|
7
29
|
/**
|
|
8
30
|
* The text to generate the embeddings for. One of text or image is required.
|
|
@@ -34,14 +56,45 @@ export interface EmbeddingsResult {
|
|
|
34
56
|
export interface ResultValidationError {
|
|
35
57
|
code: 'validation_error' | 'json_error' | 'content_policy_violation';
|
|
36
58
|
message: string;
|
|
37
|
-
data?:
|
|
59
|
+
data?: CompletionResult[];
|
|
60
|
+
}
|
|
61
|
+
export interface BaseResult {
|
|
62
|
+
type: "text" | "json" | "image";
|
|
63
|
+
value: any;
|
|
64
|
+
}
|
|
65
|
+
export interface TextResult extends BaseResult {
|
|
66
|
+
type: "text";
|
|
67
|
+
value: string;
|
|
38
68
|
}
|
|
39
|
-
export interface
|
|
40
|
-
|
|
69
|
+
export interface JsonResult extends BaseResult {
|
|
70
|
+
type: "json";
|
|
71
|
+
}
|
|
72
|
+
export interface ImageResult extends BaseResult {
|
|
73
|
+
type: "image";
|
|
74
|
+
value: string;
|
|
75
|
+
}
|
|
76
|
+
export type CompletionResult = TextResult | JsonResult | ImageResult;
|
|
77
|
+
/**
|
|
78
|
+
* Output as string
|
|
79
|
+
*/
|
|
80
|
+
export declare function completionResultToString(result: CompletionResult): string;
|
|
81
|
+
/**
|
|
82
|
+
* Output as JSON, only handles the first JSON result or tries to parse text as JSON
|
|
83
|
+
* Expects the text to be pure JSON if no JSON result is found
|
|
84
|
+
* Throws if no JSON result is found or if parsing fails
|
|
85
|
+
*/
|
|
86
|
+
export declare function parseCompletionResultsToJson(results: CompletionResult[]): any;
|
|
87
|
+
/**
|
|
88
|
+
* Output as JSON if possible, otherwise as concatenated text
|
|
89
|
+
* Joins text results with the specified separator, default is empty string
|
|
90
|
+
* If multiple JSON results are found only the first one is returned
|
|
91
|
+
*/
|
|
92
|
+
export declare function parseCompletionResults(result: CompletionResult[], separator?: string): any;
|
|
93
|
+
export interface CompletionChunkObject {
|
|
94
|
+
result: CompletionResult[];
|
|
41
95
|
token_usage?: ExecutionTokenUsage;
|
|
42
96
|
finish_reason?: "stop" | "length" | string;
|
|
43
97
|
}
|
|
44
|
-
export type CompletionChunk = CompletionChunkObject | string;
|
|
45
98
|
export interface ToolDefinition {
|
|
46
99
|
name: string;
|
|
47
100
|
description?: string;
|
|
@@ -60,8 +113,8 @@ export interface ToolUse<ParamsT = JSONObject> {
|
|
|
60
113
|
tool_name: string;
|
|
61
114
|
tool_input: ParamsT | null;
|
|
62
115
|
}
|
|
63
|
-
export interface Completion
|
|
64
|
-
result:
|
|
116
|
+
export interface Completion {
|
|
117
|
+
result: CompletionResult[];
|
|
65
118
|
token_usage?: ExecutionTokenUsage;
|
|
66
119
|
/**
|
|
67
120
|
* Contains the tools from which the model awaits information.
|
|
@@ -85,9 +138,6 @@ export interface Completion<ResultT = any> {
|
|
|
85
138
|
*/
|
|
86
139
|
conversation?: unknown;
|
|
87
140
|
}
|
|
88
|
-
export interface ImageGeneration {
|
|
89
|
-
images?: string[];
|
|
90
|
-
}
|
|
91
141
|
export interface ExecutionResponse<PromptT = any> extends Completion {
|
|
92
142
|
prompt: PromptT;
|
|
93
143
|
/**
|
|
@@ -328,7 +378,7 @@ export interface TrainingOptions {
|
|
|
328
378
|
}
|
|
329
379
|
export interface TrainingPromptOptions {
|
|
330
380
|
segments: PromptSegment[];
|
|
331
|
-
completion:
|
|
381
|
+
completion: CompletionResult[];
|
|
332
382
|
model: string;
|
|
333
383
|
schema?: JSONSchema;
|
|
334
384
|
}
|
package/lib/types/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAIxD,oBAAY,SAAS;IACjB,MAAM,WAAW;IACjB,YAAY,iBAAiB;IAC7B,aAAa,kBAAkB;IAC/B,cAAc,mBAAmB;IACjC,SAAS,cAAc;IACvB,OAAO,YAAY;IACnB,QAAQ,aAAa;IACrB,UAAU,eAAe;IACzB,SAAS,cAAc;IACvB,IAAI,SAAS;IACb,OAAO,YAAY;CACtB;AAED,MAAM,WAAW,cAAc;IAC3B,EAAE,EAAE,SAAS,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,OAAO,CAAC;IACxB,mBAAmB,EAAE,OAAO,CAAC;IA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CAAC;CACvB;AAED,MAAM,WAAW,qBAAqB;IAClC,QAAQ,EAAE,aAAa,EAAE,CAAC;IAC1B,UAAU,EAAE,gBAAgB,EAAE,CAAA;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,UAAU,CAAC;CACvB;AAED,oBAAY,iBAAiB;IACzB,OAAO,YAAY;IACnB,SAAS,cAAc;IACvB,MAAM,WAAW;IACjB,SAAS,cAAc;CAC1B;AAED,MAAM,WAAW,WAAW;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,iBAAiB,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;AAC7D,MAAM,MAAM,SAAS,GAAG,SAAS,EAAE,CAAC;AACpC,MAAM,MAAM,UAAU,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC;AACtD,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,UAAU,CAAC;AACnD,MAAM,MAAM,SAAS,GAAG,aAAa,GAAG,aAAa,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@llumiverse/common",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.0-dev.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Public types, enums and options used by Llumiverse API.",
|
|
6
6
|
"files": [
|
|
@@ -63,11 +63,11 @@
|
|
|
63
63
|
"url": "git+ssh://git@github.com/vertesia/llumiverse.git"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
|
-
"rimraf": "^6.0.
|
|
66
|
+
"rimraf": "^6.0.1",
|
|
67
67
|
"ts-dual-module": "^0.6.3",
|
|
68
|
-
"typescript": "^5.
|
|
69
|
-
"vitest": "^3.
|
|
70
|
-
"@types/node": "^22.
|
|
68
|
+
"typescript": "^5.9.2",
|
|
69
|
+
"vitest": "^3.2.4",
|
|
70
|
+
"@types/node": "^22.18.6"
|
|
71
71
|
},
|
|
72
72
|
"dependencies": {},
|
|
73
73
|
"ts_dual_module": {
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { ModelModalities, ModelCapabilities } from "../types.js";
|
|
2
|
+
|
|
3
|
+
// Global feature flags - temporarily disable tool support for non-OpenAI models
|
|
4
|
+
const ENABLE_TOOL_SUPPORT_NON_OPENAI = false;
|
|
5
|
+
|
|
6
|
+
// Record of Azure Foundry model capabilities keyed by model ID (lowercased)
|
|
7
|
+
// Only include models with specific exceptions that differ from their family patterns
|
|
8
|
+
const RECORD_MODEL_CAPABILITIES: Record<string, ModelCapabilities> = {
|
|
9
|
+
// OpenAI O-series exceptions - o1-mini doesn't have tool support like other o1 models
|
|
10
|
+
"o1-mini": { input: { text: true, image: true, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: false, tool_support_streaming: false },
|
|
11
|
+
// OpenAI o3 is text-only unlike other o-series models
|
|
12
|
+
"o3": { input: { text: true, image: false, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: true, tool_support_streaming: false },
|
|
13
|
+
|
|
14
|
+
// Models with special properties not covered by family patterns
|
|
15
|
+
"deepseek-r1-0528": { input: { text: true, image: false, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: false, tool_support_streaming: false },
|
|
16
|
+
"deepseek-v3-0324": { input: { text: true, image: false, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: false, tool_support_streaming: false },
|
|
17
|
+
"mistral-medium-2505": { input: { text: true, image: false, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: false, tool_support_streaming: false },
|
|
18
|
+
"mistral-nemo": { input: { text: true, image: false, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: false, tool_support_streaming: false },
|
|
19
|
+
"llama-4-scout-17b-16e-instruct": { input: { text: true, image: true, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: false, tool_support_streaming: false },
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
// Populate RECORD_FAMILY_CAPABILITIES as a const record (lowest common denominator for each family)
|
|
23
|
+
const RECORD_FAMILY_CAPABILITIES: Record<string, ModelCapabilities> = {
|
|
24
|
+
// OpenAI GPT families
|
|
25
|
+
"gpt-3.5-turbo": { input: { text: true, image: false, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: false, tool_support_streaming: false },
|
|
26
|
+
"gpt-35-turbo": { input: { text: true, image: false, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: false, tool_support_streaming: false },
|
|
27
|
+
"gpt-35": { input: { text: true, image: false, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: false, tool_support_streaming: false },
|
|
28
|
+
"gpt-4": { input: { text: true, image: true, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: true, tool_support_streaming: true },
|
|
29
|
+
"gpt-4.1": { input: { text: true, image: true, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: true, tool_support_streaming: true },
|
|
30
|
+
"gpt-4.5": { input: { text: true, image: true, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: true, tool_support_streaming: true },
|
|
31
|
+
"gpt-4o": { input: { text: true, image: true, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: true, tool_support_streaming: true },
|
|
32
|
+
"gpt": { input: { text: true, image: true, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: true, tool_support_streaming: true},
|
|
33
|
+
|
|
34
|
+
// OpenAI O-series families
|
|
35
|
+
"o1": { input: { text: true, image: true, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: true, tool_support_streaming: false },
|
|
36
|
+
"o1-preview": { input: { text: true, image: true, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: true, tool_support_streaming: false },
|
|
37
|
+
"o1-pro": { input: { text: true, image: true, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: true, tool_support_streaming: false },
|
|
38
|
+
"o3-mini": { input: { text: true, image: true, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: true, tool_support_streaming: false },
|
|
39
|
+
"o4-mini": { input: { text: true, image: true, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: true, tool_support_streaming: false },
|
|
40
|
+
"o4": { input: { text: true, image: true, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: true, tool_support_streaming: false },
|
|
41
|
+
|
|
42
|
+
// Llama families
|
|
43
|
+
"llama-3.1": { input: { text: true, image: false, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: true, tool_support_streaming: false },
|
|
44
|
+
"llama-3.2": { input: { text: true, image: true, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: false, tool_support_streaming: false },
|
|
45
|
+
"llama-3.3": { input: { text: true, image: false, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: true, tool_support_streaming: false },
|
|
46
|
+
"llama-3": { input: { text: true, image: false, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: true, tool_support_streaming: false },
|
|
47
|
+
"llama-4": { input: { text: true, image: true, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: false, tool_support_streaming: false },
|
|
48
|
+
"llama": { input: { text: true, image: false, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: false, tool_support_streaming: false },
|
|
49
|
+
|
|
50
|
+
// Mistral families
|
|
51
|
+
"mistral-large": { input: { text: true, image: false, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: true, tool_support_streaming: false },
|
|
52
|
+
"mistral-small": { input: { text: true, image: false, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: true, tool_support_streaming: false },
|
|
53
|
+
"mistral": { input: { text: true, image: false, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: false, tool_support_streaming: false },
|
|
54
|
+
|
|
55
|
+
// Microsoft Phi families
|
|
56
|
+
"phi-4": { input: { text: true, image: false, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: false, tool_support_streaming: false },
|
|
57
|
+
"phi": { input: { text: true, image: false, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: false, tool_support_streaming: false },
|
|
58
|
+
|
|
59
|
+
// DeepSeek families
|
|
60
|
+
"deepseek-r1": { input: { text: true, image: false, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: false, tool_support_streaming: false },
|
|
61
|
+
"deepseek-v3": { input: { text: true, image: false, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: true, tool_support_streaming: false },
|
|
62
|
+
"deepseek": { input: { text: true, image: false, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: false, tool_support_streaming: false },
|
|
63
|
+
|
|
64
|
+
// AI21 families
|
|
65
|
+
"ai21-jamba": { input: { text: true, image: false, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: true, tool_support_streaming: true },
|
|
66
|
+
"ai21": { input: { text: true, image: false, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: true, tool_support_streaming: true },
|
|
67
|
+
"jamba": { input: { text: true, image: false, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: true, tool_support_streaming: true },
|
|
68
|
+
|
|
69
|
+
// Cohere families
|
|
70
|
+
"cohere-command": { input: { text: true, image: false, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: true, tool_support_streaming: true },
|
|
71
|
+
"cohere": { input: { text: true, image: false, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: true, tool_support_streaming: true },
|
|
72
|
+
"command": { input: { text: true, image: false, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: true, tool_support_streaming: true },
|
|
73
|
+
|
|
74
|
+
// xAI families
|
|
75
|
+
"grok-3": { input: { text: true, image: false, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: true, tool_support_streaming: true },
|
|
76
|
+
"grok": { input: { text: true, image: false, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: true, tool_support_streaming: true }
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
// Fallback pattern lists for inferring modalities and tool support
|
|
80
|
+
const IMAGE_INPUT_MODELS = ["image", "vision"];
|
|
81
|
+
const VIDEO_INPUT_MODELS = ["video"];
|
|
82
|
+
const AUDIO_INPUT_MODELS = ["audio"];
|
|
83
|
+
const TEXT_INPUT_MODELS = ["text"];
|
|
84
|
+
const IMAGE_OUTPUT_MODELS = ["image"];
|
|
85
|
+
const VIDEO_OUTPUT_MODELS = ["video"];
|
|
86
|
+
const AUDIO_OUTPUT_MODELS = ["audio"];
|
|
87
|
+
const TEXT_OUTPUT_MODELS = ["text"];
|
|
88
|
+
const EMBEDDING_OUTPUT_MODELS = ["embed"];
|
|
89
|
+
const TOOL_SUPPORT_MODELS = ["tool", "gpt-4", "gpt-4o", "o1", "o3", "o4", "llama-3", "mistral-large", "mistral-small", "jamba", "cohere", "command", "grok"];
|
|
90
|
+
|
|
91
|
+
function modelMatches(modelName: string, patterns: string[]): boolean {
|
|
92
|
+
return patterns.some(pattern => modelName.includes(pattern));
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Get the full ModelCapabilities for an Azure Foundry model.
|
|
97
|
+
* Checks RECORD_MODEL_CAPABILITIES first, then falls back to family pattern matching.
|
|
98
|
+
*/
|
|
99
|
+
export function getModelCapabilitiesAzureFoundry(model: string): ModelCapabilities {
|
|
100
|
+
// Extract base model from composite ID (deployment::baseModel)
|
|
101
|
+
const { baseModel } = parseAzureFoundryModelId(model);
|
|
102
|
+
const normalized = baseModel.toLowerCase();
|
|
103
|
+
|
|
104
|
+
// 1. Exact match in record
|
|
105
|
+
const record = RECORD_MODEL_CAPABILITIES[normalized];
|
|
106
|
+
if (record) {
|
|
107
|
+
return applyGlobalToolSupportDisable(record, normalized);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// 2. Fallback: find the longest matching family prefix in RECORD_FAMILY_CAPABILITIES
|
|
111
|
+
let bestFamilyKey = undefined;
|
|
112
|
+
let bestFamilyLength = 0;
|
|
113
|
+
for (const key of Object.keys(RECORD_FAMILY_CAPABILITIES)) {
|
|
114
|
+
if (normalized.startsWith(key) && key.length > bestFamilyLength) {
|
|
115
|
+
bestFamilyKey = key;
|
|
116
|
+
bestFamilyLength = key.length;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
if (bestFamilyKey) {
|
|
120
|
+
return applyGlobalToolSupportDisable(RECORD_FAMILY_CAPABILITIES[bestFamilyKey], normalized);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// 3. Fallback: infer from normalized name using patterns
|
|
124
|
+
const input: ModelModalities = {
|
|
125
|
+
text: modelMatches(normalized, TEXT_INPUT_MODELS) || true, // Default to text input
|
|
126
|
+
image: modelMatches(normalized, IMAGE_INPUT_MODELS) || undefined,
|
|
127
|
+
video: modelMatches(normalized, VIDEO_INPUT_MODELS) || undefined,
|
|
128
|
+
audio: modelMatches(normalized, AUDIO_INPUT_MODELS) || undefined,
|
|
129
|
+
embed: false
|
|
130
|
+
};
|
|
131
|
+
const output: ModelModalities = {
|
|
132
|
+
text: modelMatches(normalized, TEXT_OUTPUT_MODELS) || true, // Default to text output
|
|
133
|
+
image: modelMatches(normalized, IMAGE_OUTPUT_MODELS) || undefined,
|
|
134
|
+
video: modelMatches(normalized, VIDEO_OUTPUT_MODELS) || undefined,
|
|
135
|
+
audio: modelMatches(normalized, AUDIO_OUTPUT_MODELS) || undefined,
|
|
136
|
+
embed: modelMatches(normalized, EMBEDDING_OUTPUT_MODELS) || undefined
|
|
137
|
+
};
|
|
138
|
+
const tool_support = modelMatches(normalized, TOOL_SUPPORT_MODELS) || undefined;
|
|
139
|
+
const tool_support_streaming = tool_support || undefined;
|
|
140
|
+
|
|
141
|
+
const inferredCapabilities = { input, output, tool_support, tool_support_streaming };
|
|
142
|
+
return applyGlobalToolSupportDisable(inferredCapabilities, normalized);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Apply global tool support disable for non-OpenAI models.
|
|
147
|
+
* Preserves model-specific information for future use while temporarily disabling tool support.
|
|
148
|
+
*/
|
|
149
|
+
function applyGlobalToolSupportDisable(capabilities: ModelCapabilities, modelName: string): ModelCapabilities {
|
|
150
|
+
// Check if this is an OpenAI model
|
|
151
|
+
const isOpenAIModel = modelName.startsWith('gpt-') || modelName.startsWith('o1') || modelName.startsWith('o3') || modelName.startsWith('o4');
|
|
152
|
+
|
|
153
|
+
if (!ENABLE_TOOL_SUPPORT_NON_OPENAI && !isOpenAIModel) {
|
|
154
|
+
// Disable tool support for non-OpenAI models while preserving other capabilities
|
|
155
|
+
return {
|
|
156
|
+
...capabilities,
|
|
157
|
+
tool_support: false,
|
|
158
|
+
tool_support_streaming: false
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
return capabilities;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// Helper function to parse composite model IDs
|
|
166
|
+
function parseAzureFoundryModelId(compositeId: string): { deploymentName: string; baseModel: string } {
|
|
167
|
+
const parts = compositeId.split('::');
|
|
168
|
+
if (parts.length === 2) {
|
|
169
|
+
return {
|
|
170
|
+
deploymentName: parts[0],
|
|
171
|
+
baseModel: parts[1]
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// Backwards compatibility: if no delimiter found, treat as deployment name
|
|
176
|
+
return {
|
|
177
|
+
deploymentName: compositeId,
|
|
178
|
+
baseModel: compositeId
|
|
179
|
+
};
|
|
180
|
+
}
|
|
@@ -36,6 +36,8 @@ const RECORD_MODEL_CAPABILITIES: Record<string, ModelCapabilities> = {
|
|
|
36
36
|
"foundation-model/mistral.mistral-large-2402-v1:0": { input: { text: true, image: false, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: true, tool_support_streaming: false },
|
|
37
37
|
"foundation-model/mistral.mistral-large-2407-v1:0": { input: { text: true, image: false, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: true, tool_support_streaming: false },
|
|
38
38
|
"foundation-model/mistral.mistral-small-2402-v1:0": { input: { text: true, image: false, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: true, tool_support_streaming: false },
|
|
39
|
+
"foundation-model/openai.gpt-oss-20b-1:0": { input: { text: true, image: false, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: false, tool_support_streaming: false },
|
|
40
|
+
"foundation-model/openai.gpt-oss-120b-1:0": { input: { text: true, image: false, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: false, tool_support_streaming: false },
|
|
39
41
|
"inference-profile/us.amazon.nova-lite-v1:0": { input: { text: true, image: true, video: true, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: true, tool_support_streaming: true },
|
|
40
42
|
"inference-profile/us.amazon.nova-micro-v1:0": { input: { text: true, image: false, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: true, tool_support_streaming: true },
|
|
41
43
|
"inference-profile/us.amazon.nova-premier-v1:0": { input: { text: true, image: true, video: true, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: true, tool_support_streaming: true },
|
|
@@ -61,7 +63,7 @@ const RECORD_MODEL_CAPABILITIES: Record<string, ModelCapabilities> = {
|
|
|
61
63
|
"inference-profile/us.meta.llama4-scout-17b-instruct-v1:0": { input: { text: true, image: true, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: false, tool_support_streaming: false },
|
|
62
64
|
"inference-profile/us.mistral.pixtral-large-2502-v1:0": { input: { text: true, image: true, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: true, tool_support_streaming: false },
|
|
63
65
|
"inference-profile/us.writer.palmyra-x4-v1:0": { input: { text: true, image: false, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: true, tool_support_streaming: false },
|
|
64
|
-
"inference-profile/us.writer.palmyra-x5-v1:0": { input: { text: true, image: false, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: true, tool_support_streaming: false }
|
|
66
|
+
"inference-profile/us.writer.palmyra-x5-v1:0": { input: { text: true, image: false, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: true, tool_support_streaming: false },
|
|
65
67
|
};
|
|
66
68
|
|
|
67
69
|
// Populate RECORD_FAMILY_CAPABILITIES as a const record (lowest common denominator for each family)
|
|
@@ -78,6 +80,7 @@ const RECORD_FAMILY_CAPABILITIES: Record<string, ModelCapabilities> = {
|
|
|
78
80
|
"foundation-model/mistral.mistral": { input: { text: true, image: false, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: false, tool_support_streaming: false },
|
|
79
81
|
"foundation-model/mistral.mistral-large": { input: { text: true, image: false, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: true, tool_support_streaming: false },
|
|
80
82
|
"foundation-model/mistral.mixtral": { input: { text: true, image: false, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: false, tool_support_streaming: false },
|
|
83
|
+
"foundation-model/openai.gpt-oss": { input: { text: true, image: false, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: false, tool_support_streaming: false },
|
|
81
84
|
"inference-profile/us.anthropic.claude-3-haiku": { input: { text: true, image: true, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: true, tool_support_streaming: false },
|
|
82
85
|
"inference-profile/us.anthropic.claude-3-5-sonnet": { input: { text: true, image: false, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: true, tool_support_streaming: true },
|
|
83
86
|
"inference-profile/us.anthropic.claude-3-opus": { input: { text: true, image: false, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: true, tool_support_streaming: false },
|
|
@@ -88,7 +91,7 @@ const RECORD_FAMILY_CAPABILITIES: Record<string, ModelCapabilities> = {
|
|
|
88
91
|
"inference-profile/us.meta.llama4-maverick-17b": { input: { text: true, image: false, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: false, tool_support_streaming: false },
|
|
89
92
|
"inference-profile/us.meta.llama4-scout-17b": { input: { text: true, image: false, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: false, tool_support_streaming: false },
|
|
90
93
|
"inference-profile/us.mistral.pixtral": { input: { text: true, image: false, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: true, tool_support_streaming: false },
|
|
91
|
-
"inference-profile/us.writer.palmyra": { input: { text: true, image: false, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: true, tool_support_streaming: false }
|
|
94
|
+
"inference-profile/us.writer.palmyra": { input: { text: true, image: false, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: true, tool_support_streaming: false },
|
|
92
95
|
};
|
|
93
96
|
|
|
94
97
|
/**
|
package/src/capability/openai.ts
CHANGED
|
@@ -53,6 +53,8 @@ const RECORD_MODEL_CAPABILITIES: Record<string, { input: ModelModalities; output
|
|
|
53
53
|
|
|
54
54
|
// Populate RECORD_FAMILY_CAPABILITIES as a const record (lowest common denominator for each family)
|
|
55
55
|
const RECORD_FAMILY_CAPABILITIES: Record<string, { input: ModelModalities; output: ModelModalities; tool_support?: boolean }> = {
|
|
56
|
+
"gpt": { input: { text: true, image: true, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: true },
|
|
57
|
+
"gpt-3.5": { input: { text: true, image: false, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: false },
|
|
56
58
|
"gpt-3.5-turbo": { input: { text: true, image: false, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: false },
|
|
57
59
|
"gpt-4": { input: { text: true, image: true, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: false },
|
|
58
60
|
"gpt-4.1": { input: { text: true, image: true, video: false, audio: false, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: true },
|
|
@@ -26,6 +26,7 @@ const RECORD_FAMILY_CAPABILITIES: Record<string, { input: ModelModalities; outpu
|
|
|
26
26
|
"gemini-1.5": { input: { text: true, image: true, video: true, audio: true, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: true },
|
|
27
27
|
"gemini-2.0": { input: { text: true, image: true, video: true, audio: true, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: true },
|
|
28
28
|
"gemini-2.5": { input: { text: true, image: true, video: true, audio: true, embed: false }, output: { text: true, image: false, video: false, audio: false, embed: false }, tool_support: true },
|
|
29
|
+
"gemini-2.5-flash-image": { input: { text: true, image: true, video: false, audio: false, embed: false }, output: { text: true, image: true, video: false, audio: false, embed: false }, tool_support: false },
|
|
29
30
|
"imagen-3.0-generate": { input: { text: true, image: false, video: false, audio: false, embed: false }, output: { text: false, image: true, video: false, audio: false, embed: false }, tool_support: false },
|
|
30
31
|
"imagen-3.0-fast-generate": { input: { text: true, image: false, video: false, audio: false, embed: false }, output: { text: false, image: true, video: false, audio: false, embed: false }, tool_support: false },
|
|
31
32
|
"imagen-3.0-capability": { input: { text: true, image: true, video: false, audio: false, embed: false }, output: { text: false, image: true, video: false, audio: false, embed: false }, tool_support: false },
|
package/src/capability.ts
CHANGED
|
@@ -1,9 +1,17 @@
|
|
|
1
|
+
import { getModelCapabilitiesAzureFoundry } from "./capability/azure_foundry.js";
|
|
1
2
|
import { getModelCapabilitiesBedrock } from "./capability/bedrock.js";
|
|
2
3
|
import { getModelCapabilitiesOpenAI } from "./capability/openai.js";
|
|
3
4
|
import { getModelCapabilitiesVertexAI } from "./capability/vertexai.js";
|
|
4
|
-
import { ModelCapabilities, ModelModalities } from "./types.js";
|
|
5
|
+
import { ModelCapabilities, ModelModalities, Providers } from "./types.js";
|
|
5
6
|
|
|
6
|
-
export function getModelCapabilities(model: string, provider?: string): ModelCapabilities {
|
|
7
|
+
export function getModelCapabilities(model: string, provider?: string | Providers): ModelCapabilities {
|
|
8
|
+
//Check for locations/<location>/ prefix and remove it
|
|
9
|
+
if (model.startsWith("locations/")) {
|
|
10
|
+
const parts = model.split("/");
|
|
11
|
+
if (parts.length >= 3) {
|
|
12
|
+
model = parts.slice(2).join("/");
|
|
13
|
+
}
|
|
14
|
+
}
|
|
7
15
|
const capabilities = _getModelCapabilities(model, provider);
|
|
8
16
|
// Globally disable audio and video for all models, as we don't support them yet
|
|
9
17
|
// We also do not support tool use while streaming
|
|
@@ -15,14 +23,17 @@ export function getModelCapabilities(model: string, provider?: string): ModelCap
|
|
|
15
23
|
return capabilities;
|
|
16
24
|
}
|
|
17
25
|
|
|
18
|
-
function _getModelCapabilities(model: string, provider?: string): ModelCapabilities {
|
|
26
|
+
function _getModelCapabilities(model: string, provider?: string | Providers): ModelCapabilities {
|
|
19
27
|
switch (provider?.toLowerCase()) {
|
|
20
|
-
case
|
|
28
|
+
case Providers.vertexai:
|
|
21
29
|
return getModelCapabilitiesVertexAI(model);
|
|
22
|
-
case
|
|
30
|
+
case Providers.openai:
|
|
23
31
|
return getModelCapabilitiesOpenAI(model);
|
|
24
|
-
case
|
|
32
|
+
case Providers.bedrock:
|
|
25
33
|
return getModelCapabilitiesBedrock(model);
|
|
34
|
+
case Providers.azure_foundry:
|
|
35
|
+
// Azure Foundry uses OpenAI capabilities
|
|
36
|
+
return getModelCapabilitiesAzureFoundry(model);
|
|
26
37
|
default:
|
|
27
38
|
// Guess the provider based on the model name
|
|
28
39
|
if (model.startsWith("gpt")) {
|
|
@@ -37,7 +48,7 @@ function _getModelCapabilities(model: string, provider?: string): ModelCapabilit
|
|
|
37
48
|
}
|
|
38
49
|
}
|
|
39
50
|
|
|
40
|
-
export function supportsToolUse(model: string, provider?: string, streaming: boolean = false): boolean {
|
|
51
|
+
export function supportsToolUse(model: string, provider?: string | Providers, streaming: boolean = false): boolean {
|
|
41
52
|
const capabilities = getModelCapabilities(model, provider);
|
|
42
53
|
return streaming ? !!capabilities.tool_support_streaming : !!capabilities.tool_support;
|
|
43
54
|
}
|