genstack


Namegenstack JSON
Version 0.1.9 PyPI version JSON
download
home_pageNone
SummaryUniversal AI SDK from Genstack
upload_time2025-07-25 10:33:37
maintainerNone
docs_urlNone
authorNone
requires_pythonNone
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Genstack Python SDK

A robust Python SDK for seamless integration with the Genstack AI platform. This SDK enables developers to interact with Genstack's AI generation APIs, providing a simple and efficient interface for sending requests and handling responses.

## Features
- **Easy API Integration**: Quickly connect to Genstack's AI services with minimal setup.
- **Async and Sync Support**: Internally uses async HTTP calls, exposed via a synchronous interface for convenience.
- **Customizable**: Configure API keys and endpoints as needed.
- **Error Handling**: Graceful error management for HTTP and runtime issues.

## Installation

Install via pip (recommended):

```bash
pip install genstack
```

Or clone this repository and install dependencies:

```bash
git clone <repo-url>
cd Python-SDK
pip install -r requirements.txt
```

## Usage

### Basic Example

```python
from genstack import Genstack

client = Genstack(api_key="gen-<your-api-key>")

response = client.generate(
    input="Generate a short poem about the sea.",
    track="default-track",  # Required
    model="gpt-4-1-nano-oai"  # Optional, defaults to 'auto'
)

if "output" in response:
    print(response["output"][0]["output"]["text"])
else:
    print("Error:", response.get("error", "Unknown error"))
```

### Initialization

- `api_key` (str): Your Genstack API key (must start with `gen-`).
- `base_url` (str, optional): Override the default API endpoint (default: `http://localhost:8000`).

### Generate Method

```python
generate(input, model="auto", track=None)
```
- `input` (str or dict): The prompt or payload to send. If a string, it is wrapped as `{ "input": <input> }`.
- `model` (str, optional): Model identifier (default: `auto`).
- `track` (str, required): Track identifier for the request.

Returns: `dict` — The API response as a dictionary.

#### Error Handling
- Raises `ValueError` if the API key is invalid or `track` is missing.
- Raises `TypeError` if `input` is not a string or dictionary.
- Returns error details in the response dictionary for HTTP or runtime errors.

## Testing

Tests are provided using `pytest`:

```bash
pytest tests/
```

- `test_generate_with_invalid_type`: Ensures type validation for the `generate` method.
- `call_test.py`: Example/test for real API calls (requires valid API key in environment).

## Dependencies
- [httpx](https://www.python-httpx.org/): For async HTTP requests.
- [pytest](https://pytest.org/): For testing.

## Project Structure

```
Python-SDK/
  genstack/
    __init__.py
    genstack.py
  tests/
    test_generate.py
    call_test.py
    x_test.py
  pyproject.toml
  requirements.txt
  README.md
```

## License

MIT License. See [LICENSE](LICENSE) for details.

---

For more information, visit the [Genstack documentation](https://genstack.ai/) or contact the maintainer at shreyk.dev@gmail.com.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "genstack",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": null,
    "author": null,
    "author_email": "Shrey Kumar <shreyk.dev@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/0f/41/fb3731283f40a19c2b498a7319e720644985abd40b9e68407166ee7236a1/genstack-0.1.9.tar.gz",
    "platform": null,
    "description": "# Genstack Python SDK\n\nA robust Python SDK for seamless integration with the Genstack AI platform. This SDK enables developers to interact with Genstack's AI generation APIs, providing a simple and efficient interface for sending requests and handling responses.\n\n## Features\n- **Easy API Integration**: Quickly connect to Genstack's AI services with minimal setup.\n- **Async and Sync Support**: Internally uses async HTTP calls, exposed via a synchronous interface for convenience.\n- **Customizable**: Configure API keys and endpoints as needed.\n- **Error Handling**: Graceful error management for HTTP and runtime issues.\n\n## Installation\n\nInstall via pip (recommended):\n\n```bash\npip install genstack\n```\n\nOr clone this repository and install dependencies:\n\n```bash\ngit clone <repo-url>\ncd Python-SDK\npip install -r requirements.txt\n```\n\n## Usage\n\n### Basic Example\n\n```python\nfrom genstack import Genstack\n\nclient = Genstack(api_key=\"gen-<your-api-key>\")\n\nresponse = client.generate(\n    input=\"Generate a short poem about the sea.\",\n    track=\"default-track\",  # Required\n    model=\"gpt-4-1-nano-oai\"  # Optional, defaults to 'auto'\n)\n\nif \"output\" in response:\n    print(response[\"output\"][0][\"output\"][\"text\"])\nelse:\n    print(\"Error:\", response.get(\"error\", \"Unknown error\"))\n```\n\n### Initialization\n\n- `api_key` (str): Your Genstack API key (must start with `gen-`).\n- `base_url` (str, optional): Override the default API endpoint (default: `http://localhost:8000`).\n\n### Generate Method\n\n```python\ngenerate(input, model=\"auto\", track=None)\n```\n- `input` (str or dict): The prompt or payload to send. If a string, it is wrapped as `{ \"input\": <input> }`.\n- `model` (str, optional): Model identifier (default: `auto`).\n- `track` (str, required): Track identifier for the request.\n\nReturns: `dict` \u2014 The API response as a dictionary.\n\n#### Error Handling\n- Raises `ValueError` if the API key is invalid or `track` is missing.\n- Raises `TypeError` if `input` is not a string or dictionary.\n- Returns error details in the response dictionary for HTTP or runtime errors.\n\n## Testing\n\nTests are provided using `pytest`:\n\n```bash\npytest tests/\n```\n\n- `test_generate_with_invalid_type`: Ensures type validation for the `generate` method.\n- `call_test.py`: Example/test for real API calls (requires valid API key in environment).\n\n## Dependencies\n- [httpx](https://www.python-httpx.org/): For async HTTP requests.\n- [pytest](https://pytest.org/): For testing.\n\n## Project Structure\n\n```\nPython-SDK/\n  genstack/\n    __init__.py\n    genstack.py\n  tests/\n    test_generate.py\n    call_test.py\n    x_test.py\n  pyproject.toml\n  requirements.txt\n  README.md\n```\n\n## License\n\nMIT License. See [LICENSE](LICENSE) for details.\n\n---\n\nFor more information, visit the [Genstack documentation](https://genstack.ai/) or contact the maintainer at shreyk.dev@gmail.com.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Universal AI SDK from Genstack",
    "version": "0.1.9",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "168afae889ba1b2c6893d1cc8fd5ea4a6bfad5046dc606f3f85c434ad8447f7c",
                "md5": "493cb47240291883e545c2935e42843d",
                "sha256": "b388957060e3f20afad3d53b4d37e35ff29fcb143b09d66f0ddc5c83220f0569"
            },
            "downloads": -1,
            "filename": "genstack-0.1.9-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "493cb47240291883e545c2935e42843d",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 3345,
            "upload_time": "2025-07-25T10:33:36",
            "upload_time_iso_8601": "2025-07-25T10:33:36.434882Z",
            "url": "https://files.pythonhosted.org/packages/16/8a/fae889ba1b2c6893d1cc8fd5ea4a6bfad5046dc606f3f85c434ad8447f7c/genstack-0.1.9-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "0f41fb3731283f40a19c2b498a7319e720644985abd40b9e68407166ee7236a1",
                "md5": "7d92106bc5353f705dd029c1ff945135",
                "sha256": "50820b984833869e9a3d2e2c495f983f0d57a62f4e5a2c1dc81ba08b64601c66"
            },
            "downloads": -1,
            "filename": "genstack-0.1.9.tar.gz",
            "has_sig": false,
            "md5_digest": "7d92106bc5353f705dd029c1ff945135",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 4753,
            "upload_time": "2025-07-25T10:33:37",
            "upload_time_iso_8601": "2025-07-25T10:33:37.466736Z",
            "url": "https://files.pythonhosted.org/packages/0f/41/fb3731283f40a19c2b498a7319e720644985abd40b9e68407166ee7236a1/genstack-0.1.9.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-25 10:33:37",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "genstack"
}
        
Elapsed time: 2.14133s