1
-
2
1
from typing import Union
3
2
import os
4
3
from .audio import Audio
15
14
from .geo import Geo
16
15
from .prompt_engine import PromptEngine
17
16
from .exceptions import JigsawStackError
17
+
18
18
# from .version import get_version
19
19
20
+
20
21
class JigsawStack :
21
22
audio : Audio
22
- vision : Vision
23
+ vision : Vision
23
24
prediction : Prediction
24
25
text_to_sql : SQL
25
26
file : Store
@@ -30,19 +31,26 @@ class JigsawStack:
30
31
validate : Validate
31
32
summary : Summary
32
33
search : Search
33
- geo : Geo
34
+ geo : Geo
34
35
prompt_engine : PromptEngine
35
36
api_key : str
36
37
api_url : str
38
+ disable_request_logging : bool
37
39
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 :
40
46
if api_key is None :
41
47
api_key = os .environ .get ("JIGSAWSTACK_API_KEY" )
42
-
48
+
43
49
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
+
46
54
if api_url is None :
47
55
api_url = os .environ .get ("JIGSAWSTACK_API_URL" )
48
56
if api_url is None :
@@ -51,20 +59,72 @@ def __init__(self, api_key: Union[str, None] = None, api_url: Union[str, None] =
51
59
self .api_key = api_key
52
60
self .api_url = api_url
53
61
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
+ )
54
127
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 )
68
128
69
129
# Create a global instance of the Web class
70
- __all__ = ["JigsawStack" , "Search" , "JigsawStackError" ]
130
+ __all__ = ["JigsawStack" , "Search" , "JigsawStackError" ]
0 commit comments