I saw some LLM product support SSE requests for text, also saw LangChain4j also support, interface is StreamingChatLanguageModel, I don't see Spring AI AIClient related interface, don't know whether the design?

I am also a recent AI related knowledge, the following is my own project using the AiClient interface to implement the code:

public void generate(Prompt prompt, ChatMessageInfo chatMessage, SimpMessagingTemplate messagingTemplate,String destination){
        List<Message> messages = prompt.getMessages();
        List<ModelRequest.Prompt> theoMessages = messages.stream().map(message -> new ModelRequest.Prompt(message.getMessageTypeValue(),message.getContent())).toList();
        logger.info(theoMessages);
        ModelRequest modelRequest = new ModelRequest();
        modelRequest.setPrompt(theoMessages);
        this.zhiPuService.createChatCompletion(modelRequest,chatMessage,messagingTemplate,destination);
    }

The parameters passed in the above code are the code related to passing WebSocket directly at the control layer.

Although solve the problem, but I know the code is very bad, hope to solve the problem from the interface design, thank you!

Comment From: making

I think this issue duplicates #116

Comment From: XYWENJIE

Thank you

Comment From: markpollack

Yes, it is being looked into. Hopefully we get it into the 0.8.0 release. Thanks for your input and patience.