- env
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-zhipuai-spring-boot-starter</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
- code
// message = "I'm visiting Jon Snow. The blood pressure looks fine: 120/80. The temperature is 36 degrees. The diagnosis is: he knows nothing"
String extract(String message) {
return chatClient
.prompt()
.user(userSpec -> userSpec.text("""
Extract structured data from the provided text.
If you do not know the value of a field asked to extract,
do not include any value for the field in the result.
Finally, save the object in the database.
---------------------
TEXT:
{text}
---------------------
""")
.param("text", message))
.call()
.content();
}
- error
org.springframework.ai.retry.NonTransientAiException: 400 - {"error":{"code":"1210","message":"API ���ò������������ĵ���"}}
Comment From: mxsl-gr
hi, i checked the ZhiPuAi error code docs, error code 1210
is API parameter error
.
from your code, it's unclear how to determine all the messages that are sent. If possible, it would be better to provide a relatively complete code snippet
but I casually wrote the text
some content, it worked.
ChatClient chatClient = new DefaultChatClientBuilder(chatModel).build();
String message = "create a new object with the following fields: name: John Doe, age: 30, email: abc@bcd.com";
String result = chatClient.prompt()
.user(userSpec -> userSpec.text("""
Extract structured data from the provided text.
If you do not know the value of a field asked to extract,
do not include any value for the field in the result.
Finally, save the object in the database.
---------------------
TEXT:
{text}
---------------------
""")
.param("text", message))
.call()
.content();
Comment From: csterwa
@liseri based on what @mxsl-gr provided, does that resolve this issue?