Metadata-Version: 2.4
Name: poridhi-cloud
Version: 0.1.3
Summary: Python SDK for Poridhi Cloud Infrastructure
Home-page: https://github.com/poridhiEng/poridhi-cloud.git
Author: Poridhi Engineering
Author-email: Poridhi Engineering <engineering@poridhi.com>
License: MIT License
        
        Copyright (c) [2025] Poridhi Engineering
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
Project-URL: Homepage, https://github.com/poridhiEng/poridhi-cloud-python-sdk
Project-URL: Repository, https://github.com/poridhiEng/poridhi-cloud-python-sdk
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests>=2.25.0
Requires-Dist: websocket-client>=1.2.0
Provides-Extra: dev
Requires-Dist: pytest; extra == "dev"
Requires-Dist: pytest-cov; extra == "dev"
Requires-Dist: sphinx; extra == "dev"
Requires-Dist: twine; extra == "dev"
Dynamic: author
Dynamic: home-page
Dynamic: license-file
Dynamic: requires-python

# Poridhi Cloud Python SDK

## Overview

The Poridhi Cloud Python SDK provides a comprehensive interface for interacting with the Poridhi Cloud infrastructure. It supports machine provisioning, worker allocation, resource monitoring, and model inference.

## Features

- Machine Provisioning
- Worker Allocation
- Resource Monitoring
- Model Inference (Streaming)
- Easy-to-use Python Interface

## Installation

```bash
pip install poridhi-cloud
```

## Quick Start

### Initializing the Client

```python
from poridhi_cloud import PoridihCloud

# Initialize with default settings
client = PoridihCloud()

# Or specify a custom base URL and API key
client = PoridihCloud(
    base_url='https://gpu-cloud.poridhi.io',
    api_key='your-api-key-here'
)
```

### Launching a Machine

```python
# Launch a machine with 4 CPUs, 16GB RAM, and 1 NVIDIA GPU
machine = client.launch_machine(
    cpu=4,
    memory=8192,  # Memory in MB
    gpu='nvidia-tesla-t4',
    gpu_count=1
)
print(machine)
```

### Allocating a Worker

```python
# Allocate a worker with specific resources
worker = client.allocate_worker(
    cpu=2,
    memory=2096,
    gpu='nvidia-tesla-t4',
    gpu_count=1,
    image='k33g/ollama-deepseek-coder-runner:0.0.0',
    port=11434,
    machine_id="your-machine-id",
    duration=3600  # Optional duration in seconds
)
print(worker)
```




### Streaming Text Generation

```python
# Stream text generation
# Real-time chunk-by-chunk streaming
for token in client.stream_generate(
    worker_id='your-worker-id',
    model='deepseek-coder',
    prompt='Write a Python function to calculate fibonacci numbers',
    temperature=0.7,
    max_tokens=500
):
    print(token, end='', flush=True)
```

## Authentication

The SDK supports Bearer token authentication using an API key. You can provide the API key in two ways:

1. Directly when initializing the client:
   ```python
   client = PoridihCloud(api_key='your-api-key-here')
   ```

2. Through an environment variable:
   ```bash
   export PORIDHI_CLOUD_API_KEY='your-api-key-here'
   ```

## Configuration

### Environment Variables

- `PORIDHI_CLOUD_URL`: Base URL for the Poridhi Cloud API
- `PORIDHI_CLOUD_API_KEY`: API key for authentication

### Initialization Options

```python
client = PoridihCloud(
    base_url='http://your-server-url',
    api_key='your-api-key'
)
```

## Error Handling

```python
from poridhi_cloud import PoridihCloudError

try:
    worker = client.allocate_worker(...)
except PoridihCloudError as e:
    print(f"Cloud Error: {e}")
```

## Contributing

1. Fork the repository
2. Create your feature branch
3. Commit your changes
4. Push to the branch
5. Create a new Pull Request

## License

MIT License

## Support

For issues and support, please open a GitHub issue in the repository.
