Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java: Not possible to retrieve function calls and function results #6227

Open
matthewbolanos opened this issue May 13, 2024 · 0 comments
Open
Labels
java Issue or PR regarding Java code triage

Comments

@matthewbolanos
Copy link
Member

matthewbolanos commented May 13, 2024

After running the following code, it is not possible to retrieve the function calls and function result messages so that they can be readded to the history.

InvocationContext invocationContext = new InvocationContext.Builder()
            .withToolCallBehavior(ToolCallBehavior.allowAllKernelFunctions(true))
            .build();
        List<ChatMessageContent<?>> results  = chat.getChatMessageContentsAsync(chatHistory, kernel, invocationContext)
        .block();

In .NET, after invoking the chat completion model, the ChatHistory is mutated so that it includes all of the messages that were created (including function calls from the assistant role and function results as tool messages)

Because of this limitation, it is not possible for the AI to reuse context it was able to retrieve in previous function calls/results. For example, in the following chat, the AI used a function call to get the states of the lightbulbs. This included the IDs of the lights which are necessary for subsequent function calls.

Unfortunately, because the function result is lost, subsequent questions aren't able to use that information and the AI cannot complete them.

image

@markwallace-microsoft markwallace-microsoft added .NET Issue or Pull requests regarding .NET code java Issue or PR regarding Java code triage labels May 13, 2024
@github-actions github-actions bot changed the title Java: Not possible to retrieve function calls and function results .Net: Java: Not possible to retrieve function calls and function results May 13, 2024
@matthewbolanos matthewbolanos removed the .NET Issue or Pull requests regarding .NET code label May 13, 2024
@matthewbolanos matthewbolanos changed the title .Net: Java: Not possible to retrieve function calls and function results Java: Not possible to retrieve function calls and function results May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
java Issue or PR regarding Java code triage
Projects
None yet
Development

No branches or pull requests

2 participants