<h1 align="center"> tgpt2 </h1>
<p align="center">
<a href="https://github.com/Simatwa/tgpt2/actions/workflows/python-test.yml"><img src="https://github.com/Simatwa/tgpt2/actions/workflows/python-test.yml/badge.svg" alt="Python Test"/></a>
<a href="LICENSE"><img alt="License" src="https://img.shields.io/static/v1?logo=GPL&color=Blue&message=GNUv3&label=License"/></a>
<a href="https://pypi.org/project/tgpt2"><img alt="PyPi" src="https://img.shields.io/static/v1?logo=pypi&label=Pypi&message=v0.0.1&color=green"/></a>
<a href="https://github.com/psf/black"><img alt="Black" src="https://img.shields.io/static/v1?logo=Black&label=Code-style&message=Black"/></a>
<a href="#"><img alt="Passing" src="https://img.shields.io/static/v1?logo=Docs&label=Docs&message=Passing&color=green"/></a>
<a href="https://github.com/Simatwa/tgpt2/actions/workflows/python-package.yml"><img src="https://github.com/Simatwa/tgpt2/actions/workflows/python-package.yml/badge.svg"/></a>
<a href="#"><img alt="coverage" src="https://img.shields.io/static/v1?logo=Coverage&label=Coverage&message=90%&color=yellowgreen"/></a>
<a href="#" alt="progress"><img alt="Progress" src="https://img.shields.io/static/v1?logo=Progress&label=Progress&message=95%&color=green"/></a>
<a href="https://pepy.tech/project/tgpt2"><img src="https://static.pepy.tech/personalized-badge/tgpt2?period=total&units=international_system&left_color=grey&right_color=green&left_text=Downloads" alt="Downloads"></a>
<!--<a href="https://github.com/Simatwa/tgpt2/releases"><img src="https://img.shields.io/github/downloads/Simatwa/tgpt2/total?label=Downloads&color=success" alt="Downloads"></img></a> -->
<a href="https://github.com/Simatwa/tgpt2/releases"><img src="https://img.shields.io/github/v/release/Simatwa/tgpt2?color=success&label=Release&logo=github" alt="Latest release"></img></a>
<a href="https://github.com/Simatwa/tgpt2/releases"><img src="https://img.shields.io/github/release-date/Simatwa/tgpt2?label=Release date&logo=github" alt="release date"></img></a>
<a href="https://wakatime.com/badge/github/Simatwa/tgpt2"><img src="https://wakatime.com/badge/github/Simatwa/tgpt2.svg" alt="wakatime"></a>
</p>
<p align="center">
AI for all
</p>
```python
from tgpt2 import TGPT
bot = TGPT()
resp = bot.chat('<Your prompt>')
print(resp)
# Output : How may I help you.
```
This project allows you to interact with AI ([LLaMA](https://ai.meta.com/llama/)) without API Key.
The name *tgpt2* is inherited from it's parent project [tgpt](https://github.com/aandrew-me/tgpt) which runs on [golang](https://go.dev/).
## Prerequisite
- [x] [Python>=3.9](https://python.org)
## Installation and usage
### Installation
Pick either of the following ways to get started.
1. From pypi:
```
pip install tgpt2
```
2. Direct from source
```
pip install git+https://github.com/Simatwa/tgpt2.git
```
3. Clone and Install
```
git clone https://github.com/Simatwa/tgpt2.git
cd tgp2
pip install .
```
## Usage
This package features a ready to use commandline interface.
- Quick response
`python -m tgpt2 generate "<Your prompt>"`
- Interactive mode
`python -m tgpt2 interactive`
Instead of `python -m tgpt2`, ypu can as well use just `tgpt2`
<details>
<summary>
### Developer Docs
</summary>
1. Generate a quick response
```python
from tgpt2 import TGPT
bot = TGPT()
resp = bot.chat('<Your prompt>')
print(resp)
# Output : How may I help you.
```
2. Get back whole response
```python
from tgpt2 import TGPT
bot = TGPT()
resp = bot.ask('<Your Prompt')
print(resp)
# Output
"""
{'completion': "I'm so excited to share with you the incredible experiences...", 'stop_reason': None, 'truncated': False, 'stop': None, 'model': 'llama-2-13b-chat', 'log_id': 'cmpl-3NmRt5A5Djqo2jXtXLBwJ2', 'exception': None}
"""
```
#### Stream Response
Just add parameter `stream` with value `true`.
1. Text Generated only
```python
from tgpt2 import TGPT
bot = TGPT()
resp = bot.chat('<Your prompt>', stream=True)
for value in resp:
print(value)
# output
"""
How may
How may I help
How may I help you
How may I help you today?
"""
```
2. Whole Response
```python
from tgpt2 import TGPT
bot = TGPT()
resp = bot.ask('<Your Prompt>', stream=True)
for value in resp:
print(value)
# Output
"""
{'completion': "I'm so", 'stop_reason': None, 'truncated': False, 'stop': None, 'model': 'llama-2-13b-chat', 'log_id': 'cmpl-3NmRt5A5Djqo2jXtXLBwJ2', 'exception': None}
{'completion': "I'm so excited to share with.", 'stop_reason': None, 'truncated': False, 'stop': None, 'model': 'llama-2-13b-chat', 'log_id': 'cmpl-3NmRt5A5Djqo2jXtXLBwJ2', 'exception': None}
{'completion': "I'm so excited to share with you the incredible ", 'stop_reason': None, 'truncated': False, 'stop': None, 'model': 'llama-2-13b-chat', 'log_id': 'cmpl-3NmRt5A5Djqo2jXtXLBwJ2', 'exception': None}
{'completion': "I'm so excited to share with you the incredible experiences...", 'stop_reason': None, 'truncated': False, 'stop': None, 'model': 'llama-2-13b-chat', 'log_id': 'cmpl-3NmRt5A5Djqo2jXtXLBwJ2', 'exception': None}
"""
```
</details>
> **Note** : At the time of wriiting this, Chatting conversational is not supported
## Acknowledgements
1. [x] [tgpt](https://github.com/aandrew-me/tgpt)
2. [x] You
Raw data
{
"_id": null,
"home_page": "https://github.com/Simatwa/python-tgpt",
"name": "tgpt2",
"maintainer": "Smartwa",
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": "",
"keywords": "chatgpt,gpt,chatgpt-cli,chatgpt-sdk,chatgpt-api,llama-api",
"author": "Smartwa",
"author_email": "simatwacaleb@proton.me",
"download_url": "https://files.pythonhosted.org/packages/75/1d/42d9ad2308af09cfc294482f11cbcdceafcd7647dc197fa4fc5480e7c7f2/tgpt2-0.0.5.tar.gz",
"platform": null,
"description": "<h1 align=\"center\"> tgpt2 </h1>\n\n<p align=\"center\">\n<a href=\"https://github.com/Simatwa/tgpt2/actions/workflows/python-test.yml\"><img src=\"https://github.com/Simatwa/tgpt2/actions/workflows/python-test.yml/badge.svg\" alt=\"Python Test\"/></a>\n<a href=\"LICENSE\"><img alt=\"License\" src=\"https://img.shields.io/static/v1?logo=GPL&color=Blue&message=GNUv3&label=License\"/></a>\n<a href=\"https://pypi.org/project/tgpt2\"><img alt=\"PyPi\" src=\"https://img.shields.io/static/v1?logo=pypi&label=Pypi&message=v0.0.1&color=green\"/></a>\n<a href=\"https://github.com/psf/black\"><img alt=\"Black\" src=\"https://img.shields.io/static/v1?logo=Black&label=Code-style&message=Black\"/></a>\n<a href=\"#\"><img alt=\"Passing\" src=\"https://img.shields.io/static/v1?logo=Docs&label=Docs&message=Passing&color=green\"/></a>\n<a href=\"https://github.com/Simatwa/tgpt2/actions/workflows/python-package.yml\"><img src=\"https://github.com/Simatwa/tgpt2/actions/workflows/python-package.yml/badge.svg\"/></a>\n<a href=\"#\"><img alt=\"coverage\" src=\"https://img.shields.io/static/v1?logo=Coverage&label=Coverage&message=90%&color=yellowgreen\"/></a>\n<a href=\"#\" alt=\"progress\"><img alt=\"Progress\" src=\"https://img.shields.io/static/v1?logo=Progress&label=Progress&message=95%&color=green\"/></a>\n<a href=\"https://pepy.tech/project/tgpt2\"><img src=\"https://static.pepy.tech/personalized-badge/tgpt2?period=total&units=international_system&left_color=grey&right_color=green&left_text=Downloads\" alt=\"Downloads\"></a>\n<!--<a href=\"https://github.com/Simatwa/tgpt2/releases\"><img src=\"https://img.shields.io/github/downloads/Simatwa/tgpt2/total?label=Downloads&color=success\" alt=\"Downloads\"></img></a> -->\n<a href=\"https://github.com/Simatwa/tgpt2/releases\"><img src=\"https://img.shields.io/github/v/release/Simatwa/tgpt2?color=success&label=Release&logo=github\" alt=\"Latest release\"></img></a>\n<a href=\"https://github.com/Simatwa/tgpt2/releases\"><img src=\"https://img.shields.io/github/release-date/Simatwa/tgpt2?label=Release date&logo=github\" alt=\"release date\"></img></a>\n<a href=\"https://wakatime.com/badge/github/Simatwa/tgpt2\"><img src=\"https://wakatime.com/badge/github/Simatwa/tgpt2.svg\" alt=\"wakatime\"></a>\n</p>\n\n<p align=\"center\">\nAI for all\n</p> \n\n```python\nfrom tgpt2 import TGPT\nbot = TGPT()\nresp = bot.chat('<Your prompt>')\nprint(resp)\n# Output : How may I help you.\n```\n\nThis project allows you to interact with AI ([LLaMA](https://ai.meta.com/llama/)) without API Key.\n\nThe name *tgpt2* is inherited from it's parent project [tgpt](https://github.com/aandrew-me/tgpt) which runs on [golang](https://go.dev/).\n\n## Prerequisite\n\n- [x] [Python>=3.9](https://python.org)\n\n## Installation and usage\n\n### Installation\n\nPick either of the following ways to get started.\n\n1. From pypi:\n\n```\npip install tgpt2\n```\n\n2. Direct from source\n\n```\npip install git+https://github.com/Simatwa/tgpt2.git\n```\n\n3. Clone and Install\n\n```\ngit clone https://github.com/Simatwa/tgpt2.git\ncd tgp2\npip install .\n```\n\n## Usage\n\nThis package features a ready to use commandline interface.\n\n- Quick response\n `python -m tgpt2 generate \"<Your prompt>\"`\n\n- Interactive mode \n `python -m tgpt2 interactive`\n\nInstead of `python -m tgpt2`, ypu can as well use just `tgpt2`\n\n<details>\n\n<summary>\n\n### Developer Docs\n\n</summary>\n\n1. Generate a quick response\n\n```python\nfrom tgpt2 import TGPT\nbot = TGPT()\nresp = bot.chat('<Your prompt>')\nprint(resp)\n# Output : How may I help you.\n```\n\n2. Get back whole response\n\n```python\nfrom tgpt2 import TGPT\nbot = TGPT()\nresp = bot.ask('<Your Prompt')\nprint(resp)\n# Output\n\"\"\"\n{'completion': \"I'm so excited to share with you the incredible experiences...\", 'stop_reason': None, 'truncated': False, 'stop': None, 'model': 'llama-2-13b-chat', 'log_id': 'cmpl-3NmRt5A5Djqo2jXtXLBwJ2', 'exception': None}\n\"\"\"\n```\n\n#### Stream Response \n\nJust add parameter `stream` with value `true`.\n\n1. Text Generated only \n\n```python\nfrom tgpt2 import TGPT\nbot = TGPT()\nresp = bot.chat('<Your prompt>', stream=True)\nfor value in resp:\n print(value)\n# output\n\"\"\"\nHow may\nHow may I help \nHow may I help you\nHow may I help you today?\n\"\"\"\n```\n\n2. Whole Response\n\n```python\nfrom tgpt2 import TGPT\nbot = TGPT()\nresp = bot.ask('<Your Prompt>', stream=True)\nfor value in resp:\n print(value)\n# Output\n\"\"\"\n{'completion': \"I'm so\", 'stop_reason': None, 'truncated': False, 'stop': None, 'model': 'llama-2-13b-chat', 'log_id': 'cmpl-3NmRt5A5Djqo2jXtXLBwJ2', 'exception': None}\n\n{'completion': \"I'm so excited to share with.\", 'stop_reason': None, 'truncated': False, 'stop': None, 'model': 'llama-2-13b-chat', 'log_id': 'cmpl-3NmRt5A5Djqo2jXtXLBwJ2', 'exception': None}\n\n{'completion': \"I'm so excited to share with you the incredible \", 'stop_reason': None, 'truncated': False, 'stop': None, 'model': 'llama-2-13b-chat', 'log_id': 'cmpl-3NmRt5A5Djqo2jXtXLBwJ2', 'exception': None}\n\n{'completion': \"I'm so excited to share with you the incredible experiences...\", 'stop_reason': None, 'truncated': False, 'stop': None, 'model': 'llama-2-13b-chat', 'log_id': 'cmpl-3NmRt5A5Djqo2jXtXLBwJ2', 'exception': None}\n\"\"\"\n```\n\n\n</details>\n\n\n> **Note** : At the time of wriiting this, Chatting conversational is not supported\n\n## Acknowledgements\n\n1. [x] [tgpt](https://github.com/aandrew-me/tgpt)\n2. [x] You\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Interact with AI without API key",
"version": "0.0.5",
"project_urls": {
"Bug Report": "https://github.com/Simatwa/python-tgpt/issues/new",
"Documentation": "https://github.com/Simatwa/python-tgpt/blob/main/docs",
"Download": "https://github.com/Simatwa/python-tgpt/releases",
"Homepage": "https://github.com/Simatwa/python-tgpt",
"Issue Tracker": "https://github.com/Simatwa/python-tgpt/issues",
"Source Code": "https://github.com/Simatwa/python-tgpt"
},
"split_keywords": [
"chatgpt",
"gpt",
"chatgpt-cli",
"chatgpt-sdk",
"chatgpt-api",
"llama-api"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "e2772a3864ef10311f44d2bdf943d35139b73e7bf007c03f2f87cc8453b4e6b8",
"md5": "a56c9c16a01f5547ac92931c03de72a1",
"sha256": "c4e289d4c409972b3022a9c9a196fd58d91accb2da3d17982f2528abed10b521"
},
"downloads": -1,
"filename": "tgpt2-0.0.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a56c9c16a01f5547ac92931c03de72a1",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 12962,
"upload_time": "2024-01-01T18:43:13",
"upload_time_iso_8601": "2024-01-01T18:43:13.559919Z",
"url": "https://files.pythonhosted.org/packages/e2/77/2a3864ef10311f44d2bdf943d35139b73e7bf007c03f2f87cc8453b4e6b8/tgpt2-0.0.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "751d42d9ad2308af09cfc294482f11cbcdceafcd7647dc197fa4fc5480e7c7f2",
"md5": "e8f9fd433e6999389c8175f2cc55020e",
"sha256": "60f8e757070b2ed915df6d03c68ff60a94c19230645cc428c048242bf34a2411"
},
"downloads": -1,
"filename": "tgpt2-0.0.5.tar.gz",
"has_sig": false,
"md5_digest": "e8f9fd433e6999389c8175f2cc55020e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 13389,
"upload_time": "2024-01-01T18:43:16",
"upload_time_iso_8601": "2024-01-01T18:43:16.030147Z",
"url": "https://files.pythonhosted.org/packages/75/1d/42d9ad2308af09cfc294482f11cbcdceafcd7647dc197fa4fc5480e7c7f2/tgpt2-0.0.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-01-01 18:43:16",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Simatwa",
"github_project": "python-tgpt",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "tgpt2"
}