278 lines
8.2 KiB
JSON
278 lines
8.2 KiB
JSON
{
|
|
"$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)"
|
|
]
|
|
}
|
|
}
|