microsoft / microsoft/semantic-kernel-java

Bug: HTTP 404 Error When Using OpenAI-Compatible Endpoint with Semantic Kernel 1.4.4-RC1

Đang mở
#330 3 bình luận 0 reaction 1 người được giao Xem trên GitHub

@johnoliver đang làm issue này rồi.

Từ ngày 5/8/2025.

bug triage
Ngôn ngữ chính
Java
Star
276
Fork
56
Merge trung bình
17 giờ 45 phút
Pull request đã merge (30 ngày)
4

Mô tả

Describe the bug
When attempting to use an OpenAI-compatible endpoint (specifically https://api.siliconflow.cn/v1) with Semantic Kernel 1.4.4-RC1, I consistently receive HTTP 404 errors ("404 page not found") regardless of the invocation method.

Code Implementation
OpenAIAsyncClient client = new OpenAIClientBuilder().credential(new KeyCredential("sk-key")).endpoint("https://api.siliconflow.cn/v1").buildAsyncClient();

ChatCompletionService chatService = OpenAIChatCompletion.builder().withModelId("Qwen/Qwen2.5-32B-Instruct").withOpenAIAsyncClient(client).build();

Kernel kernel = Kernel.builder().withAIService(ChatCompletionService.class, chatService).withPlugin(lightPlugin).build();

Error Occurrence
Both invocation methods fail with the same 404 error:
​​1、Prompt invocation​​:
kernel.invokePromptAsync(prompt, argss).block();

2、​Direct chat service invocation​​:
chatService.getChatMessageContentsAsync(history, kernel, invocationContext).block();

Error Details
Full stack trace shows:
00:37:50.318 [reactor-http-nio-1] WARN com.azure.core.implementation.serializer.HttpResponseBodyDecoder -- Failed to deserialize the error entity. Unsupported text Content-Type Type: class java.lang.Object Exception in thread "main" com.azure.core.exception.HttpResponseException: Status code 404, "404 page not found" at com.azure.core.implementation.http.rest.RestProxyBase.instantiateUnexpectedException(RestProxyBase.java:381) at com.azure.core.implementation.http.rest.AsyncRestProxy.lambda$ensureExpectedStatus$1(AsyncRestProxy.java:135) at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onNext(FluxMapFuseable.java:113) at reactor.core.publisher.MonoUsing$MonoUsingSubscriber.onNext(MonoUsing.java:231) at reactor.core.publisher.FluxHandle$HandleSubscriber.onNext(FluxHandle.java:129) at reactor.core.publisher.FluxMap$MapConditionalSubscriber.onNext(FluxMap.java:224) at reactor.core.publisher.FluxDoFinally$DoFinallySubscriber.onNext(FluxDoFinally.java:113) at reactor.core.publisher.FluxHandleFuseable$HandleFuseableSubscriber.onNext(FluxHandleFuseable.java:194) at reactor.core.publisher.FluxContextWrite$ContextWriteSubscriber.onNext(FluxContextWrite.java:107) at reactor.core.publisher.Operators$BaseFluxToMonoOperator.completePossiblyEmpty(Operators.java:2096) at reactor.core.publisher.MonoCollectList$MonoCollectListSubscriber.onComplete(MonoCollectList.java:118) at reactor.core.publisher.FluxPeek$PeekSubscriber.onComplete(FluxPeek.java:260) at reactor.core.publisher.FluxMap$MapSubscriber.onComplete(FluxMap.java:144) at reactor.netty.channel.FluxReceive.onInboundComplete(FluxReceive.java:413) at reactor.netty.channel.ChannelOperations.onInboundComplete(ChannelOperations.java:455) at reactor.netty.channel.ChannelOperations.terminate(ChannelOperations.java:509) at reactor.netty.http.client.HttpClientOperations.onInboundNext(HttpClientOperations.java:821) at reactor.netty.channel.ChannelOperationsHandler.channelRead(ChannelOperationsHandler.java:115) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) at com.azure.core.http.netty.implementation.AzureSdkHandler.channelRead(AzureSdkHandler.java:224) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:436) at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:346) at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:318) at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:251) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) at io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1515) at io.netty.handler.ssl.SslHandler.decodeNonJdkCompatible(SslHandler.java:1389) at io.netty.handler.ssl.SslHandler.decode(SslHandler.java:1429) at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:530) at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:469) at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:290) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1357) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:440) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:868) at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166) at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:796) at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:732) at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:658) at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562) at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:998) at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) at java.base/java.lang.Thread.run(Thread.java:842) Suppressed: java.lang.Exception: #block terminated with an error at reactor.core.publisher.BlockingSingleSubscriber.blockingGet(BlockingSingleSubscriber.java:104) at reactor.core.publisher.Mono.block(Mono.java:1779) at com.example.semantickernel_example.TextGenerationExample.main(TextGenerationExample.java:65) Caused by: java.lang.IllegalStateException: Unsupported text Content-Type Type: class java.lang.Object at com.azure.core.util.serializer.JacksonAdapter.deserializeText(JacksonAdapter.java:453) at com.azure.core.util.serializer.JacksonAdapter.lambda$deserialize$9(JacksonAdapter.java:354) at com.azure.core.util.serializer.JacksonAdapter.useAccessHelper(JacksonAdapter.java:491) at com.azure.core.util.serializer.JacksonAdapter.deserialize(JacksonAdapter.java:347) at com.azure.core.implementation.serializer.HttpResponseBodyDecoder.deserialize(HttpResponseBodyDecoder.java:176) at com.azure.core.implementation.serializer.HttpResponseBodyDecoder.deserializeBody(HttpResponseBodyDecoder.java:150) at com.azure.core.implementation.serializer.HttpResponseBodyDecoder.decodeByteArray(HttpResponseBodyDecoder.java:67) at com.azure.core.implementation.serializer.HttpResponseDecoder$HttpDecodedResponse.getDecodedBody(HttpResponseDecoder.java:93)

Troubleshooting Attempts
1、Verified the endpoint URL is correct and accessible
2、Confirmed the API key is valid
3、Tested the same endpoint with direct HTTP requests (works fine)
4、Tried with different model IDs
5、Verified network connectivity and firewall settings

Expected Behavior
The OpenAI-compatible endpoint should accept requests and return proper responses when used through Semantic Kernel's client.

Environment
Semantic Kernel version: 1.4.4-RC1
Java version: 17
OS: Windows 11 Pro

Additional Context
The endpoint https://api.siliconflow.cn/v1 is confirmed to work with standard OpenAI API requests, suggesting this may be a client configuration or SDK compatibility issue.

Questions
1、Are there any additional configuration requirements for using non-Azure OpenAI endpoints?
2、Is the OpenAIClientBuilderthe correct approach for third-party OpenAI-compatible services?
3、Are there known issues with the 1.4.4-RC1 version regarding custom endpoints?

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.