spring-ai icon indicating copy to clipboard operation
spring-ai copied to clipboard

UTF-8 issue on ChatClientTitan

Open williamspindox opened this issue 1 year ago • 2 comments
trafficstars

Hi, it seems that response of chatClientTitan is not in UTF-8:

image

williamspindox avatar Mar 07 '24 07:03 williamspindox

Can you make a local change in AbstractBedrockApi and see if it solves your problem.

from

try {
logger.debug("Received chunk: " + chunk.bytes().asString(StandardCharsets.UTF_8));
SO response = this.objectMapper.readValue(chunk.bytes().asByteArray(), clazz);
this.eventSink.tryEmitNext(response);
}

to

try {
logger.debug("Received chunk: " + chunk.bytes().asString(StandardCharsets.UTF_8));
SO response = this.objectMapper.readValue(chunk.bytes().asString(StandardCharsets.UTF_8), clazz);
this.eventSink.tryEmitNext(response);
}

markpollack avatar Mar 07 '24 17:03 markpollack

Same issue, I also tried with chunk.bytes().asUtf8String() The issue is only with "stream" method, with "call" it works. I'll try to do some test to understand if it's an issue on awssdk side. You can try with something like this: "Chi è Bill Gates?".

williamspindox avatar Mar 08 '24 06:03 williamspindox