microsoft / microsoft/semantic-kernel-java

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

未关闭
#330 3 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

@johnoliver 已经在做这个了。

开始于 2025年8月5日。

bug triage
主要语言
Java
星标
276
派生
56
平均合并
17 小时 45 分钟
30 天内合并 PR
4

描述

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?

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。