# Chinnu AI with Quantum Integration 
# Gift for my best friend 


Chinnu AI is a quantum-inspired chatbot framework that merges traditional deep learning methods with quantum computing concepts to deliver advanced conversational experiences.

## Features

- **Quantum State Representation**: Utilize `QuantumState` for quantum-inspired computations.
- **Training Framework**: Train quantum-enhanced neural networks using `QuantumTrainer`.
- **Dynamic Neural Network**: Leverage PyTorch-based deep learning for conversational AI.
- **JSON-based Conversations**: Enable flexible interaction using structured JSON inputs.
- **Modular Design**: Easily extend or integrate into existing systems.

## Installation

1. Clone the repository:
   ```bash
   git clone https://github.com/yourusername/chinnu-ai.git
   cd chinnu-ai
   ```

2. Install dependencies:
   ```bash
   pip install -r requirements.txt
   ```

3. Install the package:
   ```bash
   pip install .
   ```

## Usage

### Training Chinnu AI

Here is an example to train Chinnu AI with quantum integration:

```python
import torch
from ChinnuAi import QuantumState, QuantumTrainer, initialize_chinnu_ai, train_chinnu_ai

# Initialize Quantum State and Trainer
initial_state = [1, 0, 0, 0]
target_state = [0.5, 0.5, 0.5, 0.5]
quantum_model = QuantumState(initial_state)
quantum_trainer = QuantumTrainer(quantum_model, training_data=None)

# Initialize Neural Network
input_size = 4
hidden_size = 8
output_size = 4
model = initialize_chinnu_ai(input_size, hidden_size, output_size)

# Example Dataset
dataset = [
    (torch.tensor([1, 0, 0, 0]), torch.tensor([0.5, 0.5, 0.5, 0.5])),
    (torch.tensor([0, 1, 0, 0]), torch.tensor([0.5, 0.5, 0.5, 0.5])),
]
dataloader = torch.utils.data.DataLoader(dataset, batch_size=1, shuffle=True)

# Train the Model
epochs = 10
learning_rate = 0.01
train_chinnu_ai(model, quantum_trainer, target_state, dataloader, epochs, learning_rate)
```

### Live Chat with Chinnu AI

Chinnu AI can engage in real-time conversations based on JSON input:

```python
from ChinnuAi import chat_with_chinnu_ai
import json

# Example JSON input
json_input = '{"input": [1, 0, 0, 0], "responses": ["Hello!", "How can I assist?", "Here is your data.", "Goodbye!"]}'
response = chat_with_chinnu_ai(model, quantum_model, json_input)
print("Chinnu AI response:", response)
```

### Quantum State Manipulation

Chinnu AI allows you to directly manipulate quantum states for advanced computations:

```python
from ChinnuAi import QuantumState

# Initialize a Quantum State
qs = QuantumState([1, 0, 0, 0])

# Apply a Quantum Gate
qs.apply_gate(QuantumGates.H)
print("State after Hadamard Gate:", qs)

# Measure the State
measurement = qs.measure()
print("Measurement Outcome:", measurement)
```

### Example JSON Dataset

A sample JSON dataset for batch testing:

```json
{
    "data": [
        {
            "input": [1, 0, 0, 0],
            "responses": ["Welcome to Chinnu AI!", "How can I assist you today?", "Here is your data.", "Goodbye!"]
        },
        {
            "input": [0, 1, 0, 0],
            "responses": ["Hello again!", "Need assistance?", "Fetching details.", "See you soon!"]
        }
    ]
}
```

### Batch Testing with JSON

```python
import json
from ChinnuAi import chat_with_chinnu_ai

# Load the JSON file
with open('test_data.json', 'r') as file:
    test_data = json.load(file)

# Process each entry
for entry in test_data['data']:
    json_input = json.dumps(entry)
    response = chat_with_chinnu_ai(model, quantum_model, json_input)
    print("Input:", entry["input"], "Response:", response)
```

## License

This project is licensed under the MIT License. See the LICENSE file for details.

## Contributing

Contributions are welcome! Open an issue or submit a pull request to improve Chinnu AI.

