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
tagandversion. 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
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file basalt_sdk-0.0.9.tar.gz.
File metadata
- Download URL: basalt_sdk-0.0.9.tar.gz
- Upload date:
- Size: 13.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.11.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a331035881da077a151a516fd8a61431e1d30543d5cd1e7ff6bae78d04f7e0e7
|
|
| MD5 |
56fd7ab79e5bf8f4e91a54277a0b9ddf
|
|
| BLAKE2b-256 |
1d8a3b4395b643c4e0b6a2bce96ddb8d3438b803efdf84c21425b4495fd7ac66
|
File details
Details for the file basalt_sdk-0.0.9-py3-none-any.whl.
File metadata
- Download URL: basalt_sdk-0.0.9-py3-none-any.whl
- Upload date:
- Size: 13.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.11.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e8c43268b1529eb34ab237bbc27c22f761df35a061d1095b3d4253d319874cd3
|
|
| MD5 |
5803037873794fcbe0e9b6909d4a4c6d
|
|
| BLAKE2b-256 |
afcce28fc51635a46d796c5c24901b2b952a72dfb7a07ff6b9a5495dab01c0f3
|