tgpt2
AI for all
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) without API Key.
The name tgpt2 is inherited from it's parent project tgpt which runs on golang.
Prerequisite
Installation and usage
Installation
Pick either of the following ways to get started.
- From pypi:
pip install tgpt2
- Direct from source
pip install git+https://github.com/Simatwa/tgpt2.git
- 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
Developer Docs
- Generate a quick response
from tgpt2 import TGPT
bot = TGPT()
resp = bot.chat('<Your prompt>')
print(resp)
# Output : How may I help you.
- Get back whole response
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.
- Text Generated only
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?
"""
- Whole Response
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}
"""
Note : At the time of wriiting this, Chatting conversational is not supported
Acknowledgements
- tgpt
- You
Release files for tgpt2 0.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| tgpt2-0.0.5.tar.gz | 13.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| tgpt2-0.0.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 26.4 kB
Release files / tgpt2-0.0.5.tar.gz
| Download URL | tgpt2-0.0.5.tar.gz |
|---|---|
| Size | 13.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
60f8e757070b2ed915df6d03c68ff60a94c19230645cc428c048242bf34a2411
|
|
BLAKE2b-256 checksum How to use checksums |
751d42d9ad2308af09cfc294482f11cbcdceafcd7647dc197fa4fc5480e7c7f2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.0
|
Release files / tgpt2-0.0.5-py3-none-any.whl
| Download URL | tgpt2-0.0.5-py3-none-any.whl |
|---|---|
| Size | 13.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c4e289d4c409972b3022a9c9a196fd58d91accb2da3d17982f2528abed10b521
|
|
BLAKE2b-256 checksum How to use checksums |
e2772a3864ef10311f44d2bdf943d35139b73e7bf007c03f2f87cc8453b4e6b8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.0
|