@@ -253,8 +253,8 @@ class LiteralAPI(BaseLiteralAPI):
253253 R = TypeVar ("R" )
254254
255255 def make_gql_call (
256- self , description : str , query : str , variables : Dict [str , Any ], timeout : Optional [int ] = 10
257- ) -> Dict :
256+ self , description : str , query : str , variables : dict [str , Any ], timeout : Optional [int ] = 10
257+ ) -> dict :
258258 def raise_error (error ):
259259 logger .error (f"Failed to { description } : { error } " )
260260 raise Exception (error )
@@ -738,7 +738,7 @@ def upload_file(
738738 # Prepare form data
739739 form_data = (
740740 {}
741- ) # type: Dict[str, Union[Tuple [Union[str, None], Any], Tuple [Union[str, None], Any, Any]]]
741+ ) # type: Dict[str, Union[tuple [Union[str, None], Any], tuple [Union[str, None], Any, Any]]]
742742 for field_name , field_value in fields .items ():
743743 form_data [field_name ] = (None , field_value )
744744
@@ -1424,16 +1424,9 @@ def get_prompt(
14241424
14251425 try :
14261426 if id :
1427- prompt = self .gql_helper (
1428- * get_prompt_helper (self , id = id ), timeout = timeout
1429- )
1427+ prompt = self .gql_helper (* get_prompt_helper (self , id = id , timeout = timeout ))
14301428 elif name :
1431- prompt = self .gql_helper (
1432- * get_prompt_helper (
1433- self , name = name , version = version
1434- ),
1435- timeout = timeout
1436- )
1429+ prompt = self .gql_helper (* get_prompt_helper (self , name = name , version = version , timeout = timeout ))
14371430
14381431 self ._create_prompt_cache (prompt )
14391432 return prompt
@@ -1527,7 +1520,7 @@ class AsyncLiteralAPI(BaseLiteralAPI):
15271520 R = TypeVar ("R" )
15281521
15291522 async def make_gql_call (
1530- self , description : str , query : str , variables : Dict [str , Any ]
1523+ self , description : str , query : str , variables : Dict [str , Any ], timeout : Optional [ int ] = 10
15311524 ) -> Dict :
15321525 def raise_error (error ):
15331526 logger .error (f"Failed to { description } : { error } " )
@@ -1540,7 +1533,7 @@ def raise_error(error):
15401533 self .graphql_endpoint ,
15411534 json = {"query" : query , "variables" : variables },
15421535 headers = self .headers ,
1543- timeout = 10 ,
1536+ timeout = timeout ,
15441537 )
15451538
15461539 try :
@@ -1604,8 +1597,9 @@ async def gql_helper(
16041597 description : str ,
16051598 variables : Dict ,
16061599 process_response : Callable [..., R ],
1600+ timeout : Optional [int ] = 10 ,
16071601 ) -> R :
1608- response = await self .make_gql_call (description , query , variables )
1602+ response = await self .make_gql_call (description , query , variables , timeout )
16091603 return process_response (response )
16101604
16111605 async def get_users (
@@ -2039,7 +2033,7 @@ async def upload_file(
20392033 # Prepare form data
20402034 form_data = (
20412035 {}
2042- ) # type: Dict [str, Union[Tuple [Union[str, None], Any], Tuple [Union[str, None], Any, Any]]]
2036+ ) # type: dict [str, Union[tuple [Union[str, None], Any], tuple [Union[str, None], Any, Any]]]
20432037 for field_name , field_value in fields .items ():
20442038 form_data [field_name ] = (None , field_value )
20452039
@@ -2678,11 +2672,14 @@ async def get_prompt(
26782672
26792673 try :
26802674 if id :
2681- prompt = await self .gql_helper (* get_prompt_helper (sync_api , id = id ), timeout = timeout )
2675+ prompt = await self .gql_helper (
2676+ * get_prompt_helper (sync_api , id = id , timeout = timeout )
2677+ )
26822678 elif name :
26832679 prompt = await self .gql_helper (
2684- * get_prompt_helper (sync_api , name = name , version = version ),
2685- timeout = timeout ,
2680+ * get_prompt_helper (
2681+ sync_api , name = name , version = version , timeout = timeout
2682+ )
26862683 )
26872684
26882685 self ._create_prompt_cache (prompt )
0 commit comments