[GH-ISSUE #773] [Bug] /v1/chat/completions不支持content数组格式 #560

Closed
opened 2026-10-29 14:41:12 +00:00 by bsakaguchi · 2 comments
Owner

Originally created by @lonchura on GitHub (Mar 3, 2025).
Original GitHub issue: https://github.com/kvcache-ai/ktransformers/issues/773

检查清单

  • 1. 我已经搜索过相关问题,但未能获得预期的帮助
  • 2. 该问题在最新版本中尚未修复
  • 3. 请注意,如果您提交的BUG相关 issue 缺少对应环境信息和最小可复现示例,我们将难以复现和定位问题,降低获得反馈的可能性
  • 4. 如果您提出的不是bug而是问题,请在讨论区发起讨论 https://github.com/kvcache-ai/ktransformers/discussions。否则该 issue 将被关闭
  • 5. 为方便社区交流,我将使用中文/英文或附上中文/英文翻译(如使用其他语言)。未附带翻译的非中文/英语内容可能会被关闭

问题描述

POST /v1/chat/completions

{
	"model": "deepseek-r1",
	"messages": [{
		"role": "system",
		"content": "You are Cline, a highly skilled software engineer with extensive knowledge in many programming languages, frameworks, design patterns, and best practices."
	}, {
		"role": "user",
		"content": [{
			"type": "text",
			"text": "\n你是谁\n"
		}, {
			"type": "text",
			"text": "\n# VSCode Visible Files\n(No visible files)\n\n# VSCode Open Tabs\n(No open tabs)\n\n# Current Time\n2025/3/3 下午2:43:41 (Asia/Shanghai, UTC+8:00)\n\n# Current Working Directory (/Volumes/Work/workspace/open-evol) Files\nai prop f(x).py\nai_percentage_plot.png\nindex.html\nplot_function.py\n\n# Current Mode\nACT MODE\n"
		}]
	}],
	"temperature": 0,
	"stream": true,
	"stream_options": {
		"include_usage": true
	}
}

返回如下结果,看着像是与openai chat completions协议不完全兼容,不支持content的array格式

{
    "detail": [
        {
            "type": "string_type",
            "loc": [
                "body",
                "messages",
                1,
                "content"
            ],
            "msg": "Input should be a valid string",
            "input": [
                {
                    "type": "text",
                    "text": "\n你是谁\n"
                },
                {
                    "type": "text",
                    "text": "\n# VSCode Visible Files\n(No visible files)\n\n# VSCode Open Tabs\n(No open tabs)\n\n# Current Time\n2025/3/3 下午2:43:41 (Asia/Shanghai, UTC+8:00)\n\n# Current Working Directory (/Volumes/Work/workspace/open-evol) Files\nai prop f(x).py\nai_percentage_plot.png\nindex.html\nplot_function.py\n\n# Current Mode\nACT MODE\n"
                }
            ]
        }
    ]
}

复现步骤

执行如下命令进行复现

curl --location 'http://server-ip:10002/v1/chat/completions' \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--header 'user-agent: Ba/JS 4.83.0' \
--header 'x-stainless-lang: js' \
--header 'x-stainless-package-version: 4.83.0' \
--header 'x-stainless-os: MacOS' \
--header 'x-stainless-arch: x64' \
--header 'x-stainless-runtime: node' \
--header 'x-stainless-runtime-version: v20.18.1' \
--header 'authorization: Bearer sk-UV3HUPDlLELeGvzl2cF7169c334d432482B254679c9e0f83' \
--header 'x-stainless-retry-count: 0' \
--header 'x-stainless-timeout: 600000' \
--data '{
	"model": "deepseek-r1",
	"messages": [{
		"role": "system",
		"content": "You are Cline, a highly skilled software engineer with extensive knowledge in many programming languages, frameworks, design patterns, and best practices."
	}, {
		"role": "user",
		"content": [{
			"type": "text",
			"text": "\n你是谁\n"
		}, {
			"type": "text",
			"text": "\n# VSCode Visible Files\n(No visible files)\n\n# VSCode Open Tabs\n(No open tabs)\n\n# Current Time\n2025/3/3 下午2:43:41 (Asia/Shanghai, UTC+8:00)\n\n# Current Working Directory (/Volumes/Work/workspace/open-evol) Files\nai prop f(x).py\nai_percentage_plot.png\nindex.html\nplot_function.py\n\n# Current Mode\nACT MODE\n"
		}]
	}],
	"temperature": 0,
	"stream": true,
	"stream_options": {
		"include_usage": true
	}
}'

环境信息

v0.2.2rc2

Originally created by @lonchura on GitHub (Mar 3, 2025). Original GitHub issue: https://github.com/kvcache-ai/ktransformers/issues/773 ### 检查清单 - [x] 1. 我已经搜索过相关问题,但未能获得预期的帮助 - [x] 2. 该问题在最新版本中尚未修复 - [x] 3. 请注意,如果您提交的BUG相关 issue 缺少对应环境信息和最小可复现示例,我们将难以复现和定位问题,降低获得反馈的可能性 - [x] 4. 如果您提出的不是bug而是问题,请在讨论区发起讨论 https://github.com/kvcache-ai/ktransformers/discussions。否则该 issue 将被关闭 - [x] 5. 为方便社区交流,我将使用中文/英文或附上中文/英文翻译(如使用其他语言)。未附带翻译的非中文/英语内容可能会被关闭 ### 问题描述 POST /v1/chat/completions <pre> { "model": "deepseek-r1", "messages": [{ "role": "system", "content": "You are Cline, a highly skilled software engineer with extensive knowledge in many programming languages, frameworks, design patterns, and best practices." }, { "role": "user", "content": [{ "type": "text", "text": "<task>\n你是谁\n</task>" }, { "type": "text", "text": "<environment_details>\n# VSCode Visible Files\n(No visible files)\n\n# VSCode Open Tabs\n(No open tabs)\n\n# Current Time\n2025/3/3 下午2:43:41 (Asia/Shanghai, UTC+8:00)\n\n# Current Working Directory (/Volumes/Work/workspace/open-evol) Files\nai prop f(x).py\nai_percentage_plot.png\nindex.html\nplot_function.py\n\n# Current Mode\nACT MODE\n</environment_details>" }] }], "temperature": 0, "stream": true, "stream_options": { "include_usage": true } } </pre> 返回如下结果,看着像是与openai chat completions协议不完全兼容,不支持content的array格式 <pre> { "detail": [ { "type": "string_type", "loc": [ "body", "messages", 1, "content" ], "msg": "Input should be a valid string", "input": [ { "type": "text", "text": "<task>\n你是谁\n</task>" }, { "type": "text", "text": "<environment_details>\n# VSCode Visible Files\n(No visible files)\n\n# VSCode Open Tabs\n(No open tabs)\n\n# Current Time\n2025/3/3 下午2:43:41 (Asia/Shanghai, UTC+8:00)\n\n# Current Working Directory (/Volumes/Work/workspace/open-evol) Files\nai prop f(x).py\nai_percentage_plot.png\nindex.html\nplot_function.py\n\n# Current Mode\nACT MODE\n</environment_details>" } ] } ] } </pre> ### 复现步骤 执行如下命令进行复现 <pre> curl --location 'http://server-ip:10002/v1/chat/completions' \ --header 'accept: application/json' \ --header 'content-type: application/json' \ --header 'user-agent: Ba/JS 4.83.0' \ --header 'x-stainless-lang: js' \ --header 'x-stainless-package-version: 4.83.0' \ --header 'x-stainless-os: MacOS' \ --header 'x-stainless-arch: x64' \ --header 'x-stainless-runtime: node' \ --header 'x-stainless-runtime-version: v20.18.1' \ --header 'authorization: Bearer sk-UV3HUPDlLELeGvzl2cF7169c334d432482B254679c9e0f83' \ --header 'x-stainless-retry-count: 0' \ --header 'x-stainless-timeout: 600000' \ --data '{ "model": "deepseek-r1", "messages": [{ "role": "system", "content": "You are Cline, a highly skilled software engineer with extensive knowledge in many programming languages, frameworks, design patterns, and best practices." }, { "role": "user", "content": [{ "type": "text", "text": "<task>\n你是谁\n</task>" }, { "type": "text", "text": "<environment_details>\n# VSCode Visible Files\n(No visible files)\n\n# VSCode Open Tabs\n(No open tabs)\n\n# Current Time\n2025/3/3 下午2:43:41 (Asia/Shanghai, UTC+8:00)\n\n# Current Working Directory (/Volumes/Work/workspace/open-evol) Files\nai prop f(x).py\nai_percentage_plot.png\nindex.html\nplot_function.py\n\n# Current Mode\nACT MODE\n</environment_details>" }] }], "temperature": 0, "stream": true, "stream_options": { "include_usage": true } }' </pre> ### 环境信息 v0.2.2rc2
bsakaguchi 2026-10-29 14:41:12 +00:00
  • closed this issue
  • added the
    stale
    label
Author
Owner

@qiyuxinlin commented on GitHub (Mar 3, 2025):

Yes, we have not implemented the content array format interface. OpenAI's content array is for users to include text, pictures, audio and other information in one request. However, our current framework can only obtain text information, so there is no need to make an array interface.

<!-- gh-comment-id:2693695310 --> @qiyuxinlin commented on GitHub (Mar 3, 2025): Yes, we have not implemented the content array format interface. OpenAI's content array is for users to include text, pictures, audio and other information in one request. However, our current framework can only obtain text information, so there is no need to make an array interface.
Author
Owner

@ErvinXie commented on GitHub (Dec 11, 2025):

This issue has been automatically closed due to inactivity for 60 days.

If you believe this issue is still relevant, please feel free to reopen it with additional information or context.

Thank you for your contribution to KTransformers!


此 issue 因超过 60 天无活动而被自动关闭。

如果您认为此问题仍然存在,请随时重新打开并提供更多信息或上下文。

感谢您对 KTransformers 的贡献!

<!-- gh-comment-id:3639968597 --> @ErvinXie commented on GitHub (Dec 11, 2025): This issue has been automatically closed due to inactivity for 60 days. If you believe this issue is still relevant, please feel free to reopen it with additional information or context. Thank you for your contribution to KTransformers! --- 此 issue 因超过 60 天无活动而被自动关闭。 如果您认为此问题仍然存在,请随时重新打开并提供更多信息或上下文。 感谢您对 KTransformers 的贡献!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
kvcache-ai/ktransformers#560
No description provided.