text-chatgpt-connector


Nametext-chatgpt-connector JSON
Version 0.0.2 PyPI version JSON
download
home_pagehttps://github.com/rcmdnk/text_chatgpt_connector
SummaryChatGPT reads Text files
upload_time2023-03-21 18:43:55
maintainer
docs_urlNone
authorrcmdnk
requires_python>=3.8.1,<3.12
licenseMIT
keywords api chatgpt ai
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Text ChatGPT Connector

The Text ChatGPT Connector is a simple script for connecting text files and ChatGPT.

Forked from [scrapbox_chatgpt_connector](https://github.com/nishio/scrapbox_chatgpt_connector).

Ref: https://scrapbox.io/villagepump/Scrapbox_ChatGPT_Connector

## How to install

Install by pip:

```
$ pip install text_chatgpt_connector
```

Or you can use repository directly.
Install [Poetry](https://python-poetry.org/)
and run

```
$ poetry install
$ poetry run tcc ...
```

You can run \`tcc directly if you enter the poetry virtual environment:

```
$ poetry shell
```

## How to use

### Make index

To make index, run:

```
$ tcc index -i <input_dir>
```

`input_dir` is the directory which has text files (with suffix of `.txt`, `.md` or `.markdown` by default).

This will create pickle file named **index.pickle**.
If you want to change the name, set `-o <output_file>`.

If you run with different `input_dir` for the same `output_file`,
the index is appended to the previous one.

### Ask question

To ask a question, run:

```
$ tcc ask -q  "もっとも大事な問いとは何だろう?"
```

If you want compare the answer without index, run with `-n` (`--no_index`) option:

```
$ tcc ask -n -q  "もっとも大事な問いとは何だろう?"
```

### Usage

```
usage: tcc [-h] [-i INPUT_DIR] [-s INPUT_SUFFIX] [-o OUTPUT_FILE] [-k KEY] [-c CHARACTER_ENCODING] [--chat_model CHAT_MODEL]
           [--encoding ENCODING] [--embedding EMBEDDING] [--remain_url] [--keep_spaces] [--block_size BLOCK_SIZE]
           [--embed_max_size EMBED_MAX_SIZE] [--max_prompt_size MAX_PROMPT_SIZE] [--return_size RETURN_SIZE] [--prompt PROMPT]
           [--bare_prompt BARE_PROMPT] [-q QUESTION] [-n] [-v]
           [command]

positional arguments:
  command               Command (index or ask)

options:
  -h, --help            show this help message and exit
  -i INPUT_DIR, --input_dir INPUT_DIR
                        Input directory
  -s INPUT_SUFFIX, --input_suffix INPUT_SUFFIX
                        Comma separated suffixes of input files, "txt,md,markdown"
  -o OUTPUT_FILE, --output_file OUTPUT_FILE
                        Output file (pickle), default: "index.pickle"
  -k KEY, --key KEY     OpenAI API key. If not given, try to get from environment variable: OPENAI_API_KEY.
  -c CHARACTER_ENCODING, --character_encoding CHARACTER_ENCODING
                        Character encoding for input file, default: "utf-8"
  --chat_model CHAT_MODEL
                        Chat model name, default: "gpt-3.5-turbo"
  --encoding ENCODING   Encoding name for tiktoken, default: "cl100k_base"
  --embedding EMBEDDING
                        Embedding model name, default: "text-embedding-ada-002"
  --remain_url          Keep URL in the text
  --keep_spaces         Keep spaces in the text
  --block_size BLOCK_SIZE
                        Block size for embedding, default: 500
  --embed_max_size EMBED_MAX_SIZE
                        Max size for embedding, default: 8150
  --max_prompt_size MAX_PROMPT_SIZE
                        Max size for prompt, default: 4096
  --return_size RETURN_SIZE
                        Return size, default: 250
  --prompt PROMPT       Prompt template, default: "Read the following text and answer the question. Your reply should be shorter
                        than 250 characters. ## Text {text} ## Question {question}"
  --bare_prompt BARE_PROMPT
                        Prompt template without index, default: "Read the following text and answer the question. Your reply
                        should be shorter than 250 characters. ## Text {text} ## Question {question}"
  -q QUESTION, --question QUESTION
                        Question words for ask, default: "What is the most important question?"
  -n, --no_index        Ask the question directly
  -v, --version         Show version
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/rcmdnk/text_chatgpt_connector",
    "name": "text-chatgpt-connector",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8.1,<3.12",
    "maintainer_email": "",
    "keywords": "API,ChatGPT,AI",
    "author": "rcmdnk",
    "author_email": "rcmdnk@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/21/2a/1e5fd4015459a51540f0fbce72b1227ebfd57752e303e0a7c2b43d1c5db1/text_chatgpt_connector-0.0.2.tar.gz",
    "platform": null,
    "description": "# Text ChatGPT Connector\n\nThe Text ChatGPT Connector is a simple script for connecting text files and ChatGPT.\n\nForked from [scrapbox_chatgpt_connector](https://github.com/nishio/scrapbox_chatgpt_connector).\n\nRef: https://scrapbox.io/villagepump/Scrapbox_ChatGPT_Connector\n\n## How to install\n\nInstall by pip:\n\n```\n$ pip install text_chatgpt_connector\n```\n\nOr you can use repository directly.\nInstall [Poetry](https://python-poetry.org/)\nand run\n\n```\n$ poetry install\n$ poetry run tcc ...\n```\n\nYou can run \\`tcc directly if you enter the poetry virtual environment:\n\n```\n$ poetry shell\n```\n\n## How to use\n\n### Make index\n\nTo make index, run:\n\n```\n$ tcc index -i <input_dir>\n```\n\n`input_dir` is the directory which has text files (with suffix of `.txt`, `.md` or `.markdown` by default).\n\nThis will create pickle file named **index.pickle**.\nIf you want to change the name, set `-o <output_file>`.\n\nIf you run with different `input_dir` for the same `output_file`,\nthe index is appended to the previous one.\n\n### Ask question\n\nTo ask a question, run:\n\n```\n$ tcc ask -q  \"\u3082\u3063\u3068\u3082\u5927\u4e8b\u306a\u554f\u3044\u3068\u306f\u4f55\u3060\u308d\u3046\uff1f\"\n```\n\nIf you want compare the answer without index, run with `-n` (`--no_index`) option:\n\n```\n$ tcc ask -n -q  \"\u3082\u3063\u3068\u3082\u5927\u4e8b\u306a\u554f\u3044\u3068\u306f\u4f55\u3060\u308d\u3046\uff1f\"\n```\n\n### Usage\n\n```\nusage: tcc [-h] [-i INPUT_DIR] [-s INPUT_SUFFIX] [-o OUTPUT_FILE] [-k KEY] [-c CHARACTER_ENCODING] [--chat_model CHAT_MODEL]\n           [--encoding ENCODING] [--embedding EMBEDDING] [--remain_url] [--keep_spaces] [--block_size BLOCK_SIZE]\n           [--embed_max_size EMBED_MAX_SIZE] [--max_prompt_size MAX_PROMPT_SIZE] [--return_size RETURN_SIZE] [--prompt PROMPT]\n           [--bare_prompt BARE_PROMPT] [-q QUESTION] [-n] [-v]\n           [command]\n\npositional arguments:\n  command               Command (index or ask)\n\noptions:\n  -h, --help            show this help message and exit\n  -i INPUT_DIR, --input_dir INPUT_DIR\n                        Input directory\n  -s INPUT_SUFFIX, --input_suffix INPUT_SUFFIX\n                        Comma separated suffixes of input files, \"txt,md,markdown\"\n  -o OUTPUT_FILE, --output_file OUTPUT_FILE\n                        Output file (pickle), default: \"index.pickle\"\n  -k KEY, --key KEY     OpenAI API key. If not given, try to get from environment variable: OPENAI_API_KEY.\n  -c CHARACTER_ENCODING, --character_encoding CHARACTER_ENCODING\n                        Character encoding for input file, default: \"utf-8\"\n  --chat_model CHAT_MODEL\n                        Chat model name, default: \"gpt-3.5-turbo\"\n  --encoding ENCODING   Encoding name for tiktoken, default: \"cl100k_base\"\n  --embedding EMBEDDING\n                        Embedding model name, default: \"text-embedding-ada-002\"\n  --remain_url          Keep URL in the text\n  --keep_spaces         Keep spaces in the text\n  --block_size BLOCK_SIZE\n                        Block size for embedding, default: 500\n  --embed_max_size EMBED_MAX_SIZE\n                        Max size for embedding, default: 8150\n  --max_prompt_size MAX_PROMPT_SIZE\n                        Max size for prompt, default: 4096\n  --return_size RETURN_SIZE\n                        Return size, default: 250\n  --prompt PROMPT       Prompt template, default: \"Read the following text and answer the question. Your reply should be shorter\n                        than 250 characters. ## Text {text} ## Question {question}\"\n  --bare_prompt BARE_PROMPT\n                        Prompt template without index, default: \"Read the following text and answer the question. Your reply\n                        should be shorter than 250 characters. ## Text {text} ## Question {question}\"\n  -q QUESTION, --question QUESTION\n                        Question words for ask, default: \"What is the most important question?\"\n  -n, --no_index        Ask the question directly\n  -v, --version         Show version\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "ChatGPT reads Text files",
    "version": "0.0.2",
    "split_keywords": [
        "api",
        "chatgpt",
        "ai"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c493b48386d1c5b2b63c16b042b0fdbae4eb1367f101c9ecc427731786a7307a",
                "md5": "297ea36b5a1a9028a442af98cccc70b6",
                "sha256": "f4728cbe9ed90f4fc32119639146d1ef664c1b36b7d6e00ec3c9629e8e883c46"
            },
            "downloads": -1,
            "filename": "text_chatgpt_connector-0.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "297ea36b5a1a9028a442af98cccc70b6",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8.1,<3.12",
            "size": 8370,
            "upload_time": "2023-03-21T18:43:53",
            "upload_time_iso_8601": "2023-03-21T18:43:53.648765Z",
            "url": "https://files.pythonhosted.org/packages/c4/93/b48386d1c5b2b63c16b042b0fdbae4eb1367f101c9ecc427731786a7307a/text_chatgpt_connector-0.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "212a1e5fd4015459a51540f0fbce72b1227ebfd57752e303e0a7c2b43d1c5db1",
                "md5": "4f91e6f98210bfd0570adb58e1c738c4",
                "sha256": "2cd2d3de3cb9310507ef82facb0e3e098c0abb76918a919faa8eedbf67aab757"
            },
            "downloads": -1,
            "filename": "text_chatgpt_connector-0.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "4f91e6f98210bfd0570adb58e1c738c4",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8.1,<3.12",
            "size": 7486,
            "upload_time": "2023-03-21T18:43:55",
            "upload_time_iso_8601": "2023-03-21T18:43:55.111598Z",
            "url": "https://files.pythonhosted.org/packages/21/2a/1e5fd4015459a51540f0fbce72b1227ebfd57752e303e0a7c2b43d1c5db1/text_chatgpt_connector-0.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-03-21 18:43:55",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "rcmdnk",
    "github_project": "text_chatgpt_connector",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "text-chatgpt-connector"
}
        
Elapsed time: 0.12677s