Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 3 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

230 changes: 230 additions & 0 deletions packages/ai-config/providers.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,236 @@
},
"type": "object"
},
"connect": {
"additionalProperties": false,
"properties": {
"baseUrl": {
"type": "string"
},
"customHeaders": {
"additionalProperties": {
"type": "string"
},
"propertyNames": {
"type": "string"
},
"type": "object"
},
"enabled": {
"type": "boolean"
},
"endpoint": {
"type": "string"
},
"endpoints": {
"additionalProperties": {
"type": "string"
},
"propertyNames": {
"enum": [
"anthropic-messages",
"openai-chat",
"openai-responses",
"mlflow-responses",
"bedrock-converse",
"google-generative"
],
"type": "string"
},
"type": "object"
},
"models": {
"additionalProperties": false,
"properties": {
"allow": {
"items": {
"type": "string"
},
"type": "array"
},
"custom": {
"items": {
"additionalProperties": false,
"properties": {
"baseUrl": {
"type": "string"
},
"family": {
"type": "string"
},
"id": {
"minLength": 1,
"type": "string"
},
"maxContextLength": {
"exclusiveMinimum": 0,
"maximum": 9007199254740991,
"type": "integer"
},
"maxInputTokens": {
"exclusiveMinimum": 0,
"maximum": 9007199254740991,
"type": "integer"
},
"maxOutputTokens": {
"exclusiveMinimum": 0,
"maximum": 9007199254740991,
"type": "integer"
},
"name": {
"minLength": 1,
"type": "string"
},
"protocol": {
"enum": [
"anthropic-messages",
"openai-chat",
"openai-responses",
"mlflow-responses",
"bedrock-converse",
"google-generative"
],
"type": "string"
},
"supportedInputMediaTypes": {
"items": {
"type": "string"
},
"type": "array"
},
"supportsImages": {
"type": "boolean"
},
"supportsToolResultImages": {
"type": "boolean"
},
"supportsTools": {
"type": "boolean"
},
"supportsWebSearch": {
"type": "boolean"
},
"thinkingEffortLevels": {
"items": {
"type": "string"
},
"type": "array"
}
},
"required": [
"id",
"name",
"maxContextLength",
"supportsTools",
"supportsImages",
"supportsToolResultImages",
"supportsWebSearch"
],
"type": "object"
},
"type": "array"
},
"deny": {
"items": {
"type": "string"
},
"type": "array"
},
"discovery": {
"enum": [
"auto",
"off"
],
"type": "string"
},
"overrides": {
"additionalProperties": {
"additionalProperties": false,
"properties": {
"baseUrl": {
"type": "string"
},
"family": {
"type": "string"
},
"maxContextLength": {
"exclusiveMinimum": 0,
"maximum": 9007199254740991,
"type": "integer"
},
"maxInputTokens": {
"exclusiveMinimum": 0,
"maximum": 9007199254740991,
"type": "integer"
},
"maxOutputTokens": {
"exclusiveMinimum": 0,
"maximum": 9007199254740991,
"type": "integer"
},
"name": {
"type": "string"
},
"protocol": {
"enum": [
"anthropic-messages",
"openai-chat",
"openai-responses",
"mlflow-responses",
"bedrock-converse",
"google-generative"
],
"type": "string"
},
"supportedInputMediaTypes": {
"items": {
"type": "string"
},
"type": "array"
},
"supportsImages": {
"type": "boolean"
},
"supportsToolResultImages": {
"type": "boolean"
},
"supportsTools": {
"type": "boolean"
},
"supportsWebSearch": {
"type": "boolean"
},
"thinkingEffortLevels": {
"items": {
"type": "string"
},
"type": "array"
}
},
"type": "object"
},
"propertyNames": {
"type": "string"
},
"type": "object"
}
},
"type": "object"
},
"protocol": {
"enum": [
"anthropic-messages",
"openai-chat",
"openai-responses",
"mlflow-responses",
"bedrock-converse",
"google-generative"
],
"type": "string"
}
},
"type": "object"
},
"copilot": {
"additionalProperties": false,
"properties": {
Expand Down
1 change: 1 addition & 0 deletions packages/ai-config/src/build-catalog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ const BUILTIN_CLIENT_KIND = {
databricks: "databricks",
litellm: "litellm",
portkey: "portkey",
connect: "connect",
} as const satisfies Record<BuiltinProviderId, ClientKind>;

/**
Expand Down
3 changes: 3 additions & 0 deletions packages/ai-config/src/connection-env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ const CONNECTION_ENV_MAPPINGS: Partial<Record<BuiltinProviderId, ConnectionEnvMa
// mode, which determines what the stored key *is* — see base-url.ts's
// PORTKEY_HOSTED_BASE_URL and the bridge's resolvePortkeyConnection.
portkey: { baseUrl: "PORTKEY_BASE_URL" },
// The Connect server root URL (NOT a gateway route); integration discovery
// and the per-integration gateway routes are both derived from it.
connect: { baseUrl: "POSIT_CONNECT_URL" },
};

// ---------------------------------------------------------------------------
Expand Down
6 changes: 6 additions & 0 deletions packages/ai-config/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ export type {
// --- Model capability inference ---------------------------------------------
export { getAnthropicModelCapabilities } from "./model-capabilities/anthropic-helpers.js";
export { getBedrockMantleModelCapabilities } from "./model-capabilities/bedrock-mantle-helpers.js";
export {
CONNECT_BEDROCK_MODEL_IDS,
CONNECT_BEDROCK_MODELS,
getConnectBedrockModelCapabilities,
} from "./model-capabilities/connect-helpers.js";
export type { ConnectBedrockModelCapabilities } from "./model-capabilities/connect-helpers.js";
export { getDeepSeekModelCapabilities } from "./model-capabilities/deepseek-helpers.js";
export { inferDatabricksModelProfile } from "./model-capabilities/databricks-helpers.js";
export type {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*---------------------------------------------------------------------------------------------
* Copyright (C) 2026 Posit Software, PBC. All rights reserved.
*--------------------------------------------------------------------------------------------*/

import { describe, expect, it } from "vitest";

import { getAnthropicModelCapabilities } from "../anthropic-helpers.js";
import { getConnectBedrockModelCapabilities } from "../connect-helpers.js";

describe("getConnectBedrockModelCapabilities", () => {
it("borrows limits, family, and media types from the Anthropic-on-Bedrock table", () => {
const id = "us.anthropic.claude-sonnet-4-5-20250929-v1:0";
const claude = getAnthropicModelCapabilities(id)!;

const caps = getConnectBedrockModelCapabilities(id);

expect(caps.family).toBe(claude.family);
expect(caps.family).toBeDefined();
expect(caps.maxContextLength).toBe(claude.maxContextLength);
expect(caps.maxOutputTokens).toBe(claude.maxOutputTokens);
expect(caps.maxInputTokens).toBe(caps.maxContextLength - caps.maxOutputTokens);
expect(caps.supportedInputMediaTypes).toEqual(claude.supportedInputMediaTypes);
expect(caps).toMatchObject({
supportsTools: true,
supportsImages: true,
supportsToolResultImages: true,
supportsWebSearch: false,
});
});

it("falls back to conservative limits and image flags for an id the Anthropic table cannot answer", () => {
const caps = getConnectBedrockModelCapabilities("mistral.mistral-large-2407-v1:0");

expect(caps.family).toBeUndefined();
expect(caps.thinkingEffortLevels).toBeUndefined();
expect(caps.supportedInputMediaTypes).toBeUndefined();
expect(caps.maxContextLength).toBe(200_000);
expect(caps.maxOutputTokens).toBe(4_096);
expect(caps.maxInputTokens).toBe(caps.maxContextLength - caps.maxOutputTokens);
// Vision is not the norm across Bedrock chat models; over-reporting it
// produces hard API errors, so unknown ids must not claim image support.
expect(caps.supportsImages).toBe(false);
expect(caps.supportsToolResultImages).toBe(false);
expect(caps.supportsTools).toBe(true);
});
});
Loading