Skip to content

Commit 0e19ad4

Browse files
authored
Merge pull request #4 from JigsawStack/check
v0.1.2
2 parents 7f301c7 + 6f813c3 commit 0e19ad4

File tree

10 files changed

+476
-14
lines changed

10 files changed

+476
-14
lines changed

README.md

Lines changed: 67 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,32 @@
11
# JigsawStack Python SDK
22

3+
The JigsawStack Python SDK allows you to interact with powerful AI services to build AI-powered applications.
4+
5+
- 🧩 Powerful AI services all in one SDK
6+
- ⌨️ Fully typed parameters and responses
7+
- 📡 Built in Webhook support for long-running tasks
8+
- 📦 Built in file system for easy file uploads
9+
10+
## Learn more
11+
12+
To learn more about all available JigsawStack AI services, view the [Documentation](https://docs.jigsawstack.com) or [Website](https://jigsawstack.com).
13+
14+
## All APIs
15+
16+
| Category | APIs |
17+
| ----------------- | ------------------------------------------------- |
18+
| **👉 General** | Translation, Summarization, Sentiment Analysis |
19+
| **🌐 Web** | AI Web Scraping, AI Web Search |
20+
| **🎵 Audio** | Text to Speech, Speech to Text (Whisper large v3) |
21+
| **👀 Vision** | vOCR, Object Detection |
22+
| **🧠 LLMs** | Prompt Engine |
23+
| **🖼️ Generative** | AI Image (SD, SDXL-Fast & more), HTML to Any |
24+
| **🌍 Geo** | Location search, Timezone, IP Geolocation & more |
25+
| **✅ Validation** | Email, NSFW images, profanity & more |
26+
| **📁 Store** | Simple File Storage, KV Encryption store |
27+
28+
Learn more of about each category in the [API reference](https://docs.jigsawstack.com/api-reference)
29+
330
## Installation
431

532
To install JigsawStack Python SDK, simply execute the following command in a terminal:
@@ -10,30 +37,60 @@ pip install jigsawstack
1037

1138
## Setup
1239

13-
First, you need to get an API key, which is available in the [JigsawStack Dashboard](https://jigsawstack.com).
40+
First, get your API key from the [JigsawStack Dashboard](https://jigsawstack.com/dashboard)
41+
42+
Then, initialize the SDK:
1443

1544
```py
1645
from jigsawstack import JigsawStack
1746

18-
import os
47+
jigsaw = JigsawStack(api_key="your-api-key")
48+
```
49+
50+
## Usage
1951

20-
ai = JigsawStack(api_key="your-api-key")
52+
AI Scraping Example:
53+
54+
```py
55+
params = {
56+
"url": "https://www.amazon.com/Cadbury-Mini-Caramel-Eggs-Bulk/dp/B0CWM99G5W",
57+
"element_prompts": ["prices"]
58+
}
59+
result = jigsaw.web.ai_scrape(params)
2160
```
2261

23-
## Example
62+
Text To Speech Example:
2463

2564
```py
26-
import os
27-
from jigsawstack import JigsawStack
65+
params = {"text": "Hello, how are you doing?"}
66+
result = jigsaw.audio.text_to_speech(params)
67+
```
2868

69+
Speech To Text Example:
2970

30-
ai = JigsawStack(api_key="your-api-key")
71+
```py
72+
params = { "url": "https://rogilvkqloanxtvjfrkm.supabase.co/storage/v1/object/public/demo/Video%201737458382653833217.mp4?t=2024-03-22T09%3A50%3A49.894Z"}
73+
result = jigsaw.audio.speech_to_text(params)
74+
```
75+
76+
VOCR:
3177

78+
```py
3279
params = {
3380
"url": "https://rogilvkqloanxtvjfrkm.supabase.co/storage/v1/object/public/demo/Collabo%201080x842.jpg?t=2024-03-22T09%3A22%3A48.442Z"
3481
}
82+
result = jigsaw.vision.vocr(params)
83+
```
3584

36-
result = ai.vision.vocr(params)
85+
## Community
3786

38-
print(result)
39-
```
87+
Join JigsawStack community on [Discord](https://discord.gg/dj8fMBpnqd) to connect with other developers, share ideas, and get help with the SDK.
88+
89+
## Related Projects
90+
91+
- [Docs](https://docs.jigsawstack.com)
92+
- [Javascript SDK](https://github.com/JigsawStack/jigsawstack-js)
93+
94+
## Contributing
95+
96+
JigsawStack AI SDK is open-source and welcomes contributions. Please open an issue or submit a pull request with your changes. Make sure to be as descriptive as possible with your submissions, include examples if relevant.

jigsawstack/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
from .sentiment import Sentiment
1313
from .validate import Validate
1414
from .summary import Summary
15+
from .geo import Geo
16+
from .prompt_engine import PromptEngine
1517

1618
class JigsawStack:
1719
audio: Audio
@@ -26,6 +28,8 @@ class JigsawStack:
2628
validate: Validate
2729
summary: Summary
2830
search: Search
31+
geo : Geo
32+
prompt_engine: PromptEngine
2933
api_key: str
3034
api_url: str
3135

@@ -58,6 +62,8 @@ def __init__(self, api_key: Union[str, None] = None, api_url: Union[str, None] =
5862
self.file = File(api_key=api_key, api_url=api_url)
5963
self.kv = KV(api_key=api_key, api_url=api_url)
6064
self.translate = Translate(api_key=api_key, api_url=api_url)
65+
self.geo = Geo(api_key=api_key, api_url=api_url)
66+
self.prompt_engine = PromptEngine(api_key=api_key, api_url=api_url)
6167

6268
# Create a global instance of the Web class
6369
__all__ = ["JigsawStack"]

jigsawstack/audio.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,18 @@
55
from typing import Any, Dict, List, cast
66
from typing_extensions import NotRequired, TypedDict
77

8+
9+
class TextToSpeechParams(TypedDict):
10+
text:str
11+
accent: NotRequired[str]
12+
speaker_clone_url: NotRequired[str]
13+
speaker_clone_file_store_key: NotRequired[str]
14+
15+
class TextToSpeechResponse(TypedDict):
16+
success:bool
17+
text: str
18+
chunks : List[object]
19+
820
class SpeechToTextParams(TypedDict):
921
url:str
1022
file_store_key : NotRequired[str]
@@ -27,4 +39,13 @@ def speech_to_text(self, params: SpeechToTextParams) -> SpeechToTextResponse:
2739
api_url=self.api_url,
2840
path=path, params=cast(Dict[Any, Any], params), verb="post"
2941
).perform_with_content()
42+
return resp
43+
44+
def text_to_speech(self, params: TextToSpeechParams) -> TextToSpeechResponse:
45+
path = "/ai/tts"
46+
resp = Request(
47+
api_key=self.api_key,
48+
api_url=self.api_url,
49+
path=path, params=cast(Dict[Any, Any], params), verb="post"
50+
).perform_with_content()
3051
return resp

0 commit comments

Comments
 (0)