-
Notifications
You must be signed in to change notification settings - Fork 137
Description
I’d like to propose adding an id field to the Message struct.
When using LangChain to build chat interfaces, it’s common to integrate with LiveView streams for real-time updates. However, the current Message struct doesn’t include an id, which forces developers to manually assign and manage IDs when using streams. This results in extra boilerplate, even though LangChain is intended to provide an abstraction layer.
Given that some providers (e.g., OpenAI) already include message IDs in their responses, we could directly use those IDs where available. For user-generated messages or cases where an ID is missing, a randomly generated UUID could be used to ensure all messages consistently have IDs.
This addition would make it easier to use LiveView streams without additional effort, while keeping LangChain’s abstractions clean and developer-friendly.