simulacrum-sdk 0.1.0__py3-none-any.whl → 0.2.0__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 simulacrum-sdk might be problematic. Click here for more details.
- simulacrum/__init__.py +1 -1
- simulacrum/client.py +15 -4
- simulacrum/models.py +35 -11
- {simulacrum_sdk-0.1.0.dist-info → simulacrum_sdk-0.2.0.dist-info}/METADATA +1 -1
- simulacrum_sdk-0.2.0.dist-info/RECORD +11 -0
- simulacrum_sdk-0.1.0.dist-info/RECORD +0 -11
- {simulacrum_sdk-0.1.0.dist-info → simulacrum_sdk-0.2.0.dist-info}/WHEEL +0 -0
- {simulacrum_sdk-0.1.0.dist-info → simulacrum_sdk-0.2.0.dist-info}/licenses/LICENSE +0 -0
- {simulacrum_sdk-0.1.0.dist-info → simulacrum_sdk-0.2.0.dist-info}/top_level.txt +0 -0
simulacrum/__init__.py
CHANGED
simulacrum/client.py
CHANGED
|
@@ -88,7 +88,7 @@ class Simulacrum:
|
|
|
88
88
|
request_body: Dict[str, Any] = payload.model_dump()
|
|
89
89
|
response_data: Dict[str, Any] = send_request(
|
|
90
90
|
method="POST",
|
|
91
|
-
url=f"{self.base_url}/v1/forecast",
|
|
91
|
+
url=f"{self.base_url}/{model}/v1/forecast",
|
|
92
92
|
headers=self.headers,
|
|
93
93
|
json=request_body,
|
|
94
94
|
)
|
|
@@ -97,7 +97,7 @@ class Simulacrum:
|
|
|
97
97
|
)
|
|
98
98
|
return validated_response.get_forecast()
|
|
99
99
|
|
|
100
|
-
def validate(self) -> ValidateAPIKeyResponse:
|
|
100
|
+
def validate(self, model: str = "tempo") -> ValidateAPIKeyResponse:
|
|
101
101
|
"""Validate the configured API key and return its metadata.
|
|
102
102
|
|
|
103
103
|
Returns:
|
|
@@ -115,8 +115,19 @@ class Simulacrum:
|
|
|
115
115
|
"""
|
|
116
116
|
response_data: Dict[str, Any] = send_request(
|
|
117
117
|
method="GET",
|
|
118
|
-
url=f"{self.base_url}/v1/validate",
|
|
118
|
+
url=f"{self.base_url}/{model}/v1/validate",
|
|
119
119
|
headers=self.headers,
|
|
120
120
|
json=None,
|
|
121
121
|
)
|
|
122
|
-
|
|
122
|
+
|
|
123
|
+
validation: ValidateAPIKeyResponse = ValidateAPIKeyResponse.model_validate(
|
|
124
|
+
response_data
|
|
125
|
+
)
|
|
126
|
+
|
|
127
|
+
status_message = "valid" if validation.valid else "invalid"
|
|
128
|
+
print(
|
|
129
|
+
"Simulacrum API key validation: "
|
|
130
|
+
f"{status_message} (status={validation.status.value}, env={validation.env}) "
|
|
131
|
+
)
|
|
132
|
+
|
|
133
|
+
return validation
|
simulacrum/models.py
CHANGED
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
from datetime import datetime
|
|
4
4
|
from typing import List, Optional, Sequence, Union
|
|
5
|
+
from enum import Enum
|
|
5
6
|
|
|
6
7
|
import numpy as np
|
|
7
|
-
from pydantic import BaseModel, field_validator
|
|
8
|
+
from pydantic import BaseModel, field_validator, Field, constr
|
|
8
9
|
|
|
9
10
|
|
|
10
11
|
class ForecastRequest(BaseModel):
|
|
@@ -57,7 +58,6 @@ class ForecastResponse(BaseModel):
|
|
|
57
58
|
"""
|
|
58
59
|
|
|
59
60
|
forecast: List[float]
|
|
60
|
-
model_used: str
|
|
61
61
|
|
|
62
62
|
def get_forecast(self) -> np.ndarray:
|
|
63
63
|
"""Return forecast values as a numpy array for downstream processing.
|
|
@@ -68,15 +68,39 @@ class ForecastResponse(BaseModel):
|
|
|
68
68
|
return np.array(self.forecast, dtype=float)
|
|
69
69
|
|
|
70
70
|
|
|
71
|
-
class
|
|
72
|
-
"""
|
|
71
|
+
class ApiKeyStatus(str, Enum):
|
|
72
|
+
"""Possible statuses for an API key."""
|
|
73
73
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
74
|
+
active = "active"
|
|
75
|
+
deprecated = "deprecated"
|
|
76
|
+
disabled = "disabled"
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
class ApiKeyStatusHistoryEntry(BaseModel):
|
|
80
|
+
"""API key status history entry."""
|
|
81
|
+
|
|
82
|
+
status: ApiKeyStatus
|
|
83
|
+
changed_at: datetime
|
|
84
|
+
|
|
85
|
+
class Config:
|
|
86
|
+
extra = "forbid"
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
class ValidateAPIKeyResponse(BaseModel):
|
|
90
|
+
"""Structured representation of an API key validation response."""
|
|
79
91
|
|
|
80
92
|
valid: bool
|
|
81
|
-
|
|
82
|
-
|
|
93
|
+
key_id: constr(pattern=r"^[A-Za-z0-9]+$")
|
|
94
|
+
status: ApiKeyStatus
|
|
95
|
+
env: constr(pattern=r"^(live|test)$")
|
|
96
|
+
project_id: str
|
|
97
|
+
organization_id: str
|
|
98
|
+
user_id: str
|
|
99
|
+
product_id: str
|
|
100
|
+
name: constr(min_length=1, max_length=255)
|
|
101
|
+
expires_at: Optional[datetime] = None
|
|
102
|
+
rate_limit_per_minute: int = Field(ge=1)
|
|
103
|
+
rate_limit_per_hour: int = Field(ge=1)
|
|
104
|
+
|
|
105
|
+
class Config:
|
|
106
|
+
extra = "forbid"
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
simulacrum/__init__.py,sha256=yzQa-yO8unFv9uKF0gj-o3VoYT_t51-SAatr-KTKyzk,437
|
|
2
|
+
simulacrum/api.py,sha256=IZ8qNikv81Wd2l3VuaiGcLTjLOIzoxMfrbkQLwK0usg,1889
|
|
3
|
+
simulacrum/client.py,sha256=kjPnb0nAuf9djDCR8DNJ3VtPASrr7aFGDx6upN48ygk,5183
|
|
4
|
+
simulacrum/config.py,sha256=n3iN-cVUF3ucINS3iydDgMnFoMtVxDeVBIQwGiMKNk8,157
|
|
5
|
+
simulacrum/exceptions.py,sha256=6VjdyJaFx9c8nE8iIezJH6pWkdRBHRs5ORdEZUrbJmg,1289
|
|
6
|
+
simulacrum/models.py,sha256=V14jf_dcRGaBbYyKdy8c9w0yDLD5yqqE5qYvgG0ocTk,3157
|
|
7
|
+
simulacrum_sdk-0.2.0.dist-info/licenses/LICENSE,sha256=A7B9zAs2uCAzJoZPPyJW0G86yM-BTyum90vD4nSsOe0,1084
|
|
8
|
+
simulacrum_sdk-0.2.0.dist-info/METADATA,sha256=gFjEmlvV5UALjRP2M5NZpzm6sdIJQdKBlka8cd5NPmY,6329
|
|
9
|
+
simulacrum_sdk-0.2.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
10
|
+
simulacrum_sdk-0.2.0.dist-info/top_level.txt,sha256=CLUzfwEa7vZDf6zBAH8eXC2lZLMtj92MlXHOc3-V16o,11
|
|
11
|
+
simulacrum_sdk-0.2.0.dist-info/RECORD,,
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
simulacrum/__init__.py,sha256=RUetyuqgZ35UgPPcKHJAxqyh8aNkuB8AMWIevCc3iew,437
|
|
2
|
-
simulacrum/api.py,sha256=IZ8qNikv81Wd2l3VuaiGcLTjLOIzoxMfrbkQLwK0usg,1889
|
|
3
|
-
simulacrum/client.py,sha256=lAGQD_WzDHFIzmPWTjNYRRdx_Ac-qBFj5HsOvHyJZCg,4835
|
|
4
|
-
simulacrum/config.py,sha256=n3iN-cVUF3ucINS3iydDgMnFoMtVxDeVBIQwGiMKNk8,157
|
|
5
|
-
simulacrum/exceptions.py,sha256=6VjdyJaFx9c8nE8iIezJH6pWkdRBHRs5ORdEZUrbJmg,1289
|
|
6
|
-
simulacrum/models.py,sha256=YVuDNEFlEbJrdUyur_6mwbd8tnpjaf2jFQK0E7Ev-L4,2666
|
|
7
|
-
simulacrum_sdk-0.1.0.dist-info/licenses/LICENSE,sha256=A7B9zAs2uCAzJoZPPyJW0G86yM-BTyum90vD4nSsOe0,1084
|
|
8
|
-
simulacrum_sdk-0.1.0.dist-info/METADATA,sha256=NAQQH4oGVoA77x8ecZCGqwVWirHhMudV-qDuduKjiRQ,6329
|
|
9
|
-
simulacrum_sdk-0.1.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
10
|
-
simulacrum_sdk-0.1.0.dist-info/top_level.txt,sha256=CLUzfwEa7vZDf6zBAH8eXC2lZLMtj92MlXHOc3-V16o,11
|
|
11
|
-
simulacrum_sdk-0.1.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|