@@ -62,97 +62,37 @@ def __init__(
6262 self .api_key = api_key
6363 self .api_url = api_url
6464
65- self .headers = headers or {}
66-
67- disable_request_logging = self .headers .get ("x-jigsaw-no-request-log" )
68-
69- self .audio = Audio (
70- api_key = api_key ,
71- api_url = api_url + "/v1" ,
72- disable_request_logging = disable_request_logging ,
73- )
74-
75- self .web = Web (
76- api_key = api_key ,
77- api_url = api_url + "/v1" ,
78- disable_request_logging = disable_request_logging ,
79- )
80-
81- self .sentiment = Sentiment (
82- api_key = api_key ,
83- api_url = api_url + "/v1" ,
84- disable_request_logging = disable_request_logging ,
85- ).analyze
86-
87- self .validate = Validate (
88- api_key = api_key ,
89- api_url = api_url + "/v1" ,
90- disable_request_logging = disable_request_logging ,
91- )
92- self .summary = Summary (
93- api_key = api_key ,
94- api_url = api_url + "/v1" ,
95- disable_request_logging = disable_request_logging ,
96- ).summarize
97-
98- self .vision = Vision (
99- api_key = api_key ,
100- api_url = api_url + "/v1" ,
101- disable_request_logging = disable_request_logging ,
102- )
103-
104- self .prediction = Prediction (
105- api_key = api_key ,
106- api_url = api_url + "/v1" ,
107- disable_request_logging = disable_request_logging ,
108- ).predict
109-
110- self .text_to_sql = SQL (
111- api_key = api_key ,
112- api_url = api_url + "/v1" ,
113- disable_request_logging = disable_request_logging ,
114- ).text_to_sql
115-
116- self .store = Store (
117- api_key = api_key ,
118- api_url = api_url + "/v1" ,
119- disable_request_logging = disable_request_logging ,
120- )
121- self .translate = Translate (
122- api_key = api_key ,
123- api_url = api_url + "/v1" ,
124- disable_request_logging = disable_request_logging ,
125- )
126-
127- self .embedding = Embedding (
128- api_key = api_key ,
129- api_url = api_url + "/v1" ,
130- disable_request_logging = disable_request_logging ,
131- ).execute
132-
133- self .embedding_v2 = EmbeddingV2 (
134- api_key = api_key ,
135- api_url = api_url + "/v2" ,
136- disable_request_logging = disable_request_logging ,
137- ).execute
65+ self .headers = headers or {"Content-Type" : "application/json" }
66+
67+ self .audio = Audio (api_key = api_key , api_url = api_url + "/v1" )
68+
69+ self .web = Web (api_key = api_key , api_url = api_url + "/v1" )
70+
71+ self .sentiment = Sentiment (api_key = api_key , api_url = api_url + "/v1" ).analyze
72+
73+ self .validate = Validate (api_key = api_key , api_url = api_url + "/v1" )
74+ self .summary = Summary (api_key = api_key , api_url = api_url + "/v1" ).summarize
75+
76+ self .vision = Vision (api_key = api_key , api_url = api_url + "/v1" )
77+
78+ self .prediction = Prediction (api_key = api_key , api_url = api_url + "/v1" ).predict
79+
80+ self .text_to_sql = SQL (api_key = api_key , api_url = api_url + "/v1" ).text_to_sql
81+
82+ self .store = Store (api_key = api_key , api_url = api_url + "/v1" )
83+ self .translate = Translate (api_key = api_key , api_url = api_url + "/v1" )
84+
85+ self .embedding = Embedding (api_key = api_key , api_url = api_url + "/v1" ).execute
86+
87+ self .embedding_v2 = EmbeddingV2 (api_key = api_key , api_url = api_url + "/v2" ).execute
13888
13989 self .image_generation = ImageGeneration (
140- api_key = api_key ,
141- api_url = api_url + "/v1" ,
142- disable_request_logging = disable_request_logging ,
90+ api_key = api_key , api_url = api_url + "/v1"
14391 ).image_generation
14492
145- self .classification = Classification (
146- api_key = api_key ,
147- api_url = api_url + "/v1" ,
148- disable_request_logging = disable_request_logging ,
149- ).classify
93+ self .classification = Classification (api_key = api_key , api_url = api_url + "/v1" ).classify
15094
151- self .prompt_engine = PromptEngine (
152- api_key = api_key ,
153- api_url = api_url + "/v1" ,
154- disable_request_logging = disable_request_logging ,
155- )
95+ self .prompt_engine = PromptEngine (api_key = api_key , api_url = api_url + "/v1" )
15696
15797
15898class AsyncJigsawStack :
@@ -179,7 +119,7 @@ def __init__(
179119 self ,
180120 api_key : Union [str , None ] = None ,
181121 api_url : Union [str , None ] = None ,
182- disable_request_logging : Union [bool , None ] = None ,
122+ headers : Union [Dict [ str , str ] , None ] = None ,
183123 ) -> None :
184124 if api_key is None :
185125 api_key = os .environ .get ("JIGSAWSTACK_API_KEY" )
@@ -196,96 +136,38 @@ def __init__(
196136
197137 self .api_key = api_key
198138 self .api_url = api_url
199- disable_request_logging = self .headers .get ("x-jigsaw-no-request-log" )
200-
201- self .web = AsyncWeb (
202- api_key = api_key ,
203- api_url = api_url + "/v1" ,
204- disable_request_logging = disable_request_logging ,
205- )
206-
207- self .validate = AsyncValidate (
208- api_key = api_key ,
209- api_url = api_url + "/v1" ,
210- disable_request_logging = disable_request_logging ,
211- )
212- self .audio = AsyncAudio (
213- api_key = api_key ,
214- api_url = api_url + "/v1" ,
215- disable_request_logging = disable_request_logging ,
216- )
217-
218- self .vision = AsyncVision (
219- api_key = api_key ,
220- api_url = api_url + "/v1" ,
221- disable_request_logging = disable_request_logging ,
222- )
223-
224- self .store = AsyncStore (
225- api_key = api_key ,
226- api_url = api_url + "/v1" ,
227- disable_request_logging = disable_request_logging ,
228- )
229-
230- self .summary = AsyncSummary (
231- api_key = api_key ,
232- api_url = api_url + "/v1" ,
233- disable_request_logging = disable_request_logging ,
234- ).summarize
235-
236- self .prediction = AsyncPrediction (
237- api_key = api_key ,
238- api_url = api_url + "/v1" ,
239- disable_request_logging = disable_request_logging ,
240- ).predict
241-
242- self .text_to_sql = AsyncSQL (
243- api_key = api_key ,
244- api_url = api_url + "/v1" ,
245- disable_request_logging = disable_request_logging ,
246- ).text_to_sql
247-
248- self .sentiment = AsyncSentiment (
249- api_key = api_key ,
250- api_url = api_url + "/v1" ,
251- disable_request_logging = disable_request_logging ,
252- ).analyze
253-
254- self .translate = AsyncTranslate (
255- api_key = api_key ,
256- api_url = api_url + "/v1" ,
257- disable_request_logging = disable_request_logging ,
258- )
259-
260- self .embedding = AsyncEmbedding (
261- api_key = api_key ,
262- api_url = api_url + "/v1" ,
263- disable_request_logging = disable_request_logging ,
264- ).execute
265-
266- self .embedding_v2 = AsyncEmbeddingV2 (
267- api_key = api_key ,
268- api_url = api_url + "/v2" ,
269- disable_request_logging = disable_request_logging ,
270- ).execute
139+ self .headers = headers or {"Content-Type" : "application/json" }
140+
141+ self .web = AsyncWeb (api_key = api_key , api_url = api_url + "/v1" )
142+
143+ self .validate = AsyncValidate (api_key = api_key , api_url = api_url + "/v1" )
144+ self .audio = AsyncAudio (api_key = api_key , api_url = api_url + "/v1" )
145+
146+ self .vision = AsyncVision (api_key = api_key , api_url = api_url + "/v1" )
147+
148+ self .store = AsyncStore (api_key = api_key , api_url = api_url + "/v1" )
149+
150+ self .summary = AsyncSummary (api_key = api_key , api_url = api_url + "/v1" ).summarize
151+
152+ self .prediction = AsyncPrediction (api_key = api_key , api_url = api_url + "/v1" ).predict
153+
154+ self .text_to_sql = AsyncSQL (api_key = api_key , api_url = api_url + "/v1" ).text_to_sql
155+
156+ self .sentiment = AsyncSentiment (api_key = api_key , api_url = api_url + "/v1" ).analyze
157+
158+ self .translate = AsyncTranslate (api_key = api_key , api_url = api_url + "/v1" )
159+
160+ self .embedding = AsyncEmbedding (api_key = api_key , api_url = api_url + "/v1" ).execute
161+
162+ self .embedding_v2 = AsyncEmbeddingV2 (api_key = api_key , api_url = api_url + "/v2" ).execute
271163
272164 self .image_generation = AsyncImageGeneration (
273- api_key = api_key ,
274- api_url = api_url + "/v1" ,
275- disable_request_logging = disable_request_logging ,
165+ api_key = api_key , api_url = api_url + "/v1"
276166 ).image_generation
277167
278- self .classification = AsyncClassification (
279- api_key = api_key ,
280- api_url = api_url + "/v1" ,
281- disable_request_logging = disable_request_logging ,
282- ).classify
283-
284- self .prompt_engine = AsyncPromptEngine (
285- api_key = api_key ,
286- api_url = api_url + "/v1" ,
287- disable_request_logging = disable_request_logging ,
288- )
168+ self .classification = AsyncClassification (api_key = api_key , api_url = api_url + "/v1" ).classify
169+
170+ self .prompt_engine = AsyncPromptEngine (api_key = api_key , api_url = api_url + "/v1" )
289171
290172
291173# Create a global instance of the Web class
0 commit comments