microsoft / microsoft/semantic-kernel-java

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

Aperta
#330 3 commenti 0 reazioni 1 assegnatario Vedi su GitHub

@johnoliver ci sta già lavorando.

Dal 5/8/2025.

bug triage
Lingua principale
Java
Stelle
276
Fork
56
Merge medio
17h 45m
PR unite (30g)
4

Descrizione

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?

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.