vellum-ai 0.0.20__py3-none-any.whl → 0.0.25__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- vellum/__init__.py +38 -20
- vellum/client.py +278 -101
- vellum/core/__init__.py +11 -2
- vellum/core/client_wrapper.py +27 -0
- vellum/core/remove_none_from_dict.py +11 -0
- vellum/resources/deployments/client.py +35 -15
- vellum/resources/document_indexes/client.py +64 -16
- vellum/resources/documents/client.py +110 -35
- vellum/resources/model_versions/client.py +67 -25
- vellum/resources/registered_prompts/client.py +80 -16
- vellum/resources/sandboxes/client.py +90 -25
- vellum/resources/test_suites/client.py +90 -25
- vellum/types/__init__.py +24 -4
- vellum/types/deployment_read.py +2 -6
- vellum/types/document.py +3 -7
- vellum/types/document_document_to_document_index.py +2 -2
- vellum/types/document_index_read.py +3 -7
- vellum/types/enriched_normalized_completion.py +5 -9
- vellum/types/evaluation_params.py +1 -3
- vellum/types/evaluation_params_request.py +1 -3
- vellum/types/execute_workflow_stream_error_response.py +24 -0
- vellum/types/generate_error_response.py +1 -1
- vellum/types/generate_request.py +3 -7
- vellum/types/generate_result.py +2 -6
- vellum/types/generate_result_data.py +1 -1
- vellum/types/generate_result_error.py +1 -1
- vellum/types/model_version_build_config.py +2 -6
- vellum/types/model_version_compile_prompt_response.py +1 -1
- vellum/types/model_version_compiled_prompt.py +2 -4
- vellum/types/model_version_exec_config.py +3 -3
- vellum/types/model_version_read.py +7 -10
- vellum/types/model_version_sandbox_snapshot.py +3 -5
- vellum/types/prompt_template_block_properties.py +1 -0
- vellum/types/prompt_template_block_properties_request.py +3 -2
- vellum/types/prompt_template_block_request.py +1 -1
- vellum/types/prompt_template_input_variable.py +1 -1
- vellum/types/prompt_template_input_variable_request.py +1 -1
- vellum/types/provider_enum.py +5 -0
- vellum/types/register_prompt_error_response.py +1 -1
- vellum/types/register_prompt_prompt.py +2 -2
- vellum/types/register_prompt_prompt_info_request.py +1 -1
- vellum/types/register_prompt_response.py +5 -7
- vellum/types/registered_prompt_deployment.py +3 -3
- vellum/types/registered_prompt_model_version.py +2 -2
- vellum/types/registered_prompt_sandbox.py +2 -2
- vellum/types/registered_prompt_sandbox_snapshot.py +1 -1
- vellum/types/sandbox_scenario.py +2 -2
- vellum/types/scenario_input_request.py +1 -1
- vellum/types/search_error_response.py +1 -1
- vellum/types/search_filters_request.py +1 -1
- vellum/types/search_request_options_request.py +4 -6
- vellum/types/search_response.py +1 -1
- vellum/types/search_result.py +3 -3
- vellum/types/search_result_merging_request.py +1 -1
- vellum/types/search_weights_request.py +2 -2
- vellum/types/slim_document.py +5 -9
- vellum/types/submit_completion_actual_request.py +5 -15
- vellum/types/terminal_node_chat_history_result.py +1 -1
- vellum/types/terminal_node_json_result.py +1 -1
- vellum/types/terminal_node_result_output.py +2 -4
- vellum/types/terminal_node_string_result.py +1 -1
- vellum/types/test_suite_test_case.py +4 -8
- vellum/types/upload_document_response.py +1 -1
- vellum/types/workflow_event_error.py +26 -0
- vellum/types/workflow_execution_event_error_code.py +31 -0
- vellum/types/workflow_node_result_data.py +7 -11
- vellum/types/workflow_node_result_event.py +4 -3
- vellum/types/{workflow_node_result_event_state_enum.py → workflow_node_result_event_state.py} +5 -5
- vellum/types/workflow_request_chat_history_input_request.py +1 -3
- vellum/types/workflow_request_input_request.py +2 -6
- vellum/types/workflow_request_json_input_request.py +1 -3
- vellum/types/workflow_request_string_input_request.py +1 -3
- vellum/types/workflow_result_event.py +6 -3
- vellum/types/workflow_result_event_output_data.py +40 -0
- vellum/types/workflow_result_event_output_data_chat_history.py +32 -0
- vellum/types/workflow_result_event_output_data_json.py +31 -0
- vellum/types/workflow_result_event_output_data_string.py +33 -0
- vellum/types/workflow_stream_event.py +1 -4
- {vellum_ai-0.0.20.dist-info → vellum_ai-0.0.25.dist-info}/METADATA +1 -1
- vellum_ai-0.0.25.dist-info/RECORD +149 -0
- vellum/core/remove_none_from_headers.py +0 -11
- vellum/types/workflow_result_event_state_enum.py +0 -31
- vellum_ai-0.0.20.dist-info/RECORD +0 -142
- {vellum_ai-0.0.20.dist-info → vellum_ai-0.0.25.dist-info}/WHEEL +0 -0
vellum/types/slim_document.py
CHANGED
@@ -13,17 +13,15 @@ from .slim_document_status_enum import SlimDocumentStatusEnum
|
|
13
13
|
|
14
14
|
|
15
15
|
class SlimDocument(pydantic.BaseModel):
|
16
|
-
id: str = pydantic.Field(description=
|
16
|
+
id: str = pydantic.Field(description="Vellum-generated ID that uniquely identifies this document.")
|
17
17
|
external_id: typing.Optional[str] = pydantic.Field(
|
18
|
-
description=
|
18
|
+
description="The external ID that was originally provided when uploading the document."
|
19
19
|
)
|
20
20
|
last_uploaded_at: str = pydantic.Field(
|
21
|
-
description=
|
21
|
+
description="A timestamp representing when this document was most recently uploaded."
|
22
22
|
)
|
23
23
|
label: str = pydantic.Field(
|
24
|
-
description=
|
25
|
-
'Human-friendly name for this document. <span style="white-space: nowrap">`<= 1000 characters`</span> \n'
|
26
|
-
)
|
24
|
+
description='Human-friendly name for this document. <span style="white-space: nowrap">`<= 1000 characters`</span> '
|
27
25
|
)
|
28
26
|
processing_state: typing.Optional[ProcessingStateEnum] = pydantic.Field(
|
29
27
|
description=(
|
@@ -46,9 +44,7 @@ class SlimDocument(pydantic.BaseModel):
|
|
46
44
|
description=("The document's current status.\n" "\n" "* `ACTIVE` - Active\n")
|
47
45
|
)
|
48
46
|
keywords: typing.Optional[typing.List[str]] = pydantic.Field(
|
49
|
-
description=
|
50
|
-
"A list of keywords associated with this document. Originally provided when uploading the document.\n"
|
51
|
-
)
|
47
|
+
description="A list of keywords associated with this document. Originally provided when uploading the document."
|
52
48
|
)
|
53
49
|
document_to_document_indexes: typing.List[DocumentDocumentToDocumentIndex]
|
54
50
|
|
@@ -10,27 +10,17 @@ from ..core.datetime_utils import serialize_datetime
|
|
10
10
|
|
11
11
|
class SubmitCompletionActualRequest(pydantic.BaseModel):
|
12
12
|
id: typing.Optional[str] = pydantic.Field(
|
13
|
-
description=
|
14
|
-
"The Vellum-generated ID of a previously generated completion. Must provide either this or external_id.\n"
|
15
|
-
)
|
13
|
+
description="The Vellum-generated ID of a previously generated completion. Must provide either this or external_id."
|
16
14
|
)
|
17
15
|
external_id: typing.Optional[str] = pydantic.Field(
|
18
|
-
description=
|
19
|
-
"The external ID that was originally provided when generating the completion that you'd now like to submit actuals for. Must provide either this or id.\n"
|
20
|
-
)
|
21
|
-
)
|
22
|
-
text: typing.Optional[str] = pydantic.Field(
|
23
|
-
description=("Text representing what the completion _should_ have been.\n")
|
16
|
+
description="The external ID that was originally provided when generating the completion that you'd now like to submit actuals for. Must provide either this or id."
|
24
17
|
)
|
18
|
+
text: typing.Optional[str] = pydantic.Field(description="Text representing what the completion _should_ have been.")
|
25
19
|
quality: typing.Optional[float] = pydantic.Field(
|
26
|
-
description=
|
27
|
-
"A number between 0 and 1 representing the quality of the completion. 0 is the worst, 1 is the best.\n"
|
28
|
-
)
|
20
|
+
description="A number between 0 and 1 representing the quality of the completion. 0 is the worst, 1 is the best."
|
29
21
|
)
|
30
22
|
timestamp: typing.Optional[str] = pydantic.Field(
|
31
|
-
description=
|
32
|
-
"Optionally provide the timestamp representing when this feedback was collected. Used for reporting purposes.\n"
|
33
|
-
)
|
23
|
+
description="Optionally provide the timestamp representing when this feedback was collected. Used for reporting purposes."
|
34
24
|
)
|
35
25
|
|
36
26
|
def json(self, **kwargs: typing.Any) -> str:
|
@@ -10,7 +10,7 @@ from .chat_message import ChatMessage
|
|
10
10
|
|
11
11
|
|
12
12
|
class TerminalNodeChatHistoryResult(pydantic.BaseModel):
|
13
|
-
name: str = pydantic.Field(description=
|
13
|
+
name: str = pydantic.Field(description="The unique name given to the terminal node that produced this output.")
|
14
14
|
value: typing.List[ChatMessage]
|
15
15
|
|
16
16
|
def json(self, **kwargs: typing.Any) -> str:
|
@@ -9,7 +9,7 @@ from ..core.datetime_utils import serialize_datetime
|
|
9
9
|
|
10
10
|
|
11
11
|
class TerminalNodeJsonResult(pydantic.BaseModel):
|
12
|
-
name: str = pydantic.Field(description=
|
12
|
+
name: str = pydantic.Field(description="The unique name given to the terminal node that produced this output.")
|
13
13
|
value: typing.Dict[str, typing.Any]
|
14
14
|
|
15
15
|
def json(self, **kwargs: typing.Any) -> str:
|
@@ -4,7 +4,6 @@ from __future__ import annotations
|
|
4
4
|
|
5
5
|
import typing
|
6
6
|
|
7
|
-
import pydantic
|
8
7
|
import typing_extensions
|
9
8
|
|
10
9
|
from .terminal_node_chat_history_result import TerminalNodeChatHistoryResult
|
@@ -36,7 +35,6 @@ class TerminalNodeResultOutput_ChatHistory(TerminalNodeChatHistoryResult):
|
|
36
35
|
allow_population_by_field_name = True
|
37
36
|
|
38
37
|
|
39
|
-
TerminalNodeResultOutput =
|
40
|
-
|
41
|
-
pydantic.Field(discriminator="type"),
|
38
|
+
TerminalNodeResultOutput = typing.Union[
|
39
|
+
TerminalNodeResultOutput_String, TerminalNodeResultOutput_Json, TerminalNodeResultOutput_ChatHistory
|
42
40
|
]
|
@@ -9,7 +9,7 @@ from ..core.datetime_utils import serialize_datetime
|
|
9
9
|
|
10
10
|
|
11
11
|
class TerminalNodeStringResult(pydantic.BaseModel):
|
12
|
-
name: str = pydantic.Field(description=
|
12
|
+
name: str = pydantic.Field(description="The unique name given to the terminal node that produced this output.")
|
13
13
|
value: str
|
14
14
|
|
15
15
|
def json(self, **kwargs: typing.Any) -> str:
|
@@ -11,18 +11,14 @@ from .evaluation_params import EvaluationParams
|
|
11
11
|
|
12
12
|
class TestSuiteTestCase(pydantic.BaseModel):
|
13
13
|
test_case_id: typing.Optional[str] = pydantic.Field(
|
14
|
-
description=
|
15
|
-
"The id of the test case to update. If none is provided, an id will be generated and a new test case will be appended.\n"
|
16
|
-
)
|
14
|
+
description="The id of the test case to update. If none is provided, an id will be generated and a new test case will be appended."
|
17
15
|
)
|
18
|
-
label: typing.Optional[str] = pydantic.Field(description=
|
16
|
+
label: typing.Optional[str] = pydantic.Field(description="A human-friendly label for the test case.")
|
19
17
|
input_values: typing.Dict[str, typing.Any] = pydantic.Field(
|
20
|
-
description=
|
18
|
+
description="Key/value pairs for each input variable that the Test Suite expects."
|
21
19
|
)
|
22
20
|
evaluation_params: EvaluationParams = pydantic.Field(
|
23
|
-
description=
|
24
|
-
"Parameters to use when evaluating the test case, specific to the test suite's evaluation metric.\n"
|
25
|
-
)
|
21
|
+
description="Parameters to use when evaluating the test case, specific to the test suite's evaluation metric."
|
26
22
|
)
|
27
23
|
|
28
24
|
def json(self, **kwargs: typing.Any) -> str:
|
@@ -9,7 +9,7 @@ from ..core.datetime_utils import serialize_datetime
|
|
9
9
|
|
10
10
|
|
11
11
|
class UploadDocumentResponse(pydantic.BaseModel):
|
12
|
-
document_id: str = pydantic.Field(description=
|
12
|
+
document_id: str = pydantic.Field(description="The ID of the newly created document.")
|
13
13
|
|
14
14
|
def json(self, **kwargs: typing.Any) -> str:
|
15
15
|
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
2
|
+
|
3
|
+
import datetime as dt
|
4
|
+
import typing
|
5
|
+
|
6
|
+
import pydantic
|
7
|
+
|
8
|
+
from ..core.datetime_utils import serialize_datetime
|
9
|
+
from .workflow_execution_event_error_code import WorkflowExecutionEventErrorCode
|
10
|
+
|
11
|
+
|
12
|
+
class WorkflowEventError(pydantic.BaseModel):
|
13
|
+
message: str
|
14
|
+
code: WorkflowExecutionEventErrorCode
|
15
|
+
|
16
|
+
def json(self, **kwargs: typing.Any) -> str:
|
17
|
+
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
|
18
|
+
return super().json(**kwargs_with_defaults)
|
19
|
+
|
20
|
+
def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
|
21
|
+
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
|
22
|
+
return super().dict(**kwargs_with_defaults)
|
23
|
+
|
24
|
+
class Config:
|
25
|
+
frozen = True
|
26
|
+
json_encoders = {dt.datetime: serialize_datetime}
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
2
|
+
|
3
|
+
import enum
|
4
|
+
import typing
|
5
|
+
|
6
|
+
T_Result = typing.TypeVar("T_Result")
|
7
|
+
|
8
|
+
|
9
|
+
class WorkflowExecutionEventErrorCode(str, enum.Enum):
|
10
|
+
"""
|
11
|
+
* `WORKFLOW_INITIALIZATION` - WORKFLOW_INITIALIZATION
|
12
|
+
* `NODE_EXECUTION` - NODE_EXECUTION
|
13
|
+
* `NODE_EXECUTION_COUNT_LIMIT_REACHED` - NODE_EXECUTION_COUNT_LIMIT_REACHED
|
14
|
+
"""
|
15
|
+
|
16
|
+
WORKFLOW_INITIALIZATION = "WORKFLOW_INITIALIZATION"
|
17
|
+
NODE_EXECUTION = "NODE_EXECUTION"
|
18
|
+
NODE_EXECUTION_COUNT_LIMIT_REACHED = "NODE_EXECUTION_COUNT_LIMIT_REACHED"
|
19
|
+
|
20
|
+
def visit(
|
21
|
+
self,
|
22
|
+
workflow_initialization: typing.Callable[[], T_Result],
|
23
|
+
node_execution: typing.Callable[[], T_Result],
|
24
|
+
node_execution_count_limit_reached: typing.Callable[[], T_Result],
|
25
|
+
) -> T_Result:
|
26
|
+
if self is WorkflowExecutionEventErrorCode.WORKFLOW_INITIALIZATION:
|
27
|
+
return workflow_initialization()
|
28
|
+
if self is WorkflowExecutionEventErrorCode.NODE_EXECUTION:
|
29
|
+
return node_execution()
|
30
|
+
if self is WorkflowExecutionEventErrorCode.NODE_EXECUTION_COUNT_LIMIT_REACHED:
|
31
|
+
return node_execution_count_limit_reached()
|
@@ -4,7 +4,6 @@ from __future__ import annotations
|
|
4
4
|
|
5
5
|
import typing
|
6
6
|
|
7
|
-
import pydantic
|
8
7
|
import typing_extensions
|
9
8
|
|
10
9
|
from .conditional_node_result import ConditionalNodeResult
|
@@ -63,14 +62,11 @@ class WorkflowNodeResultData_Terminal(TerminalNodeResult):
|
|
63
62
|
allow_population_by_field_name = True
|
64
63
|
|
65
64
|
|
66
|
-
WorkflowNodeResultData =
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
WorkflowNodeResultData_Terminal,
|
74
|
-
],
|
75
|
-
pydantic.Field(discriminator="type"),
|
65
|
+
WorkflowNodeResultData = typing.Union[
|
66
|
+
WorkflowNodeResultData_Prompt,
|
67
|
+
WorkflowNodeResultData_Sandbox,
|
68
|
+
WorkflowNodeResultData_Deployment,
|
69
|
+
WorkflowNodeResultData_Search,
|
70
|
+
WorkflowNodeResultData_Conditional,
|
71
|
+
WorkflowNodeResultData_Terminal,
|
76
72
|
]
|
@@ -6,18 +6,19 @@ import typing
|
|
6
6
|
import pydantic
|
7
7
|
|
8
8
|
from ..core.datetime_utils import serialize_datetime
|
9
|
+
from .workflow_event_error import WorkflowEventError
|
9
10
|
from .workflow_node_result_data import WorkflowNodeResultData
|
10
|
-
from .
|
11
|
+
from .workflow_node_result_event_state import WorkflowNodeResultEventState
|
11
12
|
|
12
13
|
|
13
14
|
class WorkflowNodeResultEvent(pydantic.BaseModel):
|
14
15
|
id: str
|
15
16
|
node_id: str
|
16
17
|
node_result_id: str
|
17
|
-
state:
|
18
|
+
state: WorkflowNodeResultEventState
|
18
19
|
ts: typing.Optional[str]
|
19
20
|
data: typing.Optional[WorkflowNodeResultData]
|
20
|
-
error: typing.Optional[
|
21
|
+
error: typing.Optional[WorkflowEventError]
|
21
22
|
|
22
23
|
def json(self, **kwargs: typing.Any) -> str:
|
23
24
|
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
|
vellum/types/{workflow_node_result_event_state_enum.py → workflow_node_result_event_state.py}
RENAMED
@@ -6,7 +6,7 @@ import typing
|
|
6
6
|
T_Result = typing.TypeVar("T_Result")
|
7
7
|
|
8
8
|
|
9
|
-
class
|
9
|
+
class WorkflowNodeResultEventState(str, enum.Enum):
|
10
10
|
"""
|
11
11
|
* `INITIATED` - INITIATED
|
12
12
|
* `STREAMING` - STREAMING
|
@@ -26,11 +26,11 @@ class WorkflowNodeResultEventStateEnum(str, enum.Enum):
|
|
26
26
|
fulfilled: typing.Callable[[], T_Result],
|
27
27
|
rejected: typing.Callable[[], T_Result],
|
28
28
|
) -> T_Result:
|
29
|
-
if self is
|
29
|
+
if self is WorkflowNodeResultEventState.INITIATED:
|
30
30
|
return initiated()
|
31
|
-
if self is
|
31
|
+
if self is WorkflowNodeResultEventState.STREAMING:
|
32
32
|
return streaming()
|
33
|
-
if self is
|
33
|
+
if self is WorkflowNodeResultEventState.FULFILLED:
|
34
34
|
return fulfilled()
|
35
|
-
if self is
|
35
|
+
if self is WorkflowNodeResultEventState.REJECTED:
|
36
36
|
return rejected()
|
@@ -11,9 +11,7 @@ from .chat_message_request import ChatMessageRequest
|
|
11
11
|
|
12
12
|
class WorkflowRequestChatHistoryInputRequest(pydantic.BaseModel):
|
13
13
|
name: str = pydantic.Field(
|
14
|
-
description=
|
15
|
-
'The variable\'s name, as defined in the Workflow. <span style="white-space: nowrap">`non-empty`</span> \n'
|
16
|
-
)
|
14
|
+
description='The variable\'s name, as defined in the Workflow. <span style="white-space: nowrap">`non-empty`</span> '
|
17
15
|
)
|
18
16
|
value: typing.List[ChatMessageRequest]
|
19
17
|
|
@@ -4,7 +4,6 @@ from __future__ import annotations
|
|
4
4
|
|
5
5
|
import typing
|
6
6
|
|
7
|
-
import pydantic
|
8
7
|
import typing_extensions
|
9
8
|
|
10
9
|
from .workflow_request_chat_history_input_request import WorkflowRequestChatHistoryInputRequest
|
@@ -36,9 +35,6 @@ class WorkflowRequestInputRequest_ChatHistory(WorkflowRequestChatHistoryInputReq
|
|
36
35
|
allow_population_by_field_name = True
|
37
36
|
|
38
37
|
|
39
|
-
WorkflowRequestInputRequest =
|
40
|
-
|
41
|
-
WorkflowRequestInputRequest_String, WorkflowRequestInputRequest_Json, WorkflowRequestInputRequest_ChatHistory
|
42
|
-
],
|
43
|
-
pydantic.Field(discriminator="type"),
|
38
|
+
WorkflowRequestInputRequest = typing.Union[
|
39
|
+
WorkflowRequestInputRequest_String, WorkflowRequestInputRequest_Json, WorkflowRequestInputRequest_ChatHistory
|
44
40
|
]
|
@@ -10,9 +10,7 @@ from ..core.datetime_utils import serialize_datetime
|
|
10
10
|
|
11
11
|
class WorkflowRequestJsonInputRequest(pydantic.BaseModel):
|
12
12
|
name: str = pydantic.Field(
|
13
|
-
description=
|
14
|
-
'The variable\'s name, as defined in the Workflow. <span style="white-space: nowrap">`non-empty`</span> \n'
|
15
|
-
)
|
13
|
+
description='The variable\'s name, as defined in the Workflow. <span style="white-space: nowrap">`non-empty`</span> '
|
16
14
|
)
|
17
15
|
value: typing.Dict[str, typing.Any]
|
18
16
|
|
@@ -10,9 +10,7 @@ from ..core.datetime_utils import serialize_datetime
|
|
10
10
|
|
11
11
|
class WorkflowRequestStringInputRequest(pydantic.BaseModel):
|
12
12
|
name: str = pydantic.Field(
|
13
|
-
description=
|
14
|
-
'The variable\'s name, as defined in the Workflow. <span style="white-space: nowrap">`non-empty`</span> \n'
|
15
|
-
)
|
13
|
+
description='The variable\'s name, as defined in the Workflow. <span style="white-space: nowrap">`non-empty`</span> '
|
16
14
|
)
|
17
15
|
value: str
|
18
16
|
|
@@ -6,14 +6,17 @@ import typing
|
|
6
6
|
import pydantic
|
7
7
|
|
8
8
|
from ..core.datetime_utils import serialize_datetime
|
9
|
-
from .
|
9
|
+
from .workflow_event_error import WorkflowEventError
|
10
|
+
from .workflow_node_result_event_state import WorkflowNodeResultEventState
|
11
|
+
from .workflow_result_event_output_data import WorkflowResultEventOutputData
|
10
12
|
|
11
13
|
|
12
14
|
class WorkflowResultEvent(pydantic.BaseModel):
|
13
15
|
id: str
|
14
|
-
state:
|
16
|
+
state: WorkflowNodeResultEventState
|
15
17
|
ts: str
|
16
|
-
|
18
|
+
output: typing.Optional[WorkflowResultEventOutputData]
|
19
|
+
error: typing.Optional[WorkflowEventError]
|
17
20
|
|
18
21
|
def json(self, **kwargs: typing.Any) -> str:
|
19
22
|
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
2
|
+
|
3
|
+
from __future__ import annotations
|
4
|
+
|
5
|
+
import typing
|
6
|
+
|
7
|
+
import typing_extensions
|
8
|
+
|
9
|
+
from .workflow_result_event_output_data_chat_history import WorkflowResultEventOutputDataChatHistory
|
10
|
+
from .workflow_result_event_output_data_json import WorkflowResultEventOutputDataJson
|
11
|
+
from .workflow_result_event_output_data_string import WorkflowResultEventOutputDataString
|
12
|
+
|
13
|
+
|
14
|
+
class WorkflowResultEventOutputData_String(WorkflowResultEventOutputDataString):
|
15
|
+
type: typing_extensions.Literal["STRING"]
|
16
|
+
|
17
|
+
class Config:
|
18
|
+
frozen = True
|
19
|
+
allow_population_by_field_name = True
|
20
|
+
|
21
|
+
|
22
|
+
class WorkflowResultEventOutputData_Json(WorkflowResultEventOutputDataJson):
|
23
|
+
type: typing_extensions.Literal["JSON"]
|
24
|
+
|
25
|
+
class Config:
|
26
|
+
frozen = True
|
27
|
+
allow_population_by_field_name = True
|
28
|
+
|
29
|
+
|
30
|
+
class WorkflowResultEventOutputData_ChatHistory(WorkflowResultEventOutputDataChatHistory):
|
31
|
+
type: typing_extensions.Literal["CHAT_HISTORY"]
|
32
|
+
|
33
|
+
class Config:
|
34
|
+
frozen = True
|
35
|
+
allow_population_by_field_name = True
|
36
|
+
|
37
|
+
|
38
|
+
WorkflowResultEventOutputData = typing.Union[
|
39
|
+
WorkflowResultEventOutputData_String, WorkflowResultEventOutputData_Json, WorkflowResultEventOutputData_ChatHistory
|
40
|
+
]
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
2
|
+
|
3
|
+
import datetime as dt
|
4
|
+
import typing
|
5
|
+
|
6
|
+
import pydantic
|
7
|
+
|
8
|
+
from ..core.datetime_utils import serialize_datetime
|
9
|
+
from .chat_message import ChatMessage
|
10
|
+
from .workflow_node_result_event_state import WorkflowNodeResultEventState
|
11
|
+
|
12
|
+
|
13
|
+
class WorkflowResultEventOutputDataChatHistory(pydantic.BaseModel):
|
14
|
+
name: str
|
15
|
+
state: WorkflowNodeResultEventState
|
16
|
+
node_id: str
|
17
|
+
delta: typing.Optional[str] = pydantic.Field(
|
18
|
+
description="The newly output string value. Only relevant for string outputs with a state of STREAMING."
|
19
|
+
)
|
20
|
+
value: typing.Optional[typing.List[ChatMessage]]
|
21
|
+
|
22
|
+
def json(self, **kwargs: typing.Any) -> str:
|
23
|
+
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
|
24
|
+
return super().json(**kwargs_with_defaults)
|
25
|
+
|
26
|
+
def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
|
27
|
+
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
|
28
|
+
return super().dict(**kwargs_with_defaults)
|
29
|
+
|
30
|
+
class Config:
|
31
|
+
frozen = True
|
32
|
+
json_encoders = {dt.datetime: serialize_datetime}
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
2
|
+
|
3
|
+
import datetime as dt
|
4
|
+
import typing
|
5
|
+
|
6
|
+
import pydantic
|
7
|
+
|
8
|
+
from ..core.datetime_utils import serialize_datetime
|
9
|
+
from .workflow_node_result_event_state import WorkflowNodeResultEventState
|
10
|
+
|
11
|
+
|
12
|
+
class WorkflowResultEventOutputDataJson(pydantic.BaseModel):
|
13
|
+
name: str
|
14
|
+
state: WorkflowNodeResultEventState
|
15
|
+
node_id: str
|
16
|
+
delta: typing.Optional[str] = pydantic.Field(
|
17
|
+
description="The newly output string value. Only relevant for string outputs with a state of STREAMING."
|
18
|
+
)
|
19
|
+
value: typing.Optional[typing.Dict[str, typing.Any]]
|
20
|
+
|
21
|
+
def json(self, **kwargs: typing.Any) -> str:
|
22
|
+
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
|
23
|
+
return super().json(**kwargs_with_defaults)
|
24
|
+
|
25
|
+
def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
|
26
|
+
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
|
27
|
+
return super().dict(**kwargs_with_defaults)
|
28
|
+
|
29
|
+
class Config:
|
30
|
+
frozen = True
|
31
|
+
json_encoders = {dt.datetime: serialize_datetime}
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
2
|
+
|
3
|
+
import datetime as dt
|
4
|
+
import typing
|
5
|
+
|
6
|
+
import pydantic
|
7
|
+
|
8
|
+
from ..core.datetime_utils import serialize_datetime
|
9
|
+
from .workflow_node_result_event_state import WorkflowNodeResultEventState
|
10
|
+
|
11
|
+
|
12
|
+
class WorkflowResultEventOutputDataString(pydantic.BaseModel):
|
13
|
+
name: str
|
14
|
+
state: WorkflowNodeResultEventState
|
15
|
+
node_id: str
|
16
|
+
delta: typing.Optional[str] = pydantic.Field(
|
17
|
+
description="The newly output string value, meant to be concatenated with all previous. Will be non-null for events of state STREAMING."
|
18
|
+
)
|
19
|
+
value: typing.Optional[str] = pydantic.Field(
|
20
|
+
description="The entire string value. Will be non-null for events of state FULFILLED."
|
21
|
+
)
|
22
|
+
|
23
|
+
def json(self, **kwargs: typing.Any) -> str:
|
24
|
+
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
|
25
|
+
return super().json(**kwargs_with_defaults)
|
26
|
+
|
27
|
+
def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
|
28
|
+
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
|
29
|
+
return super().dict(**kwargs_with_defaults)
|
30
|
+
|
31
|
+
class Config:
|
32
|
+
frozen = True
|
33
|
+
json_encoders = {dt.datetime: serialize_datetime}
|
@@ -4,7 +4,6 @@ from __future__ import annotations
|
|
4
4
|
|
5
5
|
import typing
|
6
6
|
|
7
|
-
import pydantic
|
8
7
|
import typing_extensions
|
9
8
|
|
10
9
|
from .workflow_execution_node_result_event import WorkflowExecutionNodeResultEvent
|
@@ -27,6 +26,4 @@ class WorkflowStreamEvent_Node(WorkflowExecutionNodeResultEvent):
|
|
27
26
|
allow_population_by_field_name = True
|
28
27
|
|
29
28
|
|
30
|
-
WorkflowStreamEvent =
|
31
|
-
typing.Union[WorkflowStreamEvent_Workflow, WorkflowStreamEvent_Node], pydantic.Field(discriminator="type")
|
32
|
-
]
|
29
|
+
WorkflowStreamEvent = typing.Union[WorkflowStreamEvent_Workflow, WorkflowStreamEvent_Node]
|