Sorry to occupy your time,I find it diffcult to solve,I dont know if i had any fasle code. Using OpenAiChatModel to access deepseek model deployed by vLLM encountered 400 error。
Environment Spring Boot edition is 3.4.3 with JDK 17 spring-ai-openai-spring-boot-starter(1.0.0-M6) base-url ,api-key and model is all correct and can be normally accessed by ordinary http request
my code is as follow (used two kinds of code but all failed) 1.
public String chatWithDeepseek(String message) {
ChatResponse response = chatModel.call(
new Prompt(
"Generate the names of 5 famous pirates.",
OpenAiChatOptions.builder()
.model("model-key")
.temperature(0.8)
.build()
));
return response.getResult().getOutput().toString();
}
public String chat01(@RequestParam("message") String message) {
return this.chatClient.prompt()
.user(message)
.call()
.content();
}
ERROR TEXT is as follows:
org.springframework.ai.retry.NonTransientAiException: 400 - {"object":"error","message":"[{'type': 'missing', 'loc': ('body',), 'msg': 'Field required', 'input': None}]","type":"BadRequestError","param":null,"code":400}
I wonder if there are some problems with vLLM Thank you again for this
Comment From: dlstone
I'm also experiencing the same issue. Spring Boot edition is 3.4.3 with JDK 17 spring-ai-openai-spring-boot-starter(1.0.0-M6) base-url ,api-key and model is all correct and can be normally accessed by ordinary http request ERROR TEXT is as follows: 400 - {"object":"error","message":"[{'type': 'missing', 'loc': ('body',), 'msg': 'Field required', 'input': None}]","type":"BadRequestError","param":null,"code":400}
Comment From: dlstone
I'm also experiencing the same issue. Spring Boot edition is 3.4.3 with JDK 17 spring-ai-openai-spring-boot-starter(1.0.0-M6) base-url ,api-key and model is all correct and can be normally accessed by ordinary http request ERROR TEXT is as follows: 400 - {"object":"error","message":"[{'type': 'missing', 'loc': ('body',), 'msg': 'Field required', 'input': None}]","type":"BadRequestError","param":null,"code":400}
ollama is ok.