Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jpal91/xontrib-chatgpt
Gives the ability to use ChatGPT directly from the command line on the Xonsh Shell
https://github.com/jpal91/xontrib-chatgpt
chatgpt cli openai shell shell-extension terminal xonsh xontrib
Last synced: 20 days ago
JSON representation
Gives the ability to use ChatGPT directly from the command line on the Xonsh Shell
- Host: GitHub
- URL: https://github.com/jpal91/xontrib-chatgpt
- Owner: jpal91
- License: mit
- Created: 2023-09-28T12:32:30.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-08-12T09:47:46.000Z (3 months ago)
- Last Synced: 2024-10-09T10:18:14.301Z (about 1 month ago)
- Topics: chatgpt, cli, openai, shell, shell-extension, terminal, xonsh, xontrib
- Language: Python
- Homepage: https://github.com/jpal91/xontrib-chatgpt
- Size: 317 KB
- Stars: 11
- Watchers: 1
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-xontribs - chatgpt - Adds ability to communicate with OpenAI's ChatGPT directly from the command line. (Plugins / Prompt tweaks)
README
Gives the ability to use ChatGPT directly from the command line
If you like the idea click ⭐ on the repo and tweet.![Chat Screenshot](assets/chatgpt_xonsh_v013.png)
## Installation
To install use pip:
```xsh
xpip install xontrib-chatgpt
# or: xpip install -U git+https://github.com/jpal91/xontrib-chatgpt
```Then use the following command in your `xonsh` shell or add it directly to your `.xonshrc`
```xsh
xontrib load chatgpt
```### Environment Variables
❗**REQUIRED** ❗
```xsh
# Recommended you put this in your .xonshrc
$OPENAI_API_KEY =
```
If you do not have an api key, you can create an account on [OpenAI](https://openai.com/). You will need to add a credit card on file to pay for any of the api usage charges.*You are 100% responsible for any and all cost you incur by using this xontrib.*
For more information on `OpenAI` usage pricing, please go to [OpenAI Pricing](https://openai.com/pricing).
**Optional**
```xsh
$OPENAI_CHAT_MODEL = 'gpt-3.5-turbo'
```
If this is not set, it will default to `gpt-3.5-turbo`. Currently the only accepted options are `gpt-3.5-turbo` or `gpt-4`.## Usage
**NEW in Version 0.1.3**
Use `chat-manager` to easily create and manage new chats
```xsh
chat-manager add gpt
gpt! Hello, what's your name?
# ChatGPT responds here
```Use your chat as a callable alias or `xonsh` context block
```xsh
echo "Hello, what's your name" | gpt
gpt < input.txt
echo @(myvar) | gpt# The entire contents of the block is sent as text to ChatGPT
with! gpt:
Can you help me fix my python function?def hello_world():
return
print('Hello, world!')
```To get see more CLI options:
```xsh
chat-manager -h
```To get a quick tutorial:
```xsh
chat-manager help
# or
chat-manager?
```⭐ **BONUS**: If [xontrib-abbrevs](https://github.com/xonsh/xontrib-abbrevs) is loaded, use `cm` to expand to `chat-manager`
#### See Also
- [Tips and Tricks](/docs/tips_and_tricks.md)
- [How To Edit System Messages](/docs/edit_sys_messages.md)## Future Plans
- **Streaming Responses**
- Expand the ability to get streaming responses on the command line as opposed to waiting until the full completion is done
- **Chat Settings**
- Allow customizable max tokens
- Allow each chat to have separate models (ie 3.5-turbo, 4, etc.)
- Timeouts on long responses
- ~~Update individual instance system messages/chat instructions~~ **NEW in v0.1.6**
- **Additional Models**
- Open up the ability to use other models besides 3.5 and 4
- ~~**Completions**~~ **NEW in v0.1.5**
- ~~Helper completions for `chat-manager`~~## Credits
- This package was created with [xontrib template](https://github.com/xonsh/xontrib-template).
- [Xonsh Documentation](https://xon.sh/contents.html)
- [prompt_toolkit](https://python-prompt-toolkit.readthedocs.io/)
- [Pygments](https://pygments.org/docs/)
- [Awesome Xontribs](https://github.com/xonsh/awesome-xontribs) - Much inspiration was taken from many projects in this fantastic repo