langchaingo icon indicating copy to clipboard operation
langchaingo copied to clipboard

ToChatMessage() doesn't support SystemChatMessage

Open boshd opened this issue 4 months ago • 0 comments

Hello, is there a reason why ToChatMessage doesn't support SystemChatMessage? What's the solution for that? Thanks.

func (c ChatMessageModel) ToChatMessage() ChatMessage {
	switch c.Type {
	case string(ChatMessageTypeAI):
		return AIChatMessage{Content: c.Data.Content}
	case string(ChatMessageTypeHuman):
		return HumanChatMessage{Content: c.Data.Content}
	default:
		slog.Warn("convert to chat message failed with invalid message type", "type", c.Type)
		return nil
	}
}

boshd avatar Oct 27 '24 14:10 boshd