Prompt Blueprints
Prompt Blueprints are central to PromptLayer’s architecture, enabling you to work seamlessly with multiple LLM providers in a single format. They abstract provider-specific details, allowing you to switch between LLMs without modifying your code.
Prompt Blueprint is a model-agnostic and standardized schema that PromptLayer uses to store prompts.
Accessing the Prompt Blueprint
Instead of accessing the raw LLM response via response["raw_response"]
, it’s recommended to use the standardized response["prompt_blueprint"]
. This ensures consistency across different providers.
With this approach, you can update from one provider to another (e.g., OpenAI to Anthropic) without any code changes.
Placeholder Messages
Placeholder Messages are a powerful feature that allows you to inject messages into a prompt template at runtime. By using the placeholder
role, you can define placeholders within your prompt template that can be replaced with full messages when the prompt is executed.
For more detailed information on Placeholder Messages, including how to create and use them, please refer to our dedicated Placeholder Messages Documentation page.
Running a Template with Placeholders
When running a prompt that includes placeholders, you need to supply the messages that will replace the placeholders in the input variables.
Note: The messages provided must conform to the Prompt Blueprint format.
Prompt Blueprint Message Format
Each message in a Prompt Blueprint should be a dictionary with the following structure:
role
: The role of the message sender (user
,assistant
, etc.).content
: A list of content items, where each item has:type
: The type of content (text
,image_url
, etc.).text
: The text content (iftype
istext
).
Example Message
Tools and Function Calling
This section demonstrates how to handle function calling within Prompt Blueprints.
Multi-Modal Variables
The image_variable
attribute allows you to dynamically insert a list of images into prompt template messages.
The image_variable
is nested within the message content. The type
and image_url
are required fields specifying the type of content and the URL of the image, respectively. The image_url
needs to be blank and is there for type requirements. The image_variable
is the name of the list of images to be dynamically inserted.
When defining a prompt template, you can specify an image_variable
to dynamically include images in your messages.
Running with Image Variables
image_urls
is a list of stringsWas this page helpful?