1515from .exceptions import JigsawStackError
1616from .image_generation import ImageGeneration , AsyncImageGeneration
1717from .classification import Classification , AsyncClassification
18+ from .embeddingV2 import EmbeddingV2 , AsyncEmbeddingV2
1819
1920
2021class JigsawStack :
@@ -48,7 +49,7 @@ def __init__(
4849 if api_url is None :
4950 api_url = os .environ .get ("JIGSAWSTACK_API_URL" )
5051 if api_url is None :
51- api_url = f"https://api.jigsawstack.com/v1 "
52+ api_url = f"https://api.jigsawstack.com/"
5253
5354 self .api_key = api_key
5455 self .api_url = api_url
@@ -59,73 +60,79 @@ def __init__(
5960
6061 self .audio = Audio (
6162 api_key = api_key ,
62- api_url = api_url ,
63+ api_url = api_url + "/v1" ,
6364 disable_request_logging = disable_request_logging ,
6465 )
6566 self .web = Web (
6667 api_key = api_key ,
67- api_url = api_url ,
68+ api_url = api_url + "/v1" ,
6869 disable_request_logging = disable_request_logging ,
6970 )
7071 self .sentiment = Sentiment (
7172 api_key = api_key ,
72- api_url = api_url ,
73+ api_url = api_url + "/v1" ,
7374 disable_request_logging = disable_request_logging ,
7475 ).analyze
7576 self .validate = Validate (
7677 api_key = api_key ,
77- api_url = api_url ,
78+ api_url = api_url + "/v1" ,
7879 disable_request_logging = disable_request_logging ,
7980 )
8081 self .summary = Summary (
8182 api_key = api_key ,
82- api_url = api_url ,
83+ api_url = api_url + "/v1" ,
8384 disable_request_logging = disable_request_logging ,
8485 ).summarize
8586 self .vision = Vision (
8687 api_key = api_key ,
87- api_url = api_url ,
88+ api_url = api_url + "/v1" ,
8889 disable_request_logging = disable_request_logging ,
8990 )
9091 self .prediction = Prediction (
9192 api_key = api_key ,
92- api_url = api_url ,
93+ api_url = api_url + "/v1" ,
9394 disable_request_logging = disable_request_logging ,
9495 ).predict
9596 self .text_to_sql = SQL (
9697 api_key = api_key ,
97- api_url = api_url ,
98+ api_url = api_url + "/v1" ,
9899 disable_request_logging = disable_request_logging ,
99100 ).text_to_sql
100101 self .store = Store (
101102 api_key = api_key ,
102- api_url = api_url ,
103+ api_url = api_url + "/v1" ,
103104 disable_request_logging = disable_request_logging ,
104105 )
105106 self .translate = Translate (
106107 api_key = api_key ,
107- api_url = api_url ,
108+ api_url = api_url + "/v1" ,
108109 disable_request_logging = disable_request_logging ,
109110 )
110111
111112 self .embedding = Embedding (
112113 api_key = api_key ,
113- api_url = api_url ,
114+ api_url = api_url + "/v1" ,
114115 disable_request_logging = disable_request_logging ,
115116 ).execute
117+
118+ self .embeddingV2 = EmbeddingV2 (
119+ api_key = api_key ,
120+ api_url = api_url + "/v2" ,
121+ disable_request_logging = disable_request_logging ,
122+ ).execute
123+
116124 self .image_generation = ImageGeneration (
117125 api_key = api_key ,
118- api_url = api_url ,
126+ api_url = api_url + "/v1" ,
119127 disable_request_logging = disable_request_logging ,
120128 ).image_generation
121129
122130 self .classification = Classification (
123131 api_key = api_key ,
124- api_url = api_url ,
132+ api_url = api_url + "/v1" ,
125133 disable_request_logging = disable_request_logging ,
126134 ).classify
127135
128-
129136class AsyncJigsawStack :
130137 validate : AsyncValidate
131138 web : AsyncWeb
@@ -154,87 +161,92 @@ def __init__(
154161 if api_url is None :
155162 api_url = os .environ .get ("JIGSAWSTACK_API_URL" )
156163 if api_url is None :
157- api_url = f"https://api.jigsawstack.com/v1 "
164+ api_url = f"https://api.jigsawstack.com/"
158165
159166 self .api_key = api_key
160167 self .api_url = api_url
161168
162169 self .web = AsyncWeb (
163170 api_key = api_key ,
164- api_url = api_url ,
171+ api_url = api_url + "/v1" ,
165172 disable_request_logging = disable_request_logging ,
166173 )
167174
168175 self .validate = AsyncValidate (
169176 api_key = api_key ,
170- api_url = api_url ,
177+ api_url = api_url + "/v1" ,
171178 disable_request_logging = disable_request_logging ,
172179 )
173180 self .audio = AsyncAudio (
174181 api_key = api_key ,
175- api_url = api_url ,
182+ api_url = api_url + "/v1" ,
176183 disable_request_logging = disable_request_logging ,
177184 )
178185
179186 self .vision = AsyncVision (
180187 api_key = api_key ,
181- api_url = api_url ,
188+ api_url = api_url + "/v1" ,
182189 disable_request_logging = disable_request_logging ,
183190 )
184191
185192 self .store = AsyncStore (
186193 api_key = api_key ,
187- api_url = api_url ,
194+ api_url = api_url + "/v1" ,
188195 disable_request_logging = disable_request_logging ,
189196 )
190197
191198 self .summary = AsyncSummary (
192199 api_key = api_key ,
193- api_url = api_url ,
200+ api_url = api_url + "/v1" ,
194201 disable_request_logging = disable_request_logging ,
195202 ).summarize
196203
197204 self .prediction = AsyncPrediction (
198205 api_key = api_key ,
199- api_url = api_url ,
206+ api_url = api_url + "/v1" ,
200207 disable_request_logging = disable_request_logging ,
201208 ).predict
202209 self .text_to_sql = AsyncSQL (
203210 api_key = api_key ,
204- api_url = api_url ,
211+ api_url = api_url + "/v1" ,
205212 disable_request_logging = disable_request_logging ,
206213 ).text_to_sql
207214
208215 self .sentiment = AsyncSentiment (
209216 api_key = api_key ,
210- api_url = api_url ,
217+ api_url = api_url + "/v1" ,
211218 disable_request_logging = disable_request_logging ,
212219 ).analyze
213220
214221 self .translate = AsyncTranslate (
215222 api_key = api_key ,
216- api_url = api_url ,
223+ api_url = api_url + "/v1" ,
217224 disable_request_logging = disable_request_logging ,
218225 )
219226
220227 self .embedding = AsyncEmbedding (
221228 api_key = api_key ,
222- api_url = api_url ,
229+ api_url = api_url + "/v1" ,
230+ disable_request_logging = disable_request_logging ,
231+ ).execute
232+
233+ self .embeddingV2 = AsyncEmbeddingV2 (
234+ api_key = api_key ,
235+ api_url = api_url + "/v2" ,
223236 disable_request_logging = disable_request_logging ,
224237 ).execute
225238
226239 self .image_generation = AsyncImageGeneration (
227240 api_key = api_key ,
228- api_url = api_url ,
241+ api_url = api_url + "/v1" ,
229242 disable_request_logging = disable_request_logging ,
230243 ).image_generation
231244
232245 self .classification = AsyncClassification (
233246 api_key = api_key ,
234- api_url = api_url ,
247+ api_url = api_url + "/v1" ,
235248 disable_request_logging = disable_request_logging ,
236249 ).classify
237250
238-
239251# Create a global instance of the Web class
240252__all__ = ["JigsawStack" , "Search" , "JigsawStackError" , "AsyncJigsawStack" ]
0 commit comments