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.2.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.2.0-py3-none-any.whl (12.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: neecli-0.2.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.2.0.tar.gz
Algorithm Hash digest
SHA256 b2fc1db5eae04ee0a1056c63d923f496ad2c132fe7d24d89dd7f2d784aabcacb
MD5 e041eec62644528a1fd6adc68e07126e
BLAKE2b-256 36e63ab39ef8b938419aa232d1e14b927b75274f3a9707504f8c34393ef975c2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: neecli-0.2.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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b246f260e69ed51b5d78c8c38f688fc62eb04ff87dab23a999f753847ee8d7d2
MD5 ac14175b0791408f46ed38e8933172a0
BLAKE2b-256 ca7c0988fb51f8e5082830fb41337bb8290f29152eb143157c342435a50df327

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