vellum-ai 0.3.14__py3-none-any.whl → 0.3.15__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- vellum/__init__.py +22 -0
- vellum/client.py +846 -100
- vellum/core/__init__.py +8 -0
- vellum/core/client_wrapper.py +27 -8
- vellum/core/file.py +38 -0
- vellum/core/http_client.py +130 -0
- vellum/core/jsonable_encoder.py +2 -2
- vellum/core/request_options.py +32 -0
- vellum/resources/deployments/client.py +161 -24
- vellum/resources/document_indexes/client.py +337 -80
- vellum/resources/documents/client.py +278 -58
- vellum/resources/folder_entities/client.py +60 -10
- vellum/resources/model_versions/client.py +48 -8
- vellum/resources/registered_prompts/client.py +52 -6
- vellum/resources/sandboxes/client.py +108 -26
- vellum/resources/test_suite_runs/client.py +221 -38
- vellum/resources/test_suites/client.py +110 -24
- vellum/resources/workflow_deployments/client.py +110 -14
- vellum/types/__init__.py +20 -0
- vellum/types/api_node_result.py +1 -0
- vellum/types/api_node_result_data.py +4 -2
- vellum/types/array_chat_message_content.py +1 -0
- vellum/types/array_chat_message_content_item.py +6 -5
- vellum/types/array_chat_message_content_item_request.py +6 -5
- vellum/types/array_chat_message_content_request.py +1 -0
- vellum/types/array_enum.py +2 -2
- vellum/types/array_variable_value_item.py +16 -10
- vellum/types/chat_history_enum.py +2 -2
- vellum/types/chat_history_input_request.py +6 -1
- vellum/types/chat_history_variable_value.py +2 -1
- vellum/types/chat_message.py +7 -5
- vellum/types/chat_message_content.py +8 -6
- vellum/types/chat_message_content_request.py +8 -6
- vellum/types/chat_message_request.py +7 -5
- vellum/types/code_execution_node_array_result.py +31 -0
- vellum/types/code_execution_node_chat_history_result.py +2 -1
- vellum/types/code_execution_node_error_result.py +2 -1
- vellum/types/code_execution_node_function_call_result.py +31 -0
- vellum/types/code_execution_node_json_result.py +2 -1
- vellum/types/code_execution_node_number_result.py +2 -1
- vellum/types/code_execution_node_result.py +1 -0
- vellum/types/code_execution_node_result_data.py +2 -1
- vellum/types/code_execution_node_result_output.py +36 -8
- vellum/types/code_execution_node_search_results_result.py +2 -1
- vellum/types/code_execution_node_string_result.py +2 -1
- vellum/types/conditional_node_result.py +1 -0
- vellum/types/conditional_node_result_data.py +2 -1
- vellum/types/deployment_provider_payload_response.py +1 -0
- vellum/types/deployment_read.py +32 -17
- vellum/types/document_document_to_document_index.py +21 -15
- vellum/types/document_index_read.py +32 -19
- vellum/types/document_read.py +34 -24
- vellum/types/document_status.py +2 -2
- vellum/types/enriched_normalized_completion.py +36 -19
- vellum/types/error_enum.py +2 -2
- vellum/types/error_variable_value.py +2 -1
- vellum/types/execute_prompt_api_error_response.py +5 -1
- vellum/types/execute_prompt_event.py +8 -6
- vellum/types/execute_prompt_response.py +4 -4
- vellum/types/execute_workflow_error_response.py +5 -1
- vellum/types/execute_workflow_response.py +3 -2
- vellum/types/execute_workflow_stream_error_response.py +5 -1
- vellum/types/execute_workflow_workflow_result_event.py +4 -4
- vellum/types/execution_array_vellum_value.py +7 -2
- vellum/types/execution_chat_history_vellum_value.py +7 -2
- vellum/types/execution_error_vellum_value.py +7 -2
- vellum/types/execution_function_call_vellum_value.py +7 -2
- vellum/types/execution_json_vellum_value.py +7 -2
- vellum/types/execution_number_vellum_value.py +7 -2
- vellum/types/execution_search_results_vellum_value.py +7 -2
- vellum/types/execution_string_vellum_value.py +7 -2
- vellum/types/execution_vellum_value.py +16 -10
- vellum/types/fulfilled_enum.py +2 -2
- vellum/types/fulfilled_execute_prompt_event.py +2 -1
- vellum/types/fulfilled_execute_prompt_response.py +12 -5
- vellum/types/fulfilled_execute_workflow_workflow_result_event.py +1 -0
- vellum/types/fulfilled_function_call.py +2 -1
- vellum/types/fulfilled_prompt_execution_meta.py +3 -2
- vellum/types/fulfilled_workflow_node_result_event.py +6 -5
- vellum/types/function_call.py +4 -4
- vellum/types/function_call_chat_message_content.py +1 -0
- vellum/types/function_call_chat_message_content_request.py +1 -0
- vellum/types/function_call_chat_message_content_value.py +2 -1
- vellum/types/function_call_chat_message_content_value_request.py +2 -1
- vellum/types/function_call_enum.py +2 -2
- vellum/types/function_call_variable_value.py +1 -0
- vellum/types/generate_error_response.py +5 -1
- vellum/types/generate_options_request.py +8 -5
- vellum/types/generate_request.py +15 -9
- vellum/types/generate_result.py +10 -6
- vellum/types/generate_result_data.py +5 -3
- vellum/types/generate_result_error.py +5 -1
- vellum/types/generate_stream_response.py +1 -0
- vellum/types/generate_stream_result.py +3 -2
- vellum/types/generate_stream_result_data.py +1 -0
- vellum/types/image_chat_message_content.py +1 -0
- vellum/types/image_chat_message_content_request.py +1 -0
- vellum/types/image_enum.py +2 -2
- vellum/types/image_variable_value.py +2 -1
- vellum/types/initiated_enum.py +2 -2
- vellum/types/initiated_execute_prompt_event.py +2 -1
- vellum/types/initiated_prompt_execution_meta.py +5 -4
- vellum/types/initiated_workflow_node_result_event.py +5 -4
- vellum/types/json_enum.py +2 -2
- vellum/types/json_input_request.py +6 -1
- vellum/types/json_variable_value.py +2 -1
- vellum/types/logprobs_enum.py +2 -2
- vellum/types/metadata_filter_config_request.py +7 -6
- vellum/types/metadata_filter_rule_request.py +7 -6
- vellum/types/model_version_build_config.py +12 -7
- vellum/types/model_version_exec_config.py +18 -11
- vellum/types/model_version_exec_config_parameters.py +7 -6
- vellum/types/model_version_read.py +51 -32
- vellum/types/model_version_sandbox_snapshot.py +17 -4
- vellum/types/named_test_case_chat_history_variable_value_request.py +2 -1
- vellum/types/named_test_case_error_variable_value_request.py +2 -1
- vellum/types/named_test_case_json_variable_value_request.py +2 -1
- vellum/types/named_test_case_number_variable_value_request.py +2 -1
- vellum/types/named_test_case_search_results_variable_value_request.py +2 -1
- vellum/types/named_test_case_string_variable_value_request.py +2 -1
- vellum/types/named_test_case_variable_value_request.py +12 -8
- vellum/types/node_input_compiled_array_value.py +2 -1
- vellum/types/node_input_compiled_chat_history_value.py +2 -1
- vellum/types/node_input_compiled_error_value.py +2 -1
- vellum/types/node_input_compiled_function_call.py +32 -0
- vellum/types/node_input_compiled_json_value.py +2 -1
- vellum/types/node_input_compiled_number_value.py +2 -1
- vellum/types/node_input_compiled_search_results_value.py +2 -1
- vellum/types/node_input_compiled_string_value.py +2 -1
- vellum/types/node_input_variable_compiled_value.py +26 -9
- vellum/types/node_output_compiled_array_value.py +2 -1
- vellum/types/node_output_compiled_chat_history_value.py +2 -1
- vellum/types/node_output_compiled_error_value.py +2 -1
- vellum/types/node_output_compiled_function_value.py +2 -1
- vellum/types/node_output_compiled_json_value.py +2 -1
- vellum/types/node_output_compiled_number_value.py +2 -1
- vellum/types/node_output_compiled_search_results_value.py +2 -1
- vellum/types/node_output_compiled_string_value.py +2 -1
- vellum/types/node_output_compiled_value.py +16 -10
- vellum/types/normalized_log_probs.py +2 -1
- vellum/types/normalized_token_log_probs.py +3 -2
- vellum/types/number_enum.py +2 -2
- vellum/types/number_variable_value.py +2 -1
- vellum/types/paginated_document_index_read_list.py +5 -4
- vellum/types/paginated_slim_deployment_read_list.py +5 -4
- vellum/types/paginated_slim_document_list.py +5 -4
- vellum/types/paginated_slim_workflow_deployment_list.py +5 -4
- vellum/types/paginated_test_suite_run_execution_list.py +5 -4
- vellum/types/prompt_deployment_expand_meta_request_request.py +25 -15
- vellum/types/prompt_deployment_input_request.py +6 -5
- vellum/types/prompt_execution_meta.py +6 -5
- vellum/types/prompt_node_result.py +1 -0
- vellum/types/prompt_node_result_data.py +4 -3
- vellum/types/prompt_output.py +8 -6
- vellum/types/prompt_template_block.py +1 -0
- vellum/types/prompt_template_block_data.py +1 -0
- vellum/types/prompt_template_block_data_request.py +1 -0
- vellum/types/prompt_template_block_properties.py +11 -10
- vellum/types/prompt_template_block_properties_request.py +11 -10
- vellum/types/prompt_template_block_request.py +1 -0
- vellum/types/raw_prompt_execution_overrides_request.py +11 -5
- vellum/types/register_prompt_error_response.py +5 -1
- vellum/types/register_prompt_model_parameters_request.py +5 -4
- vellum/types/register_prompt_prompt.py +10 -2
- vellum/types/register_prompt_prompt_info_request.py +5 -3
- vellum/types/register_prompt_response.py +30 -10
- vellum/types/registered_prompt_deployment.py +15 -3
- vellum/types/registered_prompt_input_variable_request.py +3 -2
- vellum/types/registered_prompt_model_version.py +10 -2
- vellum/types/registered_prompt_sandbox.py +10 -2
- vellum/types/registered_prompt_sandbox_snapshot.py +5 -1
- vellum/types/rejected_enum.py +2 -2
- vellum/types/rejected_execute_prompt_event.py +2 -1
- vellum/types/rejected_execute_prompt_response.py +12 -5
- vellum/types/rejected_execute_workflow_workflow_result_event.py +1 -0
- vellum/types/rejected_function_call.py +2 -1
- vellum/types/rejected_prompt_execution_meta.py +3 -2
- vellum/types/rejected_workflow_node_result_event.py +4 -3
- vellum/types/sandbox_scenario.py +11 -3
- vellum/types/scenario_input.py +4 -3
- vellum/types/scenario_input_request.py +4 -3
- vellum/types/search_error_response.py +5 -1
- vellum/types/search_filters_request.py +10 -6
- vellum/types/search_node_result.py +1 -0
- vellum/types/search_node_result_data.py +7 -4
- vellum/types/search_request_options_request.py +20 -8
- vellum/types/search_response.py +5 -3
- vellum/types/search_result.py +15 -5
- vellum/types/search_result_document.py +20 -8
- vellum/types/search_result_document_request.py +15 -7
- vellum/types/search_result_merging_request.py +5 -1
- vellum/types/search_result_request.py +15 -5
- vellum/types/search_results_enum.py +2 -2
- vellum/types/search_results_variable_value.py +2 -1
- vellum/types/search_weights_request.py +10 -4
- vellum/types/slim_deployment_read.py +28 -14
- vellum/types/slim_document.py +56 -35
- vellum/types/slim_workflow_deployment.py +37 -24
- vellum/types/streaming_enum.py +2 -2
- vellum/types/streaming_execute_prompt_event.py +6 -4
- vellum/types/streaming_prompt_execution_meta.py +2 -1
- vellum/types/streaming_workflow_node_result_event.py +6 -5
- vellum/types/string_chat_message_content.py +1 -0
- vellum/types/string_chat_message_content_request.py +1 -0
- vellum/types/string_enum.py +2 -2
- vellum/types/string_input_request.py +6 -1
- vellum/types/string_variable_value.py +2 -1
- vellum/types/submit_completion_actual_request.py +25 -13
- vellum/types/submit_completion_actuals_error_response.py +1 -0
- vellum/types/submit_workflow_execution_actual_request.py +6 -5
- vellum/types/subworkflow_enum.py +2 -2
- vellum/types/subworkflow_node_result.py +1 -0
- vellum/types/templating_node_array_result.py +31 -0
- vellum/types/templating_node_chat_history_result.py +2 -1
- vellum/types/templating_node_error_result.py +2 -1
- vellum/types/templating_node_function_call_result.py +31 -0
- vellum/types/templating_node_json_result.py +2 -1
- vellum/types/templating_node_number_result.py +2 -1
- vellum/types/templating_node_result.py +1 -0
- vellum/types/templating_node_result_data.py +1 -0
- vellum/types/templating_node_result_output.py +36 -8
- vellum/types/templating_node_search_results_result.py +2 -1
- vellum/types/templating_node_string_result.py +2 -1
- vellum/types/terminal_node_array_result.py +8 -3
- vellum/types/terminal_node_chat_history_result.py +8 -3
- vellum/types/terminal_node_error_result.py +8 -3
- vellum/types/terminal_node_function_call_result.py +8 -3
- vellum/types/terminal_node_json_result.py +8 -3
- vellum/types/terminal_node_number_result.py +8 -3
- vellum/types/terminal_node_result.py +1 -0
- vellum/types/terminal_node_result_data.py +1 -0
- vellum/types/terminal_node_result_output.py +16 -10
- vellum/types/terminal_node_search_results_result.py +8 -3
- vellum/types/terminal_node_string_result.py +8 -3
- vellum/types/test_case_chat_history_variable_value.py +2 -1
- vellum/types/test_case_error_variable_value.py +2 -1
- vellum/types/test_case_json_variable_value.py +2 -1
- vellum/types/test_case_number_variable_value.py +2 -1
- vellum/types/test_case_search_results_variable_value.py +2 -1
- vellum/types/test_case_string_variable_value.py +2 -1
- vellum/types/test_case_variable_value.py +12 -8
- vellum/types/test_suite_run_deployment_release_tag_exec_config.py +5 -3
- vellum/types/test_suite_run_deployment_release_tag_exec_config_data.py +10 -4
- vellum/types/test_suite_run_deployment_release_tag_exec_config_data_request.py +10 -4
- vellum/types/test_suite_run_deployment_release_tag_exec_config_request.py +5 -3
- vellum/types/test_suite_run_deployment_release_tag_exec_config_type_enum.py +2 -2
- vellum/types/test_suite_run_exec_config.py +4 -4
- vellum/types/test_suite_run_exec_config_request.py +4 -4
- vellum/types/test_suite_run_execution.py +1 -0
- vellum/types/test_suite_run_execution_chat_history_output.py +2 -1
- vellum/types/test_suite_run_execution_error_output.py +2 -1
- vellum/types/test_suite_run_execution_json_output.py +2 -1
- vellum/types/test_suite_run_execution_metric_result.py +1 -0
- vellum/types/test_suite_run_execution_number_output.py +2 -1
- vellum/types/test_suite_run_execution_output.py +12 -8
- vellum/types/test_suite_run_execution_search_results_output.py +2 -1
- vellum/types/test_suite_run_execution_string_output.py +2 -1
- vellum/types/test_suite_run_metric_error_output.py +1 -0
- vellum/types/test_suite_run_metric_error_output_type_enum.py +2 -2
- vellum/types/test_suite_run_metric_number_output.py +1 -0
- vellum/types/test_suite_run_metric_number_output_type_enum.py +2 -2
- vellum/types/test_suite_run_metric_output.py +4 -4
- vellum/types/test_suite_run_read.py +16 -14
- vellum/types/test_suite_run_test_suite.py +1 -0
- vellum/types/test_suite_run_workflow_release_tag_exec_config.py +5 -3
- vellum/types/test_suite_run_workflow_release_tag_exec_config_data.py +10 -6
- vellum/types/test_suite_run_workflow_release_tag_exec_config_data_request.py +10 -6
- vellum/types/test_suite_run_workflow_release_tag_exec_config_request.py +5 -3
- vellum/types/test_suite_run_workflow_release_tag_exec_config_type_enum.py +2 -2
- vellum/types/test_suite_test_case.py +3 -2
- vellum/types/upload_document_error_response.py +1 -0
- vellum/types/upload_document_response.py +5 -1
- vellum/types/vellum_error.py +1 -0
- vellum/types/vellum_error_request.py +1 -0
- vellum/types/vellum_image.py +2 -1
- vellum/types/vellum_image_request.py +2 -1
- vellum/types/vellum_variable.py +1 -0
- vellum/types/workflow_deployment_read.py +37 -24
- vellum/types/workflow_event_error.py +1 -0
- vellum/types/workflow_execution_actual_chat_history_request.py +25 -15
- vellum/types/workflow_execution_actual_json_request.py +25 -15
- vellum/types/workflow_execution_actual_string_request.py +25 -15
- vellum/types/workflow_execution_node_result_event.py +3 -2
- vellum/types/workflow_execution_workflow_result_event.py +3 -2
- vellum/types/workflow_node_result_data.py +16 -10
- vellum/types/workflow_node_result_event.py +8 -6
- vellum/types/workflow_output.py +18 -11
- vellum/types/workflow_output_array.py +7 -2
- vellum/types/workflow_output_chat_history.py +7 -2
- vellum/types/workflow_output_error.py +7 -2
- vellum/types/workflow_output_function_call.py +7 -2
- vellum/types/workflow_output_image.py +7 -2
- vellum/types/workflow_output_json.py +7 -2
- vellum/types/workflow_output_number.py +7 -2
- vellum/types/workflow_output_search_results.py +7 -2
- vellum/types/workflow_output_string.py +7 -2
- vellum/types/workflow_request_chat_history_input_request.py +6 -1
- vellum/types/workflow_request_input_request.py +8 -6
- vellum/types/workflow_request_json_input_request.py +6 -1
- vellum/types/workflow_request_number_input_request.py +6 -1
- vellum/types/workflow_request_string_input_request.py +6 -1
- vellum/types/workflow_result_event.py +5 -4
- vellum/types/workflow_result_event_output_data.py +16 -10
- vellum/types/workflow_result_event_output_data_array.py +8 -5
- vellum/types/workflow_result_event_output_data_chat_history.py +8 -5
- vellum/types/workflow_result_event_output_data_error.py +8 -5
- vellum/types/workflow_result_event_output_data_function_call.py +8 -5
- vellum/types/workflow_result_event_output_data_json.py +8 -5
- vellum/types/workflow_result_event_output_data_number.py +8 -5
- vellum/types/workflow_result_event_output_data_search_results.py +8 -5
- vellum/types/workflow_result_event_output_data_string.py +11 -7
- vellum/types/workflow_stream_event.py +4 -4
- vellum/version.py +4 -0
- {vellum_ai-0.3.14.dist-info → vellum_ai-0.3.15.dist-info}/METADATA +4 -4
- vellum_ai-0.3.15.dist-info/RECORD +365 -0
- vellum_ai-0.3.14.dist-info/RECORD +0 -356
- {vellum_ai-0.3.14.dist-info → vellum_ai-0.3.15.dist-info}/LICENSE +0 -0
- {vellum_ai-0.3.14.dist-info → vellum_ai-0.3.15.dist-info}/WHEEL +0 -0
@@ -4,10 +4,12 @@ import typing
|
|
4
4
|
import urllib.parse
|
5
5
|
from json.decoder import JSONDecodeError
|
6
6
|
|
7
|
+
from ... import core
|
7
8
|
from ...core.api_error import ApiError
|
8
9
|
from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
9
10
|
from ...core.jsonable_encoder import jsonable_encoder
|
10
11
|
from ...core.remove_none_from_dict import remove_none_from_dict
|
12
|
+
from ...core.request_options import RequestOptions
|
11
13
|
from ...errors.bad_request_error import BadRequestError
|
12
14
|
from ...errors.internal_server_error import InternalServerError
|
13
15
|
from ...errors.not_found_error import NotFoundError
|
@@ -36,6 +38,7 @@ class DocumentsClient:
|
|
36
38
|
limit: typing.Optional[int] = None,
|
37
39
|
offset: typing.Optional[int] = None,
|
38
40
|
ordering: typing.Optional[str] = None,
|
41
|
+
request_options: typing.Optional[RequestOptions] = None,
|
39
42
|
) -> PaginatedSlimDocumentList:
|
40
43
|
"""
|
41
44
|
Used to list documents. Optionally filter on supported fields.
|
@@ -48,6 +51,8 @@ class DocumentsClient:
|
|
48
51
|
- offset: typing.Optional[int]. The initial index from which to return the results.
|
49
52
|
|
50
53
|
- ordering: typing.Optional[str]. Which field to use when ordering the results.
|
54
|
+
|
55
|
+
- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
|
51
56
|
---
|
52
57
|
from vellum.client import Vellum
|
53
58
|
|
@@ -59,11 +64,34 @@ class DocumentsClient:
|
|
59
64
|
_response = self._client_wrapper.httpx_client.request(
|
60
65
|
"GET",
|
61
66
|
urllib.parse.urljoin(f"{self._client_wrapper.get_environment().default}/", "v1/documents"),
|
62
|
-
params=
|
63
|
-
|
67
|
+
params=jsonable_encoder(
|
68
|
+
remove_none_from_dict(
|
69
|
+
{
|
70
|
+
"document_index_id": document_index_id,
|
71
|
+
"limit": limit,
|
72
|
+
"offset": offset,
|
73
|
+
"ordering": ordering,
|
74
|
+
**(
|
75
|
+
request_options.get("additional_query_parameters", {})
|
76
|
+
if request_options is not None
|
77
|
+
else {}
|
78
|
+
),
|
79
|
+
}
|
80
|
+
)
|
81
|
+
),
|
82
|
+
headers=jsonable_encoder(
|
83
|
+
remove_none_from_dict(
|
84
|
+
{
|
85
|
+
**self._client_wrapper.get_headers(),
|
86
|
+
**(request_options.get("additional_headers", {}) if request_options is not None else {}),
|
87
|
+
}
|
88
|
+
)
|
64
89
|
),
|
65
|
-
|
66
|
-
|
90
|
+
timeout=request_options.get("timeout_in_seconds")
|
91
|
+
if request_options is not None and request_options.get("timeout_in_seconds") is not None
|
92
|
+
else self._client_wrapper.get_timeout(),
|
93
|
+
retries=0,
|
94
|
+
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
67
95
|
)
|
68
96
|
if 200 <= _response.status_code < 300:
|
69
97
|
return pydantic.parse_obj_as(PaginatedSlimDocumentList, _response.json()) # type: ignore
|
@@ -73,10 +101,12 @@ class DocumentsClient:
|
|
73
101
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
74
102
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
75
103
|
|
76
|
-
def destroy(self, id: str) -> None:
|
104
|
+
def destroy(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
|
77
105
|
"""
|
78
106
|
Parameters:
|
79
107
|
- id: str. A UUID string identifying this document.
|
108
|
+
|
109
|
+
- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
|
80
110
|
---
|
81
111
|
from vellum.client import Vellum
|
82
112
|
|
@@ -89,9 +119,25 @@ class DocumentsClient:
|
|
89
119
|
"""
|
90
120
|
_response = self._client_wrapper.httpx_client.request(
|
91
121
|
"DELETE",
|
92
|
-
urllib.parse.urljoin(
|
93
|
-
|
94
|
-
|
122
|
+
urllib.parse.urljoin(
|
123
|
+
f"{self._client_wrapper.get_environment().default}/", f"v1/documents/{jsonable_encoder(id)}"
|
124
|
+
),
|
125
|
+
params=jsonable_encoder(
|
126
|
+
request_options.get("additional_query_parameters") if request_options is not None else None
|
127
|
+
),
|
128
|
+
headers=jsonable_encoder(
|
129
|
+
remove_none_from_dict(
|
130
|
+
{
|
131
|
+
**self._client_wrapper.get_headers(),
|
132
|
+
**(request_options.get("additional_headers", {}) if request_options is not None else {}),
|
133
|
+
}
|
134
|
+
)
|
135
|
+
),
|
136
|
+
timeout=request_options.get("timeout_in_seconds")
|
137
|
+
if request_options is not None and request_options.get("timeout_in_seconds") is not None
|
138
|
+
else self._client_wrapper.get_timeout(),
|
139
|
+
retries=0,
|
140
|
+
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
95
141
|
)
|
96
142
|
if 200 <= _response.status_code < 300:
|
97
143
|
return
|
@@ -108,6 +154,7 @@ class DocumentsClient:
|
|
108
154
|
label: typing.Optional[str] = OMIT,
|
109
155
|
status: typing.Optional[DocumentStatus] = OMIT,
|
110
156
|
metadata: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
|
157
|
+
request_options: typing.Optional[RequestOptions] = None,
|
111
158
|
) -> DocumentRead:
|
112
159
|
"""
|
113
160
|
Update a Document, keying off of its Vellum-generated ID. Particularly useful for updating its metadata.
|
@@ -121,6 +168,8 @@ class DocumentsClient:
|
|
121
168
|
|
122
169
|
* `ACTIVE` - Active
|
123
170
|
- metadata: typing.Optional[typing.Dict[str, typing.Any]]. A JSON object containing any metadata associated with the document that you'd like to filter upon later.
|
171
|
+
|
172
|
+
- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
|
124
173
|
---
|
125
174
|
from vellum.client import Vellum
|
126
175
|
|
@@ -140,10 +189,31 @@ class DocumentsClient:
|
|
140
189
|
_request["metadata"] = metadata
|
141
190
|
_response = self._client_wrapper.httpx_client.request(
|
142
191
|
"PATCH",
|
143
|
-
urllib.parse.urljoin(
|
144
|
-
|
145
|
-
|
146
|
-
|
192
|
+
urllib.parse.urljoin(
|
193
|
+
f"{self._client_wrapper.get_environment().default}/", f"v1/documents/{jsonable_encoder(id)}"
|
194
|
+
),
|
195
|
+
params=jsonable_encoder(
|
196
|
+
request_options.get("additional_query_parameters") if request_options is not None else None
|
197
|
+
),
|
198
|
+
json=jsonable_encoder(_request)
|
199
|
+
if request_options is None or request_options.get("additional_body_parameters") is None
|
200
|
+
else {
|
201
|
+
**jsonable_encoder(_request),
|
202
|
+
**(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
|
203
|
+
},
|
204
|
+
headers=jsonable_encoder(
|
205
|
+
remove_none_from_dict(
|
206
|
+
{
|
207
|
+
**self._client_wrapper.get_headers(),
|
208
|
+
**(request_options.get("additional_headers", {}) if request_options is not None else {}),
|
209
|
+
}
|
210
|
+
)
|
211
|
+
),
|
212
|
+
timeout=request_options.get("timeout_in_seconds")
|
213
|
+
if request_options is not None and request_options.get("timeout_in_seconds") is not None
|
214
|
+
else self._client_wrapper.get_timeout(),
|
215
|
+
retries=0,
|
216
|
+
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
147
217
|
)
|
148
218
|
if 200 <= _response.status_code < 300:
|
149
219
|
return pydantic.parse_obj_as(DocumentRead, _response.json()) # type: ignore
|
@@ -159,9 +229,10 @@ class DocumentsClient:
|
|
159
229
|
add_to_index_names: typing.Optional[typing.List[str]] = None,
|
160
230
|
external_id: typing.Optional[str] = None,
|
161
231
|
label: str,
|
162
|
-
contents:
|
232
|
+
contents: core.File,
|
163
233
|
keywords: typing.Optional[typing.List[str]] = None,
|
164
234
|
metadata: typing.Optional[str] = None,
|
235
|
+
request_options: typing.Optional[RequestOptions] = None,
|
165
236
|
) -> UploadDocumentResponse:
|
166
237
|
"""
|
167
238
|
Upload a document to be indexed and used for search.
|
@@ -177,33 +248,73 @@ class DocumentsClient:
|
|
177
248
|
- `metadata: dict[str, Any]` - A stringified JSON object containing any metadata associated with the document that you'd like to filter upon later.
|
178
249
|
|
179
250
|
Parameters:
|
180
|
-
- add_to_index_names: typing.Optional[typing.List[str]].
|
251
|
+
- add_to_index_names: typing.Optional[typing.List[str]]. Optionally include the names of all indexes that you'd like this document to be included in
|
252
|
+
|
253
|
+
- external_id: typing.Optional[str]. Optionally include an external ID for this document. This is useful if you want to re-upload the same document later when its contents change and would like it to be re-indexed.
|
254
|
+
|
255
|
+
- label: str. A human-friendly name for this document. Typically the filename.
|
181
256
|
|
182
|
-
-
|
257
|
+
- contents: core.File. See core.File for more documentation
|
183
258
|
|
184
|
-
-
|
259
|
+
- keywords: typing.Optional[typing.List[str]]. Optionally include a list of keywords that'll be associated with this document. Used when performing keyword searches.
|
185
260
|
|
186
|
-
-
|
261
|
+
- metadata: typing.Optional[str]. A stringified JSON object containing any metadata associated with the document that you'd like to filter upon later.
|
187
262
|
|
188
|
-
-
|
263
|
+
- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
|
264
|
+
---
|
265
|
+
from vellum.client import Vellum
|
189
266
|
|
190
|
-
|
267
|
+
client = Vellum(
|
268
|
+
api_key="YOUR_API_KEY",
|
269
|
+
)
|
270
|
+
client.documents.upload()
|
191
271
|
"""
|
192
272
|
_response = self._client_wrapper.httpx_client.request(
|
193
273
|
"POST",
|
194
274
|
urllib.parse.urljoin(f"{self._client_wrapper.get_environment().documents}/", "v1/upload-document"),
|
275
|
+
params=jsonable_encoder(
|
276
|
+
request_options.get("additional_query_parameters") if request_options is not None else None
|
277
|
+
),
|
195
278
|
data=jsonable_encoder(
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
279
|
+
remove_none_from_dict(
|
280
|
+
{
|
281
|
+
"add_to_index_names": add_to_index_names,
|
282
|
+
"external_id": external_id,
|
283
|
+
"label": label,
|
284
|
+
"keywords": keywords,
|
285
|
+
"metadata": metadata,
|
286
|
+
}
|
287
|
+
)
|
288
|
+
)
|
289
|
+
if request_options is None or request_options.get("additional_body_parameters") is None
|
290
|
+
else {
|
291
|
+
**jsonable_encoder(
|
292
|
+
remove_none_from_dict(
|
293
|
+
{
|
294
|
+
"add_to_index_names": add_to_index_names,
|
295
|
+
"external_id": external_id,
|
296
|
+
"label": label,
|
297
|
+
"keywords": keywords,
|
298
|
+
"metadata": metadata,
|
299
|
+
}
|
300
|
+
)
|
301
|
+
),
|
302
|
+
**(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
|
303
|
+
},
|
304
|
+
files=core.convert_file_dict_to_httpx_tuples(remove_none_from_dict({"contents": contents})),
|
305
|
+
headers=jsonable_encoder(
|
306
|
+
remove_none_from_dict(
|
307
|
+
{
|
308
|
+
**self._client_wrapper.get_headers(),
|
309
|
+
**(request_options.get("additional_headers", {}) if request_options is not None else {}),
|
310
|
+
}
|
311
|
+
)
|
203
312
|
),
|
204
|
-
|
205
|
-
|
206
|
-
|
313
|
+
timeout=request_options.get("timeout_in_seconds")
|
314
|
+
if request_options is not None and request_options.get("timeout_in_seconds") is not None
|
315
|
+
else self._client_wrapper.get_timeout(),
|
316
|
+
retries=0,
|
317
|
+
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
207
318
|
)
|
208
319
|
if 200 <= _response.status_code < 300:
|
209
320
|
return pydantic.parse_obj_as(UploadDocumentResponse, _response.json()) # type: ignore
|
@@ -231,6 +342,7 @@ class AsyncDocumentsClient:
|
|
231
342
|
limit: typing.Optional[int] = None,
|
232
343
|
offset: typing.Optional[int] = None,
|
233
344
|
ordering: typing.Optional[str] = None,
|
345
|
+
request_options: typing.Optional[RequestOptions] = None,
|
234
346
|
) -> PaginatedSlimDocumentList:
|
235
347
|
"""
|
236
348
|
Used to list documents. Optionally filter on supported fields.
|
@@ -243,6 +355,8 @@ class AsyncDocumentsClient:
|
|
243
355
|
- offset: typing.Optional[int]. The initial index from which to return the results.
|
244
356
|
|
245
357
|
- ordering: typing.Optional[str]. Which field to use when ordering the results.
|
358
|
+
|
359
|
+
- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
|
246
360
|
---
|
247
361
|
from vellum.client import AsyncVellum
|
248
362
|
|
@@ -254,11 +368,34 @@ class AsyncDocumentsClient:
|
|
254
368
|
_response = await self._client_wrapper.httpx_client.request(
|
255
369
|
"GET",
|
256
370
|
urllib.parse.urljoin(f"{self._client_wrapper.get_environment().default}/", "v1/documents"),
|
257
|
-
params=
|
258
|
-
|
371
|
+
params=jsonable_encoder(
|
372
|
+
remove_none_from_dict(
|
373
|
+
{
|
374
|
+
"document_index_id": document_index_id,
|
375
|
+
"limit": limit,
|
376
|
+
"offset": offset,
|
377
|
+
"ordering": ordering,
|
378
|
+
**(
|
379
|
+
request_options.get("additional_query_parameters", {})
|
380
|
+
if request_options is not None
|
381
|
+
else {}
|
382
|
+
),
|
383
|
+
}
|
384
|
+
)
|
385
|
+
),
|
386
|
+
headers=jsonable_encoder(
|
387
|
+
remove_none_from_dict(
|
388
|
+
{
|
389
|
+
**self._client_wrapper.get_headers(),
|
390
|
+
**(request_options.get("additional_headers", {}) if request_options is not None else {}),
|
391
|
+
}
|
392
|
+
)
|
259
393
|
),
|
260
|
-
|
261
|
-
|
394
|
+
timeout=request_options.get("timeout_in_seconds")
|
395
|
+
if request_options is not None and request_options.get("timeout_in_seconds") is not None
|
396
|
+
else self._client_wrapper.get_timeout(),
|
397
|
+
retries=0,
|
398
|
+
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
262
399
|
)
|
263
400
|
if 200 <= _response.status_code < 300:
|
264
401
|
return pydantic.parse_obj_as(PaginatedSlimDocumentList, _response.json()) # type: ignore
|
@@ -268,10 +405,12 @@ class AsyncDocumentsClient:
|
|
268
405
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
269
406
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
270
407
|
|
271
|
-
async def destroy(self, id: str) -> None:
|
408
|
+
async def destroy(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
|
272
409
|
"""
|
273
410
|
Parameters:
|
274
411
|
- id: str. A UUID string identifying this document.
|
412
|
+
|
413
|
+
- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
|
275
414
|
---
|
276
415
|
from vellum.client import AsyncVellum
|
277
416
|
|
@@ -284,9 +423,25 @@ class AsyncDocumentsClient:
|
|
284
423
|
"""
|
285
424
|
_response = await self._client_wrapper.httpx_client.request(
|
286
425
|
"DELETE",
|
287
|
-
urllib.parse.urljoin(
|
288
|
-
|
289
|
-
|
426
|
+
urllib.parse.urljoin(
|
427
|
+
f"{self._client_wrapper.get_environment().default}/", f"v1/documents/{jsonable_encoder(id)}"
|
428
|
+
),
|
429
|
+
params=jsonable_encoder(
|
430
|
+
request_options.get("additional_query_parameters") if request_options is not None else None
|
431
|
+
),
|
432
|
+
headers=jsonable_encoder(
|
433
|
+
remove_none_from_dict(
|
434
|
+
{
|
435
|
+
**self._client_wrapper.get_headers(),
|
436
|
+
**(request_options.get("additional_headers", {}) if request_options is not None else {}),
|
437
|
+
}
|
438
|
+
)
|
439
|
+
),
|
440
|
+
timeout=request_options.get("timeout_in_seconds")
|
441
|
+
if request_options is not None and request_options.get("timeout_in_seconds") is not None
|
442
|
+
else self._client_wrapper.get_timeout(),
|
443
|
+
retries=0,
|
444
|
+
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
290
445
|
)
|
291
446
|
if 200 <= _response.status_code < 300:
|
292
447
|
return
|
@@ -303,6 +458,7 @@ class AsyncDocumentsClient:
|
|
303
458
|
label: typing.Optional[str] = OMIT,
|
304
459
|
status: typing.Optional[DocumentStatus] = OMIT,
|
305
460
|
metadata: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
|
461
|
+
request_options: typing.Optional[RequestOptions] = None,
|
306
462
|
) -> DocumentRead:
|
307
463
|
"""
|
308
464
|
Update a Document, keying off of its Vellum-generated ID. Particularly useful for updating its metadata.
|
@@ -316,6 +472,8 @@ class AsyncDocumentsClient:
|
|
316
472
|
|
317
473
|
* `ACTIVE` - Active
|
318
474
|
- metadata: typing.Optional[typing.Dict[str, typing.Any]]. A JSON object containing any metadata associated with the document that you'd like to filter upon later.
|
475
|
+
|
476
|
+
- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
|
319
477
|
---
|
320
478
|
from vellum.client import AsyncVellum
|
321
479
|
|
@@ -335,10 +493,31 @@ class AsyncDocumentsClient:
|
|
335
493
|
_request["metadata"] = metadata
|
336
494
|
_response = await self._client_wrapper.httpx_client.request(
|
337
495
|
"PATCH",
|
338
|
-
urllib.parse.urljoin(
|
339
|
-
|
340
|
-
|
341
|
-
|
496
|
+
urllib.parse.urljoin(
|
497
|
+
f"{self._client_wrapper.get_environment().default}/", f"v1/documents/{jsonable_encoder(id)}"
|
498
|
+
),
|
499
|
+
params=jsonable_encoder(
|
500
|
+
request_options.get("additional_query_parameters") if request_options is not None else None
|
501
|
+
),
|
502
|
+
json=jsonable_encoder(_request)
|
503
|
+
if request_options is None or request_options.get("additional_body_parameters") is None
|
504
|
+
else {
|
505
|
+
**jsonable_encoder(_request),
|
506
|
+
**(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
|
507
|
+
},
|
508
|
+
headers=jsonable_encoder(
|
509
|
+
remove_none_from_dict(
|
510
|
+
{
|
511
|
+
**self._client_wrapper.get_headers(),
|
512
|
+
**(request_options.get("additional_headers", {}) if request_options is not None else {}),
|
513
|
+
}
|
514
|
+
)
|
515
|
+
),
|
516
|
+
timeout=request_options.get("timeout_in_seconds")
|
517
|
+
if request_options is not None and request_options.get("timeout_in_seconds") is not None
|
518
|
+
else self._client_wrapper.get_timeout(),
|
519
|
+
retries=0,
|
520
|
+
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
342
521
|
)
|
343
522
|
if 200 <= _response.status_code < 300:
|
344
523
|
return pydantic.parse_obj_as(DocumentRead, _response.json()) # type: ignore
|
@@ -354,9 +533,10 @@ class AsyncDocumentsClient:
|
|
354
533
|
add_to_index_names: typing.Optional[typing.List[str]] = None,
|
355
534
|
external_id: typing.Optional[str] = None,
|
356
535
|
label: str,
|
357
|
-
contents:
|
536
|
+
contents: core.File,
|
358
537
|
keywords: typing.Optional[typing.List[str]] = None,
|
359
538
|
metadata: typing.Optional[str] = None,
|
539
|
+
request_options: typing.Optional[RequestOptions] = None,
|
360
540
|
) -> UploadDocumentResponse:
|
361
541
|
"""
|
362
542
|
Upload a document to be indexed and used for search.
|
@@ -372,33 +552,73 @@ class AsyncDocumentsClient:
|
|
372
552
|
- `metadata: dict[str, Any]` - A stringified JSON object containing any metadata associated with the document that you'd like to filter upon later.
|
373
553
|
|
374
554
|
Parameters:
|
375
|
-
- add_to_index_names: typing.Optional[typing.List[str]].
|
555
|
+
- add_to_index_names: typing.Optional[typing.List[str]]. Optionally include the names of all indexes that you'd like this document to be included in
|
556
|
+
|
557
|
+
- external_id: typing.Optional[str]. Optionally include an external ID for this document. This is useful if you want to re-upload the same document later when its contents change and would like it to be re-indexed.
|
558
|
+
|
559
|
+
- label: str. A human-friendly name for this document. Typically the filename.
|
376
560
|
|
377
|
-
-
|
561
|
+
- contents: core.File. See core.File for more documentation
|
378
562
|
|
379
|
-
-
|
563
|
+
- keywords: typing.Optional[typing.List[str]]. Optionally include a list of keywords that'll be associated with this document. Used when performing keyword searches.
|
380
564
|
|
381
|
-
-
|
565
|
+
- metadata: typing.Optional[str]. A stringified JSON object containing any metadata associated with the document that you'd like to filter upon later.
|
382
566
|
|
383
|
-
-
|
567
|
+
- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
|
568
|
+
---
|
569
|
+
from vellum.client import AsyncVellum
|
384
570
|
|
385
|
-
|
571
|
+
client = AsyncVellum(
|
572
|
+
api_key="YOUR_API_KEY",
|
573
|
+
)
|
574
|
+
await client.documents.upload()
|
386
575
|
"""
|
387
576
|
_response = await self._client_wrapper.httpx_client.request(
|
388
577
|
"POST",
|
389
578
|
urllib.parse.urljoin(f"{self._client_wrapper.get_environment().documents}/", "v1/upload-document"),
|
579
|
+
params=jsonable_encoder(
|
580
|
+
request_options.get("additional_query_parameters") if request_options is not None else None
|
581
|
+
),
|
390
582
|
data=jsonable_encoder(
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
583
|
+
remove_none_from_dict(
|
584
|
+
{
|
585
|
+
"add_to_index_names": add_to_index_names,
|
586
|
+
"external_id": external_id,
|
587
|
+
"label": label,
|
588
|
+
"keywords": keywords,
|
589
|
+
"metadata": metadata,
|
590
|
+
}
|
591
|
+
)
|
592
|
+
)
|
593
|
+
if request_options is None or request_options.get("additional_body_parameters") is None
|
594
|
+
else {
|
595
|
+
**jsonable_encoder(
|
596
|
+
remove_none_from_dict(
|
597
|
+
{
|
598
|
+
"add_to_index_names": add_to_index_names,
|
599
|
+
"external_id": external_id,
|
600
|
+
"label": label,
|
601
|
+
"keywords": keywords,
|
602
|
+
"metadata": metadata,
|
603
|
+
}
|
604
|
+
)
|
605
|
+
),
|
606
|
+
**(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
|
607
|
+
},
|
608
|
+
files=core.convert_file_dict_to_httpx_tuples(remove_none_from_dict({"contents": contents})),
|
609
|
+
headers=jsonable_encoder(
|
610
|
+
remove_none_from_dict(
|
611
|
+
{
|
612
|
+
**self._client_wrapper.get_headers(),
|
613
|
+
**(request_options.get("additional_headers", {}) if request_options is not None else {}),
|
614
|
+
}
|
615
|
+
)
|
398
616
|
),
|
399
|
-
|
400
|
-
|
401
|
-
|
617
|
+
timeout=request_options.get("timeout_in_seconds")
|
618
|
+
if request_options is not None and request_options.get("timeout_in_seconds") is not None
|
619
|
+
else self._client_wrapper.get_timeout(),
|
620
|
+
retries=0,
|
621
|
+
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
402
622
|
)
|
403
623
|
if 200 <= _response.status_code < 300:
|
404
624
|
return pydantic.parse_obj_as(UploadDocumentResponse, _response.json()) # type: ignore
|
@@ -7,6 +7,8 @@ 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 ...core.remove_none_from_dict import remove_none_from_dict
|
11
|
+
from ...core.request_options import RequestOptions
|
10
12
|
|
11
13
|
# this is used as the default value for optional parameters
|
12
14
|
OMIT = typing.cast(typing.Any, ...)
|
@@ -16,7 +18,9 @@ class FolderEntitiesClient:
|
|
16
18
|
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
17
19
|
self._client_wrapper = client_wrapper
|
18
20
|
|
19
|
-
def add_entity_to_folder(
|
21
|
+
def add_entity_to_folder(
|
22
|
+
self, folder_id: str, *, entity_id: str, request_options: typing.Optional[RequestOptions] = None
|
23
|
+
) -> None:
|
20
24
|
"""
|
21
25
|
Add an entity to a specific folder or root directory.
|
22
26
|
|
@@ -26,6 +30,8 @@ class FolderEntitiesClient:
|
|
26
30
|
- folder_id: str. 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 directory (e.g. "PROMPT_SANDBOX").
|
27
31
|
|
28
32
|
- entity_id: str. The ID of the entity you would like to move.
|
33
|
+
|
34
|
+
- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
|
29
35
|
---
|
30
36
|
from vellum.client import Vellum
|
31
37
|
|
@@ -40,11 +46,31 @@ class FolderEntitiesClient:
|
|
40
46
|
_response = self._client_wrapper.httpx_client.request(
|
41
47
|
"POST",
|
42
48
|
urllib.parse.urljoin(
|
43
|
-
f"{self._client_wrapper.get_environment().default}/",
|
49
|
+
f"{self._client_wrapper.get_environment().default}/",
|
50
|
+
f"v1/folders/{jsonable_encoder(folder_id)}/add-entity",
|
51
|
+
),
|
52
|
+
params=jsonable_encoder(
|
53
|
+
request_options.get("additional_query_parameters") if request_options is not None else None
|
54
|
+
),
|
55
|
+
json=jsonable_encoder({"entity_id": entity_id})
|
56
|
+
if request_options is None or request_options.get("additional_body_parameters") is None
|
57
|
+
else {
|
58
|
+
**jsonable_encoder({"entity_id": entity_id}),
|
59
|
+
**(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
|
60
|
+
},
|
61
|
+
headers=jsonable_encoder(
|
62
|
+
remove_none_from_dict(
|
63
|
+
{
|
64
|
+
**self._client_wrapper.get_headers(),
|
65
|
+
**(request_options.get("additional_headers", {}) if request_options is not None else {}),
|
66
|
+
}
|
67
|
+
)
|
44
68
|
),
|
45
|
-
|
46
|
-
|
47
|
-
|
69
|
+
timeout=request_options.get("timeout_in_seconds")
|
70
|
+
if request_options is not None and request_options.get("timeout_in_seconds") is not None
|
71
|
+
else self._client_wrapper.get_timeout(),
|
72
|
+
retries=0,
|
73
|
+
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
48
74
|
)
|
49
75
|
if 200 <= _response.status_code < 300:
|
50
76
|
return
|
@@ -59,7 +85,9 @@ class AsyncFolderEntitiesClient:
|
|
59
85
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
60
86
|
self._client_wrapper = client_wrapper
|
61
87
|
|
62
|
-
async def add_entity_to_folder(
|
88
|
+
async def add_entity_to_folder(
|
89
|
+
self, folder_id: str, *, entity_id: str, request_options: typing.Optional[RequestOptions] = None
|
90
|
+
) -> None:
|
63
91
|
"""
|
64
92
|
Add an entity to a specific folder or root directory.
|
65
93
|
|
@@ -69,6 +97,8 @@ class AsyncFolderEntitiesClient:
|
|
69
97
|
- folder_id: str. 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 directory (e.g. "PROMPT_SANDBOX").
|
70
98
|
|
71
99
|
- entity_id: str. The ID of the entity you would like to move.
|
100
|
+
|
101
|
+
- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
|
72
102
|
---
|
73
103
|
from vellum.client import AsyncVellum
|
74
104
|
|
@@ -83,11 +113,31 @@ class AsyncFolderEntitiesClient:
|
|
83
113
|
_response = await self._client_wrapper.httpx_client.request(
|
84
114
|
"POST",
|
85
115
|
urllib.parse.urljoin(
|
86
|
-
f"{self._client_wrapper.get_environment().default}/",
|
116
|
+
f"{self._client_wrapper.get_environment().default}/",
|
117
|
+
f"v1/folders/{jsonable_encoder(folder_id)}/add-entity",
|
118
|
+
),
|
119
|
+
params=jsonable_encoder(
|
120
|
+
request_options.get("additional_query_parameters") if request_options is not None else None
|
121
|
+
),
|
122
|
+
json=jsonable_encoder({"entity_id": entity_id})
|
123
|
+
if request_options is None or request_options.get("additional_body_parameters") is None
|
124
|
+
else {
|
125
|
+
**jsonable_encoder({"entity_id": entity_id}),
|
126
|
+
**(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
|
127
|
+
},
|
128
|
+
headers=jsonable_encoder(
|
129
|
+
remove_none_from_dict(
|
130
|
+
{
|
131
|
+
**self._client_wrapper.get_headers(),
|
132
|
+
**(request_options.get("additional_headers", {}) if request_options is not None else {}),
|
133
|
+
}
|
134
|
+
)
|
87
135
|
),
|
88
|
-
|
89
|
-
|
90
|
-
|
136
|
+
timeout=request_options.get("timeout_in_seconds")
|
137
|
+
if request_options is not None and request_options.get("timeout_in_seconds") is not None
|
138
|
+
else self._client_wrapper.get_timeout(),
|
139
|
+
retries=0,
|
140
|
+
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
91
141
|
)
|
92
142
|
if 200 <= _response.status_code < 300:
|
93
143
|
return
|