simile 0.4.10__py3-none-any.whl → 0.4.12__py3-none-any.whl
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/client.py +39 -4
- simile/models.py +5 -0
- {simile-0.4.10.dist-info → simile-0.4.12.dist-info}/METADATA +1 -1
- simile-0.4.12.dist-info/RECORD +11 -0
- simile-0.4.10.dist-info/RECORD +0 -11
- {simile-0.4.10.dist-info → simile-0.4.12.dist-info}/WHEEL +0 -0
- {simile-0.4.10.dist-info → simile-0.4.12.dist-info}/licenses/LICENSE +0 -0
- {simile-0.4.10.dist-info → simile-0.4.12.dist-info}/top_level.txt +0 -0
simile/client.py
CHANGED
|
@@ -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
|
|
@@ -24,6 +24,7 @@ from .models import (
|
|
|
24
24
|
SurveySessionCreateResponse,
|
|
25
25
|
SurveySessionDetailResponse,
|
|
26
26
|
MemoryStream,
|
|
27
|
+
UpdateAgentInfoPayload,
|
|
27
28
|
)
|
|
28
29
|
from .resources import Agent, SurveySession
|
|
29
30
|
from .exceptions import (
|
|
@@ -34,7 +35,7 @@ from .exceptions import (
|
|
|
34
35
|
)
|
|
35
36
|
|
|
36
37
|
DEFAULT_BASE_URL = "https://api.simile.ai/api/v1"
|
|
37
|
-
TIMEOUT_CONFIG = httpx.Timeout(5.0, read=
|
|
38
|
+
TIMEOUT_CONFIG = httpx.Timeout(5.0, read=60.0, write=30.0, pool=30.0)
|
|
38
39
|
|
|
39
40
|
|
|
40
41
|
class Simile:
|
|
@@ -43,13 +44,26 @@ class Simile:
|
|
|
43
44
|
NotFoundError = SimileNotFoundError
|
|
44
45
|
BadRequestError = SimileBadRequestError
|
|
45
46
|
|
|
46
|
-
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
|
+
):
|
|
47
55
|
if not api_key:
|
|
48
56
|
raise ValueError("API key is required.")
|
|
49
57
|
self.api_key = api_key
|
|
50
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
|
+
)
|
|
51
65
|
self._client = AsyncClient(
|
|
52
|
-
headers={"X-API-Key": self.api_key}, timeout=TIMEOUT_CONFIG
|
|
66
|
+
headers={"X-API-Key": self.api_key}, timeout=TIMEOUT_CONFIG, limits=limits,
|
|
53
67
|
)
|
|
54
68
|
|
|
55
69
|
async def _request(
|
|
@@ -288,6 +302,27 @@ class Simile:
|
|
|
288
302
|
"GET", f"agents/get/{str(agent_id)}", response_model=AgentModel
|
|
289
303
|
)
|
|
290
304
|
return response_data
|
|
305
|
+
|
|
306
|
+
async def update_agent_info(
|
|
307
|
+
self,
|
|
308
|
+
agent_id: Union[str, uuid.UUID],
|
|
309
|
+
name: str,
|
|
310
|
+
) -> AgentModel:
|
|
311
|
+
"""
|
|
312
|
+
Updates agent information (name).
|
|
313
|
+
Name must be provided.
|
|
314
|
+
Requires write access to the agent.
|
|
315
|
+
"""
|
|
316
|
+
payload = UpdateAgentInfoPayload(
|
|
317
|
+
name=name,
|
|
318
|
+
)
|
|
319
|
+
response_data = await self._request(
|
|
320
|
+
"PUT",
|
|
321
|
+
f"agents/update/{str(agent_id)}",
|
|
322
|
+
json=payload.model_dump(mode="json", exclude_none=True),
|
|
323
|
+
response_model=AgentModel,
|
|
324
|
+
)
|
|
325
|
+
return response_data
|
|
291
326
|
|
|
292
327
|
async def delete_agent(self, agent_id: Union[str, uuid.UUID]) -> DeletionResponse:
|
|
293
328
|
response_data = await self._request(
|
simile/models.py
CHANGED
|
@@ -58,6 +58,11 @@ class UpdatePopulationInfoPayload(BaseModel):
|
|
|
58
58
|
description: Optional[str] = None
|
|
59
59
|
metadata: Optional[Dict[str, Any]] = None
|
|
60
60
|
|
|
61
|
+
|
|
62
|
+
class UpdateAgentInfoPayload(BaseModel):
|
|
63
|
+
name: str
|
|
64
|
+
|
|
65
|
+
|
|
61
66
|
class InitialDataItemPayload(BaseModel):
|
|
62
67
|
data_type: str
|
|
63
68
|
content: Any
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
simile/__init__.py,sha256=JAYtieyGg6YYiCackJ6YNlGJkFWmhryzbwwVt4K67uI,1360
|
|
2
|
+
simile/auth_client.py,sha256=ICImmaA5fZX9ADbIPIUh4RED3hBZvLf3XSiaqELDAME,7923
|
|
3
|
+
simile/client.py,sha256=9nZo7y_umY52oxF-YszPlbDXEbSI5MfJu0Aq0jYy7CU,30635
|
|
4
|
+
simile/exceptions.py,sha256=Q1lbfwR7mEn_LYmwjAnsMc8BW79JNPvmCmVoPibYisU,1502
|
|
5
|
+
simile/models.py,sha256=qDA768d5DtuIXUgHJ8T2dgY3Ypy7IvDDUEumMzX3__Y,12536
|
|
6
|
+
simile/resources.py,sha256=LSYZSzx1YO69xvShGxxLFVPjQHw1WukHXhdYc1EyuOs,10555
|
|
7
|
+
simile-0.4.12.dist-info/licenses/LICENSE,sha256=tpxX3bpODfyOQVyEM6kCMvPHFCpkjFDj0AICRqKqOFA,1066
|
|
8
|
+
simile-0.4.12.dist-info/METADATA,sha256=fHtzZuJGxOk2W_ATBganwqcZZSr0EIKYIE8z5HDhQx8,1599
|
|
9
|
+
simile-0.4.12.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
10
|
+
simile-0.4.12.dist-info/top_level.txt,sha256=41lJneubAG4-ZOAs5qn7iDtDb-MDxa6DdvgBKwNX84M,7
|
|
11
|
+
simile-0.4.12.dist-info/RECORD,,
|
simile-0.4.10.dist-info/RECORD
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
simile/__init__.py,sha256=JAYtieyGg6YYiCackJ6YNlGJkFWmhryzbwwVt4K67uI,1360
|
|
2
|
-
simile/auth_client.py,sha256=ICImmaA5fZX9ADbIPIUh4RED3hBZvLf3XSiaqELDAME,7923
|
|
3
|
-
simile/client.py,sha256=7QhbMCiBLF6loYZdWSpnbE2HjVEVWgLeHQv8XW-WiB0,29604
|
|
4
|
-
simile/exceptions.py,sha256=Q1lbfwR7mEn_LYmwjAnsMc8BW79JNPvmCmVoPibYisU,1502
|
|
5
|
-
simile/models.py,sha256=kD1zwLW4N1sbrfGggipSBTew--uK2Gc6OLrQb2ZICF4,12478
|
|
6
|
-
simile/resources.py,sha256=LSYZSzx1YO69xvShGxxLFVPjQHw1WukHXhdYc1EyuOs,10555
|
|
7
|
-
simile-0.4.10.dist-info/licenses/LICENSE,sha256=tpxX3bpODfyOQVyEM6kCMvPHFCpkjFDj0AICRqKqOFA,1066
|
|
8
|
-
simile-0.4.10.dist-info/METADATA,sha256=qt6h9YEGRSv1s2lCJFvPO9lDk64RDsq983DwwS6qKyc,1599
|
|
9
|
-
simile-0.4.10.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
10
|
-
simile-0.4.10.dist-info/top_level.txt,sha256=41lJneubAG4-ZOAs5qn7iDtDb-MDxa6DdvgBKwNX84M,7
|
|
11
|
-
simile-0.4.10.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|