ChatPeek is a Python utility for parsing shared conversation links from OpenAI's ChatGPT. It allows users to easily analyze, process and work with public human-AI conversations.
- Fetches shared conversation content from a given link.
- Parses the content into a structured format.
- Classifies each message in the conversation as either human or AI.
- Provides easy access to all replies in the conversation, as well as distinguishing between human and AI replies.
First, instantiate a ChatPeek
object with a shared conversation link as an argument. Then, access the Chat
object via the chat
property of the ChatPeek
object:
chat_peek = ChatPeek("your_shared_conversation_link_here")
chat = chat_peek.chat
You can then access the conversation title, all replies, and specific replies:
all_replies = chat.conversation
print(chat.title)
print(f"{datetime.datetime.fromtimestamp(chat.date)} | {chat.ai_model}\n")
for reply in all_replies:
print(f"{reply.author_name} ({str(reply.type).split('.')[1]}):\n{reply.statement}\n")
Unit tests are provided in ChatPeek_test.py
. To run the tests, use the following command:
python -m unittest ChatPeek_test.py
Contributions are welcome! Please submit a pull request or create an issue to discuss any changes you wish to make.
This project is licensed under the MIT License.
An Enum for specifying the type of reply, either HUMAN
or AI
.
Represents a single reply in a conversation, with a author names (if public), a reply type, and the statement content.
Represents a full chat conversation, with a timestamp, user name, AI model, a title and a list of Reply
objects.
The main class that takes a ChatGPT shared conversation link and parses it into a Chat
object.