vellum-ai 0.8.23__py3-none-any.whl → 0.8.26__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 +34 -0
- vellum/client.py +4 -0
- vellum/core/client_wrapper.py +1 -1
- vellum/lib/test_suites/resources.py +27 -8
- vellum/lib/utils/typing.py +10 -0
- vellum/lib/utils/uuid.py +10 -0
- vellum/resources/__init__.py +4 -0
- vellum/resources/ad_hoc/client.py +21 -0
- vellum/resources/folder_entities/__init__.py +3 -0
- vellum/resources/folder_entities/client.py +200 -3
- vellum/resources/folder_entities/types/__init__.py +5 -0
- vellum/resources/folder_entities/types/folder_entities_list_request_entity_status.py +5 -0
- vellum/resources/workspace_secrets/__init__.py +2 -0
- vellum/resources/workspace_secrets/client.py +127 -0
- vellum/types/__init__.py +30 -0
- vellum/types/api_node_result_data.py +4 -4
- vellum/types/folder_entity.py +16 -0
- vellum/types/folder_entity_document_index.py +26 -0
- vellum/types/folder_entity_document_index_data.py +25 -0
- vellum/types/folder_entity_folder.py +26 -0
- vellum/types/folder_entity_folder_data.py +24 -0
- vellum/types/folder_entity_prompt_sandbox.py +26 -0
- vellum/types/folder_entity_prompt_sandbox_data.py +26 -0
- vellum/types/folder_entity_test_suite.py +26 -0
- vellum/types/folder_entity_test_suite_data.py +25 -0
- vellum/types/folder_entity_workflow_sandbox.py +26 -0
- vellum/types/folder_entity_workflow_sandbox_data.py +26 -0
- vellum/types/paginated_folder_entity_list.py +23 -0
- vellum/types/prompt_settings_request.py +19 -0
- vellum/types/secret_type_enum.py +5 -0
- vellum/types/vellum_error_code_enum.py +4 -1
- vellum/types/workspace_secret_read.py +25 -0
- {vellum_ai-0.8.23.dist-info → vellum_ai-0.8.26.dist-info}/METADATA +1 -1
- {vellum_ai-0.8.23.dist-info → vellum_ai-0.8.26.dist-info}/RECORD +36 -15
- {vellum_ai-0.8.23.dist-info → vellum_ai-0.8.26.dist-info}/LICENSE +0 -0
- {vellum_ai-0.8.23.dist-info → vellum_ai-0.8.26.dist-info}/WHEEL +0 -0
vellum/__init__.py
CHANGED
@@ -99,6 +99,17 @@ from .types import (
|
|
99
99
|
ExternalTestCaseExecution,
|
100
100
|
ExternalTestCaseExecutionRequest,
|
101
101
|
FinishReasonEnum,
|
102
|
+
FolderEntity,
|
103
|
+
FolderEntityDocumentIndex,
|
104
|
+
FolderEntityDocumentIndexData,
|
105
|
+
FolderEntityFolder,
|
106
|
+
FolderEntityFolderData,
|
107
|
+
FolderEntityPromptSandbox,
|
108
|
+
FolderEntityPromptSandboxData,
|
109
|
+
FolderEntityTestSuite,
|
110
|
+
FolderEntityTestSuiteData,
|
111
|
+
FolderEntityWorkflowSandbox,
|
112
|
+
FolderEntityWorkflowSandboxData,
|
102
113
|
FulfilledAdHocExecutePromptEvent,
|
103
114
|
FulfilledEnum,
|
104
115
|
FulfilledExecutePromptEvent,
|
@@ -225,6 +236,7 @@ from .types import (
|
|
225
236
|
OpenAiVectorizerTextEmbeddingAda002,
|
226
237
|
OpenAiVectorizerTextEmbeddingAda002Request,
|
227
238
|
PaginatedDocumentIndexReadList,
|
239
|
+
PaginatedFolderEntityList,
|
228
240
|
PaginatedSlimDeploymentReadList,
|
229
241
|
PaginatedSlimDocumentList,
|
230
242
|
PaginatedSlimWorkflowDeploymentList,
|
@@ -250,6 +262,7 @@ from .types import (
|
|
250
262
|
PromptRequestInputRequest,
|
251
263
|
PromptRequestJsonInputRequest,
|
252
264
|
PromptRequestStringInputRequest,
|
265
|
+
PromptSettingsRequest,
|
253
266
|
RawPromptExecutionOverridesRequest,
|
254
267
|
ReductoChunkerConfig,
|
255
268
|
ReductoChunkerConfigRequest,
|
@@ -287,6 +300,7 @@ from .types import (
|
|
287
300
|
SearchResultsVellumValue,
|
288
301
|
SearchResultsVellumValueRequest,
|
289
302
|
SearchWeightsRequest,
|
303
|
+
SecretTypeEnum,
|
290
304
|
SentenceChunkerConfig,
|
291
305
|
SentenceChunkerConfigRequest,
|
292
306
|
SentenceChunking,
|
@@ -452,11 +466,13 @@ from .types import (
|
|
452
466
|
WorkflowResultEventOutputDataSearchResults,
|
453
467
|
WorkflowResultEventOutputDataString,
|
454
468
|
WorkflowStreamEvent,
|
469
|
+
WorkspaceSecretRead,
|
455
470
|
)
|
456
471
|
from .errors import BadRequestError, ForbiddenError, InternalServerError, NotFoundError
|
457
472
|
from .resources import (
|
458
473
|
DeploymentsListRequestStatus,
|
459
474
|
DocumentIndexesListRequestStatus,
|
475
|
+
FolderEntitiesListRequestEntityStatus,
|
460
476
|
WorkflowDeploymentsListRequestStatus,
|
461
477
|
ad_hoc,
|
462
478
|
deployments,
|
@@ -469,6 +485,7 @@ from .resources import (
|
|
469
485
|
test_suites,
|
470
486
|
workflow_deployments,
|
471
487
|
workflow_sandboxes,
|
488
|
+
workspace_secrets,
|
472
489
|
)
|
473
490
|
from .client import AsyncVellum, Vellum
|
474
491
|
from .environment import VellumEnvironment
|
@@ -577,6 +594,18 @@ __all__ = [
|
|
577
594
|
"ExternalTestCaseExecution",
|
578
595
|
"ExternalTestCaseExecutionRequest",
|
579
596
|
"FinishReasonEnum",
|
597
|
+
"FolderEntitiesListRequestEntityStatus",
|
598
|
+
"FolderEntity",
|
599
|
+
"FolderEntityDocumentIndex",
|
600
|
+
"FolderEntityDocumentIndexData",
|
601
|
+
"FolderEntityFolder",
|
602
|
+
"FolderEntityFolderData",
|
603
|
+
"FolderEntityPromptSandbox",
|
604
|
+
"FolderEntityPromptSandboxData",
|
605
|
+
"FolderEntityTestSuite",
|
606
|
+
"FolderEntityTestSuiteData",
|
607
|
+
"FolderEntityWorkflowSandbox",
|
608
|
+
"FolderEntityWorkflowSandboxData",
|
580
609
|
"ForbiddenError",
|
581
610
|
"FulfilledAdHocExecutePromptEvent",
|
582
611
|
"FulfilledEnum",
|
@@ -706,6 +735,7 @@ __all__ = [
|
|
706
735
|
"OpenAiVectorizerTextEmbeddingAda002",
|
707
736
|
"OpenAiVectorizerTextEmbeddingAda002Request",
|
708
737
|
"PaginatedDocumentIndexReadList",
|
738
|
+
"PaginatedFolderEntityList",
|
709
739
|
"PaginatedSlimDeploymentReadList",
|
710
740
|
"PaginatedSlimDocumentList",
|
711
741
|
"PaginatedSlimWorkflowDeploymentList",
|
@@ -731,6 +761,7 @@ __all__ = [
|
|
731
761
|
"PromptRequestInputRequest",
|
732
762
|
"PromptRequestJsonInputRequest",
|
733
763
|
"PromptRequestStringInputRequest",
|
764
|
+
"PromptSettingsRequest",
|
734
765
|
"RawPromptExecutionOverridesRequest",
|
735
766
|
"ReductoChunkerConfig",
|
736
767
|
"ReductoChunkerConfigRequest",
|
@@ -768,6 +799,7 @@ __all__ = [
|
|
768
799
|
"SearchResultsVellumValue",
|
769
800
|
"SearchResultsVellumValueRequest",
|
770
801
|
"SearchWeightsRequest",
|
802
|
+
"SecretTypeEnum",
|
771
803
|
"SentenceChunkerConfig",
|
772
804
|
"SentenceChunkerConfigRequest",
|
773
805
|
"SentenceChunking",
|
@@ -936,6 +968,7 @@ __all__ = [
|
|
936
968
|
"WorkflowResultEventOutputDataSearchResults",
|
937
969
|
"WorkflowResultEventOutputDataString",
|
938
970
|
"WorkflowStreamEvent",
|
971
|
+
"WorkspaceSecretRead",
|
939
972
|
"__version__",
|
940
973
|
"ad_hoc",
|
941
974
|
"deployments",
|
@@ -948,4 +981,5 @@ __all__ = [
|
|
948
981
|
"test_suites",
|
949
982
|
"workflow_deployments",
|
950
983
|
"workflow_sandboxes",
|
984
|
+
"workspace_secrets",
|
951
985
|
]
|
vellum/client.py
CHANGED
@@ -15,6 +15,7 @@ from .resources.test_suite_runs.client import TestSuiteRunsClient
|
|
15
15
|
from .resources.test_suites.client import TestSuitesClient
|
16
16
|
from .resources.workflow_deployments.client import WorkflowDeploymentsClient
|
17
17
|
from .resources.workflow_sandboxes.client import WorkflowSandboxesClient
|
18
|
+
from .resources.workspace_secrets.client import WorkspaceSecretsClient
|
18
19
|
from .types.code_execution_runtime import CodeExecutionRuntime
|
19
20
|
from .types.code_executor_input_request import CodeExecutorInputRequest
|
20
21
|
from .types.code_execution_package_request import CodeExecutionPackageRequest
|
@@ -60,6 +61,7 @@ from .resources.test_suite_runs.client import AsyncTestSuiteRunsClient
|
|
60
61
|
from .resources.test_suites.client import AsyncTestSuitesClient
|
61
62
|
from .resources.workflow_deployments.client import AsyncWorkflowDeploymentsClient
|
62
63
|
from .resources.workflow_sandboxes.client import AsyncWorkflowSandboxesClient
|
64
|
+
from .resources.workspace_secrets.client import AsyncWorkspaceSecretsClient
|
63
65
|
|
64
66
|
# this is used as the default value for optional parameters
|
65
67
|
OMIT = typing.cast(typing.Any, ...)
|
@@ -130,6 +132,7 @@ class Vellum:
|
|
130
132
|
self.test_suites = TestSuitesClient(client_wrapper=self._client_wrapper)
|
131
133
|
self.workflow_deployments = WorkflowDeploymentsClient(client_wrapper=self._client_wrapper)
|
132
134
|
self.workflow_sandboxes = WorkflowSandboxesClient(client_wrapper=self._client_wrapper)
|
135
|
+
self.workspace_secrets = WorkspaceSecretsClient(client_wrapper=self._client_wrapper)
|
133
136
|
|
134
137
|
def execute_code(
|
135
138
|
self,
|
@@ -1446,6 +1449,7 @@ class AsyncVellum:
|
|
1446
1449
|
self.test_suites = AsyncTestSuitesClient(client_wrapper=self._client_wrapper)
|
1447
1450
|
self.workflow_deployments = AsyncWorkflowDeploymentsClient(client_wrapper=self._client_wrapper)
|
1448
1451
|
self.workflow_sandboxes = AsyncWorkflowSandboxesClient(client_wrapper=self._client_wrapper)
|
1452
|
+
self.workspace_secrets = AsyncWorkspaceSecretsClient(client_wrapper=self._client_wrapper)
|
1449
1453
|
|
1450
1454
|
async def execute_code(
|
1451
1455
|
self,
|
vellum/core/client_wrapper.py
CHANGED
@@ -17,7 +17,7 @@ class BaseClientWrapper:
|
|
17
17
|
headers: typing.Dict[str, str] = {
|
18
18
|
"X-Fern-Language": "Python",
|
19
19
|
"X-Fern-SDK-Name": "vellum-ai",
|
20
|
-
"X-Fern-SDK-Version": "0.8.
|
20
|
+
"X-Fern-SDK-Version": "0.8.26",
|
21
21
|
}
|
22
22
|
headers["X_API_KEY"] = self.api_key
|
23
23
|
return headers
|
@@ -4,9 +4,10 @@ import logging
|
|
4
4
|
import time
|
5
5
|
from functools import cached_property
|
6
6
|
from typing import Callable, Generator, List, cast, Iterable
|
7
|
+
from uuid import UUID
|
7
8
|
|
8
9
|
from vellum import TestSuiteRunRead, TestSuiteRunMetricNumberOutput
|
9
|
-
from vellum.client import Vellum
|
10
|
+
from vellum.client import Vellum, OMIT
|
10
11
|
from vellum.lib.test_suites.constants import (
|
11
12
|
DEFAULT_MAX_POLLING_DURATION_MS,
|
12
13
|
DEFAULT_POLLING_INTERVAL_MS,
|
@@ -14,6 +15,8 @@ from vellum.lib.test_suites.constants import (
|
|
14
15
|
from vellum.lib.test_suites.exceptions import TestSuiteRunResultsException
|
15
16
|
from vellum.lib.utils.env import get_api_key
|
16
17
|
from vellum.lib.utils.paginator import PaginatedResults, get_all_results
|
18
|
+
from vellum.lib.utils.typing import cast_not_optional
|
19
|
+
from vellum.lib.utils.uuid import is_valid_uuid
|
17
20
|
from vellum.types import (
|
18
21
|
ExternalTestCaseExecutionRequest,
|
19
22
|
NamedTestCaseVariableValueRequest,
|
@@ -198,7 +201,9 @@ class VellumTestSuiteRunResults:
|
|
198
201
|
output_values = self.get_numeric_metric_output_values(
|
199
202
|
metric_identifier=metric_identifier, output_identifier=output_identifier
|
200
203
|
)
|
201
|
-
return sum(
|
204
|
+
return sum(
|
205
|
+
cast(Iterable[float], filter(lambda o: isinstance(o, float), output_values))
|
206
|
+
) / len(output_values)
|
202
207
|
|
203
208
|
def get_min_metric_output(
|
204
209
|
self, metric_identifier: str | None = None, output_identifier: str | None = None
|
@@ -207,7 +212,9 @@ class VellumTestSuiteRunResults:
|
|
207
212
|
output_values = self.get_numeric_metric_output_values(
|
208
213
|
metric_identifier=metric_identifier, output_identifier=output_identifier
|
209
214
|
)
|
210
|
-
return min(
|
215
|
+
return min(
|
216
|
+
cast(Iterable[float], filter(lambda o: isinstance(o, float), output_values))
|
217
|
+
)
|
211
218
|
|
212
219
|
def get_max_metric_output(
|
213
220
|
self, metric_identifier: str | None = None, output_identifier: str | None = None
|
@@ -216,7 +223,9 @@ class VellumTestSuiteRunResults:
|
|
216
223
|
output_values = self.get_numeric_metric_output_values(
|
217
224
|
metric_identifier=metric_identifier, output_identifier=output_identifier
|
218
225
|
)
|
219
|
-
return max(
|
226
|
+
return max(
|
227
|
+
cast(Iterable[float], filter(lambda o: isinstance(o, float), output_values))
|
228
|
+
)
|
220
229
|
|
221
230
|
def wait_until_complete(self) -> None:
|
222
231
|
"""Wait until the Test Suite Run is no longer in a QUEUED or RUNNING state."""
|
@@ -282,16 +291,25 @@ class VellumTestSuiteRunResults:
|
|
282
291
|
class VellumTestSuite:
|
283
292
|
"""A utility class that provides methods for running a Vellum Test Suite and interacting with its results."""
|
284
293
|
|
294
|
+
_test_suite_id: str | None
|
295
|
+
_test_suite_name: str | None
|
296
|
+
|
285
297
|
def __init__(
|
286
298
|
self,
|
287
|
-
|
299
|
+
test_suite_identifier: str | UUID,
|
288
300
|
*,
|
289
301
|
client: Vellum | None = None,
|
290
302
|
) -> None:
|
291
303
|
self.client = client or Vellum(
|
292
304
|
api_key=get_api_key(),
|
293
305
|
)
|
294
|
-
|
306
|
+
|
307
|
+
if is_valid_uuid(test_suite_identifier):
|
308
|
+
self._test_suite_id = str(test_suite_identifier)
|
309
|
+
self._test_suite_name = None
|
310
|
+
else:
|
311
|
+
self._test_suite_id = None
|
312
|
+
self._test_suite_name = str(test_suite_identifier)
|
295
313
|
|
296
314
|
def run_external(
|
297
315
|
self,
|
@@ -305,7 +323,7 @@ class VellumTestSuite:
|
|
305
323
|
Returns a wrapper that polls the generated Test Suite Run until it's done running and returns its results.
|
306
324
|
"""
|
307
325
|
test_cases = self.client.test_suites.list_test_suite_test_cases(
|
308
|
-
id=self._test_suite_id
|
326
|
+
id=cast_not_optional(self._test_suite_id or self._test_suite_name)
|
309
327
|
)
|
310
328
|
executions: List[ExternalTestCaseExecutionRequest] = []
|
311
329
|
|
@@ -320,7 +338,8 @@ class VellumTestSuite:
|
|
320
338
|
)
|
321
339
|
|
322
340
|
test_suite_run = self.client.test_suite_runs.create(
|
323
|
-
test_suite_id=self._test_suite_id,
|
341
|
+
test_suite_id=self._test_suite_id or OMIT,
|
342
|
+
test_suite_name=self._test_suite_name or OMIT,
|
324
343
|
exec_config=TestSuiteRunExternalExecConfigRequest(
|
325
344
|
type="EXTERNAL",
|
326
345
|
data=TestSuiteRunExternalExecConfigDataRequest(
|
@@ -0,0 +1,10 @@
|
|
1
|
+
from typing import TypeVar, Optional
|
2
|
+
|
3
|
+
_T = TypeVar("_T")
|
4
|
+
|
5
|
+
|
6
|
+
def cast_not_optional(optional: Optional[_T]) -> _T:
|
7
|
+
"""Convert an optional to its value for type checking purposes. Raises an AssertionError if passed None."""
|
8
|
+
if optional is None:
|
9
|
+
raise AssertionError("Not optional check failed")
|
10
|
+
return optional
|
vellum/lib/utils/uuid.py
ADDED
vellum/resources/__init__.py
CHANGED
@@ -12,14 +12,17 @@ from . import (
|
|
12
12
|
test_suites,
|
13
13
|
workflow_deployments,
|
14
14
|
workflow_sandboxes,
|
15
|
+
workspace_secrets,
|
15
16
|
)
|
16
17
|
from .deployments import DeploymentsListRequestStatus
|
17
18
|
from .document_indexes import DocumentIndexesListRequestStatus
|
19
|
+
from .folder_entities import FolderEntitiesListRequestEntityStatus
|
18
20
|
from .workflow_deployments import WorkflowDeploymentsListRequestStatus
|
19
21
|
|
20
22
|
__all__ = [
|
21
23
|
"DeploymentsListRequestStatus",
|
22
24
|
"DocumentIndexesListRequestStatus",
|
25
|
+
"FolderEntitiesListRequestEntityStatus",
|
23
26
|
"WorkflowDeploymentsListRequestStatus",
|
24
27
|
"ad_hoc",
|
25
28
|
"deployments",
|
@@ -32,4 +35,5 @@ __all__ = [
|
|
32
35
|
"test_suites",
|
33
36
|
"workflow_deployments",
|
34
37
|
"workflow_sandboxes",
|
38
|
+
"workspace_secrets",
|
35
39
|
]
|
@@ -6,6 +6,7 @@ from ...types.prompt_request_input_request import PromptRequestInputRequest
|
|
6
6
|
from ...types.vellum_variable_request import VellumVariableRequest
|
7
7
|
from ...types.prompt_parameters_request import PromptParametersRequest
|
8
8
|
from ...types.prompt_block_request import PromptBlockRequest
|
9
|
+
from ...types.prompt_settings_request import PromptSettingsRequest
|
9
10
|
from ...types.ad_hoc_expand_meta_request import AdHocExpandMetaRequest
|
10
11
|
from ...core.request_options import RequestOptions
|
11
12
|
from ...types.ad_hoc_execute_prompt_event import AdHocExecutePromptEvent
|
@@ -35,6 +36,7 @@ class AdHocClient:
|
|
35
36
|
input_variables: typing.Sequence[VellumVariableRequest],
|
36
37
|
parameters: PromptParametersRequest,
|
37
38
|
blocks: typing.Sequence[PromptBlockRequest],
|
39
|
+
settings: typing.Optional[PromptSettingsRequest] = OMIT,
|
38
40
|
expand_meta: typing.Optional[AdHocExpandMetaRequest] = OMIT,
|
39
41
|
request_options: typing.Optional[RequestOptions] = None,
|
40
42
|
) -> typing.Iterator[AdHocExecutePromptEvent]:
|
@@ -53,6 +55,8 @@ class AdHocClient:
|
|
53
55
|
|
54
56
|
blocks : typing.Sequence[PromptBlockRequest]
|
55
57
|
|
58
|
+
settings : typing.Optional[PromptSettingsRequest]
|
59
|
+
|
56
60
|
expand_meta : typing.Optional[AdHocExpandMetaRequest]
|
57
61
|
|
58
62
|
request_options : typing.Optional[RequestOptions]
|
@@ -72,6 +76,7 @@ class AdHocClient:
|
|
72
76
|
JinjaPromptBlockRequest,
|
73
77
|
PromptParametersRequest,
|
74
78
|
PromptRequestStringInputRequest,
|
79
|
+
PromptSettingsRequest,
|
75
80
|
StringVellumValueRequest,
|
76
81
|
Vellum,
|
77
82
|
VellumVariableExtensionsRequest,
|
@@ -114,6 +119,9 @@ class AdHocClient:
|
|
114
119
|
logit_bias={"string": {"key": "value"}},
|
115
120
|
custom_parameters={"string": {"key": "value"}},
|
116
121
|
),
|
122
|
+
settings=PromptSettingsRequest(
|
123
|
+
timeout=1.1,
|
124
|
+
),
|
117
125
|
blocks=[
|
118
126
|
JinjaPromptBlockRequest(
|
119
127
|
properties=JinjaPromptBlockPropertiesRequest(
|
@@ -152,6 +160,9 @@ class AdHocClient:
|
|
152
160
|
"parameters": convert_and_respect_annotation_metadata(
|
153
161
|
object_=parameters, annotation=PromptParametersRequest, direction="write"
|
154
162
|
),
|
163
|
+
"settings": convert_and_respect_annotation_metadata(
|
164
|
+
object_=settings, annotation=PromptSettingsRequest, direction="write"
|
165
|
+
),
|
155
166
|
"blocks": convert_and_respect_annotation_metadata(
|
156
167
|
object_=blocks, annotation=typing.Sequence[PromptBlockRequest], direction="write"
|
157
168
|
),
|
@@ -227,6 +238,7 @@ class AsyncAdHocClient:
|
|
227
238
|
input_variables: typing.Sequence[VellumVariableRequest],
|
228
239
|
parameters: PromptParametersRequest,
|
229
240
|
blocks: typing.Sequence[PromptBlockRequest],
|
241
|
+
settings: typing.Optional[PromptSettingsRequest] = OMIT,
|
230
242
|
expand_meta: typing.Optional[AdHocExpandMetaRequest] = OMIT,
|
231
243
|
request_options: typing.Optional[RequestOptions] = None,
|
232
244
|
) -> typing.AsyncIterator[AdHocExecutePromptEvent]:
|
@@ -245,6 +257,8 @@ class AsyncAdHocClient:
|
|
245
257
|
|
246
258
|
blocks : typing.Sequence[PromptBlockRequest]
|
247
259
|
|
260
|
+
settings : typing.Optional[PromptSettingsRequest]
|
261
|
+
|
248
262
|
expand_meta : typing.Optional[AdHocExpandMetaRequest]
|
249
263
|
|
250
264
|
request_options : typing.Optional[RequestOptions]
|
@@ -267,6 +281,7 @@ class AsyncAdHocClient:
|
|
267
281
|
JinjaPromptBlockRequest,
|
268
282
|
PromptParametersRequest,
|
269
283
|
PromptRequestStringInputRequest,
|
284
|
+
PromptSettingsRequest,
|
270
285
|
StringVellumValueRequest,
|
271
286
|
VellumVariableExtensionsRequest,
|
272
287
|
VellumVariableRequest,
|
@@ -311,6 +326,9 @@ class AsyncAdHocClient:
|
|
311
326
|
logit_bias={"string": {"key": "value"}},
|
312
327
|
custom_parameters={"string": {"key": "value"}},
|
313
328
|
),
|
329
|
+
settings=PromptSettingsRequest(
|
330
|
+
timeout=1.1,
|
331
|
+
),
|
314
332
|
blocks=[
|
315
333
|
JinjaPromptBlockRequest(
|
316
334
|
properties=JinjaPromptBlockPropertiesRequest(
|
@@ -352,6 +370,9 @@ class AsyncAdHocClient:
|
|
352
370
|
"parameters": convert_and_respect_annotation_metadata(
|
353
371
|
object_=parameters, annotation=PromptParametersRequest, direction="write"
|
354
372
|
),
|
373
|
+
"settings": convert_and_respect_annotation_metadata(
|
374
|
+
object_=settings, annotation=PromptSettingsRequest, direction="write"
|
375
|
+
),
|
355
376
|
"blocks": convert_and_respect_annotation_metadata(
|
356
377
|
object_=blocks, annotation=typing.Sequence[PromptBlockRequest], direction="write"
|
357
378
|
),
|
@@ -2,10 +2,13 @@
|
|
2
2
|
|
3
3
|
import typing
|
4
4
|
from ...core.client_wrapper import SyncClientWrapper
|
5
|
+
from .types.folder_entities_list_request_entity_status import FolderEntitiesListRequestEntityStatus
|
5
6
|
from ...core.request_options import RequestOptions
|
6
|
-
from ...
|
7
|
+
from ...types.paginated_folder_entity_list import PaginatedFolderEntityList
|
8
|
+
from ...core.pydantic_utilities import parse_obj_as
|
7
9
|
from json.decoder import JSONDecodeError
|
8
10
|
from ...core.api_error import ApiError
|
11
|
+
from ...core.jsonable_encoder import jsonable_encoder
|
9
12
|
from ...core.client_wrapper import AsyncClientWrapper
|
10
13
|
|
11
14
|
# this is used as the default value for optional parameters
|
@@ -16,6 +19,93 @@ class FolderEntitiesClient:
|
|
16
19
|
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
17
20
|
self._client_wrapper = client_wrapper
|
18
21
|
|
22
|
+
def list(
|
23
|
+
self,
|
24
|
+
*,
|
25
|
+
parent_folder_id: str,
|
26
|
+
entity_status: typing.Optional[FolderEntitiesListRequestEntityStatus] = None,
|
27
|
+
limit: typing.Optional[int] = None,
|
28
|
+
offset: typing.Optional[int] = None,
|
29
|
+
ordering: typing.Optional[str] = None,
|
30
|
+
request_options: typing.Optional[RequestOptions] = None,
|
31
|
+
) -> PaginatedFolderEntityList:
|
32
|
+
"""
|
33
|
+
List all folder entities within a specified folder.
|
34
|
+
|
35
|
+
Parameters
|
36
|
+
----------
|
37
|
+
parent_folder_id : str
|
38
|
+
Filter down to only those entities whose parent folder has the specified ID.
|
39
|
+
|
40
|
+
To filter by an entity's parent folder, provide the ID of the parent folder. To filter by the root directory, provide
|
41
|
+
a string representing the entity type of the root directory. Supported root directories include:
|
42
|
+
|
43
|
+
- PROMPT_SANDBOX
|
44
|
+
- WORKFLOW_SANDBOX
|
45
|
+
- DOCUMENT_INDEX
|
46
|
+
- TEST_SUITE
|
47
|
+
|
48
|
+
entity_status : typing.Optional[FolderEntitiesListRequestEntityStatus]
|
49
|
+
Filter down to only those objects whose entities have a status matching the status specified.
|
50
|
+
|
51
|
+
- `ACTIVE` - Active
|
52
|
+
- `ARCHIVED` - Archived
|
53
|
+
|
54
|
+
limit : typing.Optional[int]
|
55
|
+
Number of results to return per page.
|
56
|
+
|
57
|
+
offset : typing.Optional[int]
|
58
|
+
The initial index from which to return the results.
|
59
|
+
|
60
|
+
ordering : typing.Optional[str]
|
61
|
+
Which field to use when ordering the results.
|
62
|
+
|
63
|
+
request_options : typing.Optional[RequestOptions]
|
64
|
+
Request-specific configuration.
|
65
|
+
|
66
|
+
Returns
|
67
|
+
-------
|
68
|
+
PaginatedFolderEntityList
|
69
|
+
|
70
|
+
|
71
|
+
Examples
|
72
|
+
--------
|
73
|
+
from vellum import Vellum
|
74
|
+
|
75
|
+
client = Vellum(
|
76
|
+
api_key="YOUR_API_KEY",
|
77
|
+
)
|
78
|
+
client.folder_entities.list(
|
79
|
+
parent_folder_id="parent_folder_id",
|
80
|
+
)
|
81
|
+
"""
|
82
|
+
_response = self._client_wrapper.httpx_client.request(
|
83
|
+
"v1/folder-entities",
|
84
|
+
base_url=self._client_wrapper.get_environment().default,
|
85
|
+
method="GET",
|
86
|
+
params={
|
87
|
+
"entity_status": entity_status,
|
88
|
+
"limit": limit,
|
89
|
+
"offset": offset,
|
90
|
+
"ordering": ordering,
|
91
|
+
"parent_folder_id": parent_folder_id,
|
92
|
+
},
|
93
|
+
request_options=request_options,
|
94
|
+
)
|
95
|
+
try:
|
96
|
+
if 200 <= _response.status_code < 300:
|
97
|
+
return typing.cast(
|
98
|
+
PaginatedFolderEntityList,
|
99
|
+
parse_obj_as(
|
100
|
+
type_=PaginatedFolderEntityList, # type: ignore
|
101
|
+
object_=_response.json(),
|
102
|
+
),
|
103
|
+
)
|
104
|
+
_response_json = _response.json()
|
105
|
+
except JSONDecodeError:
|
106
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
107
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
108
|
+
|
19
109
|
def add_entity_to_folder(
|
20
110
|
self, folder_id: str, *, entity_id: str, request_options: typing.Optional[RequestOptions] = None
|
21
111
|
) -> None:
|
@@ -27,7 +117,13 @@ class FolderEntitiesClient:
|
|
27
117
|
Parameters
|
28
118
|
----------
|
29
119
|
folder_id : str
|
30
|
-
The ID of the folder to which the entity should be added. This can be a UUID of a folder, or the name of a root
|
120
|
+
The ID of the folder to which the entity should be added. This can be a UUID of a folder, or the name of a root
|
121
|
+
directory. Supported root directories include:
|
122
|
+
|
123
|
+
- PROMPT_SANDBOX
|
124
|
+
- WORKFLOW_SANDBOX
|
125
|
+
- DOCUMENT_INDEX
|
126
|
+
- TEST_SUITE
|
31
127
|
|
32
128
|
entity_id : str
|
33
129
|
The ID of the entity you would like to move.
|
@@ -74,6 +170,101 @@ class AsyncFolderEntitiesClient:
|
|
74
170
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
75
171
|
self._client_wrapper = client_wrapper
|
76
172
|
|
173
|
+
async def list(
|
174
|
+
self,
|
175
|
+
*,
|
176
|
+
parent_folder_id: str,
|
177
|
+
entity_status: typing.Optional[FolderEntitiesListRequestEntityStatus] = None,
|
178
|
+
limit: typing.Optional[int] = None,
|
179
|
+
offset: typing.Optional[int] = None,
|
180
|
+
ordering: typing.Optional[str] = None,
|
181
|
+
request_options: typing.Optional[RequestOptions] = None,
|
182
|
+
) -> PaginatedFolderEntityList:
|
183
|
+
"""
|
184
|
+
List all folder entities within a specified folder.
|
185
|
+
|
186
|
+
Parameters
|
187
|
+
----------
|
188
|
+
parent_folder_id : str
|
189
|
+
Filter down to only those entities whose parent folder has the specified ID.
|
190
|
+
|
191
|
+
To filter by an entity's parent folder, provide the ID of the parent folder. To filter by the root directory, provide
|
192
|
+
a string representing the entity type of the root directory. Supported root directories include:
|
193
|
+
|
194
|
+
- PROMPT_SANDBOX
|
195
|
+
- WORKFLOW_SANDBOX
|
196
|
+
- DOCUMENT_INDEX
|
197
|
+
- TEST_SUITE
|
198
|
+
|
199
|
+
entity_status : typing.Optional[FolderEntitiesListRequestEntityStatus]
|
200
|
+
Filter down to only those objects whose entities have a status matching the status specified.
|
201
|
+
|
202
|
+
- `ACTIVE` - Active
|
203
|
+
- `ARCHIVED` - Archived
|
204
|
+
|
205
|
+
limit : typing.Optional[int]
|
206
|
+
Number of results to return per page.
|
207
|
+
|
208
|
+
offset : typing.Optional[int]
|
209
|
+
The initial index from which to return the results.
|
210
|
+
|
211
|
+
ordering : typing.Optional[str]
|
212
|
+
Which field to use when ordering the results.
|
213
|
+
|
214
|
+
request_options : typing.Optional[RequestOptions]
|
215
|
+
Request-specific configuration.
|
216
|
+
|
217
|
+
Returns
|
218
|
+
-------
|
219
|
+
PaginatedFolderEntityList
|
220
|
+
|
221
|
+
|
222
|
+
Examples
|
223
|
+
--------
|
224
|
+
import asyncio
|
225
|
+
|
226
|
+
from vellum import AsyncVellum
|
227
|
+
|
228
|
+
client = AsyncVellum(
|
229
|
+
api_key="YOUR_API_KEY",
|
230
|
+
)
|
231
|
+
|
232
|
+
|
233
|
+
async def main() -> None:
|
234
|
+
await client.folder_entities.list(
|
235
|
+
parent_folder_id="parent_folder_id",
|
236
|
+
)
|
237
|
+
|
238
|
+
|
239
|
+
asyncio.run(main())
|
240
|
+
"""
|
241
|
+
_response = await self._client_wrapper.httpx_client.request(
|
242
|
+
"v1/folder-entities",
|
243
|
+
base_url=self._client_wrapper.get_environment().default,
|
244
|
+
method="GET",
|
245
|
+
params={
|
246
|
+
"entity_status": entity_status,
|
247
|
+
"limit": limit,
|
248
|
+
"offset": offset,
|
249
|
+
"ordering": ordering,
|
250
|
+
"parent_folder_id": parent_folder_id,
|
251
|
+
},
|
252
|
+
request_options=request_options,
|
253
|
+
)
|
254
|
+
try:
|
255
|
+
if 200 <= _response.status_code < 300:
|
256
|
+
return typing.cast(
|
257
|
+
PaginatedFolderEntityList,
|
258
|
+
parse_obj_as(
|
259
|
+
type_=PaginatedFolderEntityList, # type: ignore
|
260
|
+
object_=_response.json(),
|
261
|
+
),
|
262
|
+
)
|
263
|
+
_response_json = _response.json()
|
264
|
+
except JSONDecodeError:
|
265
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
266
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
267
|
+
|
77
268
|
async def add_entity_to_folder(
|
78
269
|
self, folder_id: str, *, entity_id: str, request_options: typing.Optional[RequestOptions] = None
|
79
270
|
) -> None:
|
@@ -85,7 +276,13 @@ class AsyncFolderEntitiesClient:
|
|
85
276
|
Parameters
|
86
277
|
----------
|
87
278
|
folder_id : str
|
88
|
-
The ID of the folder to which the entity should be added. This can be a UUID of a folder, or the name of a root
|
279
|
+
The ID of the folder to which the entity should be added. This can be a UUID of a folder, or the name of a root
|
280
|
+
directory. Supported root directories include:
|
281
|
+
|
282
|
+
- PROMPT_SANDBOX
|
283
|
+
- WORKFLOW_SANDBOX
|
284
|
+
- DOCUMENT_INDEX
|
285
|
+
- TEST_SUITE
|
89
286
|
|
90
287
|
entity_id : str
|
91
288
|
The ID of the entity you would like to move.
|