Introducing JigsawStack's Typescript and Python AI SDKs

NarcisseNarcisse
5 min read

We’re thrilled to announce the official release of the JigsawStack JavaScript and Python AI SDKs! These SDKs are designed to help developers of all levels easily integrate the JigsawStack APIs, making it simpler than ever to build AI-powered applications.

What is JigsawStack?

JigsawStack offers APIs powered fine-tuned models for use across tech stacks, whether backend, frontend, or serverless. Whether you're a seasoned developer or new to AI integration, JigsawStack provides the tools you need to seamlessly incorporate advanced AI capabilities, such as AI web scraping, vision OCR, text to speech, speech to text, AI search, prediction, etc into your projects.

Key features:

  1. Fine-tuned custom models

  2. High-performance APIs

  3. Compatibility with various tech stacks

  4. Reliable and scalable infrastructure

Why SDKs?

At JigsawStack, we prioritize developer experience. As developers ourselves, we recognize the crucial role of efficient tools in streamlining workflow. To meet this need, we've crafted SDKs for Python and JavaScript - two of the most requested SDKs by our community.

Our SDKs offer:

  1. Seamless Integration: Designed to work harmoniously with our custom-trained AI models and high-performance APIs.

  2. Cross-Platform Support: With the Python SDK, you can easily integrate JigsawStack across Python frameworks like Django and Flask. The JavaScript/Typescript SDK, on the other hand, enables smooth integration with front-end frameworks (Next.js, React, Vue, Svelte), Node.js applications, Serverless, Cloud functions and more.

  3. Active Community and Support: We’re committed to providing top-notch support for our developer community. Join our forums, contribute to our GitHub repositories, and get assistance from our dedicated support team whenever you need it.

  4. Regular Updates: Continuous improvements to ensure compatibility with the latest AI advancements.

Whether you're building a complex AI application or integrating specific AI capabilities into your existing projects, our SDKs provide the foundation for efficient, scalable development.

We drew inspiration from Vercel's AI SDK, which standardizes the integration of AI models across various providers to build the go-to AI tech stack. With JigsawStack, you can focus solely on using the toolkit that meets your specific needs, while we handle the complexities of Large Language Models (LLMs)

Getting Started

Getting started with the JigsawStack SDKs is a breeze. Here’s how you can begin:

Javascript/Typescript SDK:

  1. Install the SDK
npm install jigsawstack
#or 
yarn add jigsawstack
  1. Import and Initialize:
import { JigsawStack } from 'jigsawstack'

const jigsaw =  JigsawStack({ apiKey: 'your-api-key' });
  1. Usage
import { JigsawStack } from "jigsawstack";

const jigsaw = JigsawStack({ apiKey: "your-api-key" });

const resp = await jigsaw.web.ai_scrape({
  url: "https://www.amazon.com/Cadbury-Mini-Caramel-Eggs-Bulk/dp/B0CWM99G5W",
  element_prompts: ["prices"],
});

Python SDK:

  1. Install the SDK
pip install jigsawstack
  1. Import and Initialize:
from jigsawstack import JigsawStack

jigsaw = JigsawStack({ apiKey="your-api-key" })
  1. Usage
from jigsawstack import JigsawStack

jigsaw = JigsawStack(api_key="your-api-key")

params = {
 "url": "https://www.amazon.com/Cadbury-Mini-Caramel-Eggs-Bulk/dp/B0CWM99G5W",
 "element_prompts": ["prices"]
}

result = jigsaw.web.ai_scrape(params)

Examples

Vision OCR

const result = await jigsaw.vision.vocr({
  prompt : "Tell me about the people in this image"
  url: "https://rogilvkqloanxtvjfrkm.supabase.co/storage/v1/object/public/demo/Collabo%201080x842.jpg?t=2024-03-22T09%3A22%3A48.442Z",
});

Image generation

const result = await jigsaw.image_generation({
  prompt: "cute siamese cat",
  size: "small"
});

const data = await result.blob();

Prompt engine

const result = await jigsaw.prompt_engine.create({
  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: "long summary of story" },
});

AI Search

const result = await jigsawstack.web.search({
  query: "Time Square New Yor",
  safe_search: "strict",
  spell_check: true,
});

Text To SQL

const result = await jigsawstack.text_to_sql({
  prompt:
    "Generate a query to get transactions that amount exceed 10000 and sort by when created",
  sql_schema:
    "CREATE TABLE Transactions (transaction_id INT PRIMARY KEY, user_id INT NOT NULL,total_amount DECIMAL(10, 2 NOT NULL, transaction_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,status VARCHAR(20) DEFAULT 'pending',FOREIGN KEY(user_id) REFERENCES Users(user_id))",
});

For more SDK use cases, see more here

window.ai

window.ai is becoming a general standard in chrome and possibly other browsers for client side LLM.

Unfortunately, it isn't generally available or compatible across devices, browsers and is only limited to a small LLM, which limits its use case. However, the potential here is huge.

JigsawStack solves this by brining a suite of powerful AI utilities to window.ai

Here how how you can do it in 2 lines👇

const jigsawstack = JigsawStack({ apiKey: "pk_fecc....92je9" });
window.ai = jigsawstack

🔴 For client side access, please create and only use your public key and limit the key to the specific APIs you are using. Learn more here

That’s it! Now you can access any AI tool you allow the Public API key to access from the JigsawStack dashboard

window.ai.sentiment({ text: "I love how easy it is to get started" })

window.ai.vision.vocr({ file_store_key: "user_passport.png", prompt: "passport_number" });

Learn how to protect your public keys here by limiting domain access and API access to what you only need.

Add JigsawStack types to window.ai

//index.d.ts
import type { JigsawStack } from "jigsawstack";

declare global {
  interface Window {
    ai: ReturnType<typeof JigsawStack>;
  }
}

export {};

What’s Next?

This is just the beginning. We’re continuously working on expanding the capabilities of our SDKs and adding new features based on your feedback. Keep an eye on our GitHub repositories for the latest updates, and don’t hesitate to contribute your ideas and improvements.

We’re excited to see what you build with the JigsawStack SDKs!

Join the JigsawStack Community

We invite you to join our growing community of developers on Discord and Twitter. Share your projects, ask questions, and collaborate with others who are just as passionate about innovation as you are.

Thank you for being a part of the JigsawStack journey. We can’t wait to see where you take it next!

0
Subscribe to my newsletter

Read articles from Narcisse directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Narcisse
Narcisse