~/Library/Messages/chat.db
(at least for macOS Ventura 13.4).
The IMessageChatLoader
loads from this database file.
IMessageChatLoader
with the file path pointed to chat.db
database you’d like to process.loader.load()
(or loader.lazy_load()
) to perform the conversion. Optionally use merge_chat_runs
to combine message from the same sender in sequence, and/or map_ai_messages
to convert messages from the specified sender to the “AIMessage” class.~/Library/Messages
. To use this class, you can copy the DB to an accessible directory (e.g., Documents) and load from there. Alternatively (and not recommended), you can grant full disk access for your terminal emulator in System Settings > Security and Privacy > Full Disk Access.
We have created an example database you can use at this linked drive file.
load()
(or lazy_load
) methods return a list of “ChatSessions” that currently just contain a list of messages per loaded conversation. All messages are mapped to “HumanMessage” objects to start.
You can optionally choose to merge message “runs” (consecutive messages from the same sender) and select a sender to represent the “AI”. The fine-tuned LLM will learn to generate these AI messages.
convert_messages_for_finetuning
utility to do so.
openai
installed
and have set your OPENAI_API_KEY
appropriately
ChatOpenAI
model class.