microsoft / microsoft/semantic-kernel-java
Bug: Set ToolCallBehavior.allowAllKernelFunctions(false) doesn't work for getStreamingChatMessageContentsAsync
Nessuno ha ancora preso questa issue.
- Lingua principale
- Java
- Stelle
- 276
- Fork
- 56
- Merge medio
- 17h 45m
- PR unite (30g)
- 4
Descrizione
Describe the bug
I try to invoke toolcall myself in a streaming chat.
I have learned that how to invoke a toolcall in an non-streaming chat. like
Kernel kernel = Kernel.builder().withAIService(ChatCompletionService.class, chatCompletionService)
.withPlugin(KernelPluginFactory.createFromObject(this, "time"))
.build();
chatCompletionService
.getChatMessageContentsAsync("what time is it now?", kernel, InvocationContext.builder()
.withToolCallBehavior(ToolCallBehavior.allowAllKernelFunctions(false))
.build())
.block()
.stream().filter(it->it instanceof OpenAIChatMessageContent<?>)
.map(it->((OpenAIChatMessageContent)it))
.forEach(it->{
System.out.println(it.getToolCall().size());
});
As you can see, I can get the toolCall value;
but when I change to an streaming chat, like
Kernel kernel = Kernel.builder().withAIService(ChatCompletionService.class, chatCompletionService)
.withPlugin(KernelPluginFactory.createFromObject(this, "time"))
.build();
chatCompletionService
.getStreamingChatMessageContentsAsync("what time is it now?", kernel, InvocationContext.builder()
.withToolCallBehavior(ToolCallBehavior.allowAllKernelFunctions(false))
.build())
.filter(it->it instanceof OpenAIStreamingChatMessageContent<?>)
.map(it->(OpenAIStreamingChatMessageContent)it)
.doOnNext(it->{
System.out.println(it.getToolCall().size());
}).subscribe();
the toolCall will always be an empty array.
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia con getStreamingChatMessageContentsAsync e confrontane il comportamento con getChatMessageContentsAsync, usando gli esempi di ToolCallBehavior.allowAllKernelFunctions(false) nell’issue. Traccia il modo in cui OpenAIStreamingChatMessageContent espone le chiamate agli strumenti; il lavoro è completato quando i risultati dello streaming contengono i dati attesi della chiamata allo strumento invece di un array vuoto, con una copertura per questa riproduzione.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- java
- Ambito
- api
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 45/100