Reference documentation for the Autoblocks Python Prompt SDK, including the AutoblocksPromptManager and PromptExecutionContext classes.
AutoblocksPromptManager
name | required | default | description |
---|---|---|---|
major_version | true | The major version of the prompt to use. Can be a specific version number or “undeployed” for local development. | |
minor_version | true | Can be one of: a specific minor version or “latest” | |
api_key | false | AUTOBLOCKS_V2_API_KEY environment variable | Your Autoblocks API key. |
refresh_interval | false | timedelta(seconds=10) | How often to refresh the latest prompt. Only relevant if the minor version is set to "latest" or "latest" is used in the weighted list. |
refresh_timeout | false | timedelta(seconds=30) | How long to wait for the latest prompt to refresh before timing out. A refresh timeout will not raise an uncaught exception. An error will be logged and the background refresh process will continue to run at its configured interval. |
init_timeout | false | timedelta(seconds=30) | How long to wait for the prompt manager to be ready before timing out. |
exec
PromptExecutionContext
instance.
PromptExecutionContext
exec
context manager.
It contains a frozen copy of the prompt manager’s in-memory prompt at the time exec
was called.
This ensures the prompt is stable for the duration of an execution, even if the in-memory prompt on the manager
instance is refreshed mid-execution.
params
pydantic
model instance with the prompt’s parameters.
render_template
render_template
attribute contains an instance of a class that has methods for rendering each of the prompt’s templates.
The template IDs and template parameters are all converted to snake case so that the method and argument names follow
Python naming conventions.
For example, the prompt in the quick start guide contains the below templates:
system
user
util/language
util/tone
render_tool
render_tool
attribute contains an instance of a class that has methods for rendering each of the prompt’s tools.
The tool names and tool parameters are all converted to snake case so that the method and argument names follow
Python naming conventions. The tool will be in the JSON schema format that OpenAI expects.