Hey devs! đź‘‹
Imagine running any prompt and getting the optimal model to execute it without ever worrying about picking LLMs, managing GPUs, tokens, or rate limits. Now, with the new features, the Prompt Engine is more powerful and flexible than ever.
What’s New?
Prompt Streaming
Want real-time responses? With streaming, results start flowing as the prompt is processed. This is perfect for live apps like chatbots or realtime dashboards.
Prompt Template Page
Not sure where to start or what prompt to write? Prompt templates is a gallery of prompts that are pre-optimized and ready to run with the prompt engine. Whether it’s summarizing articles or extracting key data, you can now find pre-built prompts that are optimized to deliver the best results.
Internet Access
Need up-to-the-minute information? The Prompt Engine now has access to AI search allowing it fetch live data from the web.
Prompt Optimization
We’ve made your life easier. The engine now automatically optimizes prompts to improve accuracy, minimize token usage, and reduce costs. No more tweaking and testing—just plug and play.
Let’s Build Something!
Step 1: Create a free JigsawStack account.
Step 2: Grab your API key from the dashboard.
Step 3: Install the SDK and start building!
npm install jigsawstack
Prompt Streaming and Internet Access
Execute Directly for Quick Results
For one-time prompts, skip the setup and run directly. Let’s see Prompt Engine in action— first a run without internet access:
// Install the SDK
import { JigsawStack } from "jigsawstack";
const onHandleStreaming = async () => {
const jigsaw = JigsawStack({
apiKey: "your-api-key",
});
const stream = true;
const resp = await jigsaw.prompt_engine.run_prompt_direct({
const params = {
prompt:
"Who won the US presidential election 2024 and give me a breakdown why you think they won?",
stream: stream,
});
if (stream){
let result = "";
for await (const chunk of resp){
console.log("Chunck: ", chunk);
result += chunck;
}
console.log(result)
} else {
console.log(resp?.result)
}
};
onHandleStreaming();
Output
### US Presidential Election 2024 Results
Since my knowledge cutoff is December 2023, I do not have real-time information about
the 2024 US presidential election. The election has not occurred yet, and I do not have
the ability to predict the future or provide real-time updates.
### Why I Don't Have the Results
* My training data only goes up to December 2023
* The 2024 US presidential election has not yet taken place
* I do not have the ability to predict the future or provide real-time updates
### Where to Find the Results
To get the latest information on the 2024 US presidential election, I recommend checking
reputable news sources or official government websites for updates after the election takes
place.
Now let’s enable internet access for live results:
// Install the SDK
import { JigsawStack } from "jigsawstack";
const onHandleStreaming = async () => {
const jigsaw = JigsawStack({
apiKey: "your-api-key",
});
const stream = true;
const resp = await jigsaw.prompt_engine.run_prompt_direct({
prompt:
"Who won the US presidential election 2024 and give me a breakdown why you think they won?",
stream: stream, //Streams output to user
use_internet: true, //Allow internet access
return_prompt: "Provide the result in markdown format", //Output format
});
//Handles Streaming
if (stream){
let result = "";
for await (const chunk of resp){
console.log("Chunck: ", chunk);
result += chunk;
}
console.log(result)
} else {
console.log(resp?.result)
}
};
Output
###2024 US Presidential Election Result
The winner of the 2024 US presidential election is **Donald Trump**.
### Breakdown of the Election Result
Based on the provided context, here's a breakdown of why Donald Trump won the election:
* **Analysis**: Polling found that 56% of Republicans stated they were more likely to vote for Trump, indicating a strong base of support within the Republican party.
* **Media Coverage**: More Americans believed the media did a worse job covering the 2024 election (37%) than those who thought they did a better job (13%). This perception might have contributed to Trump's victory, as his campaign often criticized the media.
* **Voter Reaction**: Trump voters expressed joy and relief upon learning about his victory, feeling hopeful for the future direction of the country. This positive reaction suggests that Trump's campaign resonated with his supporters.
* **Electoral College Votes**: Trump secured enough swing states to reach 270 Electoral College votes, winning key battlegrounds like Pennsylvania, North Carolina, Georgia, and Wisconsin.
* **Opponent's Campaign**: Vice President Kamala Harris's campaign spent over $1 billion, but Trump's campaign was still able to secure the victory. This might indicate that Harris's campaign failed to effectively communicate her message or connect with voters.
### Sources
The information is based on the provided context from various sources, including:
* Wikipedia: 2024 United States presidential election
* YouGov: How Americans have reacted to Donald Trump's 2024 victory
* The New York Times: Presidential Election Results Map
* Fox News: Donald Trump wins 2024 presidential election
Note that the analysis is limited to the provided context and might not reflect the complete picture of the 2024 US presidential election.
How Fast Did It Run?
Speed matters, especially for real-time applications. Here’s how quickly the Prompt Engine executed with streaming on:
Without Internet Access: Response delivered in ~1.41 seconds.
With Internet Access: Response streamed live in ~3 seconds, including fetching and formatting up-to-date web data.
The combination of low latency and live streaming ensures you get results fast ⚡
Prompt Optimization
The prompt engine takes the hassle out of fine-tuning by automatically optimizing your prompts for better results. Here's a simple example of how it works:
{
prompt:
"generate an intro email to {name} based on the information you find
on what they like",
inputs: [{"key":"name"}],
use_internet: true, // Allow internet access
}
Output
{
"success": true,
"prompt_engine_id": "0d6d0760-b7e6-4f6d-8a21-e715a1886454",
"optimized_prompt": "Compose a personalized introductory email to
{name} that highlights their interests and prefences based on
available information. Ensure the tone is friendly and engaging,
and include a brief introduction about yourself."
}
By automating the fine-tuning process, you can now focus on the outcome rather than the intricacies of crafting the perfect prompt. The engine enhances accuracy, reduces token usage, and minimizes costs— All while ensuring your prompts are tailored for maximum effectiveness.
Just plug in your ideas, and let the engine do the heavy lifting empowering you to streamline your workflows and achieve more, faster!
Prompt Templates
Lets try running one of our prompts from the prompt template page:
Here’s our prompt:
Prompt: Create an outline for a blog post about topic {text}
Run the prompt id:
import { JigsawStack } from "jigsawstack";
const jigsaw = JigsawStack({
apiKey: "your api key here"
});
const response = await jigsaw.prompt_engine.run({
"id": "0073d008-da9b-4c27-90a8-0240f3ecd4f5",
"input_values": {
"text": "AI"
}
})
Output
{
"outline": [
{
"section": "Introduction to AI"
},
{
"section": "History and Development of AI"
},
{
"section": "Types of AI: Narrow, General, and Superintelligence"
},
{
"section": "Applications of AI: Machine Learning, Natural Language Processing, and Robotics"
},
{
"section": "Challenges and Limitations of AI: Bias, Job Displacement, and Ethics"
},
{
"section": "Future of AI: Emerging Trends and Potential Breakthroughs"
},
{
"section": "Conclusion: The Impact of AI on Society and Human Life"
}
]
}
Why We Are Excited!
With these new features, JigsawStack's Prompt Engine is your go-to tool for seamless, real-time AI-powered workflows. Whether you’re optimizing processes, building chatbots, or generating data-driven insights, the Prompt Engine empowers you to deliver smarter solutions at scale.