Sitemap
Iamseyedalix

Iamseyedalix

Press enter or click to view image in full size
chatgpt Automation

ChatGPT Automation 🤖💻🧠

2 min readDec 16, 2023

--

Description

ChatGPTAutomation is a Python package designed to streamline interactions with ChatGPT using Selenium, making it more accessible for developers and testers. 🚀

Features

  • Automated Messaging: Easily send messages to ChatGPT programmatically. 📩
  • File Upload Support: Seamless support for uploading files during interactions. 📁
  • Conversation Retrieval: Retrieve and store ChatGPT conversations effortlessly. 🗂️
  • Customizable WebDriver: Choose your preferred WebDriver for managing the browser. 🌐

Installation

Install with:

pip install ChatGPTAutomation

Usage

Chrome WebDriver Download:

  • Latest Chrome Version: Download here.
  • Older Chrome Versions: Find compatible drivers here.

Setup:

Get Iamseyedalix’s stories in your inbox

Join Medium for free to get updates from this writer.

Automatic setup (without paths):

from chatgpt_automation.chatgpt_automation import ChatGPTAutomation
chat_bot = ChatGPTAutomation(
username="<your username here>", # Optional
password="<your password here>" # Optional
)

Manual setup (with paths):

from chatgpt_automation.chatgpt_automation import ChatGPTAutomation

chat_bot = ChatGPTAutomation(chrome_path="path/to/chrome.exe",
chrome_driver_path="path/to/chromedriver.exe",
username="<your username here>", # Optional
password="<your password here>" # Optional
)
# Send prompt
chat_bot.send_prompt_to_chatgpt("Hello, ChatGPT!")
# Save conversation
chat_bot.save_conversation("conversation.txt")

File upload:

chat_bot.upload_file_for_prompt("test_file.txt")
chat_bot.send_prompt_to_chatgpt("Explain this file?")

Check response status:

if chat_bot.check_response_status():
print("Response ready.")
else:
print("Response issue.")

Get last response:

chat_bot.send_prompt_to_chatgpt("Hello, ChatGPT!")
response = chat_bot.return_last_response()

Switch models:

chat_bot.switch_model(4)

Login check:

if chat_bot.check_login_page():
chat_bot.login()

Requirements

  • Python 3.8+
  • Selenium==4.9.0
  • See requirements.txt for more.

To-Do List

Sign up:

  • ✅ User login
  • ⬜️ Sign up via email address

Conversation Management:

  • ✅ Create a new conversation
  • ✅ Get message list in a conversation
  • ✅ Delete a conversation
  • ⬜️ Edit Conversation Name
  • ⬜️ Subscribe for real-time messages
  • ⬜️ Handle Random messages such as pop-ups, hints, and login attempts

Advanced Features:

  • ✅ Support for uploading files
  • ⬜️ Support ChatGPT with internet
  • ⬜️ Using GPTs
  • ⬜️ API

User Account Handling:

  • ✅ Switch Between ChatGPT 3.5 and 4
  • ⬜️ Fetch user details like email and plan type
  • ⬜️ Set custom instructions for more personalized conversations

Browser:

  • ⬜️ Headless Browser

Contact

Seyed Ali Hosseini 🧑‍💻 — iamseyedalipro@gmail.com 📧.

I will be very happy if you help me in updating this library :)

Acknowledgements

  • Thanks to OpenAI and Selenium. 🙏👨‍💻

--

--