Skip to content

Add support for StreamingChatResponseHandler #1374

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

Open
Plawn opened this issue Mar 19, 2025 · 2 comments
Open

Add support for StreamingChatResponseHandler #1374

Plawn opened this issue Mar 19, 2025 · 2 comments
Labels
enhancement New feature or request

Comments

@Plawn
Copy link

Plawn commented Mar 19, 2025

Today when using

import dev.langchain4j.model.chat.response.StreamingChatResponseHandler;
import dev.langchain4j.service.MemoryId;
import dev.langchain4j.service.SystemMessage;
import dev.langchain4j.service.UserMessage;


public interface Agent {
    @SystemMessage("""
       <message>
            """)
    String chat(@MemoryId String memoryId, @UserMessage String message, StreamingChatResponseHandler handler);
}

the StreamingChatResponseHandler is not used / bound

cf: https://docs.langchain4j.dev/tutorials/response-streaming

@geoand
Copy link
Collaborator

geoand commented Mar 19, 2025

Currently you can leverage streaming by returning Multi<String> from an AiService

@Plawn
Copy link
Author

Plawn commented Mar 21, 2025

Yes !
I wanted to use the OnToolCall handler in order to provide nice responsive UI telling the user, what is happening :)

@geoand geoand added the enhancement New feature or request label Mar 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants