chatgptmax


Namechatgptmax JSON
Version 2.3.5 PyPI version JSON
download
home_page
SummaryTake large input or read a file and send it in chunks to ChatGPT.
upload_time2024-01-19 02:14:46
maintainer
docs_urlNone
author
requires_python>=3.7
license
keywords
VCS
bugtrack_url
requirements openai tiktoken
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # chatgptmax

[![PyPI Version](https://img.shields.io/pypi/v/chatgptmax)](https://pypi.org/project/chatgptmax/)
[![Python Version](https://img.shields.io/pypi/pyversions/chatgptmax)](https://pypi.org/project/chatgptmax/)
[![License](https://img.shields.io/pypi/l/chatgptmax)](https://github.com/victoriadrake/chatgptmax/blob/main/LICENSE)

A Python package for sending long input text to OpenAI's GPT models using message chunking.

Read the [blog post](https://victoria.dev/blog/how-to-send-long-text-input-to-chatgpt-using-the-openai-api/) that inspired this project.

## Installation

You can install `chatgptmax` using pip:

```bash
pip install chatgptmax
```

## Usage

Here's are basic usage examples of the `chatgptmax` module. This assumes you have an [OpenAI API key set up](/docs/set_up_openai_api_key.md) as an environment variable, `OPENAI_API_KEY`.

You can also try out `chatgptmax` using [the Jupyter notebook provided here.](https://github.com/victoriadrake/chatgptmax-jupyter)

### Clean text with preprocessing

Suppose you have a file named `sample.txt` with the following content:

```txt
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:

```python
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:

```txt
This sample text contains stop words removed. We chatgptmax module clean process text.
```

### Send lots of text to ChatGPT

You can use the `send` function to send a prompt along with a large amount of text data from a file to ChatGPT:

```python
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](/docs/set_up_openai_api_key.md) as an environment variable or using a secret management service for this example to work.

For more examples and instructions, read [the documentation](./docs/README.md)

## Documentation

For more information on how to use chatgptmax, please refer to the official [documentation](/docs/).

## Contributing

If you'd like to contribute to this project, please read our [Contribution Guide](CONTRIBUTING.md) for details on how to get started.

## License

This project is licensed under the MIT License - see the LICENSE file for details.

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "chatgptmax",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "",
    "author": "",
    "author_email": "Victoria Drake <hello@victoria.dev>",
    "download_url": "https://files.pythonhosted.org/packages/4d/45/318b1101fa67bda52e2e94b5f7e1747e0095d7ee1d398243e2a0cc9a06d6/chatgptmax-2.3.5.tar.gz",
    "platform": null,
    "description": "# chatgptmax\n\n[![PyPI Version](https://img.shields.io/pypi/v/chatgptmax)](https://pypi.org/project/chatgptmax/)\n[![Python Version](https://img.shields.io/pypi/pyversions/chatgptmax)](https://pypi.org/project/chatgptmax/)\n[![License](https://img.shields.io/pypi/l/chatgptmax)](https://github.com/victoriadrake/chatgptmax/blob/main/LICENSE)\n\nA Python package for sending long input text to OpenAI's GPT models using message chunking.\n\nRead the [blog post](https://victoria.dev/blog/how-to-send-long-text-input-to-chatgpt-using-the-openai-api/) that inspired this project.\n\n## Installation\n\nYou can install `chatgptmax` using pip:\n\n```bash\npip install chatgptmax\n```\n\n## Usage\n\nHere's are basic usage examples of the `chatgptmax` module. This assumes you have an [OpenAI API key set up](/docs/set_up_openai_api_key.md) as an environment variable, `OPENAI_API_KEY`.\n\nYou can also try out `chatgptmax` using [the Jupyter notebook provided here.](https://github.com/victoriadrake/chatgptmax-jupyter)\n\n### Clean text with preprocessing\n\nSuppose you have a file named `sample.txt` with the following content:\n\n```txt\nThis 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.\n```\n\nYou can use the `clean.text_from_file` method to read and clean the text from this file:\n\n```python\nfrom chatgptmax import clean\n\n# Specify the path to your file\nfile_path = \"sample.txt\"\n\n# Clean and process the text from the file\ncleaned_text = clean.text_from_file(file_path)\n\n# Print the cleaned text\nprint(cleaned_text)\n```\n\nThis code will read the content of `sample.txt`, remove common stopwords, and print the cleaned text:\n\n```txt\nThis sample text contains stop words removed. We chatgptmax module clean process text.\n```\n\n### Send lots of text to ChatGPT\n\nYou can use the `send` function to send a prompt along with a large amount of text data from a file to ChatGPT:\n\n```python\nfrom chatgptmax import send, read_data\n\n# Define the path to your text file\nfile_path = \"path_to_your_file.txt\"\n\n# Read the text data from the file\ntext_data = read_data(file_path)\n\n# Define your prompt\nprompt_text = \"Summarize the following text for me:\"\n\n# Send the text data to ChatGPT for summarization\nresponses = send(prompt=prompt_text, text_data=text_data)\n\n# Print ChatGPT's responses\nfor response in responses:\n    print(response)\n\n```\n\nThis 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.\n\nPlease make sure you have your [OpenAI API key properly set up](/docs/set_up_openai_api_key.md) as an environment variable or using a secret management service for this example to work.\n\nFor more examples and instructions, read [the documentation](./docs/README.md)\n\n## Documentation\n\nFor more information on how to use chatgptmax, please refer to the official [documentation](/docs/).\n\n## Contributing\n\nIf you'd like to contribute to this project, please read our [Contribution Guide](CONTRIBUTING.md) for details on how to get started.\n\n## License\n\nThis project is licensed under the MIT License - see the LICENSE file for details.\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Take large input or read a file and send it in chunks to ChatGPT.",
    "version": "2.3.5",
    "project_urls": {
        "Bug Tracker": "https://github.com/victoriadrake/chatgptmax/issues",
        "Homepage": "https://github.com/victoriadrake/chatgptmax/"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e394c1146a4f83b686ec420ae32f75aed0f1d3915895d1563aeb4c48d6163762",
                "md5": "39cb118f7f4b573612ae7b126a3d9a3f",
                "sha256": "197e226dee075bbbf7cf75325aa83f602b84ab429a872fe6144eab67763a3d79"
            },
            "downloads": -1,
            "filename": "chatgptmax-2.3.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "39cb118f7f4b573612ae7b126a3d9a3f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 6043,
            "upload_time": "2024-01-19T02:14:44",
            "upload_time_iso_8601": "2024-01-19T02:14:44.937672Z",
            "url": "https://files.pythonhosted.org/packages/e3/94/c1146a4f83b686ec420ae32f75aed0f1d3915895d1563aeb4c48d6163762/chatgptmax-2.3.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4d45318b1101fa67bda52e2e94b5f7e1747e0095d7ee1d398243e2a0cc9a06d6",
                "md5": "965b539ac2f8fe900d83d0ca580571e9",
                "sha256": "b7194f38987225670527db483e8f0ced6ddba052790460c6653eccd40adb6617"
            },
            "downloads": -1,
            "filename": "chatgptmax-2.3.5.tar.gz",
            "has_sig": false,
            "md5_digest": "965b539ac2f8fe900d83d0ca580571e9",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 5735,
            "upload_time": "2024-01-19T02:14:46",
            "upload_time_iso_8601": "2024-01-19T02:14:46.077472Z",
            "url": "https://files.pythonhosted.org/packages/4d/45/318b1101fa67bda52e2e94b5f7e1747e0095d7ee1d398243e2a0cc9a06d6/chatgptmax-2.3.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-19 02:14:46",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "victoriadrake",
    "github_project": "chatgptmax",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "openai",
            "specs": []
        },
        {
            "name": "tiktoken",
            "specs": [
                [
                    "==",
                    "0.4.0"
                ]
            ]
        }
    ],
    "lcname": "chatgptmax"
}
        
Elapsed time: 0.19691s