Skip to content

docs: add multimodal request guide for CN and EN#1249

Open
sufubao wants to merge 1 commit intomainfrom
docs/multimodal-request-guide
Open

docs: add multimodal request guide for CN and EN#1249
sufubao wants to merge 1 commit intomainfrom
docs/multimodal-request-guide

Conversation

@sufubao
Copy link
Copy Markdown
Collaborator

@sufubao sufubao commented Apr 1, 2026

Add documentation explaining how users can send multimodal requests to the LightLLM server, covering OpenAI-compatible and Legacy API formats with curl, Python requests, and OpenAI SDK examples.

Add documentation explaining how users can send multimodal requests
to the LightLLM server, covering OpenAI-compatible and Legacy API
formats with curl, Python requests, and OpenAI SDK examples.
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a comprehensive multimodal request guide in both Chinese and English, detailing how to use OpenAI-compatible and Legacy API formats for image and audio inputs. The documentation covers various integration methods including curl, Python requests, and the OpenAI SDK. Feedback focuses on improving the accuracy of the streaming response JSON examples by adding missing fields such as 'created', 'model', and 'role' to match the server implementation. Additionally, it is suggested to clarify how to handle multiple images within the Legacy format prompt using multiple tags.

Comment on lines +395 to +407
{
"id": "chatcmpl-xxx",
"object": "chat.completion.chunk",
"choices": [
{
"index": 0,
"delta": {
"content": "这张"
},
"finish_reason": null
}
]
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

流式响应示例中缺少 createdmodel 字段,且 delta 对象在 LightLLM 的当前实现中通常会包含 role 字段。为了与 lightllm/server/api_openai.py 中的实现保持一致,建议完善此 JSON 示例。

Suggested change
{
"id": "chatcmpl-xxx",
"object": "chat.completion.chunk",
"choices": [
{
"index": 0,
"delta": {
"content": "这张"
},
"finish_reason": null
}
]
}
{
"id": "chatcmpl-xxx",
"object": "chat.completion.chunk",
"created": 1234567890,
"model": "qwen",
"choices": [
{
"index": 0,
"delta": {
"role": "assistant",
"content": "这张"
},
"finish_reason": null
}
]
}

Comment on lines +395 to +407
{
"id": "chatcmpl-xxx",
"object": "chat.completion.chunk",
"choices": [
{
"index": 0,
"delta": {
"content": "The image"
},
"finish_reason": null
}
]
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The streaming response example is missing the created and model fields, and the delta object in LightLLM's current implementation typically includes the role field. To be consistent with the implementation in lightllm/server/api_openai.py, it is recommended to update this JSON example.

Suggested change
{
"id": "chatcmpl-xxx",
"object": "chat.completion.chunk",
"choices": [
{
"index": 0,
"delta": {
"content": "The image"
},
"finish_reason": null
}
]
}
{
"id": "chatcmpl-xxx",
"object": "chat.completion.chunk",
"created": 1234567890,
"model": "qwen",
"choices": [
{
"index": 0,
"delta": {
"role": "assistant",
"content": "The image"
},
"finish_reason": null
}
]
}

response = run(
uris=["https://qianwen-res.oss-accelerate.aliyuncs.com/Qwen3.5/demo/CI_Demo/mathv-1327.jpg"],
query="<|im_start|>system\nYou are a helpful assistant.<|im_end|>\n"
"<|im_start|>user\n<img></img>\n请描述这张图片的内容。<|im_end|>\n"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

在 Legacy 格式的多图片请求中,用户需要知道如何在 prompt 中放置多个占位符。建议在此处或“多图片请求”部分补充说明:对于多个输入资源,应在 prompt 中按顺序使用多个 <img></img> 标签。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant