@pipeline-builder/ai-core
v3.4.79
Published
Shared AI provider registry for Pipeline Builder: lazily initialized SDK wrappers for Anthropic, OpenAI, Google, xAI, and Bedrock used by AI-assisted pipeline and plugin generation.
Maintainers
Keywords
Readme
@pipeline-builder/ai-core
Shared AI provider registry for Pipeline Builder: lazily initialized SDK wrappers for Anthropic, OpenAI, Google, xAI, and Bedrock used by AI-assisted pipeline and plugin generation.
Internal workspace package — consumed by other packages via
workspace:*. ESM only (theaiSDK v6 is ESM-only).
Responsibilities
- Lazily initializes a registry of AI SDK provider wrappers from environment variables — only providers with a configured API key are registered.
- Resolves a Vercel AI SDK
LanguageModelfor a given provider + model, validating against the static provider catalog. - Supports a one-off model created from a caller-supplied API key (not cached in the registry).
- Re-exports the
aiSDK helpers consumers need so they don't add a separate dependency.
Providers and their env vars: Anthropic (ANTHROPIC_API_KEY), OpenAI (OPENAI_API_KEY), Google (GOOGLE_GENERATIVE_AI_API_KEY), xAI (XAI_API_KEY), and Amazon Bedrock (authenticates via the runtime IAM role).
Key exports
| Export | Purpose |
|---|---|
| getAvailableProviders() | Returns provider info for providers with a configured API key |
| getProviderModels(providerId) | Returns the model list for a provider from the static catalog (no env var needed) |
| resolveModel(providerId, modelId) | Returns a LanguageModel from the registry; throws if the provider is unconfigured or the model is unknown |
| createModelWithKey(providerId, modelId, apiKey) | Creates a one-off LanguageModel from a custom key (not cached) |
| ProviderEntry (type) | A registered provider: its info plus a createModel factory |
| LanguageModel (type), generateText, streamText, Output | Re-exported from the ai SDK |
Usage
import { resolveModel, generateText } from '@pipeline-builder/ai-core';
const model = resolveModel('anthropic', 'claude-sonnet-4-20250514');
const { text } = await generateText({ model, prompt: 'Generate a pipeline spec…' });Development
pnpm build # projen build (compile + lint + test + package)
pnpm test # run the Jest test suiteLicense
Apache-2.0. See LICENSE.
