1-
21from typing import Union
32import os
43from .audio import Audio
1514from .geo import Geo
1615from .prompt_engine import PromptEngine
1716from .exceptions import JigsawStackError
17+
1818# from .version import get_version
1919
20+
2021class JigsawStack :
2122 audio : Audio
22- vision : Vision
23+ vision : Vision
2324 prediction : Prediction
2425 text_to_sql : SQL
2526 file : Store
@@ -30,19 +31,26 @@ class JigsawStack:
3031 validate : Validate
3132 summary : Summary
3233 search : Search
33- geo : Geo
34+ geo : Geo
3435 prompt_engine : PromptEngine
3536 api_key : str
3637 api_url : str
38+ disable_request_logging : bool
3739
38-
39- def __init__ (self , api_key : Union [str , None ] = None , api_url : Union [str , None ] = None ) -> None :
40+ def __init__ (
41+ self ,
42+ api_key : Union [str , None ] = None ,
43+ api_url : Union [str , None ] = None ,
44+ disable_request_logging : Union [bool , None ] = None ,
45+ ) -> None :
4046 if api_key is None :
4147 api_key = os .environ .get ("JIGSAWSTACK_API_KEY" )
42-
48+
4349 if api_key is None :
44- raise ValueError ("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" )
45-
50+ raise ValueError (
51+ "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"
52+ )
53+
4654 if api_url is None :
4755 api_url = os .environ .get ("JIGSAWSTACK_API_URL" )
4856 if api_url is None :
@@ -51,20 +59,72 @@ def __init__(self, api_key: Union[str, None] = None, api_url: Union[str, None] =
5159 self .api_key = api_key
5260 self .api_url = api_url
5361
62+ self .audio = Audio (
63+ api_key = api_key ,
64+ api_url = api_url ,
65+ disable_request_logging = disable_request_logging ,
66+ )
67+ self .web = Web (
68+ api_key = api_key ,
69+ api_url = api_url ,
70+ disable_request_logging = disable_request_logging ,
71+ )
72+ self .sentiment = Sentiment (
73+ api_key = api_key ,
74+ api_url = api_url ,
75+ disable_request_logging = disable_request_logging ,
76+ ).analyze
77+ self .validate = Validate (
78+ api_key = api_key ,
79+ api_url = api_url ,
80+ disable_request_logging = disable_request_logging ,
81+ )
82+ self .summary = Summary (
83+ api_key = api_key ,
84+ api_url = api_url ,
85+ disable_request_logging = disable_request_logging ,
86+ ).summarize
87+ self .vision = Vision (
88+ api_key = api_key ,
89+ api_url = api_url ,
90+ disable_request_logging = disable_request_logging ,
91+ )
92+ self .prediction = Prediction (
93+ api_key = api_key ,
94+ api_url = api_url ,
95+ disable_request_logging = disable_request_logging ,
96+ ).predict
97+ self .text_to_sql = SQL (
98+ api_key = api_key ,
99+ api_url = api_url ,
100+ disable_request_logging = disable_request_logging ,
101+ ).text_to_sql
102+ self .store = Store (
103+ api_key = api_key ,
104+ api_url = api_url ,
105+ disable_request_logging = disable_request_logging ,
106+ )
107+ self .kv = KV (
108+ api_key = api_key ,
109+ api_url = api_url ,
110+ disable_request_logging = disable_request_logging ,
111+ )
112+ self .translate = Translate (
113+ api_key = api_key ,
114+ api_url = api_url ,
115+ disable_request_logging = disable_request_logging ,
116+ ).translate
117+ self .geo = Geo (
118+ api_key = api_key ,
119+ api_url = api_url ,
120+ disable_request_logging = disable_request_logging ,
121+ )
122+ self .prompt_engine = PromptEngine (
123+ api_key = api_key ,
124+ api_url = api_url ,
125+ disable_request_logging = disable_request_logging ,
126+ )
54127
55- self .audio = Audio (api_key = api_key , api_url = api_url )
56- self .web = Web (api_key = api_key , api_url = api_url )
57- self .sentiment = Sentiment (api_key = api_key , api_url = api_url ).analyze
58- self .validate = Validate (api_key = api_key , api_url = api_url )
59- self .summary = Summary (api_key = api_key , api_url = api_url ).summarize
60- self .vision = Vision (api_key = api_key , api_url = api_url )
61- self .prediction = Prediction (api_key = api_key , api_url = api_url ).predict
62- self .text_to_sql = SQL (api_key = api_key , api_url = api_url ).text_to_sql
63- self .store = Store (api_key = api_key , api_url = api_url )
64- self .kv = KV (api_key = api_key , api_url = api_url )
65- self .translate = Translate (api_key = api_key , api_url = api_url ).translate
66- self .geo = Geo (api_key = api_key , api_url = api_url )
67- self .prompt_engine = PromptEngine (api_key = api_key , api_url = api_url )
68128
69129# Create a global instance of the Web class
70- __all__ = ["JigsawStack" , "Search" , "JigsawStackError" ]
130+ __all__ = ["JigsawStack" , "Search" , "JigsawStackError" ]
0 commit comments