How to create a prompt library that leverages Lily, Switchyard, and CX orchestration for your marketing team in 2026
Today's marketing landscape is driven by data and automation. To stay competitive, teams need a robustprompt librarythat not only standardizes language but also integrates with cutting-edge AI tools, such as Perplexity’s local inference engineLily, NVIDIA’sSwitchyardproxy, andCX orchestrationplatforms.Why a prompt library is essential for modern marketing
A well-structured prompt library offers three key advantages:
- Consistency:All copywriters, campaign managers, and data specialists use the same tone, format, and context.
- Speed:Reusable templates reduce prompt creation time from minutes to seconds.
- Scalability:Integration with new language models (LLMs) and orchestration tools ensures the library grows with your marketing needs.
This year, Perplexity open-sourcedLily(a Rust+Metal engine running on Apple Silicon), and NVIDIA launchedSwitchyardfor seamless LLM traffic routing. A modern prompt library must now be bothagileandmulti-provider.
Aligning with emerging technologies: Lily, Switchyard, and CX orchestration
Integrate Lily for local inference
Lily provides low-latency inference directly on the device, ideal for real-time content generation, audience segmentation, and chat support. To leverage Lily in your prompt library, import the Rust client via its OpenAI-compatible API:
cargo add perplx-client --vers 0.2.0
cargo add serde_json
// Example of initializing the Lily client
let mut client = PerplexityClient::new("api_key", "https://lily.perplexity.ai/v1");When a prompt requires localized or offline content, redirect the request to the Lily client:
let risposta = client.chat_completion([
ChatMessage { ruolo: "system", contenuto: "You are an expert in tech branding." },
ChatMessage { ruolo: "user", contenuto: "Write a 5-word tagline for a new project management software." }
]).await?;Use Switchyard for multi-provider routing
Switchyard abstracts API details, allowing you to switch between OpenAI, Anthropic, or other providers with a simple configuration change. This is useful for A/B testing prompt models or leveraging new emerging models without rewriting code.
Example configuration in Rust:
use switchyard::{SwitchyardClient, Provider};
let mut client = SwitchyardClient::new([
Provider::OpenAI { key: "sk-***" },
Provider::Anthropic { key: "sk-ant-***" },
Provider::Perplexity { key: "pplx-***" }
]);
// Generate a prompt using the best performing provider
let risposta = client.send_prompt("Create a persuasive B2B follow-up email").await?;CX orchestration for consistent campaigns
Integration snippet:
use cx_orchestrator::{Orchestrator, Channel};
let orchestrator = Orchestrator::new("orchestrator_token");
// Register a prompt for all channels
orchestrator.register_channel(Channel::Email, "You are a trusted advisor offering honest advice.");
orchestrator.register_channel(Channel::Chat, "You are a friendly and concise assistant.");
// Generate a response adapted to the channel
let risposta = orchestrator.generate_response(
Channel::Email,
"What is the best way to introduce a new SaaS software?"
).await?;How to build your prompt library: a step-by-step guide
Below is a minimalist, example-oriented structure you can copy into a Git repository. The code is in Rust (for native compatibility with Lily), but the principles apply to any language.
1. Define a common data structure
#[derive(Debug, Serialize, Deserialize)]
struct PromptTemplate {
name: String,
role: String,
instruction: String,
variables: Vec,
}
#[derive(Debug, Serialize, Deserialize)]
struct PromptResponse {
text: String,
provider: String,
latency_ms: u64,
} 2. Create a multi-provider handler
This module abstracts provider selection logic, allowing you to switch between Lily, Switchyard, or a cloud service with a simple configuration change.
3. Implement a scoring system
- Write a test that measures response time and prompt quality for each provider.
- Use the results to automatically route heavy workloads to Lily (low latency) and creative workloads to Anthropic or OpenAI.
4. Document and version your templates
Key takeaways
- Design the prompt library as a modular infrastructurethat can be connected to Lily, Switchyard, and CX orchestration.
- Leverage Lily's local inferencefor real-time content, reducing bandwidth dependency and API costs.
- Use Switchyardfor seamless routing between providers, simplifying A/B testing and adoption of new LLM models.
- Connect CX orchestrationto ensure every channel maintains the same tone, increasing brand fidelity.
- Version and documenteach template to enable teams to collaborate quickly and securely.
Conclusion
In 2026, successful marketing teams don’t just write prompts; they buildprompt ecosystems
Get started today: initialize a Git repository, copy the code skeleton, and begin connecting your templates to the new engines. The future of AI-driven marketing belongs to those who can orchestrate the right prompt, on the right provider, at the right time.