jigsawstack 0.1.26__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- jigsawstack-0.1.26/PKG-INFO +130 -0
- jigsawstack-0.1.26/README.md +96 -0
- jigsawstack-0.1.26/jigsawstack/__init__.py +232 -0
- jigsawstack-0.1.26/jigsawstack/_client.py +62 -0
- jigsawstack-0.1.26/jigsawstack/_config.py +17 -0
- jigsawstack-0.1.26/jigsawstack/async_request.py +266 -0
- jigsawstack-0.1.26/jigsawstack/audio.py +141 -0
- jigsawstack-0.1.26/jigsawstack/custom_typing.py +574 -0
- jigsawstack-0.1.26/jigsawstack/embedding.py +77 -0
- jigsawstack-0.1.26/jigsawstack/exceptions.py +220 -0
- jigsawstack-0.1.26/jigsawstack/geo.py +408 -0
- jigsawstack-0.1.26/jigsawstack/prediction.py +94 -0
- jigsawstack-0.1.26/jigsawstack/prompt_engine.py +318 -0
- jigsawstack-0.1.26/jigsawstack/request.py +253 -0
- jigsawstack-0.1.26/jigsawstack/search.py +161 -0
- jigsawstack-0.1.26/jigsawstack/sentiment.py +100 -0
- jigsawstack-0.1.26/jigsawstack/sql.py +91 -0
- jigsawstack-0.1.26/jigsawstack/store.py +245 -0
- jigsawstack-0.1.26/jigsawstack/summary.py +105 -0
- jigsawstack-0.1.26/jigsawstack/translate.py +103 -0
- jigsawstack-0.1.26/jigsawstack/validate.py +224 -0
- jigsawstack-0.1.26/jigsawstack/version.py +8 -0
- jigsawstack-0.1.26/jigsawstack/vision.py +104 -0
- jigsawstack-0.1.26/jigsawstack/web.py +281 -0
- jigsawstack-0.1.26/jigsawstack.egg-info/PKG-INFO +130 -0
- jigsawstack-0.1.26/jigsawstack.egg-info/SOURCES.txt +41 -0
- jigsawstack-0.1.26/jigsawstack.egg-info/dependency_links.txt +1 -0
- jigsawstack-0.1.26/jigsawstack.egg-info/not-zip-safe +1 -0
- jigsawstack-0.1.26/jigsawstack.egg-info/requires.txt +3 -0
- jigsawstack-0.1.26/jigsawstack.egg-info/top_level.txt +1 -0
- jigsawstack-0.1.26/setup.cfg +4 -0
- jigsawstack-0.1.26/setup.py +36 -0
- jigsawstack-0.1.26/tests/test_async_web.py +36 -0
- jigsawstack-0.1.26/tests/test_audio.py +22 -0
- jigsawstack-0.1.26/tests/test_embedding_async.py +23 -0
- jigsawstack-0.1.26/tests/test_geo.py +38 -0
- jigsawstack-0.1.26/tests/test_prompt_engine.py +20 -0
- jigsawstack-0.1.26/tests/test_search.py +29 -0
- jigsawstack-0.1.26/tests/test_sentiment.py +22 -0
- jigsawstack-0.1.26/tests/test_store.py +39 -0
- jigsawstack-0.1.26/tests/test_validate.py +42 -0
- jigsawstack-0.1.26/tests/test_vision.py +28 -0
- jigsawstack-0.1.26/tests/test_web.py +45 -0
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
|
+
Name: jigsawstack
|
|
3
|
+
Version: 0.1.26
|
|
4
|
+
Summary: JigsawStack Python SDK
|
|
5
|
+
Home-page: https://github.com/jigsawstack/jigsawstack-python
|
|
6
|
+
Author: Narcisse Egonu
|
|
7
|
+
Author-email: hello@jigsawstack.com
|
|
8
|
+
Keywords: AI,AI Tooling
|
|
9
|
+
Classifier: Development Status :: 4 - Beta
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Natural Language :: English
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Requires-Python: >=3.7
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
Requires-Dist: requests>=2.31.0
|
|
22
|
+
Requires-Dist: typing_extensions
|
|
23
|
+
Requires-Dist: aiohttp
|
|
24
|
+
Dynamic: author
|
|
25
|
+
Dynamic: author-email
|
|
26
|
+
Dynamic: classifier
|
|
27
|
+
Dynamic: description
|
|
28
|
+
Dynamic: description-content-type
|
|
29
|
+
Dynamic: home-page
|
|
30
|
+
Dynamic: keywords
|
|
31
|
+
Dynamic: requires-dist
|
|
32
|
+
Dynamic: requires-python
|
|
33
|
+
Dynamic: summary
|
|
34
|
+
|
|
35
|
+
# JigsawStack Python SDK
|
|
36
|
+
|
|
37
|
+
The JigsawStack Python SDK allows you to interact with powerful AI services to build AI-powered applications.
|
|
38
|
+
|
|
39
|
+
- 🧩 Powerful AI services all in one SDK
|
|
40
|
+
- ⌨️ Fully typed parameters and responses
|
|
41
|
+
- 📡 Built in Webhook support for long-running tasks
|
|
42
|
+
- 📦 Built in file system for easy file uploads
|
|
43
|
+
|
|
44
|
+
## Learn more
|
|
45
|
+
|
|
46
|
+
To learn more about all available JigsawStack AI services, view the [Documentation](https://docs.jigsawstack.com) or [Website](https://jigsawstack.com).
|
|
47
|
+
|
|
48
|
+
## All APIs
|
|
49
|
+
|
|
50
|
+
| Category | APIs |
|
|
51
|
+
| ----------------- | ------------------------------------------------- |
|
|
52
|
+
| **👉 General** | Translation, Summarization, Sentiment Analysis |
|
|
53
|
+
| **🌐 Web** | AI Web Scraping, AI Web Search |
|
|
54
|
+
| **🎵 Audio** | Text to Speech, Speech to Text (Whisper large v3) |
|
|
55
|
+
| **👀 Vision** | vOCR, Object Detection |
|
|
56
|
+
| **🧠 LLMs** | Prompt Engine |
|
|
57
|
+
| **🖼️ Generative** | AI Image (SD, SDXL-Fast & more), HTML to Any |
|
|
58
|
+
| **🌍 Geo** | Location search, Timezone, IP Geolocation & more |
|
|
59
|
+
| **✅ Validation** | Email, NSFW images, profanity & more |
|
|
60
|
+
| **📁 Store** | Simple File Storage, KV Encryption store |
|
|
61
|
+
|
|
62
|
+
Learn more of about each category in the [API reference](https://docs.jigsawstack.com/api-reference)
|
|
63
|
+
|
|
64
|
+
## Installation
|
|
65
|
+
|
|
66
|
+
To install JigsawStack Python SDK, simply execute the following command in a terminal:
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
pip install jigsawstack
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Setup
|
|
73
|
+
|
|
74
|
+
First, get your API key from the [JigsawStack Dashboard](https://jigsawstack.com/dashboard)
|
|
75
|
+
|
|
76
|
+
Then, initialize the SDK:
|
|
77
|
+
|
|
78
|
+
```py
|
|
79
|
+
from jigsawstack import JigsawStack
|
|
80
|
+
|
|
81
|
+
jigsaw = JigsawStack(api_key="your-api-key")
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Usage
|
|
85
|
+
|
|
86
|
+
AI Scraping Example:
|
|
87
|
+
|
|
88
|
+
```py
|
|
89
|
+
params = {
|
|
90
|
+
"url": "https://www.amazon.com/Cadbury-Mini-Caramel-Eggs-Bulk/dp/B0CWM99G5W",
|
|
91
|
+
"element_prompts": ["prices"]
|
|
92
|
+
}
|
|
93
|
+
result = jigsaw.web.ai_scrape(params)
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Text To Speech Example:
|
|
97
|
+
|
|
98
|
+
```py
|
|
99
|
+
params = {"text": "Hello, how are you doing?"}
|
|
100
|
+
result = jigsaw.audio.text_to_speech(params)
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Speech To Text Example:
|
|
104
|
+
|
|
105
|
+
```py
|
|
106
|
+
params = { "url": "https://rogilvkqloanxtvjfrkm.supabase.co/storage/v1/object/public/demo/Video%201737458382653833217.mp4?t=2024-03-22T09%3A50%3A49.894Z"}
|
|
107
|
+
result = jigsaw.audio.speech_to_text(params)
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
VOCR:
|
|
111
|
+
|
|
112
|
+
```py
|
|
113
|
+
params = {
|
|
114
|
+
"url": "https://rogilvkqloanxtvjfrkm.supabase.co/storage/v1/object/public/demo/Collabo%201080x842.jpg?t=2024-03-22T09%3A22%3A48.442Z"
|
|
115
|
+
}
|
|
116
|
+
result = jigsaw.vision.vocr(params)
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## Community
|
|
120
|
+
|
|
121
|
+
Join JigsawStack community on [Discord](https://discord.gg/dj8fMBpnqd) to connect with other developers, share ideas, and get help with the SDK.
|
|
122
|
+
|
|
123
|
+
## Related Projects
|
|
124
|
+
|
|
125
|
+
- [Docs](https://docs.jigsawstack.com)
|
|
126
|
+
- [Javascript SDK](https://github.com/JigsawStack/jigsawstack-js)
|
|
127
|
+
|
|
128
|
+
## Contributing
|
|
129
|
+
|
|
130
|
+
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.
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# JigsawStack Python SDK
|
|
2
|
+
|
|
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
|
+
|
|
30
|
+
## Installation
|
|
31
|
+
|
|
32
|
+
To install JigsawStack Python SDK, simply execute the following command in a terminal:
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
pip install jigsawstack
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Setup
|
|
39
|
+
|
|
40
|
+
First, get your API key from the [JigsawStack Dashboard](https://jigsawstack.com/dashboard)
|
|
41
|
+
|
|
42
|
+
Then, initialize the SDK:
|
|
43
|
+
|
|
44
|
+
```py
|
|
45
|
+
from jigsawstack import JigsawStack
|
|
46
|
+
|
|
47
|
+
jigsaw = JigsawStack(api_key="your-api-key")
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Usage
|
|
51
|
+
|
|
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)
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Text To Speech Example:
|
|
63
|
+
|
|
64
|
+
```py
|
|
65
|
+
params = {"text": "Hello, how are you doing?"}
|
|
66
|
+
result = jigsaw.audio.text_to_speech(params)
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Speech To Text Example:
|
|
70
|
+
|
|
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:
|
|
77
|
+
|
|
78
|
+
```py
|
|
79
|
+
params = {
|
|
80
|
+
"url": "https://rogilvkqloanxtvjfrkm.supabase.co/storage/v1/object/public/demo/Collabo%201080x842.jpg?t=2024-03-22T09%3A22%3A48.442Z"
|
|
81
|
+
}
|
|
82
|
+
result = jigsaw.vision.vocr(params)
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Community
|
|
86
|
+
|
|
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.
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
from typing import Union
|
|
2
|
+
import os
|
|
3
|
+
from .audio import Audio, AsyncAudio
|
|
4
|
+
from .vision import Vision, AsyncVision
|
|
5
|
+
from .search import Search
|
|
6
|
+
from .prediction import Prediction, AsyncPrediction
|
|
7
|
+
from .sql import SQL, AsyncSQL
|
|
8
|
+
from .store import Store, AsyncStore
|
|
9
|
+
from .translate import Translate, AsyncTranslate
|
|
10
|
+
from .web import Web, AsyncWeb
|
|
11
|
+
from .sentiment import Sentiment, AsyncSentiment
|
|
12
|
+
from .validate import Validate, AsyncValidate
|
|
13
|
+
from .summary import Summary, AsyncSummary
|
|
14
|
+
from .geo import Geo, AsyncGeo
|
|
15
|
+
from .prompt_engine import PromptEngine, AsyncPromptEngine
|
|
16
|
+
from .embedding import Embedding, AsyncEmbedding
|
|
17
|
+
from .exceptions import JigsawStackError
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class JigsawStack:
|
|
21
|
+
audio: Audio
|
|
22
|
+
vision: Vision
|
|
23
|
+
file: Store
|
|
24
|
+
web: Web
|
|
25
|
+
search: Search
|
|
26
|
+
geo: Geo
|
|
27
|
+
prompt_engine: PromptEngine
|
|
28
|
+
api_key: str
|
|
29
|
+
api_url: str
|
|
30
|
+
disable_request_logging: bool
|
|
31
|
+
|
|
32
|
+
def __init__(
|
|
33
|
+
self,
|
|
34
|
+
api_key: Union[str, None] = None,
|
|
35
|
+
api_url: Union[str, None] = None,
|
|
36
|
+
disable_request_logging: Union[bool, None] = None,
|
|
37
|
+
) -> None:
|
|
38
|
+
if api_key is None:
|
|
39
|
+
api_key = os.environ.get("JIGSAWSTACK_API_KEY")
|
|
40
|
+
|
|
41
|
+
if api_key is None:
|
|
42
|
+
raise ValueError(
|
|
43
|
+
"The api_key client option must be set either by passing api_key to the client or by setting the JIGSAWSTACK_API_KEY environment variable"
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
if api_url is None:
|
|
47
|
+
api_url = os.environ.get("JIGSAWSTACK_API_URL")
|
|
48
|
+
if api_url is None:
|
|
49
|
+
api_url = f"https://api.jigsawstack.com/v1"
|
|
50
|
+
|
|
51
|
+
self.api_key = api_key
|
|
52
|
+
self.api_url = api_url
|
|
53
|
+
|
|
54
|
+
self.audio = Audio(
|
|
55
|
+
api_key=api_key,
|
|
56
|
+
api_url=api_url,
|
|
57
|
+
disable_request_logging=disable_request_logging,
|
|
58
|
+
)
|
|
59
|
+
self.web = Web(
|
|
60
|
+
api_key=api_key,
|
|
61
|
+
api_url=api_url,
|
|
62
|
+
disable_request_logging=disable_request_logging,
|
|
63
|
+
)
|
|
64
|
+
self.sentiment = Sentiment(
|
|
65
|
+
api_key=api_key,
|
|
66
|
+
api_url=api_url,
|
|
67
|
+
disable_request_logging=disable_request_logging,
|
|
68
|
+
).analyze
|
|
69
|
+
self.validate = Validate(
|
|
70
|
+
api_key=api_key,
|
|
71
|
+
api_url=api_url,
|
|
72
|
+
disable_request_logging=disable_request_logging,
|
|
73
|
+
)
|
|
74
|
+
self.summary = Summary(
|
|
75
|
+
api_key=api_key,
|
|
76
|
+
api_url=api_url,
|
|
77
|
+
disable_request_logging=disable_request_logging,
|
|
78
|
+
).summarize
|
|
79
|
+
self.vision = Vision(
|
|
80
|
+
api_key=api_key,
|
|
81
|
+
api_url=api_url,
|
|
82
|
+
disable_request_logging=disable_request_logging,
|
|
83
|
+
)
|
|
84
|
+
self.prediction = Prediction(
|
|
85
|
+
api_key=api_key,
|
|
86
|
+
api_url=api_url,
|
|
87
|
+
disable_request_logging=disable_request_logging,
|
|
88
|
+
).predict
|
|
89
|
+
self.text_to_sql = SQL(
|
|
90
|
+
api_key=api_key,
|
|
91
|
+
api_url=api_url,
|
|
92
|
+
disable_request_logging=disable_request_logging,
|
|
93
|
+
).text_to_sql
|
|
94
|
+
self.store = Store(
|
|
95
|
+
api_key=api_key,
|
|
96
|
+
api_url=api_url,
|
|
97
|
+
disable_request_logging=disable_request_logging,
|
|
98
|
+
)
|
|
99
|
+
self.translate = Translate(
|
|
100
|
+
api_key=api_key,
|
|
101
|
+
api_url=api_url,
|
|
102
|
+
disable_request_logging=disable_request_logging,
|
|
103
|
+
).translate
|
|
104
|
+
self.geo = Geo(
|
|
105
|
+
api_key=api_key,
|
|
106
|
+
api_url=api_url,
|
|
107
|
+
disable_request_logging=disable_request_logging,
|
|
108
|
+
)
|
|
109
|
+
self.prompt_engine = PromptEngine(
|
|
110
|
+
api_key=api_key,
|
|
111
|
+
api_url=api_url,
|
|
112
|
+
disable_request_logging=disable_request_logging,
|
|
113
|
+
)
|
|
114
|
+
self.embedding = Embedding(
|
|
115
|
+
api_key=api_key,
|
|
116
|
+
api_url=api_url,
|
|
117
|
+
disable_request_logging=disable_request_logging,
|
|
118
|
+
).execute
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
class AsyncJigsawStack:
|
|
122
|
+
geo: AsyncGeo
|
|
123
|
+
validate: AsyncValidate
|
|
124
|
+
web: AsyncWeb
|
|
125
|
+
audio: AsyncAudio
|
|
126
|
+
vision: AsyncVision
|
|
127
|
+
store: AsyncStore
|
|
128
|
+
prompt_engine: AsyncPromptEngine
|
|
129
|
+
api_key: str
|
|
130
|
+
api_url: str
|
|
131
|
+
disable_request_logging: bool
|
|
132
|
+
|
|
133
|
+
def __init__(
|
|
134
|
+
self,
|
|
135
|
+
api_key: Union[str, None] = None,
|
|
136
|
+
api_url: Union[str, None] = None,
|
|
137
|
+
disable_request_logging: Union[bool, None] = None,
|
|
138
|
+
) -> None:
|
|
139
|
+
if api_key is None:
|
|
140
|
+
api_key = os.environ.get("JIGSAWSTACK_API_KEY")
|
|
141
|
+
|
|
142
|
+
if api_key is None:
|
|
143
|
+
raise ValueError(
|
|
144
|
+
"The api_key client option must be set either by passing api_key to the client or by setting the JIGSAWSTACK_API_KEY environment variable"
|
|
145
|
+
)
|
|
146
|
+
|
|
147
|
+
if api_url is None:
|
|
148
|
+
api_url = os.environ.get("JIGSAWSTACK_API_URL")
|
|
149
|
+
if api_url is None:
|
|
150
|
+
api_url = f"https://api.jigsawstack.com/v1"
|
|
151
|
+
|
|
152
|
+
self.api_key = api_key
|
|
153
|
+
self.api_url = api_url
|
|
154
|
+
|
|
155
|
+
self.web = AsyncWeb(
|
|
156
|
+
api_key=api_key,
|
|
157
|
+
api_url=api_url,
|
|
158
|
+
disable_request_logging=disable_request_logging,
|
|
159
|
+
)
|
|
160
|
+
|
|
161
|
+
self.geo = AsyncGeo(
|
|
162
|
+
api_key=api_key,
|
|
163
|
+
api_url=api_url,
|
|
164
|
+
disable_request_logging=disable_request_logging,
|
|
165
|
+
)
|
|
166
|
+
|
|
167
|
+
self.validate = AsyncValidate(
|
|
168
|
+
api_key=api_key,
|
|
169
|
+
api_url=api_url,
|
|
170
|
+
disable_request_logging=disable_request_logging,
|
|
171
|
+
)
|
|
172
|
+
self.audio = AsyncAudio(
|
|
173
|
+
api_key=api_key,
|
|
174
|
+
api_url=api_url,
|
|
175
|
+
disable_request_logging=disable_request_logging,
|
|
176
|
+
)
|
|
177
|
+
|
|
178
|
+
self.vision = AsyncVision(
|
|
179
|
+
api_key=api_key,
|
|
180
|
+
api_url=api_url,
|
|
181
|
+
disable_request_logging=disable_request_logging,
|
|
182
|
+
)
|
|
183
|
+
|
|
184
|
+
self.store = AsyncStore(
|
|
185
|
+
api_key=api_key,
|
|
186
|
+
api_url=api_url,
|
|
187
|
+
disable_request_logging=disable_request_logging,
|
|
188
|
+
)
|
|
189
|
+
|
|
190
|
+
self.summary = AsyncSummary(
|
|
191
|
+
api_key=api_key,
|
|
192
|
+
api_url=api_url,
|
|
193
|
+
disable_request_logging=disable_request_logging,
|
|
194
|
+
).summarize
|
|
195
|
+
|
|
196
|
+
self.prediction = AsyncPrediction(
|
|
197
|
+
api_key=api_key,
|
|
198
|
+
api_url=api_url,
|
|
199
|
+
disable_request_logging=disable_request_logging,
|
|
200
|
+
).predict
|
|
201
|
+
self.text_to_sql = AsyncSQL(
|
|
202
|
+
api_key=api_key,
|
|
203
|
+
api_url=api_url,
|
|
204
|
+
disable_request_logging=disable_request_logging,
|
|
205
|
+
).text_to_sql
|
|
206
|
+
|
|
207
|
+
self.sentiment = AsyncSentiment(
|
|
208
|
+
api_key=api_key,
|
|
209
|
+
api_url=api_url,
|
|
210
|
+
disable_request_logging=disable_request_logging,
|
|
211
|
+
).analyze
|
|
212
|
+
|
|
213
|
+
self.translate = AsyncTranslate(
|
|
214
|
+
api_key=api_key,
|
|
215
|
+
api_url=api_url,
|
|
216
|
+
disable_request_logging=disable_request_logging,
|
|
217
|
+
).translate
|
|
218
|
+
|
|
219
|
+
self.prompt_engine = AsyncPromptEngine(
|
|
220
|
+
api_key=api_key,
|
|
221
|
+
api_url=api_url,
|
|
222
|
+
disable_request_logging=disable_request_logging,
|
|
223
|
+
)
|
|
224
|
+
self.embedding = AsyncEmbedding(
|
|
225
|
+
api_key=api_key,
|
|
226
|
+
api_url=api_url,
|
|
227
|
+
disable_request_logging=disable_request_logging,
|
|
228
|
+
).execute
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
# Create a global instance of the Web class
|
|
232
|
+
__all__ = ["JigsawStack", "Search", "JigsawStackError", "AsyncJigsawStack"]
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
from typing import Union
|
|
2
|
+
import os
|
|
3
|
+
from .audio import Audio
|
|
4
|
+
from .vision import Vision
|
|
5
|
+
from .search import Search
|
|
6
|
+
from .prediction import Prediction
|
|
7
|
+
from .sql import SQL
|
|
8
|
+
from .store import KV, File
|
|
9
|
+
from .translate import Translate
|
|
10
|
+
from .web import Web
|
|
11
|
+
from .sentiment import Sentiment
|
|
12
|
+
from .validate import Validate
|
|
13
|
+
from .summary import Summary
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class JigsawStack:
|
|
17
|
+
audio: Audio
|
|
18
|
+
vision: Vision
|
|
19
|
+
prediction: Prediction
|
|
20
|
+
sql: SQL
|
|
21
|
+
file: File
|
|
22
|
+
kv: KV
|
|
23
|
+
translate: Translate
|
|
24
|
+
web: Web
|
|
25
|
+
sentiment: Sentiment
|
|
26
|
+
validate: Validate
|
|
27
|
+
summary: Summary
|
|
28
|
+
search: Search
|
|
29
|
+
api_key: str
|
|
30
|
+
api_url: str
|
|
31
|
+
|
|
32
|
+
def __init__(
|
|
33
|
+
self, api_key: Union[str, None] = None, api_url: Union[str, None] = None
|
|
34
|
+
) -> None:
|
|
35
|
+
if api_key is None:
|
|
36
|
+
api_key = os.environ.get("JIGSAWSTACK_API_KEY")
|
|
37
|
+
|
|
38
|
+
if api_key is None:
|
|
39
|
+
raise ValueError(
|
|
40
|
+
"The api_key client option must be set either by passing api_key to the client or by setting the JIGSAWSTACK_API_KEY environment variable"
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
if api_url is None:
|
|
44
|
+
api_url = os.environ.get("JIGSAWSTACK_API_URL")
|
|
45
|
+
if api_url is None:
|
|
46
|
+
api_url = f"https://api.jigsawstack.com/v1"
|
|
47
|
+
|
|
48
|
+
self.api_key = api_key
|
|
49
|
+
self.api_url = api_url
|
|
50
|
+
|
|
51
|
+
self.audio = Audio(api_key=api_key, api_url=api_url)
|
|
52
|
+
self.web = Web(api_key=api_key, api_url=api_url)
|
|
53
|
+
self.search = Search(api_key=api_key, api_url=api_url)
|
|
54
|
+
self.sentiment = Sentiment(api_key=api_key, api_url=api_url)
|
|
55
|
+
self.validate = Validate(api_key=api_key, api_url=api_url)
|
|
56
|
+
self.summary = Summary(api_key=api_key, api_url=api_url)
|
|
57
|
+
self.vision = Vision(api_key=api_key, api_url=api_url)
|
|
58
|
+
self.prediction = Prediction(api_key=api_key, api_url=api_url)
|
|
59
|
+
self.sql = SQL(api_key=api_key, api_url=api_url)
|
|
60
|
+
self.file = File(api_key=api_key, api_url=api_url)
|
|
61
|
+
self.kv = KV(api_key=api_key, api_url=api_url)
|
|
62
|
+
self.translate = Translate(api_key=api_key, api_url=api_url)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
from typing import Union
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class ClientConfig:
|
|
5
|
+
base_url: str
|
|
6
|
+
api_key: str
|
|
7
|
+
disable_request_logging: Union[bool, None] = None
|
|
8
|
+
|
|
9
|
+
def __init__(
|
|
10
|
+
self,
|
|
11
|
+
api_key: str,
|
|
12
|
+
api_url: str,
|
|
13
|
+
disable_request_logging: Union[bool, None] = None,
|
|
14
|
+
):
|
|
15
|
+
self.api_key = api_key
|
|
16
|
+
self.api_url = api_url
|
|
17
|
+
self.disable_request_logging = disable_request_logging
|