Skip to main content

Basalt SDK for python

Project description

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:

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:

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:

    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]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

basalt_sdk-0.0.6.tar.gz (12.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

basalt_sdk-0.0.6-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

Details for the file basalt_sdk-0.0.6.tar.gz.

File metadata

  • Download URL: basalt_sdk-0.0.6.tar.gz
  • Upload date:
  • Size: 12.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.1

File hashes

Hashes for basalt_sdk-0.0.6.tar.gz
Algorithm Hash digest
SHA256 47162a8e9cc2ae543eb2a778f59f664adc98524b1ba1b73a95f776ff39c93b19
MD5 3050d8e7a38ec10945b41aa48cfeab05
BLAKE2b-256 9128491733ad571f68981e8201fa2fd1823560eabbdcfae780338afcde2ac847

See more details on using hashes here.

File details

Details for the file basalt_sdk-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: basalt_sdk-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 11.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.1

File hashes

Hashes for basalt_sdk-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 e7c2f3a019947a45878e9bf5ede27c06433bc60a4019ccce666eef9ec58a3995
MD5 5123d8abb4811b623d5528e3701f4047
BLAKE2b-256 a5b533423438f0ee2c4d46434180f8f016f002bcb793f4cb869b06330fafb7c5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page