mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-14 18:51:04 +00:00
43 lines
1.2 KiB
TypeScript
43 lines
1.2 KiB
TypeScript
export {
|
|
ANTHROPIC_VERTEX_DEFAULT_MODEL_ID,
|
|
buildAnthropicVertexProvider,
|
|
} from "./provider-catalog.js";
|
|
export {
|
|
hasAnthropicVertexAvailableAuth,
|
|
hasAnthropicVertexCredentials,
|
|
resolveAnthropicVertexClientRegion,
|
|
resolveAnthropicVertexConfigApiKey,
|
|
resolveAnthropicVertexProjectId,
|
|
resolveAnthropicVertexRegion,
|
|
resolveAnthropicVertexRegionFromBaseUrl,
|
|
} from "./region.js";
|
|
import { buildAnthropicVertexProvider } from "./provider-catalog.js";
|
|
import { hasAnthropicVertexAvailableAuth } from "./region.js";
|
|
|
|
export function mergeImplicitAnthropicVertexProvider(params: {
|
|
existing?: ReturnType<typeof buildAnthropicVertexProvider>;
|
|
implicit: ReturnType<typeof buildAnthropicVertexProvider>;
|
|
}) {
|
|
const { existing, implicit } = params;
|
|
if (!existing) {
|
|
return implicit;
|
|
}
|
|
return {
|
|
...implicit,
|
|
...existing,
|
|
models:
|
|
Array.isArray(existing.models) && existing.models.length > 0
|
|
? existing.models
|
|
: implicit.models,
|
|
};
|
|
}
|
|
|
|
export function resolveImplicitAnthropicVertexProvider(params?: { env?: NodeJS.ProcessEnv }) {
|
|
const env = params?.env ?? process.env;
|
|
if (!hasAnthropicVertexAvailableAuth(env)) {
|
|
return null;
|
|
}
|
|
|
|
return buildAnthropicVertexProvider({ env });
|
|
}
|