agentscope-ai / agentscope-ai/agentscope-java

Failed to call OpenAI API: OpenAI API request failed with status 400

Abierto
#628 10 comentarios 0 reacciones 0 asignados Ver en GitHub
area/core/model bug
Lenguaje dominante
Java
Estrellas
5.6k
Forks
1.3k
Merge medio
4 d 12 h
PR fusionados (30 d)
77

Descripción

**AgentScope-Java is an open-source project. To involve a broader community, we recommend asking your questions in English.**

**Describe the bug**
When I try to use agent call user message with version 1.0.7, I get an error. However, it works well with version 1.0.5. And I deploy a VLLM server to provide LLM Api.
I'm not sure it's a bug. Maybe I run it in a wrong way with the newest version.

**To Reproduce**
Steps to reproduce the behavior:

1. Here is my code:
`// 1. 配置 vLLM 的 OpenAI 兼容模型
String vllmBaseUrl = "http://localhost:8000";
String modelName = "Qwen3-235B-A22B-Instruct-2507-AWQ"; // 必须与 vLLM 启动时的 --model 一致

OpenAIChatModel model = OpenAIChatModel.builder()
.baseUrl(vllmBaseUrl)
.apiKey("EMPTY")
.modelName(modelName)
.build();

// 2. 创建 ReActAgent
ReActAgent agent = ReActAgent.builder()
.name("VLLM-Agent")
.sysPrompt("You are a helpful AI assistant powered by vLLM.")
.model(model)
.build();

// 3. 构建用户消息
Msg userMsg = Msg.builder()
.role(MsgRole.USER)
.content(TextBlock.builder().text("Hello").build())
.build();

// 4. 调用模型并打印结果
try {
Msg response = agent.call(userMsg).block();
System.out.println("【模型回复】: " + response.getTextContent());
} catch (Exception e) {
System.err.println("❌ 调用失败: " + e.getMessage());
e.printStackTrace();
}
2. Just run this method.
3. See error
**Expected behavior**
I just want it work well.

**Error messages**
Failed to call OpenAI API: OpenAI API request failed with status 400 | {"error":{"message":"1 validation error:\n {'type': 'missing', 'loc': ('body',), 'msg': 'Field required', 'input': None}\n\n File \"/usr/local/lib/python3.12/dist-packages/vllm/entrypoints/utils.py\", line 477, in create_chat_completion\n POST /v1/chat/completions [{'type': 'missing', 'loc': ('body',), 'msg': 'Field required', 'input': None}]","type":"Bad Request","param":null,"code":400}}
io.agentscope.core.model.ModelException: Failed to call OpenAI API: OpenAI API request failed with status 400 | {"error":{"message":"1 validation error:\n {'type': 'missing', 'loc': ('body',), 'msg': 'Field required', 'input': None}\n\n File \"/usr/local/lib/python3.12/dist-packages/vllm/entrypoints/utils.py\", line 477, in create_chat_completion\n POST /v1/chat/completions [{'type': 'missing', 'loc': ('body',), 'msg': 'Field required', 'input': None}]","type":"Bad Request","param":null,"code":400}} [model=Qwen3-235B-A22B-Instruct-2507-AWQ, provider=openai]

**Environment (please complete the following information):**

- AgentScope-Java Version: 1.0.7
- Java Version: 17.0.12
- OS: windows 10
- VLLM: v0.13.0

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.