本页还没有译文
本页 25 段还没译成日本語,下面显示的是英文原文。SAP AI Core
还没翻译译自英文(ai-sdk.dev)本页 25 段都还没译
jerome-benoit/sap-ai-provider is a community provider for SAP AI Core built on the official @sap-ai-sdk/orchestration and @sap-ai-sdk/foundation-models packages.
Two npm packages are published from this repository:
@jerome-benoit/sap-ai-provider- Language Model V4 for AI SDK 5.x & 6.x (recommended)@jerome-benoit/sap-ai-provider-v2- Language Model V2 for AI SDK 5.x
Features
Both providers offer:
- Dual API Support: Choose between Orchestration API (with data masking, content filtering, document grounding, translation) or Foundation Models API (
logprobs,seed,dataSources) - Tool calling and multi-modal input (images)
- Streaming support for real-time text generation
- Text embeddings for RAG and semantic search
Setup
@jerome-benoit/sap-ai-provider (recommended)
pnpm add @jerome-benoit/sap-ai-providernpm install @jerome-benoit/sap-ai-provideryarn add @jerome-benoit/sap-ai-providerbun add @jerome-benoit/sap-ai-provider@jerome-benoit/sap-ai-provider-v2
pnpm add @jerome-benoit/sap-ai-provider-v2npm install @jerome-benoit/sap-ai-provider-v2yarn add @jerome-benoit/sap-ai-provider-v2bun add @jerome-benoit/sap-ai-provider-v2Authentication is handled automatically via the AICORE_SERVICE_KEY environment variable (local) or VCAP_SERVICES (SAP BTP).
Provider Instance
You can import the default provider instance sapai from @jerome-benoit/sap-ai-provider:
import { sapai } from '@jerome-benoit/sap-ai-provider';If you need a customized setup, you can import createSAPAIProvider and create a provider instance with your settings:
import { createSAPAIProvider } from '@jerome-benoit/sap-ai-provider';
const sapai = createSAPAIProvider({
resourceGroup: 'default',
api: 'orchestration', // or 'foundation-models'
});You can use the following optional settings to customize the SAP AI provider instance:
-
resourceGroup string
SAP AI Core resource group. Defaults to
'default'. -
deploymentId string
Specific deployment ID. If not provided, the SDK resolves deployment automatically.
-
api 'orchestration' | 'foundation-models'
API to use. Defaults to
'orchestration'. Can be overridden per model or per call viaproviderOptions. -
name string
Provider name used as key in
providerOptions. Defaults to'sap-ai'. -
defaultSettings object
Default model settings including
modelParams,masking,filtering,grounding, andtranslation.
Language Models
You can create models that call the SAP AI Core API using the provider instance. The first argument is the model id. Model naming follows SAP AI Core conventions with vendor prefixes:
const model = sapai('gpt-4.1');
const claudeModel = sapai('anthropic--claude-3.5-sonnet');
const geminiModel = sapai('gemini-2.0-flash');Note
Model availability depends on your SAP AI Core tenant configuration and region.
Embedding Models
You can create models that call the SAP AI Core embeddings API using the .embeddingModel() factory method:
const model = sapai.embeddingModel('text-embedding-3-small');