1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
<?php return [
'version' => '1.0',
'info' => ['style' => 'ROA', 'product' => 'EMRASSISTANT', 'version' => '2025-07-23'],
'directories' => ['ChatCompletion'],
'components' => [
'schemas' => [],
],
'apis' => [
'ChatCompletion' => [
'summary' => 'Initiates a conversation with the EMR AI assistant. This operation receives user messages, calls the EMR AI assistant for inference, and returns the assistant\'s response token by token in Server-Sent Events (SSE) streaming mode. Multi-turn conversations are supported by using sessionId to maintain context.',
'path' => '/v1/chat/completions',
'methods' => ['post'],
'schemes' => ['https', 'sse'],
'security' => [
[
'AK' => [],
],
],
'consumes' => ['application/json'],
'produces' => ['application/octet-stream'],
'operationType' => 'readAndWrite',
'deprecated' => false,
'systemTags' => ['operationType' => 'none', 'riskType' => 'none', 'chargeType' => 'free', 'autoTest' => true, 'tenantRelevance' => 'tenant'],
'parameters' => [
[
'name' => 'stream',
'in' => 'query',
'schema' => ['description' => 'Specifies whether to use streaming output.', 'type' => 'boolean', 'required' => false, 'example' => 'true', 'title' => ''],
],
[
'name' => 'messages',
'in' => 'query',
'schema' => ['description' => 'The message data detail structure.', 'type' => 'any', 'required' => false, 'example' => 'OpenAI Style: [{"role":"user","content":"hello"}]', 'title' => ''],
],
[
'name' => 'sessionId',
'in' => 'query',
'schema' => ['description' => 'The unique identifier of the current conversation.', 'type' => 'string', 'required' => false, 'example' => 's-1234567', 'title' => ''],
],
[
'name' => 'model',
'in' => 'query',
'schema' => ['description' => 'Ignore this parameter when calling through the SDK.', 'type' => 'string', 'required' => false, 'example' => 'NONE', 'title' => ''],
],
[
'name' => 'context',
'in' => 'query',
'schema' => ['description' => 'Ignore this parameter when calling through the SDK.', 'type' => 'any', 'required' => false, 'example' => 'NONE', 'title' => ''],
],
],
'responses' => [
200 => [
'schema' => ['description' => 'The SSE event.', 'type' => 'any', 'example' => 'data: {"type":"run_started","sessionId":"s-47bd30f48dfa4e9b","messageId":"7a2d3fe019184261931a5d1d62e2ecc0","RequestId":"6ACCA254-2E83-1B5A-AF65-7C8FC7F3A275"}'."\n", 'title' => ''],
],
],
'staticInfo' => ['returnType' => 'synchronous'],
'title' => 'Initiate a conversation',
'description' => '**Before using this operation, make sure that you fully understand the [billing method](https://www.alibabacloud.com/help/en/emr/emr-on-ecs/product-overview/emr-ai) and pricing of the EMR AI assistant.**'."\n"
."\n"
.'This is a streaming (SSE / Server-Sent Events) operation. The response Content-Type is text/event-stream, and events are continuously pushed in chunked encoding until the current response is complete.'."\n"
.'The caller must read the stream in SSE mode and parse events incrementally. Do not treat the response as a one-time JSON response.'."\n"
.'The maximum duration of a single request is 300 seconds (gateway backend timeout).',
'requestParamsDescription' => '```json'."\n"
.'{'."\n"
.' "stream": true,'."\n"
.' "messages": ['."\n"
.' { "role": "user", "content": "EMR AI 助手能为我做什么" }'."\n"
.' ],'."\n"
.' "sessionId": "",'."\n"
.' "model": "",'."\n"
.' "context": {}'."\n"
.'}'."\n"
.'```.',
'responseParamsDescription' => '```json'."\n"
.'HTTP/1.1 200 OK'."\n"
.'Content-Type: text/event-stream; charset=utf-8'."\n"
.'Transfer-Encoding: chunked'."\n"
.'Cache-Control: no-cache'."\n"
.'x-acs-request-id: 6ACCA254-2E83-1B5A-AF65-7C8FC7F3A275'."\n"
.'data: {"type":"run_started","sessionId":"s-47bd30f48dfa4e9b","messageId":"7a2d3fe019184261931a5d1d62e2ecc0","RequestId":"6ACCA254-2E83-1B5A-AF65-7C8FC7F3A275"}'."\n"
.'data: {"type":"text","messageId":"7a2d3fe019184261931a5d1d62e2ecc0","text":"您好,欢迎使用EMR智能服务。请告诉我您需要咨询或处理的具体问题,我会为您提供精准支持。\\n\\n","RequestId":"6ACCA254-2E83-1B5A-AF65-7C8FC7F3A275"}'."\n"
.'data: {"type":"text","messageId":"7a2d3fe019184261931a5d1d62e2ecc0","text":"!我是阿里","RequestId":"6ACCA254-2E83-1B5A-AF65-7C8FC7F3A275"}'."\n"
.'data: {"type":"text","messageId":"7a2d3fe019184261931a5d1d62e2ecc0","text":"云EMR","RequestId":"6ACCA254-2E83-1B5A-AF65-7C8FC7F3A275"}'."\n"
.'... (Subsequent text events are concatenated incrementally to form the complete response)'."\n"
.'```.',
'changeSet' => [],
'responseDemo' => '[{"errorExample":"","example":"\\"data: {\\\\\\"type\\\\\\":\\\\\\"run_started\\\\\\",\\\\\\"sessionId\\\\\\":\\\\\\"s-47bd30f48dfa4e9b\\\\\\",\\\\\\"messageId\\\\\\":\\\\\\"7a2d3fe019184261931a5d1d62e2ecc0\\\\\\",\\\\\\"RequestId\\\\\\":\\\\\\"6ACCA254-2E83-1B5A-AF65-7C8FC7F3A275\\\\\\"}\\\\n\\"","type":"json"}]',
],
],
'endpoints' => [
['regionId' => 'cn-wulanchabu', 'regionName' => 'China (Ulanqab)', 'areaId' => 'asiaPacific', 'areaName' => 'Asia Pacific', 'public' => 'emrassistant.cn-wulanchabu.aliyuncs.com', 'endpoint' => 'emrassistant.cn-wulanchabu.aliyuncs.com', 'vpc' => ''],
['regionId' => 'cn-shenzhen', 'regionName' => 'China (Shenzhen)', 'areaId' => 'asiaPacific', 'areaName' => 'Asia Pacific', 'public' => 'emrassistant.cn-shenzhen.aliyuncs.com', 'endpoint' => 'emrassistant.cn-shenzhen.aliyuncs.com', 'vpc' => ''],
['regionId' => 'cn-shanghai', 'regionName' => 'China (Shanghai)', 'areaId' => 'asiaPacific', 'areaName' => 'Asia Pacific', 'public' => 'emrassistant.cn-shanghai.aliyuncs.com', 'endpoint' => 'emrassistant.cn-shanghai.aliyuncs.com', 'vpc' => ''],
['regionId' => 'cn-qingdao', 'regionName' => 'China (Qingdao)', 'areaId' => 'asiaPacific', 'areaName' => 'Asia Pacific', 'public' => 'emrassistant.cn-qingdao.aliyuncs.com', 'endpoint' => 'emrassistant.cn-qingdao.aliyuncs.com', 'vpc' => ''],
['regionId' => 'cn-huhehaote', 'regionName' => 'China (Hohhot)', 'areaId' => 'asiaPacific', 'areaName' => 'Asia Pacific', 'public' => 'emrassistant.cn-huhehaote.aliyuncs.com', 'endpoint' => 'emrassistant.cn-huhehaote.aliyuncs.com', 'vpc' => ''],
['regionId' => 'cn-hangzhou', 'regionName' => 'China (Hangzhou)', 'areaId' => 'asiaPacific', 'areaName' => 'Asia Pacific', 'public' => 'emrassistant.cn-hangzhou.aliyuncs.com', 'endpoint' => 'emrassistant.cn-hangzhou.aliyuncs.com', 'vpc' => ''],
['regionId' => 'cn-chengdu', 'regionName' => 'China (Chengdu)', 'areaId' => 'asiaPacific', 'areaName' => 'Asia Pacific', 'public' => 'emrassistant.cn-chengdu.aliyuncs.com', 'endpoint' => 'emrassistant.cn-chengdu.aliyuncs.com', 'vpc' => ''],
['regionId' => 'cn-beijing', 'regionName' => 'China (Beijing)', 'areaId' => 'asiaPacific', 'areaName' => 'Asia Pacific', 'public' => 'emrassistant.cn-beijing.aliyuncs.com', 'endpoint' => 'emrassistant.cn-beijing.aliyuncs.com', 'vpc' => ''],
['regionId' => 'ap-southeast-1', 'regionName' => 'Singapore', 'areaId' => 'asiaPacific', 'areaName' => 'Asia Pacific', 'public' => 'emrassistant.ap-southeast-1.aliyuncs.com', 'endpoint' => 'emrassistant.ap-southeast-1.aliyuncs.com', 'vpc' => ''],
],
'errorCodes' => [
['code' => 'TaskNotSubscribed', 'message' => 'The task has not been subscribed.', 'http_code' => 400, 'description' => ''],
],
'changeSet' => [],
];
|