basalt-sdk


Namebasalt-sdk JSON
Version 0.0.4 PyPI version JSON
download
home_pagehttps://github.com/basalt-ai/basalt-python
SummaryBasalt SDK for python
upload_time2025-01-17 17:21:06
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

[TODO]

            

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/e6/20/c67da4c8367923dbbac46c6a8e53a43c70ff798c8f26a3a06685cf61dd7a/basalt_sdk-0.0.4.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\n[TODO]\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Basalt SDK for python",
    "version": "0.0.4",
    "project_urls": {
        "Homepage": "https://github.com/basalt-ai/basalt-python"
    },
    "split_keywords": [
        "basalt",
        " ai",
        " sdk",
        " python"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "573a961131d9f3ab8e47bbaa2aa0a648bf7ba8579a659c73e97f54b739cd2fe9",
                "md5": "2de6078cf2fc722595b4d3c77aa55bc6",
                "sha256": "16a6a9060c94df732f04b13ddf67b925edfd024f9780b5f931efd65ef8bda344"
            },
            "downloads": -1,
            "filename": "basalt_sdk-0.0.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2de6078cf2fc722595b4d3c77aa55bc6",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 10812,
            "upload_time": "2025-01-17T17:21:04",
            "upload_time_iso_8601": "2025-01-17T17:21:04.415421Z",
            "url": "https://files.pythonhosted.org/packages/57/3a/961131d9f3ab8e47bbaa2aa0a648bf7ba8579a659c73e97f54b739cd2fe9/basalt_sdk-0.0.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e620c67da4c8367923dbbac46c6a8e53a43c70ff798c8f26a3a06685cf61dd7a",
                "md5": "22f2f8efa66be38864b9100b753f5184",
                "sha256": "b9e157fa399db9b666cc271c8a635c5dd231e73e75e00260ada34fba129e68a1"
            },
            "downloads": -1,
            "filename": "basalt_sdk-0.0.4.tar.gz",
            "has_sig": false,
            "md5_digest": "22f2f8efa66be38864b9100b753f5184",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 11932,
            "upload_time": "2025-01-17T17:21:06",
            "upload_time_iso_8601": "2025-01-17T17:21:06.594153Z",
            "url": "https://files.pythonhosted.org/packages/e6/20/c67da4c8367923dbbac46c6a8e53a43c70ff798c8f26a3a06685cf61dd7a/basalt_sdk-0.0.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-17 17:21:06",
    "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.95739s