Notebooks
G
Groq
Jigsawstack Prompt Engine

Jigsawstack Prompt Engine

managed-by-terraformjigsawstack-prompt-engine08-integrationstutorialsgroq-api-cookbook

JigsawStack Prompt Engine

JigsawStack is an AI SDK that is easy to plug and play into any backend to automate a lot of the heavy lifting away for tasks like scraping, OCR, translation, and using LLMs.

The JigsawStack Prompt Engine allows you to run the best LLM on every prompt at the fastest speed powered by Groq!

Features

🌐Prompt caching: Stores prompts and responses for quick reuse, significantly reducing latency for repeated queries.

💬Automatic prompt optimization: Automatically refines prompts to enhance response accuracy and efficiency from the language model.

📄Response schema validation: Ensures that responses adhere to a predefined format or structure, providing consistency in output.

🔁Reusable prompts: Allows prompts to be reused across different sessions and workflows, saving time in repetitive tasks.

🧠Multi-agent LLM from 50+ models: Automatically selects the best model suitable for the task from the poll of models.

🚫 No virtual rate limits, tokens, and GPU management

Prerequisite

  • Create a JigsawStack account (Get started for free)
  • Retrieve your api key

Setup

Install the JigsawStack SDK

[1]
Requirement already satisfied: jigsawstack in /opt/anaconda3/envs/openvoice/lib/python3.9/site-packages (0.1.14)
Requirement already satisfied: requests>=2.31.0 in /opt/anaconda3/envs/openvoice/lib/python3.9/site-packages (from jigsawstack) (2.32.2)
Requirement already satisfied: typing-extensions in /opt/anaconda3/envs/openvoice/lib/python3.9/site-packages (from jigsawstack) (4.11.0)
Requirement already satisfied: charset-normalizer<4,>=2 in /opt/anaconda3/envs/openvoice/lib/python3.9/site-packages (from requests>=2.31.0->jigsawstack) (2.0.4)
Requirement already satisfied: idna<4,>=2.5 in /opt/anaconda3/envs/openvoice/lib/python3.9/site-packages (from requests>=2.31.0->jigsawstack) (3.7)
Requirement already satisfied: urllib3<3,>=1.21.1 in /opt/anaconda3/envs/openvoice/lib/python3.9/site-packages (from requests>=2.31.0->jigsawstack) (2.2.2)
Requirement already satisfied: certifi>=2017.4.17 in /opt/anaconda3/envs/openvoice/lib/python3.9/site-packages (from requests>=2.31.0->jigsawstack) (2024.7.4)
Note: you may need to restart the kernel to use updated packages.

Import and Initialize the SDK

[ ]

Usage

Example 1: Create and run a prompt

  • Create prompt

[ ]
  • Run the prompt

[ ]

Example 2: Execute the prompt directly

[ ]

Prompt Guard - Llama Guard 3 by Groq

The prompt engine comes with prompt guards to prevent prompt injection from user inputs and a wide range of unsafe use cases. This can be turned on automatically using the prompt_guard field.

[ ]

Recommendation

  • For prompts that are used repeatedly, it is recommended to first create the prompt, then run it using its prompt ID to enable optimization.

  • Run Prompt Direct is ideal for one-time use.

For more information on the Prompt Engine engine see documentation