GPTRouter 0.3.4__tar.gz → 0.3.5__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: GPTRouter
3
- Version: 0.3.4
3
+ Version: 0.3.5
4
4
  Summary: A Python package for working with GPTRouter APIs
5
5
  Author-email: sirjanpreet@writesonic.com
6
6
  Classifier: Development Status :: 3 - Alpha
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: GPTRouter
3
- Version: 0.3.4
3
+ Version: 0.3.5
4
4
  Summary: A Python package for working with GPTRouter APIs
5
5
  Author-email: sirjanpreet@writesonic.com
6
6
  Classifier: Development Status :: 3 - Alpha
@@ -95,7 +95,7 @@ class GPTRouterClient:
95
95
  payload = {k: v for k, v in payload.items() if v is not None}
96
96
  return payload
97
97
 
98
- async def _async_api_call(self, *, path: str, method: str, payload: dict):
98
+ async def _async_api_call(self, *, path: str, method: str, payload: dict, **kwargs):
99
99
  try:
100
100
  async with httpx.AsyncClient() as client:
101
101
  response = await client.request(
@@ -123,7 +123,7 @@ class GPTRouterClient:
123
123
  logger.error(f"Timeout error: {err}")
124
124
  raise GPTRouterApiTimeoutError("Api Request timed out")
125
125
 
126
- def _api_call(self, *, path: str, method: str, payload: dict):
126
+ def _api_call(self, *, path: str, method: str, payload: dict, **kwargs):
127
127
  try:
128
128
  with httpx.Client() as client:
129
129
  response = client.request(
@@ -151,9 +151,8 @@ class GPTRouterClient:
151
151
  logger.error(f"Timeout error: {err}")
152
152
  raise GPTRouterApiTimeoutError("Api Request timed out")
153
153
 
154
- async def astream_events(
155
- self, *, path: str, method: str, payload: dict, retry_count: int = 1
156
- ):
154
+ async def astream_events(self, *, path: str, method: str, payload: dict, **kwargs):
155
+ retry_count = kwargs.get("stream_retry_count") or 1
157
156
  async_retrying = AsyncRetrying(
158
157
  stop=stop_after_attempt(retry_count),
159
158
  wait=wait_fixed(0.5),
@@ -226,8 +225,9 @@ class GPTRouterClient:
226
225
  raise TimeoutError("Request timed out") from err
227
226
 
228
227
  def stream_events(
229
- self, *, path: str, method: str, payload: dict, retry_count: int = 1
228
+ self, *, path: str, method: str, payload: dict, **kwargs
230
229
  ) -> Generator[ChunkedGenerationResponse]:
230
+ retry_count = kwargs.get("stream_retry_count") or 1
231
231
  retrying = Retrying(
232
232
  stop=stop_after_attempt(retry_count),
233
233
  wait=wait_fixed(0.5),
@@ -322,11 +322,13 @@ class GPTRouterClient:
322
322
  path=api_path,
323
323
  method=api_method,
324
324
  payload=api_payload,
325
+ **kwargs,
325
326
  )
326
327
  result = self._api_call(
327
328
  path=api_path,
328
329
  method=api_method,
329
330
  payload=api_payload,
331
+ **kwargs,
330
332
  )
331
333
  return parse_obj_as(GenerationResponse, result)
332
334
 
@@ -353,11 +355,13 @@ class GPTRouterClient:
353
355
  path=api_path,
354
356
  method=api_method,
355
357
  payload=api_payload,
358
+ **kwargs,
356
359
  )
357
360
  result = await self._async_api_call(
358
361
  path=api_path,
359
362
  method=api_method,
360
363
  payload=api_payload,
364
+ **kwargs,
361
365
  )
362
366
  return parse_obj_as(GenerationResponse, result)
363
367
 
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
5
5
 
6
6
  setup(
7
7
  name="GPTRouter",
8
- version="0.3.4",
8
+ version="0.3.5",
9
9
  description="A Python package for working with GPTRouter APIs",
10
10
  long_description=long_description,
11
11
  long_description_content_type="text/markdown",
File without changes
File without changes
File without changes
File without changes
File without changes