Skip to main content

Streaming CLI interface for OpenAI's Chat API

Project description

ChatCLI

ChatCLI is a command line interface for OpenAI's Chat API.

ChatCLI aims to provide a similar experience the ChatGPT frontend; like ChatGPT, ChatCLI streams tokens from the model as they are generated.

$ chatcli
ChatCLI v0.1.5 | [↩] to submit | [ALT/⌥] + [↩] for newline
>>> Write 3 funny prompts for yourself.
1. If you could only communicate through interpretive dance for the next 24 hours, how would you go about your day?

2. You wake up in a world where everyone speaks in rhyme. How do you adapt to this unusual circumstance?

3. You can only speak in questions for the rest of the day. How do you navigate conversations with friends, co-workers, and strangers?

Installation

To install ChatCLI, use pip:

pip install chatcli

You'll need an OpenAI API key to use ChatCLI. You can get one here.

ChatCLI reads your key from the OPENAI_API_KEY environment variable, so you'll also need to set that.

Usage

CLI Usage

To use ChatCLI, simply run the chatcli command:

chatcli

This will start a chat session with the default OpenAI model. You can type your messages and the AI will respond.

You can exit the chat at any time by typing "exit" into the prompt or pressing Ctrl+C.

Python Usage

ChatCLI can also be used as a Python library. Here's an example:

import chatcli
# Create the chat generator
generator = chatcli.ChatGenerator()

# Send a message to the generator
response = generator.send("Prove Riemann's Hypothesis.")

# Print the response
print(response["message"]["content"])

This will send a message to the API and then print the response stream as it is generated.

License

ChatCLI is licensed under the MIT license. See LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

chatcli-0.1.20.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

chatcli-0.1.20-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file chatcli-0.1.20.tar.gz.

File metadata

  • Download URL: chatcli-0.1.20.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.1 CPython/3.11.0 Darwin/22.3.0

File hashes

Hashes for chatcli-0.1.20.tar.gz
Algorithm Hash digest
SHA256 1d51f4ea961dc049a5c9f5a0fbab78fcb00f06330b1a60cfc46f4f758a4c0a02
MD5 0d63ed11dbfbd8929082560ae98ff791
BLAKE2b-256 be469ed7edeb54a8f083ec4ddbcc0f3df3295f8ae8dd1b8e6a89b88c45d560a4

See more details on using hashes here.

File details

Details for the file chatcli-0.1.20-py3-none-any.whl.

File metadata

  • Download URL: chatcli-0.1.20-py3-none-any.whl
  • Upload date:
  • Size: 8.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.1 CPython/3.11.0 Darwin/22.3.0

File hashes

Hashes for chatcli-0.1.20-py3-none-any.whl
Algorithm Hash digest
SHA256 6d05286052c5cb14a873a7ac0c512d2ff3e10600fb9a0c005db9e68a051e0b5e
MD5 4fc7ae7eb89889fd4c1018378bfc4152
BLAKE2b-256 d994915e6d4a71daec3598a554dc7e9eebca1ab405fe1a9415acbe4306583f95

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page