### Upload File to JigsawStack Storage (Quick Start) Source: https://jigsawstack.com/docs/llms-full This example shows the basic steps to upload a file to JigsawStack File Storage using the `jigsaw.store.upload` method. It reads a local file, uploads it, and then constructs a publicly accessible URL using a public key. ```javascript import { JigsawStack } from 'jigsawstack'; import fs from 'fs'; const jigsaw = new JigsawStack('your-api-key'); // Your public key for making files accessible const publicKey = "your-public-key"; // Read file data const imageFile = fs.readFileSync("./beach_house.png"); // Upload the file const result = await jigsaw.store.upload(imageFile, { filename: "beach_house.png", }); // Create a publicly accessible URL const publicFileUrl = `${result.url}?x-api-key=${publicKey}`; console.log("Upload result:", result); console.log("Public URL:", publicFileUrl); ``` -------------------------------- ### Quick Start: JigsawStack AI Web Scraper (JavaScript) Source: https://jigsawstack.com/docs/llms-full This JavaScript quick start guide demonstrates how to use the JigsawStack SDK to interact with the AI Web Scraper API. It shows how to initialize the client and make a call to extract specific elements from a given URL using natural language prompts. ```javascript import { JigsawStack } from "jigsawstack"; const jigsaw = JigsawStack({ apiKey: "your-api-key" }); const response = await jigsaw.web.ai_scrape({ url: "https://news.ycombinator.com", element_prompts: ["post_titles", "post_points", "post_username"] }); console.log(response); ``` -------------------------------- ### Install JigsawStack Python SDK Source: https://jigsawstack.com/docs/quick-start/python/introduction Instructions to install the JigsawStack Python SDK using pip, the standard package installer for Python. ```Python pip install jigsawstack ``` -------------------------------- ### JavaScript Quick Start for JigsawStack Speech to Text Source: https://jigsawstack.com/docs/llms-full This JavaScript example demonstrates how to initialize the JigsawStack client and perform basic audio transcription from a URL. It also shows how to enable speaker diarization and iterate through the identified speakers and their respective text segments. ```JavaScript import { JigsawStack } from 'jigsawstack'; const jigsaw = new JigsawStack('your-api-key'); // Basic transcription from URL const response = await jigsaw.audio.speech_to_text({ url: "https://example.com/path/to/audio.mp3" }); console.log(response.text); // With speaker diarization const responseWithSpeakers = await jigsaw.audio.speech_to_text({ url: "https://example.com/path/to/audio.mp3", by_speaker: true }); // Display speakers and their text responseWithSpeakers.speakers.forEach(segment => { console.log(`${segment.speaker}: ${segment.text}`); }); ``` -------------------------------- ### Retrieve File from JigsawStack Store Source: https://jigsawstack.com/docs/llms-full Demonstrates how to retrieve a file from the JigsawStack store using its key. Examples are provided for various programming languages, showing how to initialize the client, set the API key, and make a GET request to the file read endpoint. ```Javascript import { JigsawStack } from "jigsawstack"; const jigsaw = JigsawStack({ apiKey: "your-api-key" }); const response = await jigsaw.store.get({ "key": "image-123.png" }) ``` ```Python from jigsawstack import JigsawStack jigsaw = JigsawStack(api_key="your-api-key") response = jigsaw.store.get({ "key": "image-123.png" }) ``` ```Bash curl https://api.jigsawstack.com/v1/store/file/read/image-123.png?key=image-123.png \ -X GET \ -H 'Content-Type: application/json' \ -H 'x-api-key: your-api-key' ``` ```PHP 'image-123.png', } uri.query = URI.encode_www_form(params) req = Net::HTTP::Get.new(uri) req.content_type = 'application/json' req['x-api-key'] = 'your-api-key' req_options = { use_ssl: uri.scheme == 'https' } res = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http| http.request(req) end ``` ```Go package main import ( "fmt" "io" "log" "net/http" ) func main() { client := &http.Client{} req, err := http.NewRequest("GET", "https://api.jigsawstack.com/v1/store/file/read/image-123.png?key=image-123.png", nil) if err != nil { log.Fatal(err) } req.Header.Set("Content-Type", "application/json") req.Header.Set("x-api-key", "your-api-key") resp, err := client.Do(req) if err != nil { log.Fatal(err) } defer resp.Body.Close() bodyText, err := io.ReadAll(resp.Body) if err != nil { log.Fatal(err) } fmt.Printf("%s\n", bodyText) } ``` ```Java import java.io.IOException; import java.net.URI; import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; HttpClient client = HttpClient.newHttpClient(); HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://api.jigsawstack.com/v1/store/file/read/image-123.png?key=image-123.png")) .GET() .setHeader("Content-Type", "application/json") .setHeader("x-api-key", "your-api-key") .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); ``` ```Swift import Foundation let url = URL(string: "https://api.jigsawstack.com/v1/store/file/read/image-123.png?key=image-123.png")! let headers = [ "Content-Type": "application/json", "x-api-key": "your-api-key" ] var request = URLRequest(url: url) request.allHTTPHeaderFields = headers let task = URLSession.shared.dataTask(with: request) { (data, response, error) in if let error = error { print(error) } else if let data = data { let str = String(data: data, encoding: .utf8) print(str ?? "") } } task.resume() ``` ```Dart import 'package:http/http.dart' as http; void main() async { final headers = { 'Content-Type': 'application/json', 'x-api-key': 'your-api-key', }; final params = { 'key': 'image-123.png', }; final url = Uri.parse('https://api.jigsawstack.com/v1/store/file/read/image-123.png') .replace(queryParameters: params); final res = await http.get(url, headers: headers); final status = res.statusCode; if (status != 200) throw Exception('http.get error: statusCode= $status'); print(res.body); } ``` ```Kotlin import java.io.IOException import okhttp3.OkHttpClient import okhttp3.Request val client = OkHttpClient() val request = Request.Builder() .url("https://api.jigsawstack.com/v1/store/file/read/image-123.png?key=image-123.png") .header("Content-Type", "application/json") .header("x-api-key", "your-api-key") .build() client.newCall(request).execute().use { response -> if (!response.isSuccessful) throw IOException("Unexpected code $response") response.body!!.string() } ``` ```C# using System.Net.Http; using System.Net.Http.Headers; HttpClient client = new HttpClient(); ``` -------------------------------- ### Install JigsawStack SDK (Node.js) Source: https://jigsawstack.com/docs/examples/file-upload Instructions for installing the JigsawStack SDK in Node.js projects using various package managers like npm, yarn, pnpm, or bun. ```Node.js npm install jigsawstack # or yarn add jigsawstack # or pnpm add jigsawstack # or bun add jigsawstack ``` -------------------------------- ### Use JigsawStack Prompt Engine in LangChain.js Source: https://jigsawstack.com/docs/llms-full This example demonstrates how to integrate and use the JigsawStack Prompt Engine within a LangChain.js application. It shows how to initialize the `JigsawStackPromptEngine` model and invoke it with a prompt to get a response. ```javascript import { JigsawStackPromptEngine } from "@langchain/jigsawstack"; export const run = async () => { const model = new JigsawStackPromptEngine(); const res = await model.invoke( "Tell me about the leaning tower of pisa?\nAnswer:", ); console.log({ res }); }; ``` -------------------------------- ### Call JigsawStack Web Search Suggestions API Source: https://jigsawstack.com/docs/llms-full Demonstrates how to make a GET request to the JigsawStack web search suggestions API endpoint. Examples cover various programming languages, showing how to set the query parameter and API key for authentication. ```Javascript import { JigsawStack } from "jigsawstack"; const jigsaw = JigsawStack({ apiKey: "your-api-key" }); const response = await jigsaw.web.search_suggestions({ "query": "What is the capital" }) ``` ```Python from jigsawstack import JigsawStack jigsaw = JigsawStack(api_key="your-api-key") response = jigsaw.web.search_suggestions({ "query": "What is the capital" }) ``` ```Curl curl https://api.jigsawstack.com/v1/web/search/suggest?query=What+is+the+capital \ -X GET \ -H 'Content-Type: application/json' \ -H 'x-api-key: your-api-key' ``` ```PHP 'What is the capital', } uri.query = URI.encode_www_form(params) req = Net::HTTP::Get.new(uri) req.content_type = 'application/json' req['x-api-key'] = 'your-api-key' req_options = { use_ssl: uri.scheme == 'https' } res = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http| http.request(req) end ``` ```Go package main import ( "fmt" "io" "log" "net/http" ) func main() { client := &http.Client{} req, err := http.NewRequest("GET", "https://api.jigsawstack.com/v1/web/search/suggest?query=What+is+the+capital", nil) if err != nil { log.Fatal(err) } req.Header.Set("Content-Type", "application/json") req.Header.Set("x-api-key", "your-api-key") resp, err := client.Do(req) if err != nil { log.Fatal(err) } defer resp.Body.Close() bodyText, err := io.ReadAll(resp.Body) if err != nil { log.Fatal(err) } fmt.Printf("%s\n", bodyText) } ``` ```Java import java.io.IOException; import java.net.URI; import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; HttpClient client = HttpClient.newHttpClient(); HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://api.jigsawstack.com/v1/web/search/suggest?query=What+is+the+capital")) .GET() .setHeader("Content-Type", "application/json") .setHeader("x-api-key", "your-api-key") .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); ``` ```Swift import Foundation let url = URL(string: "https://api.jigsawstack.com/v1/web/search/suggest?query=What+is+the+capital")! let headers = [ "Content-Type": "application/json", "x-api-key": "your-api-key" ] var request = URLRequest(url: url) request.allHTTPHeaderFields = headers let task = URLSession.shared.dataTask(with: request) { (data, response, error) in if let error = error { print(error) } else if let data = data { let str = String(data: data, encoding: .utf8) print(str ?? "") } } task.resume() ``` ```Dart import 'package:http/http.dart' as http; void main() async { final headers = { 'Content-Type': 'application/json', 'x-api-key': 'your-api-key', }; final params = { 'query': 'What is the capital', }; final url = Uri.parse('https://api.jigsawstack.com/v1/web/search/suggest') .replace(queryParameters: params); final res = await http.get(url, headers: headers); final status = res.statusCode; if (status != 200) throw Exception('http.get error: statusCode= $status'); print(res.body); } ``` ```Kotlin import java.io.IOException import okhttp3.OkHttpClient import okhttp3.Request val client = OkHttpClient() val request = Request.Builder() .url("https://api.jigsawstack.com/v1/web/search/suggest?query=What+is+the+capital") .header("Content-Type", "application/json") .header("x-api-key", "your-api-key") .build() client.newCall(request).execute().use { response -> if (!response.isSuccessful) throw IOException("Unexpected code $response") response.body!!.string() } ``` ```C# using System.Net.Http; using System.Net.Http.Headers; HttpClient client = new HttpClient(); HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, "https://api.jigsawstack.com/v1/web/search/suggest?query=What+is+the+capital"); request.Headers.Add("x-api-key", "your-api-key"); request.Content = new StringContent(""); request.Content.Headers.ContentType = new MediaTypeHeaderValue("application/json"); ``` -------------------------------- ### vOCR Prompt Example (String) Source: https://jigsawstack.com/docs/llms-full Example of a vOCR API request body using a single string as the prompt to describe the image in detail. ```JavaScript { prompt: "Describe the image in detail."; } ``` -------------------------------- ### JSON AI SQL Generation Response Example Source: https://jigsawstack.com/docs/llms-full An example of the JSON response received from the AI SQL generation endpoint, showing the success status, the generated SQL query, and token usage statistics. ```JSON { "success": true, "sql": "SELECT * FROM Transactions WHERE total_amount > 10000 ORDER BY transaction_date;", "_usage": { "input_tokens": 132, "output_tokens": 27, "inference_time_tokens": 748, "total_tokens": 907 } } ``` -------------------------------- ### Install JigsawStack Python SDK with Pip, Pipenv, or Poetry Source: https://jigsawstack.com/docs/llms-full This section provides commands for installing the JigsawStack Python SDK using popular Python package managers: pip, pipenv, and poetry. Choose the command that best fits your project's dependency management setup. ```bash pip install jigsawstack ``` ```bash pipenv install jigsawstack ``` ```bash poetry add jigsawstack ``` -------------------------------- ### Install JigsawStack SDK in Node.js Source: https://jigsawstack.com/docs/introduction Instructions for installing the JigsawStack SDK in a Node.js project using various package managers such as npm, yarn, pnpm, or bun. ```bash npm install jigsawstack # or yarn add jigsawstack # or pnpm add jigsawstack # or bun add jigsawstack ``` -------------------------------- ### List Prompt Engines API Request Source: https://jigsawstack.com/docs/llms-full Demonstrates how to make a GET request to list prompt engines using the JigsawStack API, with examples in various programming languages. The 'limit' parameter is used to specify the number of results. ```Javascript import { JigsawStack } from "jigsawstack"; const jigsaw = JigsawStack({ apiKey: "your-api-key" }); const response = await jigsaw.prompt_engine.list({ "limit": "10" }) ``` ```Python from jigsawstack import JigsawStack jigsaw = JigsawStack(api_key="your-api-key") response = jigsaw.prompt_engine.list({ "limit": "10" }) ``` ```Curl curl https://api.jigsawstack.com/v1/prompt_engine?limit=10 \ -X GET \ -H 'Content-Type: application/json' \ -H 'x-api-key: your-api-key' ``` ```PHP '10', } uri.query = URI.encode_www_form(params) req = Net::HTTP::Get.new(uri) req.content_type = 'application/json' req['x-api-key'] = 'your-api-key' req_options = { use_ssl: uri.scheme == 'https' } res = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http| http.request(req) end ``` ```Go package main import ( "fmt" "io" "log" "net/http" ) func main() { client := &http.Client{} req, err := http.NewRequest("GET", "https://api.jigsawstack.com/v1/prompt_engine?limit=10", nil) if err != nil { log.Fatal(err) } req.Header.Set("Content-Type", "application/json") req.Header.Set("x-api-key", "your-api-key") resp, err := client.Do(req) if err != nil { log.Fatal(err) } defer resp.Body.Close() bodyText, err := io.ReadAll(resp.Body) if err != nil { log.Fatal(err) } fmt.Printf("%s\n", bodyText) } ``` ```Java import java.io.IOException; import java.net.URI; import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; HttpClient client = HttpClient.newHttpClient(); HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://api.jigsawstack.com/v1/prompt_engine?limit=10")) .GET() .setHeader("Content-Type", "application/json") .setHeader("x-api-key", "your-api-key") .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); ``` ```Swift import Foundation let url = URL(string: "https://api.jigsawstack.com/v1/prompt_engine?limit=10")! let headers = [ "Content-Type": "application/json", "x-api-key": "your-api-key" ] var request = URLRequest(url: url) request.allHTTPHeaderFields = headers let task = URLSession.shared.dataTask(with: request) { (data, response, error) in if let error = error { print(error) } else if let data = data { let str = String(data: data, encoding: .utf8) print(str ?? "") } } task.resume() ``` ```Dart import 'package:http/http.dart' as http; void main() async { final headers = { 'Content-Type': 'application/json', 'x-api-key': 'your-api-key', }; final params = { 'limit': '10', }; final url = Uri.parse('https://api.jigsawstack.com/v1/prompt_engine') .replace(queryParameters: params); final res = await http.get(url, headers: headers); final status = res.statusCode; if (status != 200) throw Exception('http.get error: statusCode= $status'); print(res.body); } ``` ```Kotlin import java.io.IOException import okhttp3.OkHttpClient import okhttp3.Request val client = OkHttpClient() val request = Request.Builder() .url("https://api.jigsawstack.com/v1/prompt_engine?limit=10") .header("Content-Type", "application/json") .header("x-api-key", "your-api-key") .build() client.newCall(request).execute().use { response -> if (!response.isSuccessful) throw IOException("Unexpected code $response") response.body!!.string() } ``` ```C# using System.Net.Http; using System.Net.Http.Headers; HttpClient client = new HttpClient(); HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, "https://api.jigsawstack.com/v1/prompt_engine?limit=10"); request.Headers.Add("x-api-key", "your-api-key"); request.Content = new StringContent(""); request.Content.Headers.ContentType = new MediaTypeHeaderValue("application/json"); HttpResponseMessage response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); string responseBody = await response.Content.ReadAsStringAsync(); ``` -------------------------------- ### Window.ai Integration: JigsawStack Basic Setup (Script Tag) Source: https://jigsawstack.com/docs/llms-full This snippet demonstrates how to include JigsawStack via a CDN script tag and then initialize it with a public API key, assigning the instance to the `window.ai` object. This setup is suitable for traditional browser environments. ```html ``` -------------------------------- ### Install JigsawStack SDK Source: https://jigsawstack.com/docs/llms-full This snippet shows how to install the JigsawStack SDK using npm for JavaScript projects or pip for Python projects. It's the first step to integrate the Prompt Engine into your application. ```JavaScript npm i jigsawstack ``` ```Python pip install jigsawstack ``` -------------------------------- ### Retrieve Voice Clones via API Request Source: https://jigsawstack.com/docs/llms-full Demonstrates how to make a GET request to the JigsawStack API to retrieve a list of voice clones. Examples are provided in various programming languages, showing how to set the API key and content type headers. ```Javascript import { JigsawStack } from "jigsawstack"; const jigsaw = JigsawStack({ apiKey: "your-api-key" }); const response = await jigsaw.audio.list_clones({}) ``` ```Python from jigsawstack import JigsawStack jigsaw = JigsawStack(api_key="your-api-key") response = jigsaw.audio.list_clones({}) ``` ```Curl curl https://api.jigsawstack.com/v1/ai/tts/clone \ -X GET \ -H 'Content-Type: application/json' \ -H 'x-api-key: your-api-key' ``` ```PHP ``` ```Ruby require 'net/http' uri = URI('https://api.jigsawstack.com/v1/ai/tts/clone') req = Net::HTTP::Get.new(uri) req.content_type = 'application/json' req['x-api-key'] = 'your-api-key' req_options = { use_ssl: uri.scheme == 'https' } res = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http| http.request(req) end ``` ```Go package main import ( "fmt" "io" "log" "net/http" ) func main() { client := &http.Client{} req, err := http.NewRequest("GET", "https://api.jigsawstack.com/v1/ai/tts/clone", nil) if err != nil { log.Fatal(err) } req.Header.Set("Content-Type", "application/json") req.Header.Set("x-api-key", "your-api-key") resp, err := client.Do(req) if err != nil { log.Fatal(err) } defer resp.Body.Close() bodyText, err := io.ReadAll(resp.Body) if err != nil { log.Fatal(err) } fmt.Printf("%s\n", bodyText) } ``` ```Java import java.io.IOException; import java.net.URI; import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; HttpClient client = HttpClient.newHttpClient(); HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://api.jigsawstack.com/v1/ai/tts/clone")) .GET() .setHeader("Content-Type", "application/json") .setHeader("x-api-key", "your-api-key") .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); ``` ```Swift import Foundation let url = URL(string: "https://api.jigsawstack.com/v1/ai/tts/clone")! let headers = [ "Content-Type": "application/json", "x-api-key": "your-api-key" ] var request = URLRequest(url: url) request.allHTTPHeaderFields = headers let task = URLSession.shared.dataTask(with: request) { (data, response, error) in if let error = error { print(error) } else if let data = data { let str = String(data: data, encoding: .utf8) print(str ?? "") } } task.resume() ``` ```Dart import 'package:http/http.dart' as http; void main() async { final headers = { 'Content-Type': 'application/json', 'x-api-key': 'your-api-key', }; final url = Uri.parse('https://api.jigsawstack.com/v1/ai/tts/clone'); final res = await http.get(url, headers: headers); final status = res.statusCode; if (status != 200) throw Exception('http.get error: statusCode= $status'); print(res.body); } ``` ```Kotlin import java.io.IOException import okhttp3.OkHttpClient import okhttp3.Request val client = OkHttpClient() val request = Request.Builder() .url("https://api.jigsawstack.com/v1/ai/tts/clone") .header("Content-Type", "application/json") .header("x-api-key", "your-api-key") .build() client.newCall(request).execute().use { response -> if (!response.isSuccessful) throw IOException("Unexpected code $response") response.body!!.string() } ``` ```C# using System.Net.Http; using System.Net.Http.Headers; HttpClient client = new HttpClient(); HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, "https://api.jigsawstack.com/v1/ai/tts/clone"); request.Headers.Add("x-api-key", "your-api-key"); request.Content = new StringContent(""); request.Content.Headers.ContentType = new MediaTypeHeaderValue("application/json"); HttpResponseMessage response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); string responseBody = await response.Content.ReadAsStringAsync(); ``` -------------------------------- ### Example JSON Response for Voice Clones List Source: https://jigsawstack.com/docs/llms-full Provides an example of the JSON structure returned by the API when successfully retrieving a list of voice clones, including the 'voice_clones' array with individual clone details. ```JSON { "voice_clones": [ { "id": "049c9f2d-3e54-42e0-82ca-bc616640c0fb", "name": "My Voice Clone 1", "created_at": "2023-01-01T12:00:00Z" }, { "id": "a1b2c3d4-e5f6-7890-1234-567890abcdef", "name": "My Voice Clone 2", "created_at": "2023-01-02T13:00:00Z" } ], "total_count": 2, "limit": 10, "page": 1 } ``` -------------------------------- ### Quick Start Web Search in Javascript Source: https://jigsawstack.com/docs/examples/web/web-search This Javascript example demonstrates how to initialize the JigsawStack client with an API key and perform a web search. It queries for 'capital of France' with AI overview and moderate safe search enabled, then logs the full response and the geolocation of the first geo result. ```Javascript import { JigsawStack } from "jigsawstack"; const jigsaw = JigsawStack({ apiKey: "your-api-key" }); const response = await jigsaw.web.search({ query: "capital of France", ai_overview: true, safe_search: "moderate" }); console.log(response); console.log(response.geo_results[0].geoloc); ``` -------------------------------- ### CSS Selector Syntax Examples Source: https://jigsawstack.com/docs/llms-full Examples of various CSS selectors, including combinators, attribute selectors, and pseudo-classes, demonstrating how to target specific HTML elements based on their relationships, attributes, or states. ```CSS div, p ``` ```CSS div + p ``` ```CSS a[href^="https"] ``` ```CSS a[href*="jigsawstack"] ``` ```CSS :active ``` ```CSS :link ``` -------------------------------- ### Install JigsawStack SDK in Node.js Source: https://jigsawstack.com/docs/learn/webhook/secure Instructions for installing the JigsawStack SDK using various Node.js package managers like npm, yarn, pnpm, or bun. ```Node.js npm install jigsawstack # or yarn add jigsawstack # or pnpm add jigsawstack # or bun add jigsawstack ``` -------------------------------- ### JigsawStack Prediction API Request Examples Source: https://jigsawstack.com/docs/llms-full Provides code examples in multiple programming languages for making a POST request to the JigsawStack prediction API. These examples demonstrate how to send a dataset of historical values and specify the number of future steps for which predictions are required. ```Javascript import { JigsawStack } from "jigsawstack"; const jigsaw = JigsawStack({ apiKey: "your-api-key" }); const response = await jigsaw.prediction({ "dataset": [ { "date": "2023-01-01", "value": 353459 }, { "date": "2023-01-02", "value": 313734 }, { "date": "2023-01-03", "value": 333774 }, { "date": "2023-01-04", "value": 348636 }, { "date": "2023-01-05", "value": 278903 } ], "steps": 3 }) ``` ```Python from jigsawstack import JigsawStack jigsaw = JigsawStack(api_key="your-api-key") response = jigsaw.prediction({ "dataset": [ { "date": "2023-01-01", "value": 353459 }, { "date": "2023-01-02", "value": 313734 }, { "date": "2023-01-03", "value": 333774 }, { "date": "2023-01-04", "value": 348636 }, { "date": "2023-01-05", "value": 278903 } ], "steps": 3 }) ``` ```Bash curl https://api.jigsawstack.com/v1/ai/prediction \ -X POST \ -H 'Content-Type: application/json' \ -H 'x-api-key: your-api-key' \ -d '{"dataset":[{"date":"2023-01-01","value":353459},{"date":"2023-01-02","value":313734},{"date":"2023-01-03","value":333774},{"date":"2023-01-04","value":348636},{"date":"2023-01-05","value":278903}],"steps":3}' ``` ```PHP ``` ```Ruby require 'net/http' require 'json' uri = URI('https://api.jigsawstack.com/v1/ai/prediction') req = Net::HTTP::Post.new(uri) req.content_type = 'application/json' req['x-api-key'] = 'your-api-key' req.body = { 'dataset' => [ { 'date' => '2023-01-01', 'value' => 353459 }, { 'date' => '2023-01-02', 'value' => 313734 }, { 'date' => '2023-01-03', 'value' => 333774 }, { 'date' => '2023-01-04', 'value' => 348636 }, { 'date' => '2023-01-05', 'value' => 278903 } ], 'steps' => 3 }.to_json req_options = { use_ssl: uri.scheme == 'https' } res = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http| http.request(req) end ``` ```Go package main import ( "fmt" "io" "log" "net/http" "strings" ) func main() { client := &http.Client{} var data = strings.NewReader(`{"dataset":[{"date":"2023-01-01","value":353459},{"date":"2023-01-02","value":313734},{"date":"2023-01-03","value":333774},{"date":"2023-01-04","value":348636},{"date":"2023-01-05","value":278903}],"steps":3}`) req, err := http.NewRequest("POST", "https://api.jigsawstack.com/v1/ai/prediction", data) if err != nil { log.Fatal(err) } req.Header.Set("Content-Type", "application/json") req.Header.Set("x-api-key", "your-api-key") resp, err := client.Do(req) if err != nil { log.Fatal(err) } defer resp.Body.Close() bodyText, err := io.ReadAll(resp.Body) if err != nil { log.Fatal(err) } fmt.Printf("%s\n", bodyText) } ``` ```Java import java.io.IOException; import java.net.URI; import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpRequest.BodyPublishers; import java.net.http.HttpResponse; HttpClient client = HttpClient.newHttpClient(); HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://api.jigsawstack.com/v1/ai/prediction")) ``` -------------------------------- ### Text Summary API Response Example Source: https://jigsawstack.com/docs/llms-full An example of the JSON response structure for a successful text summarization request, returning a single paragraph summary. ```JSON { "success": true, "summary": "Renewable energy had record growth in 2022 with solar and wind exceeding forecasts, despite pandemic-related supply chain issues. Global clean energy investment surpassed $500 billion for the first time, with major oil companies investing in renewables to reach carbon neutrality by 2050. Challenges include grid integration, regulatory barriers, and energy storage needs. Growth is expected to continue in 2023, especially in utility-scale solar and offshore wind." } ``` -------------------------------- ### Voice Clone Creation API Response Example Source: https://jigsawstack.com/docs/llms-full Example JSON response received after successfully creating a voice clone, including the generated voice ID and usage statistics. ```JSON { "voice_id": "09706c90-28f0-4df5-ba54-9c16db45d686", "_usage": { "input_tokens": 7, "output_tokens": 4, "inference_time_tokens": 1302, "total_tokens": 1313 } } ``` -------------------------------- ### Install JigsawStack SDK for Node.js and Python Source: https://jigsawstack.com/docs/llms-full Provides commands to install the JigsawStack SDK across various Node.js package managers (npm, yarn, pnpm, bun) and Python's pip. This is a prerequisite for using the SDK in your projects. ```bash npm install jigsawstack # or yarn add jigsawstack # or pnpm add jigsawstack # or bun add jigsawstack ``` ```bash pip install jigsawstack ``` -------------------------------- ### JigsawStack API Categories and Example Endpoints Source: https://jigsawstack.com/docs/llms-full This table provides an overview of the different API categories available in the JigsawStack Postman collection, along with a brief description of their capabilities and example endpoints for each category. ```APIDOC Category: Core AI Description: Essential AI capabilities for text and data analysis Example Endpoints: Sentiment Analysis, Translation, Summary Category: Web & Search Description: Web scraping and search capabilities Example Endpoints: AI Web Scraper, Web Search, HTML to Any Category: Computer Vision Description: Image analysis and processing Example Endpoints: vOCR, Object Detection Category: Audio Description: Speech processing and voice capabilities Example Endpoints: Speech to Text, Text to Speech Category: Geolocation Description: Location-based services and data Example Endpoints: Geo Search, Geocode Category: Validation Description: Content validation and verification Example Endpoints: NSFW Detection, Profanity Check, Spell Check Category: File Management Description: Cloud-based file storage and retrieval Example Endpoints: File Storage ``` -------------------------------- ### vOCR Prompt Example (Array of Strings) Source: https://jigsawstack.com/docs/llms-full Example of a vOCR API request body using an array of strings as the prompt to retrieve specific data fields from the image. ```JavaScript { prompt: ["first name", "last name"]; } ``` -------------------------------- ### Install JigsawStack SDK in Next.js Project Source: https://jigsawstack.com/docs/llms-full Instructions for adding the JigsawStack SDK to a Next.js project using popular package managers: npm, yarn, and pnpm. ```npm npm install jigsawstack ``` ```yarn yarn add jigsawstack ``` ```pnpm pnpm add jigsawstack ``` -------------------------------- ### Example API Response for Prediction Source: https://jigsawstack.com/docs/llms-full Illustrates a fragment of a successful JSON response from the prediction API, including bounding box coordinates and token usage statistics. ```json }, "bottom_right": { "x": 1078, "y": 825 }, "bottom_left": { "x": 546, "y": 825 }, "width": 532, "height": 599 } ] ], "_usage": { "input_tokens": 34, "output_tokens": 244, "inference_time_tokens": 2354, "total_tokens": 2632 } } ``` -------------------------------- ### Example AI Prediction API Response Source: https://jigsawstack.com/docs/llms-full An example JSON response from the Jigsawstack AI prediction API, showing predicted values, steps, and usage metrics including input, output, and total tokens. ```JSON { "success": true, "prediction": [ { "date": "2023-01-08 00:00:00", "value": 315214.5625 }, { "date": "2023-01-07 00:00:00", "value": 320094.71875 }, { "date": "2023-01-06 00:00:00", "value": 316329.9375 } ], "steps": 3, "_usage": { "input_tokens": 53, "output_tokens": 49, "inference_time_tokens": 792, "total_tokens": 894 } } ``` -------------------------------- ### JigsawStack API Integration with Postman Setup Source: https://jigsawstack.com/docs/llms-full Provides instructions for setting up and exploring JigsawStack APIs using Postman. This includes steps to create a Postman account, fork the official JigsawStack collection, and configure environment variables for the API key and base URL. ```APIDOC Postman Integration: Description: Explore and test JigsawStack APIs directly in Postman with our official collection. Features: - Explore complete API suite in an interactive environment - Test API calls with pre-configured requests - Integrate JigsawStack into projects with generated code snippets - Collaborate with your team on API development - Build workflows using Postman's powerful features Getting Started: - Fork Our Collection: The quickest way to get started with JigsawStack in Postman. (Link: https://www.postman.com/jigsawstack-devrel?view=collections) - Vote for JigsawStack: Support JigsawStack in the 2025 Postman Developers' Choice Awards. (Link: https://www.postman.com/jigsawstack-devrel) Setup Instructions: 1. Create a Postman account if you don't already have one. 2. Fork the JigsawStack collection from our official workspace: https://www.postman.com/jigsawstack/workspace/jigsawstack/ 3. Set up your environment variables: - Create a new environment in Postman. - Add the variable `JIGSAWSTACK_API_KEY` with your API key. - Set the `BASE_URL` to `https://api.jigsawstack.com/v1`. ``` -------------------------------- ### Install JigsawStack SDK (Node.js) Source: https://jigsawstack.com/docs/examples/ai/prompt-engine This snippet provides commands to install the JigsawStack SDK in a Node.js project using popular package managers such as npm, yarn, pnpm, and bun. It is the first step to integrate JigsawStack functionalities into your application. ```Node.js npm install jigsawstack # or yarn add jigsawstack # or pnpm add jigsawstack # or bun add jigsawstack ``` -------------------------------- ### Install JigsawStack SDK (Node.js) Source: https://jigsawstack.com/docs/index This snippet demonstrates how to install the JigsawStack SDK in a Node.js project. It provides commands for popular package managers including npm, yarn, pnpm, and bun, allowing developers to choose their preferred method. ```Node.js npm install jigsawstack # or yarn add jigsawstack # or pnpm add jigsawstack # or bun add jigsawstack ``` -------------------------------- ### Prompt Engine API Endpoints Overview Source: https://jigsawstack.com/docs/llms-full This section provides references to key Prompt Engine API endpoints for managing and running prompts. It highlights `Create` and `Run` for reusable prompts, and `Run Prompt Direct` for one-time use cases. ```APIDOC Prompt Engine API: - Create: /docs/api-reference/prompt-engine/create - Run: /docs/api-reference/prompt-engine/run - Run Prompt Direct: /docs/api-reference/prompt-engine/run-direct ``` -------------------------------- ### Initialize and Use JigsawStack SDK (Node.js) Source: https://jigsawstack.com/docs/examples/file-upload Example demonstrating how to initialize the JigsawStack SDK with an API key and perform a web scraping operation using the `ai_scrape` method. ```Node.js import { JigsawStack } from "jigsawstack"; const jigsawstack = JigsawStack({ apiKey: "your-api-key", }); const result = await jigsawstack.web.ai_scrape({ url: "https://www.amazon.com/Cadbury-Mini-Caramel-Eggs-Bulk/dp/B0CWM99G5W", element_prompts: ["prices"] }); ``` -------------------------------- ### Example SQL Schema for Transactions Table Source: https://jigsawstack.com/docs/examples/data/text-to-sql This SQL schema defines a `transactions` table with columns for `id`, `created_at`, `amount`, and `user_id`. It is used as the `sql_schema` parameter for the Text to SQL API to guide SQL generation. ```SQL CREATE TABLE transactions ( id TEXT UNIQUE NOT NULL DEFAULT ( lower(hex(randomblob(4))) || '-' || lower(hex(randomblob(2))) || '-4' || substr(lower(hex(randomblob(2))), 2) || '-' || substr('89ab', abs(random()) % 4 + 1, 1) || substr(lower(hex(randomblob(2))), 2) || '-' || lower(hex(randomblob(6))) ), created_at DATETIME NOT NULL DEFAULT (datetime('now', 'subsec')), amount NUMERIC NOT NULL, user_id TEXT NOT NULL, PRIMARY KEY (id)); ``` -------------------------------- ### Configure JigsawStack API Key via Direct SDK Initialization Source: https://jigsawstack.com/docs/llms-full Illustrates an alternative method for configuring the JigsawStack SDK by directly passing the API key during the SDK's initialization. This example shows the JavaScript syntax for instantiating the `JigsawStack` client with the `apiKey` parameter. ```javascript import { JigsawStack } from "jigsawstack"; const jigsawstack = JigsawStack({ apiKey: "your-api-key", }); ``` -------------------------------- ### Quick Start: Analyze Sentiment with JigsawStack SDK Source: https://jigsawstack.com/docs/llms-full This JavaScript snippet provides a quick example of how to use the JigsawStack SDK to perform sentiment analysis on a given text. It initializes the SDK and calls the `jigsaw.ai.sentiment` method with the text to be analyzed. ```javascript import { JigsawStack } from 'jigsawstack'; const jigsaw = new JigsawStack('your-api-key'); const response = await jigsaw.ai.sentiment({ text: "The customer service was excellent, and I really enjoyed the product!" }); console.log(response); ``` -------------------------------- ### Window.ai Integration: JigsawStack Basic Setup (Module) Source: https://jigsawstack.com/docs/llms-full This code snippet shows how to initialize JigsawStack with a public API key and assign it to the `window.ai` object in a module-based JavaScript environment. This enables access to JigsawStack's AI capabilities through the `window.ai` interface. ```javascript // Import JigsawStack in a module environment import { JigsawStack } from "jigsawstack"; // Initialize with your public key const jigsawstack = JigsawStack({ apiKey: "pk_fecc....92je9" // Use your public key here }); // Assign to window.ai window.ai = jigsawstack; ``` -------------------------------- ### Retrieve File from JigsawStack Store using JavaScript Source: https://jigsawstack.com/docs/api-reference/store/file/get Example demonstrating how to use the JigsawStack SDK to retrieve a file from the store using its key. This snippet shows the basic setup and an asynchronous call to the 'store.get' method. Requires an API key for authentication. ```Javascript import { JigsawStack } from "jigsawstack"; const jigsaw = JigsawStack({ apiKey: "your-api-key" }); const response = await jigsaw.store.get({ "key": "image-123.png" }) ``` -------------------------------- ### Quick Start: Summarize Text with JigsawStack JavaScript SDK Source: https://jigsawstack.com/docs/llms-full Demonstrates how to initialize the JigsawStack SDK and use the Summarization API to generate both paragraph and bullet point summaries from text input. ```JavaScript import { JigsawStack } from 'jigsawstack'; const jigsaw = new JigsawStack('your-api-key'); // Text summary example const response = await jigsaw.ai.summary({ text: "The renewable energy sector saw unprecedented growth in 2022, with solar and wind installation rates exceeding forecasts by 25%. Despite supply chain challenges related to the pandemic, global clean energy investment topped $500 billion for the first time. Notably, several major oil companies increased their renewable investments, with commitments to achieve carbon neutrality by 2050. However, challenges remain, including grid integration issues, regulatory hurdles in developing markets, and the need for advanced energy storage solutions. Experts project continued acceleration through 2023, particularly in utility-scale solar and offshore wind development." }); console.log(response); // Bullet point summary example const bulletResponse = await jigsaw.ai.summary({ text: "The renewable energy sector saw unprecedented growth in 2022...", type: "points", max_points: 5 }); console.log(bulletResponse); ``` -------------------------------- ### Perform a Basic Web Search Source: https://jigsawstack.com/docs/llms-full This example demonstrates a straightforward web search query using the JigsawStack API. It shows how to retrieve an AI overview and check the number of results returned for a given query. ```javascript const basicSearch = await jigsaw.web.search({ query: "best restaurants in New York" }); console.log(basicSearch.ai_overview); console.log(basicSearch.results.length); ``` -------------------------------- ### Retrieve Prompt Engine Entry by ID from JigsawStack API Source: https://jigsawstack.com/docs/llms-full Demonstrates how to make a GET request to the JigsawStack Prompt Engine API to retrieve a specific entry using its ID. Examples are provided for various programming languages, showing how to set the API key and content type headers. ```Javascript import { JigsawStack } from "jigsawstack"; const jigsaw = JigsawStack({ apiKey: "your-api-key" }); const response = await jigsaw.prompt_engine.get({ "id": "14d675d5-b309-463d-8906-1be65af74c43" }) ``` ```Python from jigsawstack import JigsawStack jigsaw = JigsawStack(api_key="your-api-key") response = jigsaw.prompt_engine.get({ "id": "14d675d5-b309-463d-8906-1be65af74c43" }) ``` ```Curl curl https://api.jigsawstack.com/v1/prompt_engine/14d675d5-b309-463d-8906-1be65af74c43?id=14d675d5-b309-463d-8906-1be65af74c43 \ -X GET \ -H 'Content-Type: application/json' \ -H 'x-api-key: your-api-key' ``` ```PHP '14d675d5-b309-463d-8906-1be65af74c43', } uri.query = URI.encode_www_form(params) req = Net::HTTP::Get.new(uri) req.content_type = 'application/json' req['x-api-key'] = 'your-api-key' req_options = { use_ssl: uri.scheme == 'https' } res = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http| http.request(req) end ``` ```Go package main import ( "fmt" "io" "log" "net/http" ) func main() { client := &http.Client{} req, err := http.NewRequest("GET", "https://api.jigsawstack.com/v1/prompt_engine/14d675d5-b309-463d-8906-1be65af74c43?id=14d675d5-b309-463d-8906-1be65af74c43", nil) if err != nil { log.Fatal(err) } req.Header.Set("Content-Type", "application/json") req.Header.Set("x-api-key", "your-api-key") resp, err := client.Do(req); if err != nil { log.Fatal(err) } defer resp.Body.Close() bodyText, err := io.ReadAll(resp.Body) if err != nil { log.Fatal(err) } fmt.Printf("%s\n", bodyText) } ``` ```Java import java.io.IOException; import java.net.URI; import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; HttpClient client = HttpClient.newHttpClient(); HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://api.jigsawstack.com/v1/prompt_engine/14d675d5-b309-463d-8906-1be65af74c43?id=14d675d5-b309-463d-8906-1be65af74c43")) .GET() .setHeader("Content-Type", "application/json") .setHeader("x-api-key", "your-api-key") .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); ``` ```Swift import Foundation let url = URL(string: "https://api.jigsawstack.com/v1/prompt_engine/14d675d5-b309-463d-8906-1be65af74c43?id=14d675d5-b309-463d-8906-1be65af74c43")! let headers = [ "Content-Type": "application/json", "x-api-key": "your-api-key" ] var request = URLRequest(url: url) request.allHTTPHeaderFields = headers let task = URLSession.shared.dataTask(with: request) { (data, response, error) in if let error = error { print(error) } else if let data = data { let str = String(data: data, encoding: .utf8) print(str ?? "") } } task.resume() ``` -------------------------------- ### JigsawStack AI Web Scraper Basic Usage (JavaScript) Source: https://jigsawstack.com/docs/llms-full Demonstrates how to initialize the JigsawStack SDK and use the `ai_scrape` method to extract specific information (e.g., plan titles and prices) from a given URL. The API key is loaded from environment variables. ```javascript import { JigsawStack } from "jigsawstack"; // Initialize the SDK (API key from environment variables) const jigsawstack = JigsawStack(); // Basic usage - extract pricing information const result = await jigsawstack.web.ai_scrape({ url: "https://supabase.com/pricing", element_prompts: ["Plan title", "Plan price"] }); ``` -------------------------------- ### Example JSON Response for Prompt Retrieval Source: https://jigsawstack.com/docs/llms-full Illustrates the structure of a successful JSON response when retrieving prompt details, including metadata like creation timestamp, pagination, and token usage. ```json "created_at": "2025-04-24T21:37:51.030727+00:00" } ], "page": 0, "limit": 10, "has_more": true, "_usage": { "input_tokens": 4, "output_tokens": 705, "inference_time_tokens": 207, "total_tokens": 916 } } ``` -------------------------------- ### API Endpoint: GET Get Prompt Source: https://jigsawstack.com/docs/api-reference/web/ai-search Provides an API endpoint to retrieve details of a specific prompt using the GET method. ```APIDOC GET /api-reference/prompt-engine/retrieve ``` -------------------------------- ### Example JSON Response for Prompt Engine API Source: https://jigsawstack.com/docs/llms-full Illustrates a successful JSON response from the Jigsawstack Prompt Engine API, showing the structure of the prompt details, including inputs, prompt text, guard settings, optimization, and usage statistics. ```JSON { "success": true, "id": "14d675d5-b309-463d-8906-1be65af74c43", "inputs": [ { "key": "about", "optional": false } ], "prompt": "Tell me a story about {about}", "return_prompt": "Return the result in a markdown format", "created_at": "2025-04-11T21:34:29.434339+00:00", "prompt_guard": [ "sexual_content", "defamation" ], "optimized_prompt": "Create a captivating story centered around the theme of {about}, incorporating vivid characters and an engaging plot.", "use_internet": false, "public": false, "name": null, "user_id": null, "public_status": null, "updated_at": "2025-04-11T21:34:29.434339+00:00", "_usage": { "input_tokens": 1, "output_tokens": 142, "inference_time_tokens": 202, "total_tokens": 345 } } ``` -------------------------------- ### Javascript Example: Scrape Website with JigsawStack SDK Source: https://jigsawstack.com/docs/api-reference/ai/scrape This snippet demonstrates how to use the JigsawStack SDK in Javascript to perform an AI-powered web scrape. It initializes the SDK with an API key and then calls the `ai_scrape` method, specifying the target URL and an array of `element_prompts` to guide the AI in extracting specific data like 'titles' and 'points'. ```Javascript import { JigsawStack } from "jigsawstack"; const jigsaw = JigsawStack({ apiKey: "your-api-key" }); const response = await jigsaw.web.ai_scrape({ "url": "https://news.ycombinator.com/news", "element_prompts": [ "titles", "points" ] }) ``` -------------------------------- ### Sample Prompt Payload Examples Source: https://jigsawstack.com/docs/api-reference/prompt-engine/run-direct Illustrative JSON payloads demonstrating various configurations for the JigsawStack Prompt Engine API, specifically showcasing different formats for the 'return_prompt' field (string, array of objects, and object) and the use of 'prompt_guard' and 'input_values'. ```JSON { "prompt": "Tell me a story about {about}", "inputs": [ { "key": "about", "optional": false } ], "return_prompt": "Return the result in a markdown format", "prompt_guard": ["sexual_content", "defamation"], "input_values": { "about": "Santorini" } } ``` ```JSON { "prompt": "Tell me a story about {about}", "inputs": [ { "key": "about", "optional": false, "initial_value": "Leaning Tower of Pisa" } ], "return_prompt": [{"excerpt": "short story text", "summary": "summary of story"}], "prompt_guard": ["sexual_content", "defamation"], "input_values": { "about": "Santorini" } } ``` ```JSON { "prompt": "Tell me a story about {about}", "inputs": [ { "key": "about", "optional": false, "initial_value": "Leaning Tower of Pisa" } ], "return_prompt": {"excerpt": "short story text", "summary": "summary of story"}, "prompt_guard": ["sexual_content", "defamation"], "input_values": { "about": "Santorini" } } ``` -------------------------------- ### Initialize JigsawStack and Perform Web Search Source: https://jigsawstack.com/docs/llms-full This snippet demonstrates how to initialize the JigsawStack client with an API key and perform a basic web search. It shows how to query for information, enable AI overviews, and set safe search preferences, then logs the full response and specific geolocation data. ```javascript import { JigsawStack } from "jigsawstack"; const jigsaw = JigsawStack({ apiKey: "your-api-key" }); const response = await jigsaw.web.search({ query: "capital of France", ai_overview: true, safe_search: "moderate" }); console.log(response); console.log(response.geo_results[0].geoloc); ``` -------------------------------- ### Example API Response for Prompt Engine Retrieval Source: https://jigsawstack.com/docs/api-reference/prompt-engine/retrieve Illustrates the comprehensive JSON structure returned upon successfully retrieving prompt engine details. The 'success' boolean indicates the call's status. The response includes the prompt's ID, defined inputs, the prompt string, return prompt, creation/update timestamps, prompt guard settings, optimization details, internet usage flag, public status, and usage statistics. ```APIDOC { "success": true, "id": "14d675d5-b309-463d-8906-1be65af74c43", "inputs": [ { "key": "about", "optional": false } ], "prompt": "Tell me a story about {about}", "return_prompt": "Return the result in a markdown format", "created_at": "2025-04-11T21:34:29.434339+00:00", "prompt_guard": [ "sexual_content", "defamation" ], "optimized_prompt": "Create a captivating story centered around the theme of {about}, incorporating vivid characters and an engaging plot.", "use_internet": false, "public": false, "name": null, "user_id": null, "public_status": null, "updated_at": "2025-04-11T21:34:29.434339+00:00", "_usage": { "input_tokens": 1, "output_tokens": 142, "inference_time_tokens": 202, "total_tokens": 345 } } ``` -------------------------------- ### API Endpoint: GET List Prompts Source: https://jigsawstack.com/docs/api-reference/web/ai-search Provides an API endpoint to list all available prompts using the GET method. ```APIDOC GET /api-reference/prompt-engine/list ``` -------------------------------- ### Example JSON Response for Query Suggestions Source: https://jigsawstack.com/docs/llms-full This JSON object illustrates a typical successful API response for a query suggestion service. It includes a boolean success flag, a list of suggested queries, and detailed usage metrics such as input/output tokens and inference time. ```JSON { "success": true, "suggestions": [ "what is the capital of california", "what is the capital of australia", "what is the capital of canada", "what is the capital of the united states", "what is the capital of england", "what is the capital of texas", "what is the capital of france", "what is the capital of florida", "what is the capital of new york", "what is the capital of italy", "what is the capital of japan", "what is the capital of turkey", "what is the capital of alaska", "what is the capital of georgia", "what is the capital of brazil" ], "_usage": { "input_tokens": 8, "output_tokens": 133, "inference_time_tokens": 332, "total_tokens": 473 } } ``` -------------------------------- ### API Endpoint: GET File Retrieve Source: https://jigsawstack.com/docs/api-reference/web/ai-search Provides an API endpoint to retrieve files from the file store using the GET method. ```APIDOC GET /api-reference/store/file/get ``` -------------------------------- ### Perform Web AI Scraping with JigsawStack SDK Source: https://jigsawstack.com/docs/llms-full Demonstrates how to initialize the JigsawStack SDK with your API key and execute a web AI scrape operation. The example targets an Amazon product page to extract price information, showcasing the `ai_scrape` method's usage with URL and element prompts. ```javascript import { JigsawStack } from "jigsawstack"; const jigsawstack = JigsawStack({ apiKey: "your-api-key", }); const result = await jigsawstack.web.ai_scrape({ url: "https://www.amazon.com/Cadbury-Mini-Caramel-Eggs-Bulk/dp/B0CWM99G5W", element_prompts: ["prices"], }); ``` ```python from jigsawstack import JigsawStack jigsawstack = JigsawStack(api_key="your-api-key") params = { "url": "https://www.amazon.com/Cadbury-Mini-Caramel-Eggs-Bulk/dp/B0CWM99G5W", "element_prompts": ["prices"] } result = jigsawstack.web.ai_scrape(params) ``` -------------------------------- ### API Endpoint: GET List Voice Clones Source: https://jigsawstack.com/docs/api-reference/web/ai-search Provides an API endpoint to retrieve a list of all available voice clones using the GET method. ```APIDOC GET /api-reference/audio/tts/list-clones ``` -------------------------------- ### API Endpoint: GET Search Suggestion Source: https://jigsawstack.com/docs/api-reference/web/ai-search Provides an API endpoint to retrieve search suggestions based on partial input using the GET method. ```APIDOC GET /api-reference/web/search-suggestion ``` -------------------------------- ### Jigsawstack Prompt Engine API - POST Response Example Source: https://jigsawstack.com/docs/llms-full An example of a successful JSON response returned by the Jigsawstack Prompt Engine API after a POST request. ```json { "success": true, "prompt_engine_id": "8af1dc58-8e2c-4b92-b870-4d5550796646", "optimized_prompt": "Write a detailed and engaging story about {about}, including vivid descriptions, well-developed characters, and a clear beginning, middle, and end.", "_usage": { "input_tokens": 58, "output_tokens": 61, "inference_time_tokens": 1437, "total_tokens": 1556 } } ``` -------------------------------- ### Initialize JigsawStack and Perform Sentiment Analysis (JavaScript) Source: https://jigsawstack.com/docs/llms-full This JavaScript example demonstrates how to set up the JigsawStack client using an API key and perform a sentiment analysis on a given text. It showcases the `JigsawStack` import, client initialization, and an asynchronous call to the `sentiment` API, logging the structured result. ```javascript // Example: Using the Sentiment Analysis API import { JigsawStack } from "jigsawstack"; const jigsaw = JigsawStack({ apiKey: "your-api-key" }); const response = await jigsaw.sentiment({ text: "I love this product!" }); console.log(result); // Output: { sentiment: "positive", score: 0.92 } ``` -------------------------------- ### Install JigsawStack SDK with npm Source: https://jigsawstack.com/docs/quick-start/node/introduction Installs the JigsawStack SDK using the npm package manager. This is the first step to integrate JigsawStack into your Node.js project. ```npm npm install jigsawstack ``` -------------------------------- ### Example JSON Response for File Upload Source: https://jigsawstack.com/docs/llms-full Illustrates the typical JSON response received after a successful file upload operation, including the key, URL, and size of the uploaded file. ```JSON { "key": "new-image.jpg", "url": "https://api.jigsawstack.com/v1/store/file/read/new-image.jpg", "size": 75078 } ``` -------------------------------- ### Example JSON Response for Post Context Source: https://jigsawstack.com/docs/llms-full Illustrates the structure of a typical JSON response from a content aggregation service, showing arrays for post titles, associated points, and usernames. ```json { "context": { "post_titles": [ "The Grug Brained Developer (2022)", "Honda conducts successful launch and landing of experimental reusable rocket", "Resurrecting a dead torrent tracker and finding 3M peers", "Building Effective AI Agents", "Bzip2 crate switches from C to 100% rust", "AMD's CDNA 4 Architecture Announcement", "Making 2.5 Flash and 2.5 Pro GA, and introducing Gemini 2.5 Flash-Lite", "Foundry (YC F24) Hiring Early Engineer to Build Web Agent Infrastructure", "LLMs pose an interesting problem for DSL designers", "Time Series Forecasting with Graph Transformers", "What Google Translate Can Tell Us About Vibecoding", "Why JPEGs still rule the web (2024)", "AI will shrink Amazon's workforce in the coming years, CEO Jassy says", "Tetrachromatic Vision", "After millions of years, why are carnivorous plants still so small?", "From SDR to 'Fake HDR': Mario Kart World on Switch 2", "The hamburger-menu icon today: Is it recognizable?", "A Rural Public Transit Odyssey", "Bots are overwhelming websites with their hunger for AI data", "AMD's Pre-Zen Interconnect: Testing Trinity's Northbridge", "O3 Turns Pro", "Real-time action chunking with large models", "The magic of through running", "Voyager: Real-Time Splatting City-Scale 3D Gaussians on Your Phone", "Attempting to Make the Smallest* Electric Motor [video]", "CPU-Based Layout Design for Picker-to-Parts Pallet Warehouses", "Miscalculation by Spanish power grid operator REE contributed to blackout", "What happens when clergy take psilocybin", "Calculating Oil Storage Tank Occupancy with Help of Satellite Imagery", "Guidelines on how to be a scientific sleuth released" ], "post_points": [ "213 points", "682 points", "264 points", "161 points", "48 points", "73 points", "240 points", "64 points", "50 points", "43 points", "107 points", "51 points", "14 points", "25 points", "21 points", "57 points", "9 points", "18 points", "94 points", "143 points", "29 points", "154 points", "40 points", "81 points", "15 points", "327 points", "28 points" ], "post_username": [ "smartmic", "LorenDB", "k-ian", "Anon84", "Bogdanp", "rbanffy", "meetpateltech", "gopiandcode", "turntable_pride", "todsacerdoti", "purpleko", "rntn", "surprisetalk", "gmays", "ibobev", "thm", "herbertl", "Bender", "zdw", "jsnider3", "pr337h4m", "ortegaygasset", "PaulHoule", "croes", "bookofjoe", "marklit", "crescit_eundo" ] } .... } ``` -------------------------------- ### Install JigsawStack JavaScript SDK Source: https://jigsawstack.com/docs/integration/groq This snippet demonstrates how to install the JigsawStack SDK using npm, the package manager for JavaScript, to begin integrating it into your project. ```JavaScript npm i jigsawstack ``` -------------------------------- ### Example API Response for Listing Prompt Engines Source: https://jigsawstack.com/docs/llms-full Illustrates the expected JSON structure for a successful response when listing prompt engines, including the 'success' status and an array of 'prompt_engines'. ```JSON { "success": true, "prompt_engines": [ { ``` -------------------------------- ### Bullet Points Summary API Response Example Source: https://jigsawstack.com/docs/llms-full An example of the JSON response structure for a successful bullet point summarization request, returning an array of summary points. ```JSON { "success": true, "summary": [ "Renewable energy growth exceeded forecasts by 25% in 2022", "Global clean energy investment topped $500 billion", "Major oil companies committed to carbon neutrality by 2050", "Challenges include grid integration, regulations, and energy storage", "Growth expected to continue in utility-scale solar and offshore wind" ] } ``` -------------------------------- ### Example JSON API Response Source: https://jigsawstack.com/docs/llms-full This JSON snippet illustrates a typical API response structure, including a list of entities with their IDs, names, and creation timestamps, along with pagination details and usage statistics. ```JSON { "data": [ { "name": "Elon Musk", "created_at": "2025-06-17T23:13:35.474507+00:00" }, { "id": "469734c9-7e02-4746-91bc-ecea8bd834ff", "name": "Elon Musk", "created_at": "2025-06-17T22:48:59.519488+00:00" }, { "id": "d95dd328-0bd9-45aa-be65-21d14b796bf6", "name": "Elon Musk", "created_at": "2025-06-17T22:45:28.988647+00:00" }, { "id": "bbd09919-73d1-436a-b235-8803d5b989af", "name": "Elon Musk", "created_at": "2025-06-17T22:44:23.863269+00:00" }, { "id": "65741ba3-b9d4-4583-88b1-cdab99940014", "name": "Elon Musk", "created_at": "2025-06-17T22:39:27.48397+00:00" }, { "id": "750e9682-e4f0-4090-8e19-b6320d4a4d7d", "name": "elon", "created_at": "2025-05-24T01:46:20.635163+00:00" }, { "id": "e8c930b5-d857-45fa-b084-cb2ae98c696a", "name": "elon", "created_at": "2025-05-22T22:51:32.701387+00:00" }, { "id": "3e789328-880c-4211-b44e-c6b62ce0968c", "name": "somename", "created_at": "2025-05-21T20:37:51.833524+00:00" }, { "id": "e6d28c98-850a-4dc3-b188-675bdaf1e4eb", "name": "somename", "created_at": "2025-05-21T20:03:37.987976+00:00" }, { "id": "67771dfb-0bda-4037-a9dd-d20d4661c492", "name": "somename", "created_at": "2025-05-21T20:02:26.758113+00:00" } ], "page": 0, "limit": 10, "has_more": true, "_usage": { "input_tokens": 1, "output_tokens": 88, "inference_time_tokens": 108, "total_tokens": 197 } } ``` -------------------------------- ### Sample Result for Direct Prompt Execution Source: https://jigsawstack.com/docs/llms-full This JSON snippet illustrates the expected successful response structure from the `prompt_engine.run_prompt_direct` API call. It shows the boolean and string results for the defined return prompt keys. ```json { "success": true, "result": { "experienceWithNodejs": true, "seniorInReactNative": false, "sectorExperience": "Fintech" } } ``` -------------------------------- ### JigsawStack Zapier Integration Setup Instructions Source: https://jigsawstack.com/docs/integration/zapier This section provides step-by-step instructions for setting up the JigsawStack integration within your Zapier account, including connecting apps, creating Zaps, and testing automated workflows. ```Workflow 1. Create or log in to your Zapier account 2. Visit the JigsawStack integration page 3. Click “Connect JigsawStack to…” and select an app to pair with 4. Follow the prompts to authorize JigsawStack and the other app 5. Create your Zap by selecting triggers and actions 6. Test and activate your automated workflow ``` -------------------------------- ### Prompt Example: Single String Source: https://jigsawstack.com/docs/api-reference/ai/vocr This example demonstrates how to provide a single string as the prompt to describe an image in detail. This is the default and simplest way to use the prompt parameter. ```JSON { prompt: "Describe the image in detail."; } ```