simile 0.4.11__tar.gz → 0.4.12__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.
Potentially problematic release.
This version of simile might be problematic. Click here for more details.
- {simile-0.4.11 → simile-0.4.12}/PKG-INFO +1 -1
- {simile-0.4.11 → simile-0.4.12}/pyproject.toml +1 -1
- {simile-0.4.11 → simile-0.4.12}/simile/client.py +17 -4
- {simile-0.4.11 → simile-0.4.12}/simile.egg-info/PKG-INFO +1 -1
- {simile-0.4.11 → simile-0.4.12}/LICENSE +0 -0
- {simile-0.4.11 → simile-0.4.12}/README.md +0 -0
- {simile-0.4.11 → simile-0.4.12}/setup.cfg +0 -0
- {simile-0.4.11 → simile-0.4.12}/setup.py +0 -0
- {simile-0.4.11 → simile-0.4.12}/simile/__init__.py +0 -0
- {simile-0.4.11 → simile-0.4.12}/simile/auth_client.py +0 -0
- {simile-0.4.11 → simile-0.4.12}/simile/exceptions.py +0 -0
- {simile-0.4.11 → simile-0.4.12}/simile/models.py +0 -0
- {simile-0.4.11 → simile-0.4.12}/simile/resources.py +0 -0
- {simile-0.4.11 → simile-0.4.12}/simile.egg-info/SOURCES.txt +0 -0
- {simile-0.4.11 → simile-0.4.12}/simile.egg-info/dependency_links.txt +0 -0
- {simile-0.4.11 → simile-0.4.12}/simile.egg-info/requires.txt +0 -0
- {simile-0.4.11 → simile-0.4.12}/simile.egg-info/top_level.txt +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import httpx
|
|
2
|
-
from httpx import AsyncClient
|
|
2
|
+
from httpx import AsyncClient, Limits
|
|
3
3
|
from typing import List, Dict, Any, Optional, Union, Type, AsyncGenerator
|
|
4
4
|
import uuid
|
|
5
5
|
from pydantic import BaseModel
|
|
@@ -35,7 +35,7 @@ from .exceptions import (
|
|
|
35
35
|
)
|
|
36
36
|
|
|
37
37
|
DEFAULT_BASE_URL = "https://api.simile.ai/api/v1"
|
|
38
|
-
TIMEOUT_CONFIG = httpx.Timeout(5.0, read=
|
|
38
|
+
TIMEOUT_CONFIG = httpx.Timeout(5.0, read=60.0, write=30.0, pool=30.0)
|
|
39
39
|
|
|
40
40
|
|
|
41
41
|
class Simile:
|
|
@@ -44,13 +44,26 @@ class Simile:
|
|
|
44
44
|
NotFoundError = SimileNotFoundError
|
|
45
45
|
BadRequestError = SimileBadRequestError
|
|
46
46
|
|
|
47
|
-
def __init__(
|
|
47
|
+
def __init__(
|
|
48
|
+
self,
|
|
49
|
+
api_key: str,
|
|
50
|
+
base_url: str = DEFAULT_BASE_URL,
|
|
51
|
+
max_connections: int = 5000,
|
|
52
|
+
max_keepalive_connections: int = 2000,
|
|
53
|
+
keepalive_expiry: float = 300.0,
|
|
54
|
+
):
|
|
48
55
|
if not api_key:
|
|
49
56
|
raise ValueError("API key is required.")
|
|
50
57
|
self.api_key = api_key
|
|
51
58
|
self.base_url = base_url.rstrip("/")
|
|
59
|
+
|
|
60
|
+
limits = Limits(
|
|
61
|
+
max_connections=max_connections,
|
|
62
|
+
max_keepalive_connections=max_keepalive_connections,
|
|
63
|
+
keepalive_expiry=keepalive_expiry,
|
|
64
|
+
)
|
|
52
65
|
self._client = AsyncClient(
|
|
53
|
-
headers={"X-API-Key": self.api_key}, timeout=TIMEOUT_CONFIG
|
|
66
|
+
headers={"X-API-Key": self.api_key}, timeout=TIMEOUT_CONFIG, limits=limits,
|
|
54
67
|
)
|
|
55
68
|
|
|
56
69
|
async def _request(
|
|
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
|
|
File without changes
|