@@ -19,9 +19,11 @@ def push_prompt(
1919 name : str ,
2020 prompt : str ,
2121 tags : List [str ],
22- judgment_api_key : str = JUDGMENT_API_KEY ,
23- organization_id : str = JUDGMENT_ORG_ID ,
22+ judgment_api_key : str | None = JUDGMENT_API_KEY ,
23+ organization_id : str | None = JUDGMENT_ORG_ID ,
2424) -> tuple [str , Optional [str ], str ]:
25+ if not judgment_api_key or not organization_id :
26+ raise ValueError ("Judgment API key and organization ID are required" )
2527 client = JudgmentSyncClient (judgment_api_key , organization_id )
2628 try :
2729 project_id = _resolve_project_id (
@@ -55,9 +57,11 @@ def fetch_prompt(
5557 name : str ,
5658 commit_id : Optional [str ] = None ,
5759 tag : Optional [str ] = None ,
58- judgment_api_key : str = JUDGMENT_API_KEY ,
59- organization_id : str = JUDGMENT_ORG_ID ,
60+ judgment_api_key : str | None = JUDGMENT_API_KEY ,
61+ organization_id : str | None = JUDGMENT_ORG_ID ,
6062) -> Optional [PromptCommitInfo ]:
63+ if not judgment_api_key or not organization_id :
64+ raise ValueError ("Judgment API key and organization ID are required" )
6165 client = JudgmentSyncClient (judgment_api_key , organization_id )
6266 try :
6367 project_id = _resolve_project_id (
@@ -89,9 +93,11 @@ def tag_prompt(
8993 name : str ,
9094 commit_id : str ,
9195 tags : List [str ],
92- judgment_api_key : str = JUDGMENT_API_KEY ,
93- organization_id : str = JUDGMENT_ORG_ID ,
96+ judgment_api_key : str | None = JUDGMENT_API_KEY ,
97+ organization_id : str | None = JUDGMENT_ORG_ID ,
9498) -> PromptTagResponse :
99+ if not judgment_api_key or not organization_id :
100+ raise ValueError ("Judgment API key and organization ID are required" )
95101 client = JudgmentSyncClient (judgment_api_key , organization_id )
96102 try :
97103 project_id = _resolve_project_id (
@@ -124,9 +130,11 @@ def untag_prompt(
124130 project_name : str ,
125131 name : str ,
126132 tags : List [str ],
127- judgment_api_key : str = JUDGMENT_API_KEY ,
128- organization_id : str = JUDGMENT_ORG_ID ,
133+ judgment_api_key : str | None = JUDGMENT_API_KEY ,
134+ organization_id : str | None = JUDGMENT_ORG_ID ,
129135) -> PromptUntagResponse :
136+ if not judgment_api_key or not organization_id :
137+ raise ValueError ("Judgment API key and organization ID are required" )
130138 client = JudgmentSyncClient (judgment_api_key , organization_id )
131139 try :
132140 project_id = _resolve_project_id (
@@ -153,9 +161,11 @@ def untag_prompt(
153161def list_prompt (
154162 project_name : str ,
155163 name : str ,
156- judgment_api_key : str = JUDGMENT_API_KEY ,
157- organization_id : str = JUDGMENT_ORG_ID ,
164+ judgment_api_key : str | None = JUDGMENT_API_KEY ,
165+ organization_id : str | None = JUDGMENT_ORG_ID ,
158166) -> PromptVersionsResponse :
167+ if not judgment_api_key or not organization_id :
168+ raise ValueError ("Judgment API key and organization ID are required" )
159169 client = JudgmentSyncClient (judgment_api_key , organization_id )
160170 try :
161171 project_id = _resolve_project_id (
@@ -201,8 +211,8 @@ def create(
201211 name : str ,
202212 prompt : str ,
203213 tags : Optional [List [str ]] = None ,
204- judgment_api_key : str = JUDGMENT_API_KEY ,
205- organization_id : str = JUDGMENT_ORG_ID ,
214+ judgment_api_key : str | None = JUDGMENT_API_KEY ,
215+ organization_id : str | None = JUDGMENT_ORG_ID ,
206216 ):
207217 if tags is None :
208218 tags = []
@@ -225,8 +235,8 @@ def get(
225235 name : str ,
226236 commit_id : Optional [str ] = None ,
227237 tag : Optional [str ] = None ,
228- judgment_api_key : str = JUDGMENT_API_KEY ,
229- organization_id : str = JUDGMENT_ORG_ID ,
238+ judgment_api_key : str | None = JUDGMENT_API_KEY ,
239+ organization_id : str | None = JUDGMENT_ORG_ID ,
230240 ):
231241 if commit_id is not None and tag is not None :
232242 raise ValueError (
@@ -262,8 +272,8 @@ def tag(
262272 name : str ,
263273 commit_id : str ,
264274 tags : List [str ],
265- judgment_api_key : str = JUDGMENT_API_KEY ,
266- organization_id : str = JUDGMENT_ORG_ID ,
275+ judgment_api_key : str | None = JUDGMENT_API_KEY ,
276+ organization_id : str | None = JUDGMENT_ORG_ID ,
267277 ):
268278 prompt_config = tag_prompt (
269279 project_name , name , commit_id , tags , judgment_api_key , organization_id
@@ -276,8 +286,8 @@ def untag(
276286 project_name : str ,
277287 name : str ,
278288 tags : List [str ],
279- judgment_api_key : str = JUDGMENT_API_KEY ,
280- organization_id : str = JUDGMENT_ORG_ID ,
289+ judgment_api_key : str | None = JUDGMENT_API_KEY ,
290+ organization_id : str | None = JUDGMENT_ORG_ID ,
281291 ):
282292 prompt_config = untag_prompt (
283293 project_name , name , tags , judgment_api_key , organization_id
@@ -289,8 +299,8 @@ def list(
289299 cls ,
290300 project_name : str ,
291301 name : str ,
292- judgment_api_key : str = JUDGMENT_API_KEY ,
293- organization_id : str = JUDGMENT_ORG_ID ,
302+ judgment_api_key : str | None = JUDGMENT_API_KEY ,
303+ organization_id : str | None = JUDGMENT_ORG_ID ,
294304 ):
295305 prompt_configs = list_prompt (
296306 project_name , name , judgment_api_key , organization_id
0 commit comments