basalt-sdk


Namebasalt-sdk JSON
Version 0.0.9 PyPI version JSON
download
home_pagehttps://github.com/basalt-ai/basalt-python
SummaryBasalt SDK for python
upload_time2025-02-11 14:04:21
maintainerNone
docs_urlNone
authorBasalt
requires_python>=3.6
licenseMIT
keywords basalt ai sdk python
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Basalt SDK

Basalt is a powerful tool for managing AI prompts and their release workflows. This SDK is the official Python package for interacting with your Basalt prompts.

## Installation

Install the Basalt SDK via pip:

```bash
pip install basalt-sdk
```

## Usage

### Importing and Initializing the SDK

To get started, import the `PromptSDK` class and initialize it with your API and cache instances:

```python
from basalt import Basalt

basalt = Basalt(api_key="my-dev-api-key")

# Specify a log_level
basalt = Basalt(api_key="my-dev-api-key", log_level="none")

# Or with an env
import os

basalt = Basalt(api_key=os.getenv("BASALT_API_KEY"))
```

### Available Methods

#### Prompts
Your Basalt instance exposes a `prompt` property for interacting with your Basalt prompts:

- **Get a Prompt**

  Retrieve a specific prompt using a slug, and optional filters `tag` and `version`. Without tag or version, the production version of your prompt is selected by default.

  **Example Usage:**

  ```python
  error, result = basalt.prompt.get('prompt-slug')

  # With optional tag or version parameters
  error, result = basalt.get(slug='prompt-slug', tag='latest')
  error, result = basalt.get(slug='prompt-slug', version='1.0.0')

  # If your prompt has variables,
  # pass them when fetching your prompt
  error, result = basale.get(slug='prompt-slug', variables={ name: 'John Doe' })

  # Handle the result by unwrapping the error / value
  if error:
      print('Could not fetch prompt', error)
  else:
      # Use the prompt with your AI provider of choice
      # Example: OpenAI
      openai_client.chat_completion.create(
          model='gpt-4',
          messages=[{'role': 'user', 'content': result.prompt}]
      )
  ```

## License

MIT

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/basalt-ai/basalt-python",
    "name": "basalt-sdk",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": "basalt, ai, sdk, python",
    "author": "Basalt",
    "author_email": "support@getbasalt.ai",
    "download_url": "https://files.pythonhosted.org/packages/1d/8a/3b4395b643c4e0b6a2bce96ddb8d3438b803efdf84c21425b4495fd7ac66/basalt_sdk-0.0.9.tar.gz",
    "platform": null,
    "description": "# Basalt SDK\n\nBasalt is a powerful tool for managing AI prompts and their release workflows. This SDK is the official Python package for interacting with your Basalt prompts.\n\n## Installation\n\nInstall the Basalt SDK via pip:\n\n```bash\npip install basalt-sdk\n```\n\n## Usage\n\n### Importing and Initializing the SDK\n\nTo get started, import the `PromptSDK` class and initialize it with your API and cache instances:\n\n```python\nfrom basalt import Basalt\n\nbasalt = Basalt(api_key=\"my-dev-api-key\")\n\n# Specify a log_level\nbasalt = Basalt(api_key=\"my-dev-api-key\", log_level=\"none\")\n\n# Or with an env\nimport os\n\nbasalt = Basalt(api_key=os.getenv(\"BASALT_API_KEY\"))\n```\n\n### Available Methods\n\n#### Prompts\nYour Basalt instance exposes a `prompt` property for interacting with your Basalt prompts:\n\n- **Get a Prompt**\n\n  Retrieve a specific prompt using a slug, and optional filters `tag` and `version`. Without tag or version, the production version of your prompt is selected by default.\n\n  **Example Usage:**\n\n  ```python\n  error, result = basalt.prompt.get('prompt-slug')\n\n  # With optional tag or version parameters\n  error, result = basalt.get(slug='prompt-slug', tag='latest')\n  error, result = basalt.get(slug='prompt-slug', version='1.0.0')\n\n  # If your prompt has variables,\n  # pass them when fetching your prompt\n  error, result = basale.get(slug='prompt-slug', variables={ name: 'John Doe' })\n\n  # Handle the result by unwrapping the error / value\n  if error:\n      print('Could not fetch prompt', error)\n  else:\n      # Use the prompt with your AI provider of choice\n      # Example: OpenAI\n      openai_client.chat_completion.create(\n          model='gpt-4',\n          messages=[{'role': 'user', 'content': result.prompt}]\n      )\n  ```\n\n## License\n\nMIT\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Basalt SDK for python",
    "version": "0.0.9",
    "project_urls": {
        "Homepage": "https://github.com/basalt-ai/basalt-python"
    },
    "split_keywords": [
        "basalt",
        " ai",
        " sdk",
        " python"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "afcce28fc51635a46d796c5c24901b2b952a72dfb7a07ff6b9a5495dab01c0f3",
                "md5": "5803037873794fcbe0e9b6909d4a4c6d",
                "sha256": "e8c43268b1529eb34ab237bbc27c22f761df35a061d1095b3d4253d319874cd3"
            },
            "downloads": -1,
            "filename": "basalt_sdk-0.0.9-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5803037873794fcbe0e9b6909d4a4c6d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 13849,
            "upload_time": "2025-02-11T14:04:20",
            "upload_time_iso_8601": "2025-02-11T14:04:20.110652Z",
            "url": "https://files.pythonhosted.org/packages/af/cc/e28fc51635a46d796c5c24901b2b952a72dfb7a07ff6b9a5495dab01c0f3/basalt_sdk-0.0.9-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1d8a3b4395b643c4e0b6a2bce96ddb8d3438b803efdf84c21425b4495fd7ac66",
                "md5": "56fd7ab79e5bf8f4e91a54277a0b9ddf",
                "sha256": "a331035881da077a151a516fd8a61431e1d30543d5cd1e7ff6bae78d04f7e0e7"
            },
            "downloads": -1,
            "filename": "basalt_sdk-0.0.9.tar.gz",
            "has_sig": false,
            "md5_digest": "56fd7ab79e5bf8f4e91a54277a0b9ddf",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 13402,
            "upload_time": "2025-02-11T14:04:21",
            "upload_time_iso_8601": "2025-02-11T14:04:21.217717Z",
            "url": "https://files.pythonhosted.org/packages/1d/8a/3b4395b643c4e0b6a2bce96ddb8d3438b803efdf84c21425b4495fd7ac66/basalt_sdk-0.0.9.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-02-11 14:04:21",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "basalt-ai",
    "github_project": "basalt-python",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "basalt-sdk"
}
        
Elapsed time: 0.39918s