vellum-ai 0.1.3__py3-none-any.whl → 0.1.5__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- vellum/__init__.py +88 -0
- vellum/client.py +118 -7
- vellum/core/client_wrapper.py +1 -1
- vellum/errors/forbidden_error.py +3 -2
- vellum/resources/test_suites/client.py +25 -27
- vellum/types/__init__.py +96 -0
- vellum/types/chat_history_input_request.py +30 -0
- vellum/types/error_execute_prompt_response.py +30 -0
- vellum/types/execute_prompt_api_error_response.py +28 -0
- vellum/types/execute_prompt_response.py +43 -0
- vellum/types/json_execute_prompt_response.py +29 -0
- vellum/types/json_input_request.py +29 -0
- vellum/types/prompt_deployment_input_request.py +43 -0
- vellum/types/register_prompt_model_parameters_request.py +1 -1
- vellum/types/search_result_document_request.py +34 -0
- vellum/types/search_result_request.py +34 -0
- vellum/types/string_execute_prompt_response.py +29 -0
- vellum/types/string_input_request.py +29 -0
- vellum/types/test_case_chat_history_variable_value.py +30 -0
- vellum/types/test_case_chat_history_variable_value_request.py +30 -0
- vellum/types/test_case_error_variable_value.py +30 -0
- vellum/types/test_case_error_variable_value_request.py +30 -0
- vellum/types/test_case_json_variable_value.py +29 -0
- vellum/types/test_case_json_variable_value_request.py +29 -0
- vellum/types/test_case_number_variable_value.py +29 -0
- vellum/types/test_case_number_variable_value_request.py +29 -0
- vellum/types/test_case_search_results_variable_value.py +30 -0
- vellum/types/test_case_search_results_variable_value_request.py +30 -0
- vellum/types/test_case_string_variable_value.py +29 -0
- vellum/types/test_case_string_variable_value_request.py +29 -0
- vellum/types/test_case_variable_value.py +78 -0
- vellum/types/test_case_variable_value_request.py +78 -0
- vellum/types/test_suite_test_case.py +5 -11
- vellum/types/vellum_error_request.py +30 -0
- {vellum_ai-0.1.3.dist-info → vellum_ai-0.1.5.dist-info}/METADATA +1 -1
- {vellum_ai-0.1.3.dist-info → vellum_ai-0.1.5.dist-info}/RECORD +37 -11
- {vellum_ai-0.1.3.dist-info → vellum_ai-0.1.5.dist-info}/WHEEL +0 -0
vellum/__init__.py
CHANGED
@@ -4,6 +4,7 @@ from .types import (
|
|
4
4
|
ApiNodeResult,
|
5
5
|
ApiNodeResultData,
|
6
6
|
BlockTypeEnum,
|
7
|
+
ChatHistoryInputRequest,
|
7
8
|
ChatMessage,
|
8
9
|
ChatMessageRequest,
|
9
10
|
ChatMessageRole,
|
@@ -18,8 +19,14 @@ from .types import (
|
|
18
19
|
DocumentStatus,
|
19
20
|
EnrichedNormalizedCompletion,
|
20
21
|
EnvironmentEnum,
|
22
|
+
ErrorExecutePromptResponse,
|
21
23
|
EvaluationParams,
|
22
24
|
EvaluationParamsRequest,
|
25
|
+
ExecutePromptApiErrorResponse,
|
26
|
+
ExecutePromptResponse,
|
27
|
+
ExecutePromptResponse_Error,
|
28
|
+
ExecutePromptResponse_Json,
|
29
|
+
ExecutePromptResponse_String,
|
23
30
|
ExecuteWorkflowStreamErrorResponse,
|
24
31
|
FinishReasonEnum,
|
25
32
|
GenerateErrorResponse,
|
@@ -33,6 +40,8 @@ from .types import (
|
|
33
40
|
GenerateStreamResult,
|
34
41
|
GenerateStreamResultData,
|
35
42
|
IndexingStateEnum,
|
43
|
+
JsonExecutePromptResponse,
|
44
|
+
JsonInputRequest,
|
36
45
|
LogicalOperator,
|
37
46
|
LogprobsEnum,
|
38
47
|
MetadataFilterConfigRequest,
|
@@ -62,6 +71,10 @@ from .types import (
|
|
62
71
|
PaginatedSlimDocumentList,
|
63
72
|
ProcessingFailureReasonEnum,
|
64
73
|
ProcessingStateEnum,
|
74
|
+
PromptDeploymentInputRequest,
|
75
|
+
PromptDeploymentInputRequest_ChatHistory,
|
76
|
+
PromptDeploymentInputRequest_Json,
|
77
|
+
PromptDeploymentInputRequest_String,
|
65
78
|
PromptNodeResult,
|
66
79
|
PromptNodeResultData,
|
67
80
|
PromptTemplateBlock,
|
@@ -95,9 +108,13 @@ from .types import (
|
|
95
108
|
SearchResponse,
|
96
109
|
SearchResult,
|
97
110
|
SearchResultDocument,
|
111
|
+
SearchResultDocumentRequest,
|
98
112
|
SearchResultMergingRequest,
|
113
|
+
SearchResultRequest,
|
99
114
|
SearchWeightsRequest,
|
100
115
|
SlimDocument,
|
116
|
+
StringExecutePromptResponse,
|
117
|
+
StringInputRequest,
|
101
118
|
SubmitCompletionActualRequest,
|
102
119
|
SubmitCompletionActualsErrorResponse,
|
103
120
|
SubmitWorkflowExecutionActualRequest,
|
@@ -134,11 +151,38 @@ from .types import (
|
|
134
151
|
TerminalNodeResultOutput_String,
|
135
152
|
TerminalNodeSearchResultsResult,
|
136
153
|
TerminalNodeStringResult,
|
154
|
+
TestCaseChatHistoryVariableValue,
|
155
|
+
TestCaseChatHistoryVariableValueRequest,
|
156
|
+
TestCaseErrorVariableValue,
|
157
|
+
TestCaseErrorVariableValueRequest,
|
158
|
+
TestCaseJsonVariableValue,
|
159
|
+
TestCaseJsonVariableValueRequest,
|
160
|
+
TestCaseNumberVariableValue,
|
161
|
+
TestCaseNumberVariableValueRequest,
|
162
|
+
TestCaseSearchResultsVariableValue,
|
163
|
+
TestCaseSearchResultsVariableValueRequest,
|
164
|
+
TestCaseStringVariableValue,
|
165
|
+
TestCaseStringVariableValueRequest,
|
166
|
+
TestCaseVariableValue,
|
167
|
+
TestCaseVariableValueRequest,
|
168
|
+
TestCaseVariableValueRequest_ChatHistory,
|
169
|
+
TestCaseVariableValueRequest_Error,
|
170
|
+
TestCaseVariableValueRequest_Json,
|
171
|
+
TestCaseVariableValueRequest_Number,
|
172
|
+
TestCaseVariableValueRequest_SearchResults,
|
173
|
+
TestCaseVariableValueRequest_String,
|
174
|
+
TestCaseVariableValue_ChatHistory,
|
175
|
+
TestCaseVariableValue_Error,
|
176
|
+
TestCaseVariableValue_Json,
|
177
|
+
TestCaseVariableValue_Number,
|
178
|
+
TestCaseVariableValue_SearchResults,
|
179
|
+
TestCaseVariableValue_String,
|
137
180
|
TestSuiteTestCase,
|
138
181
|
UploadDocumentErrorResponse,
|
139
182
|
UploadDocumentResponse,
|
140
183
|
VellumError,
|
141
184
|
VellumErrorCodeEnum,
|
185
|
+
VellumErrorRequest,
|
142
186
|
VellumVariable,
|
143
187
|
VellumVariableType,
|
144
188
|
WorkflowEventError,
|
@@ -200,6 +244,7 @@ __all__ = [
|
|
200
244
|
"ApiNodeResultData",
|
201
245
|
"BadRequestError",
|
202
246
|
"BlockTypeEnum",
|
247
|
+
"ChatHistoryInputRequest",
|
203
248
|
"ChatMessage",
|
204
249
|
"ChatMessageRequest",
|
205
250
|
"ChatMessageRole",
|
@@ -215,8 +260,14 @@ __all__ = [
|
|
215
260
|
"DocumentStatus",
|
216
261
|
"EnrichedNormalizedCompletion",
|
217
262
|
"EnvironmentEnum",
|
263
|
+
"ErrorExecutePromptResponse",
|
218
264
|
"EvaluationParams",
|
219
265
|
"EvaluationParamsRequest",
|
266
|
+
"ExecutePromptApiErrorResponse",
|
267
|
+
"ExecutePromptResponse",
|
268
|
+
"ExecutePromptResponse_Error",
|
269
|
+
"ExecutePromptResponse_Json",
|
270
|
+
"ExecutePromptResponse_String",
|
220
271
|
"ExecuteWorkflowStreamErrorResponse",
|
221
272
|
"FinishReasonEnum",
|
222
273
|
"ForbiddenError",
|
@@ -232,6 +283,8 @@ __all__ = [
|
|
232
283
|
"GenerateStreamResultData",
|
233
284
|
"IndexingStateEnum",
|
234
285
|
"InternalServerError",
|
286
|
+
"JsonExecutePromptResponse",
|
287
|
+
"JsonInputRequest",
|
235
288
|
"LogicalOperator",
|
236
289
|
"LogprobsEnum",
|
237
290
|
"MetadataFilterConfigRequest",
|
@@ -262,6 +315,10 @@ __all__ = [
|
|
262
315
|
"PaginatedSlimDocumentList",
|
263
316
|
"ProcessingFailureReasonEnum",
|
264
317
|
"ProcessingStateEnum",
|
318
|
+
"PromptDeploymentInputRequest",
|
319
|
+
"PromptDeploymentInputRequest_ChatHistory",
|
320
|
+
"PromptDeploymentInputRequest_Json",
|
321
|
+
"PromptDeploymentInputRequest_String",
|
265
322
|
"PromptNodeResult",
|
266
323
|
"PromptNodeResultData",
|
267
324
|
"PromptTemplateBlock",
|
@@ -295,9 +352,13 @@ __all__ = [
|
|
295
352
|
"SearchResponse",
|
296
353
|
"SearchResult",
|
297
354
|
"SearchResultDocument",
|
355
|
+
"SearchResultDocumentRequest",
|
298
356
|
"SearchResultMergingRequest",
|
357
|
+
"SearchResultRequest",
|
299
358
|
"SearchWeightsRequest",
|
300
359
|
"SlimDocument",
|
360
|
+
"StringExecutePromptResponse",
|
361
|
+
"StringInputRequest",
|
301
362
|
"SubmitCompletionActualRequest",
|
302
363
|
"SubmitCompletionActualsErrorResponse",
|
303
364
|
"SubmitWorkflowExecutionActualRequest",
|
@@ -334,12 +395,39 @@ __all__ = [
|
|
334
395
|
"TerminalNodeResultOutput_String",
|
335
396
|
"TerminalNodeSearchResultsResult",
|
336
397
|
"TerminalNodeStringResult",
|
398
|
+
"TestCaseChatHistoryVariableValue",
|
399
|
+
"TestCaseChatHistoryVariableValueRequest",
|
400
|
+
"TestCaseErrorVariableValue",
|
401
|
+
"TestCaseErrorVariableValueRequest",
|
402
|
+
"TestCaseJsonVariableValue",
|
403
|
+
"TestCaseJsonVariableValueRequest",
|
404
|
+
"TestCaseNumberVariableValue",
|
405
|
+
"TestCaseNumberVariableValueRequest",
|
406
|
+
"TestCaseSearchResultsVariableValue",
|
407
|
+
"TestCaseSearchResultsVariableValueRequest",
|
408
|
+
"TestCaseStringVariableValue",
|
409
|
+
"TestCaseStringVariableValueRequest",
|
410
|
+
"TestCaseVariableValue",
|
411
|
+
"TestCaseVariableValueRequest",
|
412
|
+
"TestCaseVariableValueRequest_ChatHistory",
|
413
|
+
"TestCaseVariableValueRequest_Error",
|
414
|
+
"TestCaseVariableValueRequest_Json",
|
415
|
+
"TestCaseVariableValueRequest_Number",
|
416
|
+
"TestCaseVariableValueRequest_SearchResults",
|
417
|
+
"TestCaseVariableValueRequest_String",
|
418
|
+
"TestCaseVariableValue_ChatHistory",
|
419
|
+
"TestCaseVariableValue_Error",
|
420
|
+
"TestCaseVariableValue_Json",
|
421
|
+
"TestCaseVariableValue_Number",
|
422
|
+
"TestCaseVariableValue_SearchResults",
|
423
|
+
"TestCaseVariableValue_String",
|
337
424
|
"TestSuiteTestCase",
|
338
425
|
"UploadDocumentErrorResponse",
|
339
426
|
"UploadDocumentResponse",
|
340
427
|
"VellumEnvironment",
|
341
428
|
"VellumError",
|
342
429
|
"VellumErrorCodeEnum",
|
430
|
+
"VellumErrorRequest",
|
343
431
|
"VellumVariable",
|
344
432
|
"VellumVariableType",
|
345
433
|
"WorkflowEventError",
|
vellum/client.py
CHANGED
@@ -22,11 +22,12 @@ from .resources.model_versions.client import AsyncModelVersionsClient, ModelVers
|
|
22
22
|
from .resources.registered_prompts.client import AsyncRegisteredPromptsClient, RegisteredPromptsClient
|
23
23
|
from .resources.sandboxes.client import AsyncSandboxesClient, SandboxesClient
|
24
24
|
from .resources.test_suites.client import AsyncTestSuitesClient, TestSuitesClient
|
25
|
-
from .types.
|
25
|
+
from .types.execute_prompt_response import ExecutePromptResponse
|
26
26
|
from .types.generate_options_request import GenerateOptionsRequest
|
27
27
|
from .types.generate_request import GenerateRequest
|
28
28
|
from .types.generate_response import GenerateResponse
|
29
29
|
from .types.generate_stream_response import GenerateStreamResponse
|
30
|
+
from .types.prompt_deployment_input_request import PromptDeploymentInputRequest
|
30
31
|
from .types.search_request_options_request import SearchRequestOptionsRequest
|
31
32
|
from .types.search_response import SearchResponse
|
32
33
|
from .types.submit_completion_actual_request import SubmitCompletionActualRequest
|
@@ -66,6 +67,61 @@ class Vellum:
|
|
66
67
|
self.sandboxes = SandboxesClient(client_wrapper=self._client_wrapper)
|
67
68
|
self.test_suites = TestSuitesClient(client_wrapper=self._client_wrapper)
|
68
69
|
|
70
|
+
def execute_prompt(
|
71
|
+
self,
|
72
|
+
*,
|
73
|
+
inputs: typing.List[PromptDeploymentInputRequest],
|
74
|
+
prompt_deployment_id: typing.Optional[str] = OMIT,
|
75
|
+
prompt_deployment_name: typing.Optional[str] = OMIT,
|
76
|
+
release_tag: typing.Optional[str] = OMIT,
|
77
|
+
external_id: typing.Optional[str] = OMIT,
|
78
|
+
) -> ExecutePromptResponse:
|
79
|
+
"""
|
80
|
+
Executes a deployed Prompt and returns the result.
|
81
|
+
|
82
|
+
Parameters:
|
83
|
+
- inputs: typing.List[PromptDeploymentInputRequest].
|
84
|
+
|
85
|
+
- prompt_deployment_id: typing.Optional[str]. The ID of the Prompt Deployment. Must provide either this or prompt_deployment_name.
|
86
|
+
|
87
|
+
- prompt_deployment_name: typing.Optional[str]. The name of the Prompt Deployment. Must provide either this or prompt_deployment_id.
|
88
|
+
|
89
|
+
- release_tag: typing.Optional[str]. Optionally specify a release tag if you want to pin to a specific release of the Prompt Deployment
|
90
|
+
|
91
|
+
- external_id: typing.Optional[str].
|
92
|
+
"""
|
93
|
+
_request: typing.Dict[str, typing.Any] = {"inputs": inputs}
|
94
|
+
if prompt_deployment_id is not OMIT:
|
95
|
+
_request["prompt_deployment_id"] = prompt_deployment_id
|
96
|
+
if prompt_deployment_name is not OMIT:
|
97
|
+
_request["prompt_deployment_name"] = prompt_deployment_name
|
98
|
+
if release_tag is not OMIT:
|
99
|
+
_request["release_tag"] = release_tag
|
100
|
+
if external_id is not OMIT:
|
101
|
+
_request["external_id"] = external_id
|
102
|
+
_response = self._client_wrapper.httpx_client.request(
|
103
|
+
"POST",
|
104
|
+
urllib.parse.urljoin(f"{self._client_wrapper.get_environment().default}/", "v1/execute-prompt"),
|
105
|
+
json=jsonable_encoder(_request),
|
106
|
+
headers=self._client_wrapper.get_headers(),
|
107
|
+
timeout=None,
|
108
|
+
)
|
109
|
+
if 200 <= _response.status_code < 300:
|
110
|
+
return pydantic.parse_obj_as(ExecutePromptResponse, _response.json()) # type: ignore
|
111
|
+
if _response.status_code == 400:
|
112
|
+
raise BadRequestError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
113
|
+
if _response.status_code == 403:
|
114
|
+
raise ForbiddenError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
115
|
+
if _response.status_code == 404:
|
116
|
+
raise NotFoundError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
117
|
+
if _response.status_code == 500:
|
118
|
+
raise InternalServerError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
119
|
+
try:
|
120
|
+
_response_json = _response.json()
|
121
|
+
except JSONDecodeError:
|
122
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
123
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
124
|
+
|
69
125
|
def execute_workflow_stream(
|
70
126
|
self,
|
71
127
|
*,
|
@@ -86,7 +142,7 @@ class Vellum:
|
|
86
142
|
|
87
143
|
- release_tag: typing.Optional[str]. Optionally specify a release tag if you want to pin to a specific release of the Workflow Deployment
|
88
144
|
|
89
|
-
- inputs: typing.List[WorkflowRequestInputRequest].
|
145
|
+
- inputs: typing.List[WorkflowRequestInputRequest]. The list of inputs defined in the Workflow's deployment with their corresponding values.
|
90
146
|
|
91
147
|
- external_id: typing.Optional[str]. Optionally include a unique identifier for tracking purposes.
|
92
148
|
|
@@ -187,7 +243,7 @@ class Vellum:
|
|
187
243
|
if _response.status_code == 400:
|
188
244
|
raise BadRequestError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
189
245
|
if _response.status_code == 403:
|
190
|
-
raise ForbiddenError(pydantic.parse_obj_as(
|
246
|
+
raise ForbiddenError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
191
247
|
if _response.status_code == 404:
|
192
248
|
raise NotFoundError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
193
249
|
if _response.status_code == 500:
|
@@ -244,7 +300,7 @@ class Vellum:
|
|
244
300
|
if _response.status_code == 400:
|
245
301
|
raise BadRequestError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
246
302
|
if _response.status_code == 403:
|
247
|
-
raise ForbiddenError(pydantic.parse_obj_as(
|
303
|
+
raise ForbiddenError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
248
304
|
if _response.status_code == 404:
|
249
305
|
raise NotFoundError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
250
306
|
if _response.status_code == 500:
|
@@ -432,6 +488,61 @@ class AsyncVellum:
|
|
432
488
|
self.sandboxes = AsyncSandboxesClient(client_wrapper=self._client_wrapper)
|
433
489
|
self.test_suites = AsyncTestSuitesClient(client_wrapper=self._client_wrapper)
|
434
490
|
|
491
|
+
async def execute_prompt(
|
492
|
+
self,
|
493
|
+
*,
|
494
|
+
inputs: typing.List[PromptDeploymentInputRequest],
|
495
|
+
prompt_deployment_id: typing.Optional[str] = OMIT,
|
496
|
+
prompt_deployment_name: typing.Optional[str] = OMIT,
|
497
|
+
release_tag: typing.Optional[str] = OMIT,
|
498
|
+
external_id: typing.Optional[str] = OMIT,
|
499
|
+
) -> ExecutePromptResponse:
|
500
|
+
"""
|
501
|
+
Executes a deployed Prompt and returns the result.
|
502
|
+
|
503
|
+
Parameters:
|
504
|
+
- inputs: typing.List[PromptDeploymentInputRequest].
|
505
|
+
|
506
|
+
- prompt_deployment_id: typing.Optional[str]. The ID of the Prompt Deployment. Must provide either this or prompt_deployment_name.
|
507
|
+
|
508
|
+
- prompt_deployment_name: typing.Optional[str]. The name of the Prompt Deployment. Must provide either this or prompt_deployment_id.
|
509
|
+
|
510
|
+
- release_tag: typing.Optional[str]. Optionally specify a release tag if you want to pin to a specific release of the Prompt Deployment
|
511
|
+
|
512
|
+
- external_id: typing.Optional[str].
|
513
|
+
"""
|
514
|
+
_request: typing.Dict[str, typing.Any] = {"inputs": inputs}
|
515
|
+
if prompt_deployment_id is not OMIT:
|
516
|
+
_request["prompt_deployment_id"] = prompt_deployment_id
|
517
|
+
if prompt_deployment_name is not OMIT:
|
518
|
+
_request["prompt_deployment_name"] = prompt_deployment_name
|
519
|
+
if release_tag is not OMIT:
|
520
|
+
_request["release_tag"] = release_tag
|
521
|
+
if external_id is not OMIT:
|
522
|
+
_request["external_id"] = external_id
|
523
|
+
_response = await self._client_wrapper.httpx_client.request(
|
524
|
+
"POST",
|
525
|
+
urllib.parse.urljoin(f"{self._client_wrapper.get_environment().default}/", "v1/execute-prompt"),
|
526
|
+
json=jsonable_encoder(_request),
|
527
|
+
headers=self._client_wrapper.get_headers(),
|
528
|
+
timeout=None,
|
529
|
+
)
|
530
|
+
if 200 <= _response.status_code < 300:
|
531
|
+
return pydantic.parse_obj_as(ExecutePromptResponse, _response.json()) # type: ignore
|
532
|
+
if _response.status_code == 400:
|
533
|
+
raise BadRequestError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
534
|
+
if _response.status_code == 403:
|
535
|
+
raise ForbiddenError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
536
|
+
if _response.status_code == 404:
|
537
|
+
raise NotFoundError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
538
|
+
if _response.status_code == 500:
|
539
|
+
raise InternalServerError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
540
|
+
try:
|
541
|
+
_response_json = _response.json()
|
542
|
+
except JSONDecodeError:
|
543
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
544
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
545
|
+
|
435
546
|
async def execute_workflow_stream(
|
436
547
|
self,
|
437
548
|
*,
|
@@ -452,7 +563,7 @@ class AsyncVellum:
|
|
452
563
|
|
453
564
|
- release_tag: typing.Optional[str]. Optionally specify a release tag if you want to pin to a specific release of the Workflow Deployment
|
454
565
|
|
455
|
-
- inputs: typing.List[WorkflowRequestInputRequest].
|
566
|
+
- inputs: typing.List[WorkflowRequestInputRequest]. The list of inputs defined in the Workflow's deployment with their corresponding values.
|
456
567
|
|
457
568
|
- external_id: typing.Optional[str]. Optionally include a unique identifier for tracking purposes.
|
458
569
|
|
@@ -553,7 +664,7 @@ class AsyncVellum:
|
|
553
664
|
if _response.status_code == 400:
|
554
665
|
raise BadRequestError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
555
666
|
if _response.status_code == 403:
|
556
|
-
raise ForbiddenError(pydantic.parse_obj_as(
|
667
|
+
raise ForbiddenError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
557
668
|
if _response.status_code == 404:
|
558
669
|
raise NotFoundError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
559
670
|
if _response.status_code == 500:
|
@@ -610,7 +721,7 @@ class AsyncVellum:
|
|
610
721
|
if _response.status_code == 400:
|
611
722
|
raise BadRequestError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
612
723
|
if _response.status_code == 403:
|
613
|
-
raise ForbiddenError(pydantic.parse_obj_as(
|
724
|
+
raise ForbiddenError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
614
725
|
if _response.status_code == 404:
|
615
726
|
raise NotFoundError(pydantic.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
616
727
|
if _response.status_code == 500:
|
vellum/core/client_wrapper.py
CHANGED
@@ -16,7 +16,7 @@ class BaseClientWrapper:
|
|
16
16
|
headers: typing.Dict[str, str] = {
|
17
17
|
"X-Fern-Language": "Python",
|
18
18
|
"X-Fern-SDK-Name": "vellum-ai",
|
19
|
-
"X-Fern-SDK-Version": "v0.1.
|
19
|
+
"X-Fern-SDK-Version": "v0.1.5",
|
20
20
|
}
|
21
21
|
headers["X_API_KEY"] = self.api_key
|
22
22
|
return headers
|
vellum/errors/forbidden_error.py
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
2
2
|
|
3
|
+
import typing
|
4
|
+
|
3
5
|
from ..core.api_error import ApiError
|
4
|
-
from ..types.generate_error_response import GenerateErrorResponse
|
5
6
|
|
6
7
|
|
7
8
|
class ForbiddenError(ApiError):
|
8
|
-
def __init__(self, body:
|
9
|
+
def __init__(self, body: typing.Any):
|
9
10
|
super().__init__(status_code=403, body=body)
|
@@ -7,7 +7,7 @@ from json.decoder import JSONDecodeError
|
|
7
7
|
from ...core.api_error import ApiError
|
8
8
|
from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
9
9
|
from ...core.jsonable_encoder import jsonable_encoder
|
10
|
-
from ...types.
|
10
|
+
from ...types.test_case_variable_value_request import TestCaseVariableValueRequest
|
11
11
|
from ...types.test_suite_test_case import TestSuiteTestCase
|
12
12
|
|
13
13
|
try:
|
@@ -27,10 +27,10 @@ class TestSuitesClient:
|
|
27
27
|
self,
|
28
28
|
id: str,
|
29
29
|
*,
|
30
|
-
|
30
|
+
test_suite_test_case_request_id: typing.Optional[str] = OMIT,
|
31
31
|
label: typing.Optional[str] = OMIT,
|
32
|
-
input_values: typing.
|
33
|
-
|
32
|
+
input_values: typing.List[TestCaseVariableValueRequest],
|
33
|
+
evaluation_values: typing.List[TestCaseVariableValueRequest],
|
34
34
|
) -> TestSuiteTestCase:
|
35
35
|
"""
|
36
36
|
Upserts a new test case for a test suite, keying off of the optionally provided test case id.
|
@@ -44,15 +44,14 @@ class TestSuitesClient:
|
|
44
44
|
Parameters:
|
45
45
|
- id: str. A UUID string identifying this test suite.
|
46
46
|
|
47
|
-
-
|
47
|
+
- test_suite_test_case_request_id: typing.Optional[str].
|
48
48
|
|
49
|
-
- label: typing.Optional[str].
|
49
|
+
- label: typing.Optional[str].
|
50
50
|
|
51
|
-
- input_values: typing.
|
51
|
+
- input_values: typing.List[TestCaseVariableValueRequest].
|
52
52
|
|
53
|
-
-
|
53
|
+
- evaluation_values: typing.List[TestCaseVariableValueRequest].
|
54
54
|
---
|
55
|
-
from vellum import EvaluationParamsRequest
|
56
55
|
from vellum.client import Vellum
|
57
56
|
|
58
57
|
client = Vellum(
|
@@ -60,13 +59,13 @@ class TestSuitesClient:
|
|
60
59
|
)
|
61
60
|
client.test_suites.upsert_test_suite_test_case(
|
62
61
|
id="id",
|
63
|
-
input_values=
|
64
|
-
|
62
|
+
input_values=[],
|
63
|
+
evaluation_values=[],
|
65
64
|
)
|
66
65
|
"""
|
67
|
-
_request: typing.Dict[str, typing.Any] = {"input_values": input_values, "
|
68
|
-
if
|
69
|
-
_request["
|
66
|
+
_request: typing.Dict[str, typing.Any] = {"input_values": input_values, "evaluation_values": evaluation_values}
|
67
|
+
if test_suite_test_case_request_id is not OMIT:
|
68
|
+
_request["id"] = test_suite_test_case_request_id
|
70
69
|
if label is not OMIT:
|
71
70
|
_request["label"] = label
|
72
71
|
_response = self._client_wrapper.httpx_client.request(
|
@@ -130,10 +129,10 @@ class AsyncTestSuitesClient:
|
|
130
129
|
self,
|
131
130
|
id: str,
|
132
131
|
*,
|
133
|
-
|
132
|
+
test_suite_test_case_request_id: typing.Optional[str] = OMIT,
|
134
133
|
label: typing.Optional[str] = OMIT,
|
135
|
-
input_values: typing.
|
136
|
-
|
134
|
+
input_values: typing.List[TestCaseVariableValueRequest],
|
135
|
+
evaluation_values: typing.List[TestCaseVariableValueRequest],
|
137
136
|
) -> TestSuiteTestCase:
|
138
137
|
"""
|
139
138
|
Upserts a new test case for a test suite, keying off of the optionally provided test case id.
|
@@ -147,15 +146,14 @@ class AsyncTestSuitesClient:
|
|
147
146
|
Parameters:
|
148
147
|
- id: str. A UUID string identifying this test suite.
|
149
148
|
|
150
|
-
-
|
149
|
+
- test_suite_test_case_request_id: typing.Optional[str].
|
151
150
|
|
152
|
-
- label: typing.Optional[str].
|
151
|
+
- label: typing.Optional[str].
|
153
152
|
|
154
|
-
- input_values: typing.
|
153
|
+
- input_values: typing.List[TestCaseVariableValueRequest].
|
155
154
|
|
156
|
-
-
|
155
|
+
- evaluation_values: typing.List[TestCaseVariableValueRequest].
|
157
156
|
---
|
158
|
-
from vellum import EvaluationParamsRequest
|
159
157
|
from vellum.client import AsyncVellum
|
160
158
|
|
161
159
|
client = AsyncVellum(
|
@@ -163,13 +161,13 @@ class AsyncTestSuitesClient:
|
|
163
161
|
)
|
164
162
|
await client.test_suites.upsert_test_suite_test_case(
|
165
163
|
id="id",
|
166
|
-
input_values=
|
167
|
-
|
164
|
+
input_values=[],
|
165
|
+
evaluation_values=[],
|
168
166
|
)
|
169
167
|
"""
|
170
|
-
_request: typing.Dict[str, typing.Any] = {"input_values": input_values, "
|
171
|
-
if
|
172
|
-
_request["
|
168
|
+
_request: typing.Dict[str, typing.Any] = {"input_values": input_values, "evaluation_values": evaluation_values}
|
169
|
+
if test_suite_test_case_request_id is not OMIT:
|
170
|
+
_request["id"] = test_suite_test_case_request_id
|
173
171
|
if label is not OMIT:
|
174
172
|
_request["label"] = label
|
175
173
|
_response = await self._client_wrapper.httpx_client.request(
|