alibaba / spring-ai-alibaba

An Application Framework for Java Developers
https://sca.aliyun.com/ai
Apache License 2.0
382 stars 89 forks source link

`converter.BeanOutputConverter` occasional conversion failure problem #62

Open yuluo-yx opened 2 weeks ago

yuluo-yx commented 2 weeks ago

info

2024-10-15T12:25:49.005+08:00 ERROR 7792 --- [text-classifier] [nio-8082-exec-1] o.s.ai.converter.BeanOutputConverter     : Could not parse the given text to the desired target type:{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "string",
  "enum": [ "POSITIVE" ]
} into org.springframework.ai.converter.BeanOutputConverter$CustomizedTypeReference@43a5fda
2024-10-15T12:25:49.007+08:00 ERROR 7792 --- [text-classifier] [nio-8082-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed: java.lang.RuntimeException: com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize value of type `com.alibaba.cloud.ai.text.enums.TextClassifierTypes` from Object value (token `JsonToken.START_OBJECT`)
 at [Source: REDACTED (`StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION` disabled); line: 1, column: 1]] with root cause

com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize value of type `com.alibaba.cloud.ai.text.enums.TextClassifierTypes` from Object value (token `JsonToken.START_OBJECT`)
 at [Source: REDACTED (`StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION` disabled); line: 1, column: 1]

normal situation

$ curl http://localhost:8082/ai/text/structured-output?text=god

"NEUTRAL"

$ curl http://localhost:8082/ai/text/structured-output?text=waste

"NEGATIVE"
JunJieLiu51520 commented 1 week ago

which test case or function ?

yuluo-yx commented 1 week ago

which test case or function ?

here: https://github.com/alibaba/spring-ai-alibaba/pull/35 text-classifier