Bug: An assistant message with 'tool_calls' must be followed by tool messages responding to each 'tool_call_id'
Les mainteneurs répondent en général sous 14 jours
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 42/100
Piste de recherche
Commencez par l’exemple Lights joint et org.example.LightsExample, en particulier par l’appel en échec signalé à LightsExample.java:86. Construisez-le avec mvn clean install, exécutez les deux entrées décrites et comparez le comportement avec MODEL_ID défini sur les modèles listés. C’est terminé lorsque la deuxième entrée allume les lumières sans le tool_calls validation error.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Describe the bug
Got the following error using Semantic Kernel in Java with automatic function calling using 4o* OpenAI models: "An assistant message with 'tool_calls' must be followed by tool messages responding to each 'tool_call_id'".
To Reproduce
Steps to reproduce the behavior:
- Unzip provided example, build it and execute it:
mvn clean install
export OPENAI_API_KEY=sk-...
java -jar target/lights-example-1.0-SNAPSHOT.jar
- Enter two consecute inputs: "get the lights" and "turn them on"
- See error
SLF4J(W): No SLF4J providers were found.
SLF4J(W): Defaulting to no-operation (NOP) logger implementation
SLF4J(W): See https://www.slf4j.org/codes.html#noProviders for further details.
User > get the lights
Getting lights
Assistant > Here are the current states of the lights:
1. **Table Lamp**: Off
2. **Porch Light**: Off
3. **Chandelier**: On
User > turn them on
Exception in thread "main" com.azure.core.exception.HttpResponseException: Status code 400, "{
"error": {
"message": "An assistant message with 'tool_calls' must be followed by tool messages responding to each 'tool_call_id'. The following tool_call_ids did not have response messages: call_Mor7WOBzlb1Ao9ryIczup9mS, call_ejzgT6RAATaWBqmJbrzbzAMP",
"type": "invalid_request_error",
"param": "messages",
"code": null
}
}"
at com.azure.core.implementation.http.rest.RestProxyBase.instantiateUnexpectedException(RestProxyBase.java:388)
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:126)
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:191)
at reactor.core.publisher.FluxContextWrite$ContextWriteSubscriber.onNext(FluxContextWrite.java:107)
at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1839)
at reactor.core.publisher.MonoCollectList$MonoCollectListSubscriber.onComplete(MonoCollectList.java:129)
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:415)
at reactor.netty.channel.ChannelOperations.onInboundComplete(ChannelOperations.java:439)
at reactor.netty.channel.ChannelOperations.terminate(ChannelOperations.java:493)
at reactor.netty.http.client.HttpClientOperations.onInboundNext(HttpClientOperations.java:789)
at reactor.netty.channel.ChannelOperationsHandler.channelRead(ChannelOperationsHandler.java:114)
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:1475)
at io.netty.handler.ssl.SslHandler.decodeNonJdkCompatible(SslHandler.java:1349)
at io.netty.handler.ssl.SslHandler.decode(SslHandler.java:1389)
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:1407)
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:918)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:788)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:994)
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:1583)
Suppressed: java.lang.Exception: #block terminated with an error
at reactor.core.publisher.BlockingSingleSubscriber.blockingGet(BlockingSingleSubscriber.java:100)
at reactor.core.publisher.Mono.block(Mono.java:1742)
at org.example.LightsExample.main(LightsExample.java:86)
Expected behavior
The lights should be turned on.
Platform
- OS: Mac M1
- IDE: IntelliJ Idea or command line
- Language: Java
- Source: Maven repository, version 1.3.0
Additional context
The problem seems to be reproduced with models 4o and 4o-mini, but not with "gpt-3.5-turbo-0125". Change constant MODEL_ID in class LightsExample to see the difference.lights-example.zip
- Langage dominant
- Java
- Étoiles
- 276
- Forks
- 56
- Merge moyen
- 23 h 36 min
- PR mergées (30 j)
- 3
Préparer son environnement
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de microsoft/semantic-kernel-java
-
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 20/100
microsoft/semantic-kernel-java#334 · 1 commentaire ·
Les mainteneurs répondent en général sous 14 jours
-
Feature Parity Inquiry: Multi-Agent Orchestration and Roadmap Alignment with Python/.NET VersionsOuverte
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 25/100
microsoft/semantic-kernel-java#331 · 7 commentaires ·
Les mainteneurs répondent en général sous 14 jours
-
Bug: HTTP 404 Error When Using OpenAI-Compatible Endpoint with Semantic Kernel 1.4.4-RC1Peut-être à nouveau libre @johnoliver l’a pris il y a 418 jours, et aucune pull request n’est ouverte. Ouvertebug triage
microsoft/semantic-kernel-java#330 · 3 commentaires · 1 personne assignée ·
Les mainteneurs répondent en général sous 14 jours
-
agents without chatcompletion ?Ouvertebug triage
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 20/100
microsoft/semantic-kernel-java#328 · 1 commentaire ·
Les mainteneurs répondent en général sous 14 jours
-
Java: Remove SK plannersPeut-être à nouveau libre @johnoliver l’a pris il y a 471 jours, et aucune pull request n’est ouverte. Ouverte
microsoft/semantic-kernel-java#323 · 1 réaction · 2 personnes assignées ·
Les mainteneurs répondent en général sous 14 jours
Toutes les issues de microsoft/semantic-kernel-java
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
checkstyle/checkstyle#21755 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 84/100
Les mainteneurs répondent en général sous 1 jour
-
agentic-workflows
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
github/copilot-sdk#2782 ·
Les mainteneurs répondent en général sous 1 jour
-
Make docs website more visibleOuvertedocumentation Good for newcomer quick win
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
CodeForPhilly/benefit-decision-toolkit#519 ·
Les mainteneurs répondent en général sous 1 jour
-
area-deployment triage:bot-seen triage:needs-human
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
microsoft/aspire#20533 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour