Skip to main content

A CLI to chat with LLMs (Groq/OpenAI etc.)

Project description

NeeCLI

A command-line interface (CLI) tool for chatting with Large Language Models (LLMs) using Groq and OpenAI APIs.

Features

  • Multi-provider support: Chat with Groq and OpenAI models
  • Interactive chat loop: Continuous conversation mode
  • Conversation history: Save and load chat history
  • Streaming responses: Real-time response streaming
  • Flexible model selection: Choose from different LLM models
  • Environment-based configuration: Secure API key management

Installation

Prerequisites

  • Python 3.8 or higher
  • A Groq or OpenAI API key

Install the package

# Clone the repository
git clone <repository-url>
cd NeeCLI

# Install dependencies
pip install -e .

Configuration

API Keys

You can set your API keys in several ways:

  1. Environment variables:

    export GROQ_API="your-groq-api-key"
    export OPENAI_API_KEY="your-openai-api-key"
    
  2. .env file (recommended):

    GROQ_API=your-groq-api-key
    OPENAI_API_KEY=your-openai-api-key
    
  3. Interactive prompt: The tool will prompt you for the API key if not found.

Usage

Basic Commands

# Send a single message
neecli chat "Hello, how are you?"

# Start an interactive chat loop
neecli loop "Let's start a conversation"

# View conversation history
neecli history

# Clear conversation history
neecli clear

Advanced Options

# Use a specific model
neecli chat "Explain quantum computing" --model "openai/gpt-oss-20b"

# Adjust response randomness
neecli chat "Tell me a story" --temperature 0.9

# Use OpenAI instead of Groq
neecli chat "Hello" --provider openai --model "gpt-3.5-turbo"

# Interactive loop with custom settings
neecli loop "Start a coding session" --model "openai/gpt-oss-20b" --temperature 0.3 --provider groq

Interactive Chat Loop

When using the loop command, you can:

  • Type your messages and press Enter
  • Type exit to quit the chat loop
  • Type clear to clear conversation history
  • The conversation automatically clears after 20 messages to prevent context overflow

Available Models

Groq Models

  • openai/gpt-oss-20b (default)
  • llama3-8b-8192
  • llama3-70b-8192
  • mixtral-8x7b-32768

OpenAI Models

  • gpt-3.5-turbo
  • gpt-4
  • gpt-4-turbo

Development

Project Structure

NeeCLI/
├── NeeCLI/
│   ├── __init__.py
│   ├── cli.py          # Main CLI implementation
│   ├── config.py       # Configuration and API key management
│   ├── history.py      # Conversation history management
│   └── main.py         # Entry point
├── tests/
│   └── test_cli.py     # Test suite
├── pyproject.toml      # Project configuration
└── README.md

Running Tests

python -m pytest tests/

Building the Package

python -m build

Troubleshooting

Common Issues

  1. API Key Not Found: Make sure your API key is set in environment variables or .env file
  2. Model Not Available: Check if the model name is correct for your provider
  3. Rate Limiting: Some models have rate limits; try again later
  4. Network Issues: Check your internet connection

Error Messages

  • Failed to initialize client: Check your API key and internet connection
  • Model not found: Verify the model name is correct for your provider
  • Rate limit exceeded: Wait before making more requests

License

MIT License - see LICENSE file for details.

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests
  5. Submit a pull request

Support

For issues and questions, please open an issue on the GitHub repository.

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

neecli-0.3.0.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

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

neecli-0.3.0-py3-none-any.whl (12.9 kB view details)

Uploaded Python 3

File details

Details for the file neecli-0.3.0.tar.gz.

File metadata

  • Download URL: neecli-0.3.0.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.14

File hashes

Hashes for neecli-0.3.0.tar.gz
Algorithm Hash digest
SHA256 8a031d0d3f555b6572c76b52ea7f323d4b27ceced93dae8ad815743e5e2ad606
MD5 26e36ad6d9421a1023e9c4a554369130
BLAKE2b-256 0cbd665fae51a55ba0591a020e6226e491c59bea3711f55e77cc61fc763b111a

See more details on using hashes here.

File details

Details for the file neecli-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: neecli-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 12.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.14

File hashes

Hashes for neecli-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5a3310e3b08ff81948f66efd963ac63fd3a3fc52d66e25728fb6f016cb6c8035
MD5 638d366a33bcaa39e034ffd65e8ace00
BLAKE2b-256 0489c4b298dbb6f0b9d2d155e885856d1e91806a8d575769fa004d558b7b2e7c

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