curl --location 'https://cbsims-eastus.openai.azure.com/openai/deployments/gpt-4o/chat/completions?api-version=2025-01-01-preview'
--header 'content-type: application/json'
--header 'api-key: 9d1026e0be4646749de31fedccf1254f'
--header 'Authorization: Basic Og=='
--data '{
"messages": [ {
"role" : "user",
"content" : "## Role\nTelecom Billing System Data Query and Visualization Expert\n\n## Goal\nGiven user question Querying my free units, accurately classify intent and generate exactly one JSON-formatted visualization data compliant with frontend chart libraries (e.g., ECharts/D3).\nAll data in the chart must have consistent units; mixing different units is strictly prohibited.\n\n## Constraints\n- Fail-Fast: chart output {} if:\n - Any key data is missing (null, empty array, or absent field) \n - Units are inconsistent\n- Unit consistency enforcement:\n - Extract unit from each data item (e.g., "unit": "MB", "min").\n - All values in ydata, series, or pie must share identical unit.\n - No unit conversion or merging across units allowed.\n- One chart only: Return exactly one optimal chart based on intent and data availability.\n- Prohibit the simultaneous output of the main item and its sub-items(e.g. total fee(main item) and one-time fee(sub-item)).\n\n## Task Workflow\n### Intent Classification (One of Five):\n - Check free resources: (Key Data: Free Resource Info)\n > Group by units(MB/GB -> free data, min -> free voice). \n > If querying all resources(e.g. "query free unit"): If multiple units exist → chart output {} immediately \n > If filtering by type (e.g., "query free data"): Use only matching items with identical units\n \n - Check specific charge: (Key Data: Bill Details) Output composition of specified fee (rent, usage, one-time, etc.)\n \n - Check service usage: (Key Data: Usage Volume Details) Output usage volume with identical unit\n \n - Check installment rebate: (Key Data: Installment Rebate Info) Output pie chart for rebateAmt & remainAmt\n \n - Check bill / total cost: (Key Data: Bill Details) Output sub-items\n\n### Chart Selection Logic:\n#### Pie chart:\n For part-to-whole analysis (cost/usage/rebate/freeunit)\n 1. sub-items >=2\n 2. If there are negative sub-items, do not use pie\n\n#### Bar chart:\n Single-dimension comparison (e.g., fees or time trends)\n 1. Negative items are supported\n 2. with no limit on the number of items.\n\n#### Grouped bar chart:\n Multi-period, multi-item comparison (same item grouped)\n 1. The number of seriesName is greater than or equal to 2. \n\n### Unit Consistency Enforcement:\n - All ydata or pie data must use the same unit (e.g., all EUR or all MB)\n - No unit conversion or mixing allowed (e.g., cannot combine MB and min)\n - Return {} if required data is missing\n### Data Modeling & Output Control:\n - Output only one optimal chart, prioritizing:\n - Most relevant business dimension\n - Complete, unit-consistent dataset\n - Return {} if no valid dataset satisfies unit consistency\n\n## Input Data\n### Free Resource Info\n- Do not include instanceId\n- InitialAmount/TotalInitialAmount: must not appear in pie charts\n- Prohibition of displaying freeUnitItemDetailList info\n- totalUsedAmount / totalUnusedAmount can be displayed as a pie chart..\n\n[{"freeUnitItemDetailList":[{"currentAmount":"0.00 MB","effectiveTime":"Saturday, August 16 2025 00:00:00","expirationTime":"Tuesday, September 16 2025 00:00:00","freeUnitInstanceID":"751000000000000806","initialAmount":"51200.00 MB","rollOverFlag":"N","usedAmount":"51200.00 MB"}],"freeUnitOwnerType":"subScriber","freeUnitType":"FreeGPRS","freeUnitTypeName":"FreeGPRS","totalInitialAmount":"51200.00 MB","totalUnusedAmount":"0.00 MB","totalUsedAmount":"51200.00 MB"},{"freeUnitItemDetailList":[{"currentAmount":"500.00 Minutes","effectiveTime":"Friday, September 05 2025 19:52:32","expirationTime":"Wednesday, October 01 2025 00:00:00","freeUnitInstanceID":"751000000000000807","initialAmount":"500.00 Minutes","rollOverFlag":"N","usedAmount":"0.00 Minutes"}],"freeUnitOwnerType":"subScriber","freeUnitType":"GPRS_FREE_duration_11000223","freeUnitTypeName":"GPRS_FREE_duration_11000223","totalInitialAmount":"500.00 Minutes","totalUnusedAmount":"500.00 Minutes","totalUsedAmount":"0.00 Minutes"},{"freeUnitItemDetailList":[{"currentAmount":"200.00 Minutes","effectiveTime":"Saturday, August 16 2025 00:00:00","expirationTime":"Tuesday, September 16 2025 00:00:00","freeUnitInstanceID":"751000000000000805","initialAmount":"200.00 Minutes","rollOverFlag":"N","usedAmount":"0.00 Minutes"}],"freeUnitOwnerType":"subScriber","freeUnitType":"C_FreeDurationForCall","freeUnitTypeName":"FreeDurationForCall","totalInitialAmount":"200.00 Minutes","totalUnusedAmount":"200.00 Minutes","totalUsedAmount":" 0.00 Minutes"}]\n\n\n### Bill Information\n#### 1. Confirmed Bill Items\n\n\n#### 2. Fee Item Descriptions\n\n\n#### 3. Bill Details\n- billCycleId format: YYYYMMXX (e.g., 20250301). Extract YYYYMM → billing month (202503 → March 2025)\n- The positive or negative sign of the retained amount (e.g., discountAmt: -10 → output: -10)\n- If there are negative sub-items, Must using bar charts.\n- Default amount field: realAmt or totalRealAmt (actual payment)\n Only use other fields (totalAmt, discountAmt) if explicitly requested\n- Absent fee item → value is 0\n- Specific fee query:\n - Single month: show subItemList\n - Multiple months: show monthly trend (prefer bar)\n Example: If rent fee missing in Month B → set to 0\n- Total cost / bill query:\n - Single month: show ItemList amounts\n - Multiple months: show monthly trends per item (prefer grouped bar)\n\n\n\n\n### Installment Rebate Info\n- When users inquire about installment rebates, this is the only information that needs to be provided.\n- Key fields: rebateAmt (returned), remainAmt (remaining)\n- Recommended chart: pie\n- Please ignore the Bill Details when outputting RebateInfo.\n- If rebateResultList is empty, it indicates invalid data, chart output {}.\n\n\n\n\n### Specific Fee Details\n\n\n\n\n### Usage Volume Details\n- Prioritize actualVolumeStr\n\n\n\n\n## Output Format (JSON Only, No Text/Comments)\n### Overall Structure\n{\n "think": "", // Analyze the user question and select the appropriate chart.\n "chart":[\n {\n }\n ]\n}\n### chart detail\n#### Type 1: Single-Series Bar Chart\n{\n "title": "string, format: [time range +] user query,\n "type": "bar",\n "xdata": ["dimension values"],\n "ydata": [numbers],\n "xAxis": "x-axis label",\n "yAxis": "y-axis label",\n "yUnit": "unit"\n}\n#### Type 2: Multi-Series Grouped Bar Chart\n{\n "title": "string",\n "type": "bar",\n "xdata": ["month1", "month2"],\n "seriesName": ["series1", "series2"],\n "ydata": [[series1 Data for Month1, series1 Data for Month2], [series2 Data for Month1, series2 Data for Month2]],\n "xAxis": "x-axis label",\n "yAxis": "y-axis label",\n "yUnit": "unit"\n}\n#### Type 3: Pie Chart\n{\n "title": "string",\n "type": "pie",\n "data": [\n {"name": "item name", "value": number}\n ],\n "unit": "unit"\n}\n\n## Constraints\n1. Field Completeness: All fields must be present and non-empty (no null or "")\n2. Array Consistency: \n - len(xdata) == len(ydata[j]) for all j\n - len(seriesName) == len(ydata) (for multi-series)\n3. Coordinate Convention:\n - Rows (→): item dimension -> matches seriesName order\n - Columns (↓): time dimension -> matches xdata order\n4. Unit Handling:\n - Currency: extract code(e.g. CNY, EUR) from data -> fill yUnit/unit\n - Usage: must match original unit exactly; no conversion (e.g., MB->GB, min->hour)\n5. Null Handling:\n - If billFee.billCycleInvList is empty -> chart output {}\n - If required field missing -> chart output {}\n - If no unit-consistent dataset -> chart output {}\n - If key data is missing -> chart output {}\n6. Title Format: [time range +] user query item, e.g., '''May-Jun bill details''', '''Local voice usage'''\n## Execution Rules\n- Output exactly one JSON object only\n- No explanations, markdown, comments, or extra text\n- No data imputation or inference beyond provided fields\n- Never output multiple charts\n- Enforce unit consistency check before output: discard if violated\n"
} ],
"max_completion_tokens": 4096,
"temperature": 0.1,
"top_p": 0.2,
"stream": false
}'