Initial commit

This commit is contained in:
Zhongwei Li
2025-11-30 08:54:41 +08:00
commit 47e178c6cb
15 changed files with 5385 additions and 0 deletions

View File

@@ -0,0 +1,51 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$comment": "SAP AI Core Deployment Configuration Template",
"foundation_model_configuration": {
"name": "my-model-deployment-config",
"executableId": "azure-openai",
"scenarioId": "foundation-models",
"parameterBindings": [
{"key": "modelName", "value": "gpt-4o"},
{"key": "modelVersion", "value": "latest"}
]
},
"orchestration_configuration": {
"name": "my-orchestration-config",
"executableId": "orchestration",
"scenarioId": "orchestration",
"parameterBindings": []
},
"deployment_request": {
"configurationId": "<configuration-id-from-above>",
"ttl": "24h"
},
"deployment_with_replicas": {
"configurationId": "<configuration-id>",
"ttl": "7d",
"minReplicas": 1,
"maxReplicas": 3
},
"_documentation": {
"ttl_format": "Natural numbers with units: m (minutes), h (hours), d (days)",
"ttl_examples": ["5m", "2h", "7d", "30d"],
"executable_ids": {
"azure-openai": "Azure OpenAI models (GPT-4o, GPT-4, GPT-3.5)",
"aicore-opensource": "SAP-hosted open source (Llama, Mistral, Falcon)",
"gcp-vertexai": "Google Vertex AI (Gemini, PaLM)",
"aws-bedrock": "AWS Bedrock (Claude, Titan)",
"aicore-mistralai": "Mistral AI models",
"aicore-ibm": "IBM Granite models",
"orchestration": "Orchestration service"
},
"model_version_options": {
"latest": "Auto-upgrade to newest version",
"specific": "Pin to specific version (e.g., '2024-05-13')"
}
}
}

View File

@@ -0,0 +1,219 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$comment": "SAP AI Core Orchestration Workflow Template",
"basic_chat_completion": {
"config": {
"module_configurations": {
"llm_module_config": {
"model_name": "gpt-4o",
"model_version": "latest",
"model_params": {
"max_tokens": 1000,
"temperature": 0.7
}
},
"templating_module_config": {
"template": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "{{?user_message}}"}
]
}
}
},
"input_params": {
"user_message": "Hello, how can you help me?"
}
},
"with_content_filtering": {
"config": {
"module_configurations": {
"llm_module_config": {
"model_name": "gpt-4o",
"model_version": "latest"
},
"templating_module_config": {
"template": [
{"role": "user", "content": "{{?user_message}}"}
]
},
"filtering_module_config": {
"input": {
"filters": [
{
"type": "azure_content_safety",
"config": {
"Hate": 2,
"Violence": 2,
"Sexual": 2,
"SelfHarm": 2
}
}
]
},
"output": {
"filters": [
{
"type": "azure_content_safety",
"config": {
"Hate": 0,
"Violence": 0,
"Sexual": 0,
"SelfHarm": 0
}
}
]
}
}
}
}
},
"with_data_masking": {
"config": {
"module_configurations": {
"llm_module_config": {
"model_name": "gpt-4o",
"model_version": "latest"
},
"templating_module_config": {
"template": [
{"role": "user", "content": "{{?user_message}}"}
]
},
"masking_module_config": {
"masking_providers": [
{
"type": "sap_data_privacy_integration",
"method": "pseudonymization",
"entities": [
{"type": "profile-person"},
{"type": "profile-email"},
{"type": "profile-phone"},
{"type": "profile-credit-card-number"}
]
}
]
}
}
}
},
"with_grounding_rag": {
"config": {
"module_configurations": {
"grounding_module_config": {
"grounding_service": "document_grounding_service",
"grounding_service_configuration": {
"grounding_input_parameters": ["user_query"],
"grounding_output_parameter": "context",
"filters": [
{
"id": "<your-pipeline-id>",
"search_configuration": {
"max_chunk_count": 5
}
}
]
}
},
"llm_module_config": {
"model_name": "gpt-4o",
"model_version": "latest"
},
"templating_module_config": {
"template": [
{
"role": "system",
"content": "Answer questions based only on the following context:\n\n{{$context}}\n\nIf the answer is not in the context, say you don't know."
},
{"role": "user", "content": "{{?user_query}}"}
]
}
}
},
"input_params": {
"user_query": "What is the vacation policy?"
}
},
"full_enterprise_workflow": {
"config": {
"module_configurations": {
"grounding_module_config": {
"grounding_service": "document_grounding_service",
"grounding_service_configuration": {
"grounding_input_parameters": ["user_query"],
"grounding_output_parameter": "context",
"filters": [{"id": "<pipeline-id>"}]
}
},
"templating_module_config": {
"template": [
{"role": "system", "content": "You are a helpful enterprise assistant. Use the following context:\n{{$context}}"},
{"role": "user", "content": "{{?user_query}}"}
]
},
"translation_module_config": {
"input": {"source_language": "auto", "target_language": "en"},
"output": {"source_language": "en", "target_language": "auto"}
},
"masking_module_config": {
"masking_providers": [{
"type": "sap_data_privacy_integration",
"method": "pseudonymization",
"entities": [
{"type": "profile-person"},
{"type": "profile-email"},
{"type": "profile-phone"}
]
}]
},
"filtering_module_config": {
"input": {
"filters": [{
"type": "azure_content_safety",
"config": {"Hate": 2, "Violence": 2, "Sexual": 2, "SelfHarm": 2}
}]
},
"output": {
"filters": [{
"type": "azure_content_safety",
"config": {"Hate": 0, "Violence": 0, "Sexual": 0, "SelfHarm": 0}
}]
}
},
"llm_module_config": {
"model_name": "gpt-4o",
"model_version": "latest",
"model_params": {
"max_tokens": 2000,
"temperature": 0.5
}
}
}
}
},
"_documentation": {
"module_execution_order": [
"1. Grounding",
"2. Templating (mandatory)",
"3. Input Translation",
"4. Data Masking",
"5. Input Filtering",
"6. Model Configuration (mandatory)",
"7. Output Filtering",
"8. Output Translation"
],
"placeholder_syntax": {
"{{?variable}}": "Required input parameter",
"{{$output}}": "Output from previous module (e.g., grounding)"
},
"masking_methods": {
"anonymization": "Irreversible - MASKED_ENTITY placeholder",
"pseudonymization": "Reversible - MASKED_ENTITY_ID placeholder"
}
}
}

View File

@@ -0,0 +1,277 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$comment": "SAP AI Core Tool Calling Definition Template",
"single_tool_definition": {
"tools": [
{
"type": "function",
"function": {
"name": "get_product_info",
"description": "Get information about a product including price, availability, and description",
"strict": true,
"parameters": {
"type": "object",
"properties": {
"product_id": {
"type": "string",
"description": "The unique product identifier (e.g., 'PROD-12345')"
}
},
"required": ["product_id"],
"additionalProperties": false
}
}
}
]
},
"multiple_tools_definition": {
"tools": [
{
"type": "function",
"function": {
"name": "get_inventory",
"description": "Get current inventory quantity for a product",
"strict": true,
"parameters": {
"type": "object",
"properties": {
"product_id": {
"type": "string",
"description": "The product identifier"
},
"warehouse": {
"type": "string",
"enum": ["US-EAST", "US-WEST", "EU-CENTRAL", "APAC"],
"description": "The warehouse location"
}
},
"required": ["product_id"],
"additionalProperties": false
}
}
},
{
"type": "function",
"function": {
"name": "create_order",
"description": "Create a new order for a customer",
"strict": true,
"parameters": {
"type": "object",
"properties": {
"customer_id": {
"type": "string",
"description": "The customer identifier"
},
"product_id": {
"type": "string",
"description": "The product to order"
},
"quantity": {
"type": "integer",
"minimum": 1,
"description": "Number of items to order"
},
"shipping_address": {
"type": "object",
"properties": {
"street": {"type": "string"},
"city": {"type": "string"},
"country": {"type": "string"},
"postal_code": {"type": "string"}
},
"required": ["street", "city", "country"]
}
},
"required": ["customer_id", "product_id", "quantity"],
"additionalProperties": false
}
}
},
{
"type": "function",
"function": {
"name": "get_customer_history",
"description": "Get order history for a customer",
"strict": true,
"parameters": {
"type": "object",
"properties": {
"customer_id": {
"type": "string",
"description": "The customer identifier"
},
"limit": {
"type": "integer",
"minimum": 1,
"maximum": 100,
"default": 10,
"description": "Maximum number of orders to return"
}
},
"required": ["customer_id"],
"additionalProperties": false
}
}
}
]
},
"orchestration_request_with_tools": {
"config": {
"module_configurations": {
"llm_module_config": {
"model_name": "gpt-4o",
"model_version": "latest",
"model_params": {
"max_tokens": 1000
}
},
"templating_module_config": {
"template": [
{
"role": "system",
"content": "You are a helpful sales assistant. Use the available tools to help customers with their orders and product inquiries."
},
{
"role": "user",
"content": "{{?user_message}}"
}
],
"tools": [
{
"type": "function",
"function": {
"name": "get_product_info",
"description": "Get product information",
"parameters": {
"type": "object",
"properties": {
"product_id": {"type": "string"}
},
"required": ["product_id"]
}
}
}
]
}
}
},
"input_params": {
"user_message": "What is the price of product PROD-12345?"
}
},
"tool_response_continuation": {
"config": {
"module_configurations": {
"llm_module_config": {
"model_name": "gpt-4o",
"model_version": "latest"
},
"templating_module_config": {
"template": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "What is the inventory for product ABC123?"},
{
"role": "assistant",
"tool_calls": [
{
"id": "call_abc123",
"type": "function",
"function": {
"name": "get_inventory",
"arguments": "{\"product_id\": \"ABC123\"}"
}
}
]
},
{
"role": "tool",
"tool_call_id": "call_abc123",
"content": "{\"product_id\": \"ABC123\", \"quantity\": 150, \"warehouse\": \"US-EAST\"}"
}
]
}
}
}
},
"structured_output_json_schema": {
"config": {
"module_configurations": {
"llm_module_config": {
"model_name": "gpt-4o",
"model_version": "latest",
"model_params": {
"response_format": {
"type": "json_schema",
"json_schema": {
"name": "product_analysis",
"strict": true,
"schema": {
"type": "object",
"properties": {
"product_name": {"type": "string"},
"category": {
"type": "string",
"enum": ["electronics", "clothing", "food", "other"]
},
"price_range": {
"type": "string",
"enum": ["budget", "mid-range", "premium"]
},
"key_features": {
"type": "array",
"items": {"type": "string"}
},
"recommendation_score": {
"type": "number",
"minimum": 0,
"maximum": 10
}
},
"required": ["product_name", "category", "recommendation_score"],
"additionalProperties": false
}
}
}
}
},
"templating_module_config": {
"template": [
{"role": "user", "content": "Analyze this product: {{?product_description}}"}
]
}
}
}
},
"_documentation": {
"tool_calling_workflow": [
"1. Send request with tool definitions",
"2. Model returns tool_calls with function name and arguments",
"3. Execute function externally with provided arguments",
"4. Return result in 'tool' role message with matching tool_call_id",
"5. Model incorporates result in final response"
],
"best_practices": [
"Use descriptive function names and descriptions",
"Enable strict mode for parameter validation",
"Define clear parameter types and constraints",
"Include examples in descriptions when helpful",
"Handle tool call errors gracefully"
],
"supported_parameter_types": [
"string",
"integer",
"number",
"boolean",
"array",
"object",
"enum (via type + enum array)"
]
}
}