GPTRouter 0.3.4__tar.gz → 0.3.6__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.
- {GPTRouter-0.3.4 → GPTRouter-0.3.6}/GPTRouter.egg-info/PKG-INFO +1 -1
- {GPTRouter-0.3.4 → GPTRouter-0.3.6}/PKG-INFO +1 -1
- {GPTRouter-0.3.4 → GPTRouter-0.3.6}/gpt_router/client.py +10 -6
- {GPTRouter-0.3.4 → GPTRouter-0.3.6}/gpt_router/enums.py +3 -0
- {GPTRouter-0.3.4 → GPTRouter-0.3.6}/setup.py +1 -1
- {GPTRouter-0.3.4 → GPTRouter-0.3.6}/GPTRouter.egg-info/SOURCES.txt +0 -0
- {GPTRouter-0.3.4 → GPTRouter-0.3.6}/GPTRouter.egg-info/dependency_links.txt +0 -0
- {GPTRouter-0.3.4 → GPTRouter-0.3.6}/GPTRouter.egg-info/requires.txt +0 -0
- {GPTRouter-0.3.4 → GPTRouter-0.3.6}/GPTRouter.egg-info/top_level.txt +0 -0
- {GPTRouter-0.3.4 → GPTRouter-0.3.6}/LICENSE +0 -0
- {GPTRouter-0.3.4 → GPTRouter-0.3.6}/README.md +0 -0
- {GPTRouter-0.3.4 → GPTRouter-0.3.6}/gpt_router/__init__.py +0 -0
- {GPTRouter-0.3.4 → GPTRouter-0.3.6}/gpt_router/constants.py +0 -0
- {GPTRouter-0.3.4 → GPTRouter-0.3.6}/gpt_router/exceptions.py +0 -0
- {GPTRouter-0.3.4 → GPTRouter-0.3.6}/gpt_router/models.py +0 -0
- {GPTRouter-0.3.4 → GPTRouter-0.3.6}/pyproject.toml +0 -0
- {GPTRouter-0.3.4 → GPTRouter-0.3.6}/setup.cfg +0 -0
|
@@ -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
|
-
|
|
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,
|
|
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
|
|
|
@@ -93,6 +93,9 @@ class GPTRouterEngines(Enum):
|
|
|
93
93
|
OPENAI_GPT_4_O = ModelDetails(ProvidersEnum.CHAT_OPENAI.value, "gpt-4o")
|
|
94
94
|
|
|
95
95
|
OPENAI_GPT_4_O_MINI = ModelDetails(ProvidersEnum.CHAT_OPENAI.value, "gpt-4o-mini")
|
|
96
|
+
AZURE_GPT_4O_MINI_2024_07_18 = ModelDetails(
|
|
97
|
+
ProvidersEnum.AZURE_CHAT_OPENAI.value, "gpt-4o-mini-2024-07-18"
|
|
98
|
+
)
|
|
96
99
|
OPENAI_GPT_4_O_24_08_06 = ModelDetails(ProvidersEnum.CHAT_OPENAI.value, "gpt-4o-2024-08-06")
|
|
97
100
|
|
|
98
101
|
OPENAI_GPT_4_32K_0613 = ModelDetails(
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|