根据前缀和后缀生成中间内容
POST
https://dashscope.aliyuncs.com/compatible-mode/v1/completions
<|fim_prefix|>{prefix_content}<|fim_suffix|>{suffix_content}<|fim_middle|>
{prefix_content}
替换为传入的前缀信息,将{suffix_content}
替换为传入的后缀信息。请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://dashscope.aliyuncs.com/compatible-mode/v1/completions' \
--header 'Authorization: Bearer {{DASHSCOPE_API_KEY}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"model": "qwen2.5-coder-32b-instruct",
"prompt": "<|fim_prefix|>def reverse_words_with_special_chars(s):\n\"\"\"\n反转字符串中的每个单词(保留非字母字符的位置),并保持单词顺序。\n 示例:\n reverse_words_with_special_chars(\"Hello, world!\") -> \"olleH, dlrow!\"\n 参数:\n s (str): 输入字符串(可能包含标点符号)\n 返回:\n str: 处理后的字符串,单词反转但非字母字符位置不变\n\"\"\"\n<|fim_suffix|>return result<|fim_middle|>"
}'
响应示例响应示例
{}
请求参数
Header 参数
Authorization
string
必需
示例值:
Bearer {{DASHSCOPE_API_KEY}}
Content-Type
string
必需
示例值:
application/json
Body 参数application/json
返回 响应
修改于 2025-02-28 10:41:36