Description

The current implementation of the fromSpringAiMessage method in the AzureOpenAiChatModel class does not support passing tool_calls or tool_call_id. Additionally, it does not handle the FUNCTION message type, which results in an IllegalArgumentException when such a message type is encountered.

Current Implementation

private ChatRequestMessage fromSpringAiMessage(Message message) { 
    switch (message.getMessageType()) { 
        case USER: 
            return new ChatRequestUserMessage(message.getContent()); 
        case SYSTEM: 
            return new ChatRequestSystemMessage(message.getContent()); 
        case ASSISTANT: 
            return new ChatRequestAssistantMessage(message.getContent()); 
        default: 
            throw new IllegalArgumentException("Unknown message type " + message.getMessageType()); 
    } 
}

Problems

  1. No way to pass tool_calls or tool_call_id: The ChatRequestAssistantMessage constructor does not provide a way to pass the tool_calls java @JsonCreator public ChatRequestAssistantMessage(@JsonProperty("content") String content) { this.content = content; }

  2. Does not support FUNCTION message type

Comment From: csterwa

@RikJux does the recent M2 release resolve this issue?

Comment From: csterwa

May be old. Closing.