A Python library for processing conversation data, creating Jupyter Notebooks, handling Google Drive uploads, and updating Google Sheets.
Project description
mdtidy
mdtidy is a Python library designed to process conversational AI outputs (specifically GPT and Gemini) into Jupyter Notebooks (.ipynb), while also counting code errors within the content. It's an intuitive tool for transforming raw markdown, code blocks, and conversation data into well-structured Jupyter notebooks, specifically tailored for reviewing AI-generated conversation data and integrating with Google Drive and Google Sheets for enhanced data management.
Features
- Markdown to Jupyter Notebook: Convert markdown content with embedded Python code blocks into a Jupyter Notebook file.
- Error Counting: Identify and count common Python error types within the content.
- Conversation Analysis: Supports parsing and formatting conversation data from both GPT and Gemini models.
- Google Drive Integration: Upload processed notebooks to Google Drive.
- Google Sheets Integration: Update Google Sheets with processed conversation data and error counts.
Installation
Install mdtidy using pip:
pip install mdtidy
Usage
Setting Up Chrome Profiles for Gemini and GPT
To use mdtidy effectively, you need to set up Chrome profiles for both Gemini and GPT. This allows Selenium to use your Chrome profile for scraping data.
Manually Create a New Chrome Profile
-
Create a New Profile Folder:
- Navigate to the Chrome User Data directory:
- Windows:
C:\Users\<Your Username>\AppData\Local\Google\Chrome\User Data - macOS:
~/Library/Application Support/Google/Chrome - Linux:
~/.config/google-chrome
- Windows:
- Navigate to the Chrome User Data directory:
-
Create a New Folder for the Profile:
- Inside the
User Datadirectory, create a new folder, for example,Profile 2 GeminiandProfile 2 GPT.
- Inside the
-
Start Chrome with the New Profile:
-
Open a terminal or command prompt and start Chrome with the new profile:
-
Windows:
"C:\Program Files\Google\Chrome\Application\chrome.exe" --user-data-dir="C:\Users\<Your Username>\AppData\Local\Google\Chrome\User Data\Profile 2 Gemini"
"C:\Program Files\Google\Chrome\Application\chrome.exe" --user-data-dir="C:\Users\<Your Username>\AppData\Local\Google\Chrome\User Data\Profile 2 GPT"
-
macOS:
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --user-data-dir="~/Library/Application Support/Google/Chrome/Profile 2 Gemini"
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --user-data-dir="~/Library/Application Support/Google/Chrome/Profile 2 GPT"
-
Linux:
google-chrome --user-data-dir="~/.config/google-chrome/Profile 2 Gemini"
google-chrome --user-data-dir="~/.config/google-chrome/Profile 2 GPT"
-
-
-
Set Up the New Profile:
- When Chrome opens, set up the new profile by signing in and configuring it as needed.
After setting up your Chrome profiles and updating the configuration, you can proceed with running the scripts.
Combined Processor
This example shows how to process both GPT and Gemini conversation data into a structured Jupyter notebook all at once.
from mdtidy.combined_processor import process_conversation
# Trigger the processing of a conversation for both models combined, prompting for required details
process_conversation()
Convert GPT Conversations to Notebook
This example shows how to process GPT conversation data into a structured Jupyter notebook.
from mdtidy.gpt_processor import process_gpt_conversation
# Trigger the processing of a GPT conversation, prompting for required details
process_gpt_conversation()
Convert Gemini Conversations to Notebook
This example details processing Gemini model conversations into a notebook format, integrating error analysis.
from mdtidy.gemini_processor import process_gemini_conversation
# Trigger the processing of a Gemini conversation, prompting for required details
process_gemini_conversation()
Count Code Errors
This function identifies and counts typical Python errors within given content.
from mdtidy.gemini_processor import count_code_errors
# Example content with typical Python errors
input_strings_with_errors = [
"""
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'variable' is not defined
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for +: 'int' and 'str'
"""
]
# Count and display code errors
error_counts = count_code_errors(input_strings_with_errors)
print(error_counts)
Update Google Sheets
This feature is currently under development and will be available in a future release.
Once implemented, it will allow you to update Google Sheets with processed conversation data and error counts.
from mdtidy.update_google_sheets import update_google_sheet
# Update the Google Sheet
update_google_sheet()
The update_google_sheet function will automatically use the default directory comp_ana_json for JSON files and the stored Google Sheets credentials and spreadsheet name from the configuration file (google_sheets.ini).
License
This project is licensed under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mdtidy-0.4.7.tar.gz.
File metadata
- Download URL: mdtidy-0.4.7.tar.gz
- Upload date:
- Size: 15.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.10.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
57487847f6508e483726d36fd60eb7fef0396b437134f06ea96649d295fdc659
|
|
| MD5 |
fcbc38f283cd1f7d6faa886e2a2d350a
|
|
| BLAKE2b-256 |
abcd83d1d5893d911fc2288a7fa3f980641c9b70402b3f602918c6b42677b205
|
File details
Details for the file mdtidy-0.4.7-py3-none-any.whl.
File metadata
- Download URL: mdtidy-0.4.7-py3-none-any.whl
- Upload date:
- Size: 18.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.10.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
64a3a82a2887c9f625dd0b047af0bb12acbafedf5ecdbbf1f75d5cadfe578806
|
|
| MD5 |
2659f09047a1c4345219b81d12175bcd
|
|
| BLAKE2b-256 |
8f0014d523afc0f6cf0cdb4b111da3c02bbf5cfc6e243300aebadbdebbcd937c
|