Metadata-Version: 2.1
Name: copilot-service
Version: 1.0.0
Summary: A Copilot-like API service for code completions
Home-page: https://github.com/yourusername/copilot-service
Author: Your Name
Author-email: your.email@example.com
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
Classifier: Operating System :: OS Independent
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE

# Copilot Service API

This Flask application provides an API service for AI-powered code completions, mimicking GitHub Copilot functionality.

## Features
- Generate code completions with configurable AI models
- Token usage tracking
- Prompt customization
- Caching for efficiency
- Interactive playground for testing

## PyPI Installation

```bash
pip install copilot-service
```

## GitHub Installation
```bash
pip install git+https://github.com/yourusername/copilot-service.git
```

## Usage

Start the service:
```bash
copilot-service
```

Configuration via environment variables:
```bash
export DEFAULT_MODEL="gpt-3.5-turbo"
export DEFAULT_MAX_TOKENS=100
copilot-service
```

## API Endpoints

### POST /copilot/completions
Get AI-generated code completions

**Request Body:**
```json
{
  "file_contents": "def hello_w",
  "cursor_position": 10
}
```

**Response:**
```json
{
  "completion": "orld():\n    print(\"Hello World!\")",
  "token_metadata": {
    "prompt_tokens": 120,
    "completion_tokens": 20,
    "total_tokens": 140
  }
}
```

### POST /copilot/preview
Preview the prompt being sent to the AI

### GET /version
Get service version information

## Testing

Run tests with:
```bash
python test.py
```

## License
GNU General Public License v3.0

## Interactive Playground
Access the playground at `http://localhost:5000`
- Type code and click "Get Completion" for ghost text suggestions
- Test API endpoints directly from the browser


