
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
A Python package for sending long input text to OpenAI's GPT models using message chunking.
Read the blog post that inspired this project.
You can install chatgptmax
using pip:
pip install chatgptmax
Here's are basic usage examples of the chatgptmax
module. This assumes you have an OpenAI API key set up as an environment variable, OPENAI_API_KEY
.
You can also try out chatgptmax
using the Jupyter notebook provided here.
Suppose you have a file named sample.txt
with the following content:
This is a sample text. It contains some stop words that should be removed. We will use the chatgptmax module to clean and process this text.
You can use the clean.text_from_file
method to read and clean the text from this file:
from chatgptmax import clean
# Specify the path to your file
file_path = "sample.txt"
# Clean and process the text from the file
cleaned_text = clean.text_from_file(file_path)
# Print the cleaned text
print(cleaned_text)
This code will read the content of sample.txt
, remove common stopwords, and print the cleaned text:
This sample text contains stop words removed. We chatgptmax module clean process text.
You can use the send
function to send a prompt along with a large amount of text data from a file to ChatGPT:
from chatgptmax import send, read_data
# Define the path to your text file
file_path = "path_to_your_file.txt"
# Read the text data from the file
text_data = read_data(file_path)
# Define your prompt
prompt_text = "Summarize the following text for me:"
# Send the text data to ChatGPT for summarization
responses = send(prompt=prompt_text, text_data=text_data)
# Print ChatGPT's responses
for response in responses:
print(response)
This code will send the cleaned text as text data to ChatGPT along with the prompt. ChatGPT will provide responses based on your prompt and text data.
Please make sure you have your OpenAI API key properly set up as an environment variable or using a secret management service for this example to work.
For more examples and instructions, read the documentation
For more information on how to use chatgptmax, please refer to the official documentation.
If you'd like to contribute to this project, please read our Contribution Guide for details on how to get started.
This project is licensed under the MIT License - see the LICENSE file for details.
FAQs
Take large input or read a file and send it in chunks to ChatGPT.
We found that chatgptmax demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.