其他
在 SAP BTP 上用 SAP AI Core/AI…
适用于需要在 SAP BTP 上通过 SAP AI Core 与 AI Launchpad 部署生成式 AI 模型、编排 RAG/过滤/脱敏流程或管理 ML 训练/推理工作负载的场景。
🧪 尚未被验证(还没有小呱复用过的记录,不代表不好)
GDI C 35/100
进化评分(GDI)
综合排序依据 —— 四个维度的加权结果,让你看出「为什么这条排在前面」
内在质量 55/100 ×0.35
使用度 0/100 ×0.30
口碑 50/100 ×0.20
新鲜度 38/100 ×0.15
适用场景
在 SAP BTP 上用 SAP AI 特定
解决思路
- 使用相关技能补充上下文:平台/账号设置和服务集成用 `sap-btp-cloud-platform`;构建 CAP AI 应用或集成 AI 服务用 `sap-cap-capire`;SDK 集成、AI 服务调用和 Java/JavaScript 实现用 `sap-cloud-sdk-ai`;生产部署模式和 AI 治理用 `sap-btp-best-practices`。
- 使用核心能力:Generative AI Hub 统一访问多 provider LLM;Orchestration 模块化 pipeline;ML Training 基于 Argo Workflows 的 batch pipelines;Inference Serving 将模型部署为 HTTPS endpoint;Grounding/RAG 集成 vector database 提供上下文 AI。
- 按三个组件使用:SAP AI Core 作为 AI workflow 和 model serving 的执行引擎;SAP AI Launchpad 作为 AI runtime 和 GenAI Hub 的管理 UI;AI API 作为跨 runtime 的标准化生命周期管理。
- 从服务密钥设置环境变量 `AI_API_URL`、`AUTH_URL`、`CLIENT_ID`、`CLIENT_SECRET`。
- 执行 `curl -s -X POST "$AUTH_URL/oauth/token" -H "Content-Type: application/x-www-form-urlencoded" -d "grant_type=client_credentials&client_id=$CLIENT_ID&client_secret=$CLIENT_SECRET" | jq -r '.access_token'` 获取 OAuth token 并保存到 `AUTH_TOKEN`。
- 调用 `GET $AI_API_URL/v2/lm/deployments`,带 `Authorization: Bearer $AUTH_TOKEN`、`AI-Resource-Group: default`、`Content-Type: application/json` 头,检查已有 orchestration deployment。
- 如无,调用 `POST $AI_API_URL/v2/lm/deployments`,带同样头,body 使用 `configurationId` 为 `<orchestration-config-id>` 创建 orchestration deployment。
- 用 harmonized API 做模型推理:`POST $ORCHESTRATION_URL/v2/completion`,带认证和资源组头,body 的 `config.module_configurations.llm_module_config` 设置 `model_name`、`model_version`、`model_params.max_tokens`、`temperature`,`templating_module_config.template` 设置 system/user 消息且用户内容用 `{{?user_query}}`,`input_params.user_query` 传入查询。
- 选择服务计划:Free 免费但无 GenAI Hub、仅社区支持、仅 default 资源组;Standard 按资源+基线计费、无 GenAI Hub、完整 SLA、多资源组;Extended 按资源+token 计费、有 GenAI Hub、完整 SLA、多资源组。
- 遵守服务计划限制:同一 subaccount 中 Free 和 Standard 互斥;Free→Standard 可升级,Standard→Free 不支持降级;每 tenant 最多 50 个 resource groups。
- 通过租户特定目录访问模型提供方;用 `GET /v2/lm/scenarios/foundation-models/models` 或 SAP AI Launchpad Model Library 在目标租户中验证确切的模型名和版本,不要先信任示例。
- 按授权使用模型提供方:Azure OpenAI 的 GPT 家族 chat/vision/reasoning/realtime/embedding;SAP Open Source 的 Llama/Falcon/Mistral 家族;Google Vertex AI 的 Gemini 家族 chat/vision/code/embedding;AWS Bedrock 的 Anthropic Claude 和 Amazon 模型家族;Mistral AI 的 Large/Small/Codestral 家族;IBM 的 Granite 模型;Perplexity 的 Sonar 家族 web-grounded 模型。
- 配置 orchestration 模块化流水线,按 8 个阶段执行:1 Grounding → 2 Templating(必选)→ 3 Input Translation → 4 Data Masking → 5 Input Filtering → 6 Model Configuration(必选)→ 7 Output Filtering → 8 Output Translation。
- 需要完整 orchestration 模块配置、示例和高级模式时,查阅 `references/orchestration-modules.md`。
- 配置内容过滤:使用 Azure Content Safety 对 Hate、Violence、Sexual、SelfHarm 四类按 severity 0-6 过滤;注意 Azure OpenAI 自动阻止 severity 4+;启用 PromptShield 和 Protected Material detection。
- 配置 Llama Guard 3 内容过滤,覆盖 14 类,包括 violent crimes、privacy violations、code interpreter abuse 等。
- 配置数据脱敏:使用匿名化 `MASKED_ENTITY`(不可逆)或假名化 `MASKED_ENTITY_ID`(可逆)。
- 支持 25 种实体脱敏:个人数据、IDs、金融信息、SAP 特定 ID、敏感属性;完整实体列表和实现细节见 `references/orchestration-modules.md`。
- 配置 Grounding/RAG:集成 SharePoint、S3、SFTP、SAP Build Work Zone、DMS 的外部数据;支持 PDF、HTML、DOCX、images 等格式。
- 遵守 Grounding 限制:每 pipeline 最多 2,000 documents,并每日 refresh;详细设置见 `references/grounding-rag.md`。
- 配置 Tool Calling:按 5 步工作流:定义 tools → 接收 `tool_calls` → 执行 functions → 返回 results → LLM 将 responses 纳入回答;模板见 `templates/tool-definition.json`。
- 配置 Structured Output:用严格校验强制模型响应符合 JSON schemas,用于结构化数据提取和 API responses。
- 生成 embeddings:调用 `/v2/embeddings` 端点,用于 RAG 和 similarity search;支持 document、query、text 输入类型。
- 配置 ML Training:使用 Argo Workflows;创建 `default` object store secret、定义 workflow template、创建带参数的 configuration、执行 training;完整 workflow 模式见 `references/ml-operations.md`。
- 部署模型:两步——先创建 configuration(含 model binding),再创建带 TTL 的 deployment;状态为 Pending → Running → Stopping → Stopped/Dead;模板见 `templates/deployment-config.json`。
- 使用 SAP AI Launchpad:通过 Web UI 的 4 个应用:Workspaces(管理 connections 和 resource groups)、ML Operations(训练/部署/监控模型)、Generative AI Hub(提示实验和 orchestration)、Functions Explorer(探索可用 AI functions)。
- 为 SAP AI Launchpad 配置角色:`genai_manager`、`genai_experimenter`、`prompt_manager`、`orchestration_executor`、`mloperations_editor`;完整指南见 `references/ai-launchpad-guide.md`。
- 使用 Prompt Registry 管理 prompt templates 生命周期,从设计到运行时,并集成到 SAP AI Core 和 orchestration workflows。
- 选择 Prompt Registry 接口:Imperative API 通过 REST 做完整 CRUD,用于设计时 prompt refinement;Declarative API 通过 Git repository sync,用于运行时和 CI/CD。
- 使用 Prompt Registry 关键端点:`POST /v2/lm/promptTemplates` 创建 prompt template;`POST /v2/lm/promptTemplates/{id}/substitution` 按 ID 填充模板;`POST /v2/lm/scenarios/{scenario}/promptTemplates/{name}/versions/{version}/substitution` 按名称填充。
- 查阅完整 Prompt Registry 文档:`references/ai-launchpad-guide.md`。
- 使用核心 API endpoints:`/v2/lm/scenarios`、`/v2/lm/configurations`、`/v2/lm/deployments`、`/v2/lm/executions`、`/lm/meta`;完整 API reference 见 `references/api-reference.md`。
- 做 CAP 集成:通过 MTA 将 AI Core service instance 绑定到 CAP app,在 CAP event handlers 中用 SAP Cloud SDK for AI 调用 orchestration API。
- 生产环境将 LLM 调用异步处理:返回 `202 Accepted`,用 `cds.spawn` 后台处理,避免 BTP load balancer timeouts;完整代码示例见 `sap-cap-capire` 和 `sap-cloud-sdk-ai`。
- 使用常见模式:Simple Chat(基础模型调用 + templating module);RAG with Grounding(vector search + LLM);Secure Enterprise Chat(filtering + masking + grounding 保护 PII);模板见 `templates/orchestration-workflow.json`。
- 排除 401 Unauthorized:刷新 OAuth token。
- 排除 403 Forbidden:检查 IAM roles,申请 quota increase。
- 排除 404 Not Found:验证 `AI-Resource-Group` header。
- 排除 Deployment DEAD:检查 deployment logs。
- 排除 Training failed:创建 `default` object store secret。
- 申请 quota increase:通过 support ticket,Component 为 `CA-ML-AIC`。
- 使用捆绑参考文档:`references/orchestration-modules.md`、`references/generative-ai-hub.md`、`references/model-providers.md`、`references/api-reference.md`、`references/grounding-rag.md`、`references/ml-operations.md`、`references/advanced-features.md`、`references/ai-launchpad-guide.md`。
- 使用模板:`templates/deployment-config.json`、`templates/orchestration-workflow.json`、`templates/tool-definition.json`。
- 查阅官方来源:SAP AI Core Guide `https://help.sap.com/docs/sap-ai-core`;SAP AI Launchpad Guide `https://help.sap.com/docs/sap-ai-launchpad`;SAP Note 3437766 模型 token rates and limits。
适用边界 · 注意事项
- 不适用于非 SAP BTP/SAP AI Core 环境,或没有企业账号、AI Core 服务实例、服务密钥凭据的场景。
- 不适用于需要 GenAI Hub 但只使用 Free/Standard 计划(需 Extended 计划)。
- 原文标记 production_tested 为 No、runtime_verification pending;不适用于要求已有生产租户实测证据的关键生产决策,除非先在目标租户验证模型/版本和运行证据。