vellum-ai 1.1.5__py3-none-any.whl → 1.2.1__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.
- vellum/__init__.py +18 -1
- vellum/client/__init__.py +3 -0
- vellum/client/core/client_wrapper.py +2 -2
- vellum/client/errors/__init__.py +10 -1
- vellum/client/errors/too_many_requests_error.py +11 -0
- vellum/client/errors/unauthorized_error.py +11 -0
- vellum/client/reference.md +94 -0
- vellum/client/resources/__init__.py +2 -0
- vellum/client/resources/events/__init__.py +4 -0
- vellum/client/resources/events/client.py +165 -0
- vellum/client/resources/events/raw_client.py +207 -0
- vellum/client/types/__init__.py +6 -0
- vellum/client/types/error_detail_response.py +22 -0
- vellum/client/types/event_create_response.py +26 -0
- vellum/client/types/execution_thinking_vellum_value.py +1 -1
- vellum/client/types/thinking_vellum_value.py +1 -1
- vellum/client/types/thinking_vellum_value_request.py +1 -1
- vellum/client/types/workflow_event.py +33 -0
- vellum/errors/too_many_requests_error.py +3 -0
- vellum/errors/unauthorized_error.py +3 -0
- vellum/resources/events/__init__.py +3 -0
- vellum/resources/events/client.py +3 -0
- vellum/resources/events/raw_client.py +3 -0
- vellum/types/error_detail_response.py +3 -0
- vellum/types/event_create_response.py +3 -0
- vellum/types/workflow_event.py +3 -0
- vellum/workflows/nodes/displayable/bases/api_node/node.py +4 -0
- vellum/workflows/nodes/displayable/bases/api_node/tests/test_node.py +26 -0
- vellum/workflows/nodes/displayable/bases/inline_prompt_node/node.py +6 -1
- vellum/workflows/nodes/displayable/bases/inline_prompt_node/tests/test_inline_prompt_node.py +22 -0
- vellum/workflows/sandbox.py +28 -8
- vellum/workflows/state/encoder.py +19 -1
- vellum/workflows/utils/hmac.py +44 -0
- {vellum_ai-1.1.5.dist-info → vellum_ai-1.2.1.dist-info}/METADATA +1 -1
- {vellum_ai-1.1.5.dist-info → vellum_ai-1.2.1.dist-info}/RECORD +61 -43
- vellum_ee/workflows/display/nodes/base_node_display.py +2 -2
- vellum_ee/workflows/display/nodes/vellum/inline_prompt_node.py +37 -7
- vellum_ee/workflows/display/nodes/vellum/retry_node.py +1 -1
- vellum_ee/workflows/display/nodes/vellum/tests/test_retry_node.py +1 -1
- vellum_ee/workflows/display/nodes/vellum/tests/test_tool_calling_node.py +314 -2
- vellum_ee/workflows/display/nodes/vellum/try_node.py +1 -1
- vellum_ee/workflows/display/tests/test_base_workflow_display.py +53 -1
- vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_adornments_serialization.py +9 -9
- vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_attributes_serialization.py +9 -9
- vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_outputs_serialization.py +3 -3
- vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_ports_serialization.py +14 -15
- vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_trigger_serialization.py +58 -3
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_code_execution_node_serialization.py +1 -1
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_inline_prompt_node_serialization.py +4 -0
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_inline_subworkflow_serialization.py +1 -1
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_tool_calling_node_inline_workflow_serialization.py +2 -2
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_tool_calling_node_serialization.py +1 -1
- vellum_ee/workflows/display/utils/expressions.py +9 -1
- vellum_ee/workflows/display/utils/registry.py +46 -0
- vellum_ee/workflows/display/workflows/base_workflow_display.py +21 -1
- vellum_ee/workflows/tests/test_registry.py +169 -0
- vellum_ee/workflows/tests/test_serialize_module.py +31 -0
- vellum_ee/workflows/tests/test_server.py +72 -0
- {vellum_ai-1.1.5.dist-info → vellum_ai-1.2.1.dist-info}/LICENSE +0 -0
- {vellum_ai-1.1.5.dist-info → vellum_ai-1.2.1.dist-info}/WHEEL +0 -0
- {vellum_ai-1.1.5.dist-info → vellum_ai-1.2.1.dist-info}/entry_points.txt +0 -0
vellum/__init__.py
CHANGED
@@ -103,9 +103,11 @@ from .client.types import (
|
|
103
103
|
EnvironmentEnum,
|
104
104
|
EphemeralPromptCacheConfig,
|
105
105
|
EphemeralPromptCacheConfigTypeEnum,
|
106
|
+
ErrorDetailResponse,
|
106
107
|
ErrorInput,
|
107
108
|
ErrorVellumValue,
|
108
109
|
ErrorVellumValueRequest,
|
110
|
+
EventCreateResponse,
|
109
111
|
ExecuteApiRequestBearerToken,
|
110
112
|
ExecuteApiRequestBody,
|
111
113
|
ExecuteApiRequestHeadersValue,
|
@@ -543,6 +545,7 @@ from .client.types import (
|
|
543
545
|
WorkflowDeploymentReleaseWorkflowDeployment,
|
544
546
|
WorkflowDeploymentReleaseWorkflowVersion,
|
545
547
|
WorkflowError,
|
548
|
+
WorkflowEvent,
|
546
549
|
WorkflowEventError,
|
547
550
|
WorkflowEventExecutionRead,
|
548
551
|
WorkflowExecutionActual,
|
@@ -617,7 +620,14 @@ from .client.types import (
|
|
617
620
|
WorkspaceRead,
|
618
621
|
WorkspaceSecretRead,
|
619
622
|
)
|
620
|
-
from .errors import
|
623
|
+
from .errors import (
|
624
|
+
BadRequestError,
|
625
|
+
ForbiddenError,
|
626
|
+
InternalServerError,
|
627
|
+
NotFoundError,
|
628
|
+
TooManyRequestsError,
|
629
|
+
UnauthorizedError,
|
630
|
+
)
|
621
631
|
from .resources import (
|
622
632
|
DeploymentsListRequestStatus,
|
623
633
|
DocumentIndexesListRequestStatus,
|
@@ -631,6 +641,7 @@ from .resources import (
|
|
631
641
|
deployments,
|
632
642
|
document_indexes,
|
633
643
|
documents,
|
644
|
+
events,
|
634
645
|
folder_entities,
|
635
646
|
metric_definitions,
|
636
647
|
ml_models,
|
@@ -752,9 +763,11 @@ __all__ = [
|
|
752
763
|
"EnvironmentEnum",
|
753
764
|
"EphemeralPromptCacheConfig",
|
754
765
|
"EphemeralPromptCacheConfigTypeEnum",
|
766
|
+
"ErrorDetailResponse",
|
755
767
|
"ErrorInput",
|
756
768
|
"ErrorVellumValue",
|
757
769
|
"ErrorVellumValueRequest",
|
770
|
+
"EventCreateResponse",
|
758
771
|
"ExecuteApiRequestBearerToken",
|
759
772
|
"ExecuteApiRequestBody",
|
760
773
|
"ExecuteApiRequestHeadersValue",
|
@@ -1156,6 +1169,8 @@ __all__ = [
|
|
1156
1169
|
"TokenOverlappingWindowChunkerConfigRequest",
|
1157
1170
|
"TokenOverlappingWindowChunking",
|
1158
1171
|
"TokenOverlappingWindowChunkingRequest",
|
1172
|
+
"TooManyRequestsError",
|
1173
|
+
"UnauthorizedError",
|
1159
1174
|
"UnitEnum",
|
1160
1175
|
"UploadDocumentResponse",
|
1161
1176
|
"UpsertTestSuiteTestCaseRequest",
|
@@ -1202,6 +1217,7 @@ __all__ = [
|
|
1202
1217
|
"WorkflowDeploymentReleaseWorkflowVersion",
|
1203
1218
|
"WorkflowDeploymentsListRequestStatus",
|
1204
1219
|
"WorkflowError",
|
1220
|
+
"WorkflowEvent",
|
1205
1221
|
"WorkflowEventError",
|
1206
1222
|
"WorkflowEventExecutionRead",
|
1207
1223
|
"WorkflowExecutionActual",
|
@@ -1281,6 +1297,7 @@ __all__ = [
|
|
1281
1297
|
"deployments",
|
1282
1298
|
"document_indexes",
|
1283
1299
|
"documents",
|
1300
|
+
"events",
|
1284
1301
|
"folder_entities",
|
1285
1302
|
"metric_definitions",
|
1286
1303
|
"ml_models",
|
vellum/client/__init__.py
CHANGED
@@ -14,6 +14,7 @@ from .resources.container_images.client import AsyncContainerImagesClient, Conta
|
|
14
14
|
from .resources.deployments.client import AsyncDeploymentsClient, DeploymentsClient
|
15
15
|
from .resources.document_indexes.client import AsyncDocumentIndexesClient, DocumentIndexesClient
|
16
16
|
from .resources.documents.client import AsyncDocumentsClient, DocumentsClient
|
17
|
+
from .resources.events.client import AsyncEventsClient, EventsClient
|
17
18
|
from .resources.folder_entities.client import AsyncFolderEntitiesClient, FolderEntitiesClient
|
18
19
|
from .resources.metric_definitions.client import AsyncMetricDefinitionsClient, MetricDefinitionsClient
|
19
20
|
from .resources.ml_models.client import AsyncMlModelsClient, MlModelsClient
|
@@ -128,6 +129,7 @@ class Vellum:
|
|
128
129
|
timeout=_defaulted_timeout,
|
129
130
|
)
|
130
131
|
self._raw_client = RawVellum(client_wrapper=self._client_wrapper)
|
132
|
+
self.events = EventsClient(client_wrapper=self._client_wrapper)
|
131
133
|
self.ad_hoc = AdHocClient(client_wrapper=self._client_wrapper)
|
132
134
|
self.container_images = ContainerImagesClient(client_wrapper=self._client_wrapper)
|
133
135
|
self.deployments = DeploymentsClient(client_wrapper=self._client_wrapper)
|
@@ -991,6 +993,7 @@ class AsyncVellum:
|
|
991
993
|
timeout=_defaulted_timeout,
|
992
994
|
)
|
993
995
|
self._raw_client = AsyncRawVellum(client_wrapper=self._client_wrapper)
|
996
|
+
self.events = AsyncEventsClient(client_wrapper=self._client_wrapper)
|
994
997
|
self.ad_hoc = AsyncAdHocClient(client_wrapper=self._client_wrapper)
|
995
998
|
self.container_images = AsyncContainerImagesClient(client_wrapper=self._client_wrapper)
|
996
999
|
self.deployments = AsyncDeploymentsClient(client_wrapper=self._client_wrapper)
|
@@ -27,10 +27,10 @@ class BaseClientWrapper:
|
|
27
27
|
|
28
28
|
def get_headers(self) -> typing.Dict[str, str]:
|
29
29
|
headers: typing.Dict[str, str] = {
|
30
|
-
"User-Agent": "vellum-ai/1.1
|
30
|
+
"User-Agent": "vellum-ai/1.2.1",
|
31
31
|
"X-Fern-Language": "Python",
|
32
32
|
"X-Fern-SDK-Name": "vellum-ai",
|
33
|
-
"X-Fern-SDK-Version": "1.1
|
33
|
+
"X-Fern-SDK-Version": "1.2.1",
|
34
34
|
**(self.get_custom_headers() or {}),
|
35
35
|
}
|
36
36
|
if self._api_version is not None:
|
vellum/client/errors/__init__.py
CHANGED
@@ -6,5 +6,14 @@ from .bad_request_error import BadRequestError
|
|
6
6
|
from .forbidden_error import ForbiddenError
|
7
7
|
from .internal_server_error import InternalServerError
|
8
8
|
from .not_found_error import NotFoundError
|
9
|
+
from .too_many_requests_error import TooManyRequestsError
|
10
|
+
from .unauthorized_error import UnauthorizedError
|
9
11
|
|
10
|
-
__all__ = [
|
12
|
+
__all__ = [
|
13
|
+
"BadRequestError",
|
14
|
+
"ForbiddenError",
|
15
|
+
"InternalServerError",
|
16
|
+
"NotFoundError",
|
17
|
+
"TooManyRequestsError",
|
18
|
+
"UnauthorizedError",
|
19
|
+
]
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
2
|
+
|
3
|
+
import typing
|
4
|
+
|
5
|
+
from ..core.api_error import ApiError
|
6
|
+
from ..types.error_detail_response import ErrorDetailResponse
|
7
|
+
|
8
|
+
|
9
|
+
class TooManyRequestsError(ApiError):
|
10
|
+
def __init__(self, body: ErrorDetailResponse, headers: typing.Optional[typing.Dict[str, str]] = None):
|
11
|
+
super().__init__(status_code=429, headers=headers, body=body)
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
2
|
+
|
3
|
+
import typing
|
4
|
+
|
5
|
+
from ..core.api_error import ApiError
|
6
|
+
from ..types.error_detail_response import ErrorDetailResponse
|
7
|
+
|
8
|
+
|
9
|
+
class UnauthorizedError(ApiError):
|
10
|
+
def __init__(self, body: ErrorDetailResponse, headers: typing.Optional[typing.Dict[str, str]] = None):
|
11
|
+
super().__init__(status_code=401, headers=headers, body=body)
|
vellum/client/reference.md
CHANGED
@@ -1245,6 +1245,100 @@ client.submit_workflow_execution_actuals(
|
|
1245
1245
|
</dl>
|
1246
1246
|
|
1247
1247
|
|
1248
|
+
</dd>
|
1249
|
+
</dl>
|
1250
|
+
</details>
|
1251
|
+
|
1252
|
+
## Events
|
1253
|
+
<details><summary><code>client.events.<a href="src/vellum/resources/events/client.py">create</a>(...)</code></summary>
|
1254
|
+
<dl>
|
1255
|
+
<dd>
|
1256
|
+
|
1257
|
+
#### 📝 Description
|
1258
|
+
|
1259
|
+
<dl>
|
1260
|
+
<dd>
|
1261
|
+
|
1262
|
+
<dl>
|
1263
|
+
<dd>
|
1264
|
+
|
1265
|
+
Accept an event and publish it to ClickHouse for analytics processing.
|
1266
|
+
</dd>
|
1267
|
+
</dl>
|
1268
|
+
</dd>
|
1269
|
+
</dl>
|
1270
|
+
|
1271
|
+
#### 🔌 Usage
|
1272
|
+
|
1273
|
+
<dl>
|
1274
|
+
<dd>
|
1275
|
+
|
1276
|
+
<dl>
|
1277
|
+
<dd>
|
1278
|
+
|
1279
|
+
```python
|
1280
|
+
import datetime
|
1281
|
+
|
1282
|
+
from vellum import (
|
1283
|
+
NodeExecutionInitiatedBody,
|
1284
|
+
NodeExecutionInitiatedEvent,
|
1285
|
+
Vellum,
|
1286
|
+
VellumCodeResourceDefinition,
|
1287
|
+
)
|
1288
|
+
|
1289
|
+
client = Vellum(
|
1290
|
+
api_version="YOUR_API_VERSION",
|
1291
|
+
api_key="YOUR_API_KEY",
|
1292
|
+
)
|
1293
|
+
client.events.create(
|
1294
|
+
request=NodeExecutionInitiatedEvent(
|
1295
|
+
body=NodeExecutionInitiatedBody(
|
1296
|
+
node_definition=VellumCodeResourceDefinition(
|
1297
|
+
name="name",
|
1298
|
+
module=["module", "module"],
|
1299
|
+
id="id",
|
1300
|
+
),
|
1301
|
+
inputs={"inputs": {"key": "value"}},
|
1302
|
+
),
|
1303
|
+
id="id",
|
1304
|
+
timestamp=datetime.datetime.fromisoformat(
|
1305
|
+
"2024-01-15 09:30:00+00:00",
|
1306
|
+
),
|
1307
|
+
trace_id="trace_id",
|
1308
|
+
span_id="span_id",
|
1309
|
+
),
|
1310
|
+
)
|
1311
|
+
|
1312
|
+
```
|
1313
|
+
</dd>
|
1314
|
+
</dl>
|
1315
|
+
</dd>
|
1316
|
+
</dl>
|
1317
|
+
|
1318
|
+
#### ⚙️ Parameters
|
1319
|
+
|
1320
|
+
<dl>
|
1321
|
+
<dd>
|
1322
|
+
|
1323
|
+
<dl>
|
1324
|
+
<dd>
|
1325
|
+
|
1326
|
+
**request:** `WorkflowEvent`
|
1327
|
+
|
1328
|
+
</dd>
|
1329
|
+
</dl>
|
1330
|
+
|
1331
|
+
<dl>
|
1332
|
+
<dd>
|
1333
|
+
|
1334
|
+
**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
|
1335
|
+
|
1336
|
+
</dd>
|
1337
|
+
</dl>
|
1338
|
+
</dd>
|
1339
|
+
</dl>
|
1340
|
+
|
1341
|
+
|
1248
1342
|
</dd>
|
1249
1343
|
</dl>
|
1250
1344
|
</details>
|
@@ -8,6 +8,7 @@ from . import (
|
|
8
8
|
deployments,
|
9
9
|
document_indexes,
|
10
10
|
documents,
|
11
|
+
events,
|
11
12
|
folder_entities,
|
12
13
|
metric_definitions,
|
13
14
|
ml_models,
|
@@ -42,6 +43,7 @@ __all__ = [
|
|
42
43
|
"deployments",
|
43
44
|
"document_indexes",
|
44
45
|
"documents",
|
46
|
+
"events",
|
45
47
|
"folder_entities",
|
46
48
|
"metric_definitions",
|
47
49
|
"ml_models",
|
@@ -0,0 +1,165 @@
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
2
|
+
|
3
|
+
import typing
|
4
|
+
|
5
|
+
from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
6
|
+
from ...core.request_options import RequestOptions
|
7
|
+
from ...types.event_create_response import EventCreateResponse
|
8
|
+
from ...types.workflow_event import WorkflowEvent
|
9
|
+
from .raw_client import AsyncRawEventsClient, RawEventsClient
|
10
|
+
|
11
|
+
# this is used as the default value for optional parameters
|
12
|
+
OMIT = typing.cast(typing.Any, ...)
|
13
|
+
|
14
|
+
|
15
|
+
class EventsClient:
|
16
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
17
|
+
self._raw_client = RawEventsClient(client_wrapper=client_wrapper)
|
18
|
+
|
19
|
+
@property
|
20
|
+
def _client_wrapper(self) -> SyncClientWrapper:
|
21
|
+
return self._raw_client._client_wrapper
|
22
|
+
|
23
|
+
@property
|
24
|
+
def with_raw_response(self) -> RawEventsClient:
|
25
|
+
"""
|
26
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
27
|
+
|
28
|
+
Returns
|
29
|
+
-------
|
30
|
+
RawEventsClient
|
31
|
+
"""
|
32
|
+
return self._raw_client
|
33
|
+
|
34
|
+
def create(
|
35
|
+
self, *, request: WorkflowEvent, request_options: typing.Optional[RequestOptions] = None
|
36
|
+
) -> EventCreateResponse:
|
37
|
+
"""
|
38
|
+
Accept an event and publish it to ClickHouse for analytics processing.
|
39
|
+
|
40
|
+
Parameters
|
41
|
+
----------
|
42
|
+
request : WorkflowEvent
|
43
|
+
|
44
|
+
request_options : typing.Optional[RequestOptions]
|
45
|
+
Request-specific configuration.
|
46
|
+
|
47
|
+
Returns
|
48
|
+
-------
|
49
|
+
EventCreateResponse
|
50
|
+
|
51
|
+
|
52
|
+
Examples
|
53
|
+
--------
|
54
|
+
import datetime
|
55
|
+
|
56
|
+
from vellum import (
|
57
|
+
NodeExecutionInitiatedBody,
|
58
|
+
NodeExecutionInitiatedEvent,
|
59
|
+
Vellum,
|
60
|
+
VellumCodeResourceDefinition,
|
61
|
+
)
|
62
|
+
|
63
|
+
client = Vellum(
|
64
|
+
api_version="YOUR_API_VERSION",
|
65
|
+
api_key="YOUR_API_KEY",
|
66
|
+
)
|
67
|
+
client.events.create(
|
68
|
+
request=NodeExecutionInitiatedEvent(
|
69
|
+
body=NodeExecutionInitiatedBody(
|
70
|
+
node_definition=VellumCodeResourceDefinition(
|
71
|
+
name="name",
|
72
|
+
module=["module", "module"],
|
73
|
+
id="id",
|
74
|
+
),
|
75
|
+
inputs={"inputs": {"key": "value"}},
|
76
|
+
),
|
77
|
+
id="id",
|
78
|
+
timestamp=datetime.datetime.fromisoformat(
|
79
|
+
"2024-01-15 09:30:00+00:00",
|
80
|
+
),
|
81
|
+
trace_id="trace_id",
|
82
|
+
span_id="span_id",
|
83
|
+
),
|
84
|
+
)
|
85
|
+
"""
|
86
|
+
_response = self._raw_client.create(request=request, request_options=request_options)
|
87
|
+
return _response.data
|
88
|
+
|
89
|
+
|
90
|
+
class AsyncEventsClient:
|
91
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
92
|
+
self._raw_client = AsyncRawEventsClient(client_wrapper=client_wrapper)
|
93
|
+
|
94
|
+
@property
|
95
|
+
def with_raw_response(self) -> AsyncRawEventsClient:
|
96
|
+
"""
|
97
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
98
|
+
|
99
|
+
Returns
|
100
|
+
-------
|
101
|
+
AsyncRawEventsClient
|
102
|
+
"""
|
103
|
+
return self._raw_client
|
104
|
+
|
105
|
+
async def create(
|
106
|
+
self, *, request: WorkflowEvent, request_options: typing.Optional[RequestOptions] = None
|
107
|
+
) -> EventCreateResponse:
|
108
|
+
"""
|
109
|
+
Accept an event and publish it to ClickHouse for analytics processing.
|
110
|
+
|
111
|
+
Parameters
|
112
|
+
----------
|
113
|
+
request : WorkflowEvent
|
114
|
+
|
115
|
+
request_options : typing.Optional[RequestOptions]
|
116
|
+
Request-specific configuration.
|
117
|
+
|
118
|
+
Returns
|
119
|
+
-------
|
120
|
+
EventCreateResponse
|
121
|
+
|
122
|
+
|
123
|
+
Examples
|
124
|
+
--------
|
125
|
+
import asyncio
|
126
|
+
import datetime
|
127
|
+
|
128
|
+
from vellum import (
|
129
|
+
AsyncVellum,
|
130
|
+
NodeExecutionInitiatedBody,
|
131
|
+
NodeExecutionInitiatedEvent,
|
132
|
+
VellumCodeResourceDefinition,
|
133
|
+
)
|
134
|
+
|
135
|
+
client = AsyncVellum(
|
136
|
+
api_version="YOUR_API_VERSION",
|
137
|
+
api_key="YOUR_API_KEY",
|
138
|
+
)
|
139
|
+
|
140
|
+
|
141
|
+
async def main() -> None:
|
142
|
+
await client.events.create(
|
143
|
+
request=NodeExecutionInitiatedEvent(
|
144
|
+
body=NodeExecutionInitiatedBody(
|
145
|
+
node_definition=VellumCodeResourceDefinition(
|
146
|
+
name="name",
|
147
|
+
module=["module", "module"],
|
148
|
+
id="id",
|
149
|
+
),
|
150
|
+
inputs={"inputs": {"key": "value"}},
|
151
|
+
),
|
152
|
+
id="id",
|
153
|
+
timestamp=datetime.datetime.fromisoformat(
|
154
|
+
"2024-01-15 09:30:00+00:00",
|
155
|
+
),
|
156
|
+
trace_id="trace_id",
|
157
|
+
span_id="span_id",
|
158
|
+
),
|
159
|
+
)
|
160
|
+
|
161
|
+
|
162
|
+
asyncio.run(main())
|
163
|
+
"""
|
164
|
+
_response = await self._raw_client.create(request=request, request_options=request_options)
|
165
|
+
return _response.data
|
@@ -0,0 +1,207 @@
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
2
|
+
|
3
|
+
import typing
|
4
|
+
from json.decoder import JSONDecodeError
|
5
|
+
|
6
|
+
from ...core.api_error import ApiError
|
7
|
+
from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
8
|
+
from ...core.http_response import AsyncHttpResponse, HttpResponse
|
9
|
+
from ...core.pydantic_utilities import parse_obj_as
|
10
|
+
from ...core.request_options import RequestOptions
|
11
|
+
from ...core.serialization import convert_and_respect_annotation_metadata
|
12
|
+
from ...errors.bad_request_error import BadRequestError
|
13
|
+
from ...errors.forbidden_error import ForbiddenError
|
14
|
+
from ...errors.too_many_requests_error import TooManyRequestsError
|
15
|
+
from ...errors.unauthorized_error import UnauthorizedError
|
16
|
+
from ...types.error_detail_response import ErrorDetailResponse
|
17
|
+
from ...types.event_create_response import EventCreateResponse
|
18
|
+
from ...types.workflow_event import WorkflowEvent
|
19
|
+
|
20
|
+
# this is used as the default value for optional parameters
|
21
|
+
OMIT = typing.cast(typing.Any, ...)
|
22
|
+
|
23
|
+
|
24
|
+
class RawEventsClient:
|
25
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
26
|
+
self._client_wrapper = client_wrapper
|
27
|
+
|
28
|
+
def create(
|
29
|
+
self, *, request: WorkflowEvent, request_options: typing.Optional[RequestOptions] = None
|
30
|
+
) -> HttpResponse[EventCreateResponse]:
|
31
|
+
"""
|
32
|
+
Accept an event and publish it to ClickHouse for analytics processing.
|
33
|
+
|
34
|
+
Parameters
|
35
|
+
----------
|
36
|
+
request : WorkflowEvent
|
37
|
+
|
38
|
+
request_options : typing.Optional[RequestOptions]
|
39
|
+
Request-specific configuration.
|
40
|
+
|
41
|
+
Returns
|
42
|
+
-------
|
43
|
+
HttpResponse[EventCreateResponse]
|
44
|
+
|
45
|
+
"""
|
46
|
+
_response = self._client_wrapper.httpx_client.request(
|
47
|
+
"monitoring/v1/events",
|
48
|
+
base_url=self._client_wrapper.get_environment().default,
|
49
|
+
method="POST",
|
50
|
+
json=convert_and_respect_annotation_metadata(object_=request, annotation=WorkflowEvent, direction="write"),
|
51
|
+
headers={
|
52
|
+
"content-type": "application/json",
|
53
|
+
},
|
54
|
+
request_options=request_options,
|
55
|
+
omit=OMIT,
|
56
|
+
)
|
57
|
+
try:
|
58
|
+
if 200 <= _response.status_code < 300:
|
59
|
+
_data = typing.cast(
|
60
|
+
EventCreateResponse,
|
61
|
+
parse_obj_as(
|
62
|
+
type_=EventCreateResponse, # type: ignore
|
63
|
+
object_=_response.json(),
|
64
|
+
),
|
65
|
+
)
|
66
|
+
return HttpResponse(response=_response, data=_data)
|
67
|
+
if _response.status_code == 400:
|
68
|
+
raise BadRequestError(
|
69
|
+
headers=dict(_response.headers),
|
70
|
+
body=typing.cast(
|
71
|
+
typing.Optional[typing.Any],
|
72
|
+
parse_obj_as(
|
73
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
74
|
+
object_=_response.json(),
|
75
|
+
),
|
76
|
+
),
|
77
|
+
)
|
78
|
+
if _response.status_code == 401:
|
79
|
+
raise UnauthorizedError(
|
80
|
+
headers=dict(_response.headers),
|
81
|
+
body=typing.cast(
|
82
|
+
ErrorDetailResponse,
|
83
|
+
parse_obj_as(
|
84
|
+
type_=ErrorDetailResponse, # type: ignore
|
85
|
+
object_=_response.json(),
|
86
|
+
),
|
87
|
+
),
|
88
|
+
)
|
89
|
+
if _response.status_code == 403:
|
90
|
+
raise ForbiddenError(
|
91
|
+
headers=dict(_response.headers),
|
92
|
+
body=typing.cast(
|
93
|
+
typing.Optional[typing.Any],
|
94
|
+
parse_obj_as(
|
95
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
96
|
+
object_=_response.json(),
|
97
|
+
),
|
98
|
+
),
|
99
|
+
)
|
100
|
+
if _response.status_code == 429:
|
101
|
+
raise TooManyRequestsError(
|
102
|
+
headers=dict(_response.headers),
|
103
|
+
body=typing.cast(
|
104
|
+
ErrorDetailResponse,
|
105
|
+
parse_obj_as(
|
106
|
+
type_=ErrorDetailResponse, # type: ignore
|
107
|
+
object_=_response.json(),
|
108
|
+
),
|
109
|
+
),
|
110
|
+
)
|
111
|
+
_response_json = _response.json()
|
112
|
+
except JSONDecodeError:
|
113
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
114
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
115
|
+
|
116
|
+
|
117
|
+
class AsyncRawEventsClient:
|
118
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
119
|
+
self._client_wrapper = client_wrapper
|
120
|
+
|
121
|
+
async def create(
|
122
|
+
self, *, request: WorkflowEvent, request_options: typing.Optional[RequestOptions] = None
|
123
|
+
) -> AsyncHttpResponse[EventCreateResponse]:
|
124
|
+
"""
|
125
|
+
Accept an event and publish it to ClickHouse for analytics processing.
|
126
|
+
|
127
|
+
Parameters
|
128
|
+
----------
|
129
|
+
request : WorkflowEvent
|
130
|
+
|
131
|
+
request_options : typing.Optional[RequestOptions]
|
132
|
+
Request-specific configuration.
|
133
|
+
|
134
|
+
Returns
|
135
|
+
-------
|
136
|
+
AsyncHttpResponse[EventCreateResponse]
|
137
|
+
|
138
|
+
"""
|
139
|
+
_response = await self._client_wrapper.httpx_client.request(
|
140
|
+
"monitoring/v1/events",
|
141
|
+
base_url=self._client_wrapper.get_environment().default,
|
142
|
+
method="POST",
|
143
|
+
json=convert_and_respect_annotation_metadata(object_=request, annotation=WorkflowEvent, direction="write"),
|
144
|
+
headers={
|
145
|
+
"content-type": "application/json",
|
146
|
+
},
|
147
|
+
request_options=request_options,
|
148
|
+
omit=OMIT,
|
149
|
+
)
|
150
|
+
try:
|
151
|
+
if 200 <= _response.status_code < 300:
|
152
|
+
_data = typing.cast(
|
153
|
+
EventCreateResponse,
|
154
|
+
parse_obj_as(
|
155
|
+
type_=EventCreateResponse, # type: ignore
|
156
|
+
object_=_response.json(),
|
157
|
+
),
|
158
|
+
)
|
159
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
160
|
+
if _response.status_code == 400:
|
161
|
+
raise BadRequestError(
|
162
|
+
headers=dict(_response.headers),
|
163
|
+
body=typing.cast(
|
164
|
+
typing.Optional[typing.Any],
|
165
|
+
parse_obj_as(
|
166
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
167
|
+
object_=_response.json(),
|
168
|
+
),
|
169
|
+
),
|
170
|
+
)
|
171
|
+
if _response.status_code == 401:
|
172
|
+
raise UnauthorizedError(
|
173
|
+
headers=dict(_response.headers),
|
174
|
+
body=typing.cast(
|
175
|
+
ErrorDetailResponse,
|
176
|
+
parse_obj_as(
|
177
|
+
type_=ErrorDetailResponse, # type: ignore
|
178
|
+
object_=_response.json(),
|
179
|
+
),
|
180
|
+
),
|
181
|
+
)
|
182
|
+
if _response.status_code == 403:
|
183
|
+
raise ForbiddenError(
|
184
|
+
headers=dict(_response.headers),
|
185
|
+
body=typing.cast(
|
186
|
+
typing.Optional[typing.Any],
|
187
|
+
parse_obj_as(
|
188
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
189
|
+
object_=_response.json(),
|
190
|
+
),
|
191
|
+
),
|
192
|
+
)
|
193
|
+
if _response.status_code == 429:
|
194
|
+
raise TooManyRequestsError(
|
195
|
+
headers=dict(_response.headers),
|
196
|
+
body=typing.cast(
|
197
|
+
ErrorDetailResponse,
|
198
|
+
parse_obj_as(
|
199
|
+
type_=ErrorDetailResponse, # type: ignore
|
200
|
+
object_=_response.json(),
|
201
|
+
),
|
202
|
+
),
|
203
|
+
)
|
204
|
+
_response_json = _response.json()
|
205
|
+
except JSONDecodeError:
|
206
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
207
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
vellum/client/types/__init__.py
CHANGED
@@ -107,9 +107,11 @@ from .entity_visibility import EntityVisibility
|
|
107
107
|
from .environment_enum import EnvironmentEnum
|
108
108
|
from .ephemeral_prompt_cache_config import EphemeralPromptCacheConfig
|
109
109
|
from .ephemeral_prompt_cache_config_type_enum import EphemeralPromptCacheConfigTypeEnum
|
110
|
+
from .error_detail_response import ErrorDetailResponse
|
110
111
|
from .error_input import ErrorInput
|
111
112
|
from .error_vellum_value import ErrorVellumValue
|
112
113
|
from .error_vellum_value_request import ErrorVellumValueRequest
|
114
|
+
from .event_create_response import EventCreateResponse
|
113
115
|
from .execute_api_request_bearer_token import ExecuteApiRequestBearerToken
|
114
116
|
from .execute_api_request_body import ExecuteApiRequestBody
|
115
117
|
from .execute_api_request_headers_value import ExecuteApiRequestHeadersValue
|
@@ -567,6 +569,7 @@ from .workflow_deployment_release import WorkflowDeploymentRelease
|
|
567
569
|
from .workflow_deployment_release_workflow_deployment import WorkflowDeploymentReleaseWorkflowDeployment
|
568
570
|
from .workflow_deployment_release_workflow_version import WorkflowDeploymentReleaseWorkflowVersion
|
569
571
|
from .workflow_error import WorkflowError
|
572
|
+
from .workflow_event import WorkflowEvent
|
570
573
|
from .workflow_event_error import WorkflowEventError
|
571
574
|
from .workflow_event_execution_read import WorkflowEventExecutionRead
|
572
575
|
from .workflow_execution_actual import WorkflowExecutionActual
|
@@ -739,9 +742,11 @@ __all__ = [
|
|
739
742
|
"EnvironmentEnum",
|
740
743
|
"EphemeralPromptCacheConfig",
|
741
744
|
"EphemeralPromptCacheConfigTypeEnum",
|
745
|
+
"ErrorDetailResponse",
|
742
746
|
"ErrorInput",
|
743
747
|
"ErrorVellumValue",
|
744
748
|
"ErrorVellumValueRequest",
|
749
|
+
"EventCreateResponse",
|
745
750
|
"ExecuteApiRequestBearerToken",
|
746
751
|
"ExecuteApiRequestBody",
|
747
752
|
"ExecuteApiRequestHeadersValue",
|
@@ -1179,6 +1184,7 @@ __all__ = [
|
|
1179
1184
|
"WorkflowDeploymentReleaseWorkflowDeployment",
|
1180
1185
|
"WorkflowDeploymentReleaseWorkflowVersion",
|
1181
1186
|
"WorkflowError",
|
1187
|
+
"WorkflowEvent",
|
1182
1188
|
"WorkflowEventError",
|
1183
1189
|
"WorkflowEventExecutionRead",
|
1184
1190
|
"WorkflowExecutionActual",
|