adaline-api 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- adaline_api/__init__.py +193 -0
- adaline_api/api/__init__.py +5 -0
- adaline_api/api/default_api.py +1221 -0
- adaline_api/api_client.py +804 -0
- adaline_api/api_response.py +21 -0
- adaline_api/configuration.py +582 -0
- adaline_api/exceptions.py +216 -0
- adaline_api/models/__init__.py +89 -0
- adaline_api/models/api_message_content.py +113 -0
- adaline_api/models/api_message_content_type.py +113 -0
- adaline_api/models/base64_hosted_image_content_value.py +99 -0
- adaline_api/models/base64_hosted_image_content_value_type.py +99 -0
- adaline_api/models/base64_hosted_pdf_content_value.py +99 -0
- adaline_api/models/base64_hosted_pdf_content_value_type.py +99 -0
- adaline_api/models/base64_image_content_value.py +105 -0
- adaline_api/models/base64_image_content_value_type.py +105 -0
- adaline_api/models/base64_media.py +118 -0
- adaline_api/models/base64_media_type.py +118 -0
- adaline_api/models/base64_pdf_content_value.py +96 -0
- adaline_api/models/base64_pdf_content_value_type.py +96 -0
- adaline_api/models/base_entity.py +96 -0
- adaline_api/models/config_type.py +94 -0
- adaline_api/models/content.py +196 -0
- adaline_api/models/content_type.py +196 -0
- adaline_api/models/create_log_span_request.py +94 -0
- adaline_api/models/create_log_span_request_span.py +150 -0
- adaline_api/models/create_log_span_request_type.py +94 -0
- adaline_api/models/create_log_span_response.py +88 -0
- adaline_api/models/create_log_span_response_type.py +88 -0
- adaline_api/models/create_log_trace_request.py +104 -0
- adaline_api/models/create_log_trace_request_span.py +146 -0
- adaline_api/models/create_log_trace_request_trace.py +122 -0
- adaline_api/models/create_log_trace_request_type.py +104 -0
- adaline_api/models/create_log_trace_response.py +90 -0
- adaline_api/models/create_log_trace_response_type.py +90 -0
- adaline_api/models/deployment.py +107 -0
- adaline_api/models/deployment_prompt.py +121 -0
- adaline_api/models/deployment_prompt_config.py +94 -0
- adaline_api/models/deployment_prompt_config_type.py +94 -0
- adaline_api/models/deployment_prompt_type.py +121 -0
- adaline_api/models/deployment_prompt_variables.py +96 -0
- adaline_api/models/deployment_prompt_variables_type.py +96 -0
- adaline_api/models/deployment_type.py +107 -0
- adaline_api/models/deployment_type_prompt.py +121 -0
- adaline_api/models/enum_value.py +166 -0
- adaline_api/models/enum_value_type.py +166 -0
- adaline_api/models/error_response.py +91 -0
- adaline_api/models/error_response_type.py +91 -0
- adaline_api/models/function.py +101 -0
- adaline_api/models/function_parameter.py +139 -0
- adaline_api/models/function_parameter_type.py +139 -0
- adaline_api/models/function_parameters.py +115 -0
- adaline_api/models/function_parameters_type.py +115 -0
- adaline_api/models/function_request_http.py +121 -0
- adaline_api/models/function_request_http_type.py +121 -0
- adaline_api/models/function_request_retry.py +92 -0
- adaline_api/models/function_request_retry_type.py +92 -0
- adaline_api/models/function_tool.py +106 -0
- adaline_api/models/function_tool_definition.py +91 -0
- adaline_api/models/function_tool_definition_type.py +104 -0
- adaline_api/models/function_tool_type.py +106 -0
- adaline_api/models/function_tool_type_definition.py +91 -0
- adaline_api/models/function_type.py +106 -0
- adaline_api/models/image_content.py +109 -0
- adaline_api/models/image_content_type.py +109 -0
- adaline_api/models/image_content_value.py +140 -0
- adaline_api/models/image_content_value_type.py +140 -0
- adaline_api/models/image_message_content.py +111 -0
- adaline_api/models/image_message_content_type.py +111 -0
- adaline_api/models/image_message_content_type_value.py +154 -0
- adaline_api/models/image_message_content_value.py +154 -0
- adaline_api/models/image_source.py +140 -0
- adaline_api/models/image_source_type.py +140 -0
- adaline_api/models/log_attributes_value.py +160 -0
- adaline_api/models/log_feedback_comment.py +98 -0
- adaline_api/models/log_span.py +180 -0
- adaline_api/models/log_span_all_of_internal_feedback.py +98 -0
- adaline_api/models/log_span_content.py +224 -0
- adaline_api/models/log_span_embeddings_content.py +101 -0
- adaline_api/models/log_span_event.py +96 -0
- adaline_api/models/log_span_function_content.py +101 -0
- adaline_api/models/log_span_guardrail_content.py +101 -0
- adaline_api/models/log_span_model_content.py +109 -0
- adaline_api/models/log_span_model_stream_content.py +111 -0
- adaline_api/models/log_span_other_content.py +101 -0
- adaline_api/models/log_span_parsed_content.py +101 -0
- adaline_api/models/log_span_retrieval_content.py +101 -0
- adaline_api/models/log_span_tool_content.py +101 -0
- adaline_api/models/log_trace.py +132 -0
- adaline_api/models/log_trace_attributes_inner.py +102 -0
- adaline_api/models/log_trace_attributes_value.py +160 -0
- adaline_api/models/log_trace_attributes_value_type.py +160 -0
- adaline_api/models/log_trace_tags_inner.py +96 -0
- adaline_api/models/log_trace_type.py +132 -0
- adaline_api/models/log_trace_type_attributes_inner.py +102 -0
- adaline_api/models/log_trace_type_tags_inner.py +96 -0
- adaline_api/models/mcp_server.py +114 -0
- adaline_api/models/mcp_server_tool_configuration.py +90 -0
- adaline_api/models/mcp_server_tool_configuration_type.py +90 -0
- adaline_api/models/mcp_server_type.py +114 -0
- adaline_api/models/message.py +98 -0
- adaline_api/models/message_content_inner.py +182 -0
- adaline_api/models/message_content_type_inner.py +182 -0
- adaline_api/models/message_type.py +98 -0
- adaline_api/models/modality_enum.py +41 -0
- adaline_api/models/modality_enum_type.py +41 -0
- adaline_api/models/pdf_content.py +106 -0
- adaline_api/models/pdf_content_file.py +91 -0
- adaline_api/models/pdf_content_type.py +106 -0
- adaline_api/models/pdf_content_type_file.py +91 -0
- adaline_api/models/pdf_content_value.py +140 -0
- adaline_api/models/pdf_content_value_type.py +140 -0
- adaline_api/models/pdf_message_content.py +108 -0
- adaline_api/models/pdf_message_content_file.py +91 -0
- adaline_api/models/pdf_message_content_type.py +108 -0
- adaline_api/models/pdf_message_content_type_file.py +91 -0
- adaline_api/models/pdf_message_content_type_value.py +154 -0
- adaline_api/models/pdf_message_content_value.py +154 -0
- adaline_api/models/prompt_variable.py +96 -0
- adaline_api/models/prompt_variable_value.py +210 -0
- adaline_api/models/reasoning_content.py +100 -0
- adaline_api/models/reasoning_content_type.py +100 -0
- adaline_api/models/reasoning_content_value.py +98 -0
- adaline_api/models/reasoning_content_value_type.py +98 -0
- adaline_api/models/reasoning_content_value_union.py +140 -0
- adaline_api/models/reasoning_content_value_union_type.py +140 -0
- adaline_api/models/reasoning_message_content.py +102 -0
- adaline_api/models/reasoning_message_content_type.py +102 -0
- adaline_api/models/reasoning_message_content_type_value.py +140 -0
- adaline_api/models/reasoning_message_content_value.py +140 -0
- adaline_api/models/reasoning_redacted_value.py +109 -0
- adaline_api/models/reasoning_redacted_value_type.py +109 -0
- adaline_api/models/reasoning_thinking_value.py +111 -0
- adaline_api/models/reasoning_thinking_value_type.py +111 -0
- adaline_api/models/reasoning_value.py +140 -0
- adaline_api/models/reasoning_value_type.py +140 -0
- adaline_api/models/redacted_reasoning_content_value.py +96 -0
- adaline_api/models/redacted_reasoning_content_value_type.py +96 -0
- adaline_api/models/response_schema.py +105 -0
- adaline_api/models/response_schema_property.py +135 -0
- adaline_api/models/response_schema_property_enum_inner.py +166 -0
- adaline_api/models/response_schema_property_type.py +143 -0
- adaline_api/models/response_schema_property_type_enum_inner.py +166 -0
- adaline_api/models/response_schema_property_type_type.py +143 -0
- adaline_api/models/response_schema_structure.py +122 -0
- adaline_api/models/response_schema_structure_type.py +122 -0
- adaline_api/models/response_schema_type.py +105 -0
- adaline_api/models/role_enum.py +39 -0
- adaline_api/models/role_enum_type.py +39 -0
- adaline_api/models/span_content_detailed.py +112 -0
- adaline_api/models/span_content_detailed_type.py +112 -0
- adaline_api/models/span_content_detailed_type_variables_value.py +94 -0
- adaline_api/models/span_content_detailed_variables_value.py +94 -0
- adaline_api/models/span_content_minimal.py +91 -0
- adaline_api/models/span_content_minimal_type.py +91 -0
- adaline_api/models/span_log_req_attributes.py +160 -0
- adaline_api/models/span_log_req_attributes_type.py +160 -0
- adaline_api/models/span_log_req_content.py +137 -0
- adaline_api/models/span_log_req_content_type.py +137 -0
- adaline_api/models/span_log_request.py +93 -0
- adaline_api/models/span_log_request_span.py +139 -0
- adaline_api/models/span_log_request_type.py +93 -0
- adaline_api/models/span_log_request_type_span.py +139 -0
- adaline_api/models/span_log_response.py +87 -0
- adaline_api/models/span_log_response_type.py +87 -0
- adaline_api/models/spans_request_attribute_value.py +160 -0
- adaline_api/models/spans_request_attribute_value_type.py +160 -0
- adaline_api/models/spans_request_content_value.py +143 -0
- adaline_api/models/spans_request_content_value_type.py +143 -0
- adaline_api/models/text_content.py +96 -0
- adaline_api/models/text_content_type.py +96 -0
- adaline_api/models/text_message_content.py +98 -0
- adaline_api/models/text_message_content_type.py +98 -0
- adaline_api/models/tool_call_content.py +105 -0
- adaline_api/models/tool_call_content_type.py +105 -0
- adaline_api/models/tool_call_message_content.py +107 -0
- adaline_api/models/tool_call_message_content_type.py +107 -0
- adaline_api/models/tool_response_content.py +109 -0
- adaline_api/models/tool_response_content_api_response.py +88 -0
- adaline_api/models/tool_response_content_type.py +109 -0
- adaline_api/models/tool_response_content_type_api_response.py +88 -0
- adaline_api/models/tool_response_message_content.py +111 -0
- adaline_api/models/tool_response_message_content_api_response.py +87 -0
- adaline_api/models/tool_response_message_content_type.py +111 -0
- adaline_api/models/tool_response_message_content_type_api_response.py +87 -0
- adaline_api/models/tool_type.py +113 -0
- adaline_api/models/trace_log_patch_request.py +137 -0
- adaline_api/models/trace_log_patch_request_one_of.py +97 -0
- adaline_api/models/trace_log_patch_request_one_of1.py +97 -0
- adaline_api/models/trace_log_patch_request_type.py +137 -0
- adaline_api/models/trace_log_patch_request_type_one_of.py +97 -0
- adaline_api/models/trace_log_patch_request_type_one_of1.py +97 -0
- adaline_api/models/trace_log_patch_response.py +87 -0
- adaline_api/models/trace_log_patch_response_type.py +87 -0
- adaline_api/models/trace_log_request.py +103 -0
- adaline_api/models/trace_log_request_spans_inner.py +135 -0
- adaline_api/models/trace_log_request_trace.py +121 -0
- adaline_api/models/trace_log_request_type.py +103 -0
- adaline_api/models/trace_log_request_type_spans_inner.py +135 -0
- adaline_api/models/trace_log_request_type_trace.py +121 -0
- adaline_api/models/trace_log_response.py +89 -0
- adaline_api/models/trace_log_response_type.py +89 -0
- adaline_api/models/trace_request_attribute_value.py +160 -0
- adaline_api/models/trace_request_attribute_value_type.py +160 -0
- adaline_api/models/update_log_trace_request.py +98 -0
- adaline_api/models/update_log_trace_request_attribute_item.py +140 -0
- adaline_api/models/update_log_trace_request_attribute_item_one_of.py +102 -0
- adaline_api/models/update_log_trace_request_attribute_item_one_of1.py +96 -0
- adaline_api/models/update_log_trace_request_attribute_item_one_of_value.py +160 -0
- adaline_api/models/update_log_trace_request_tag_item.py +140 -0
- adaline_api/models/update_log_trace_request_tag_item_one_of.py +97 -0
- adaline_api/models/update_log_trace_request_tag_item_one_of1.py +97 -0
- adaline_api/models/update_log_trace_request_trace.py +120 -0
- adaline_api/models/update_log_trace_request_type.py +98 -0
- adaline_api/models/update_log_trace_response.py +87 -0
- adaline_api/models/update_log_trace_response_type.py +87 -0
- adaline_api/models/url_image_content_value.py +96 -0
- adaline_api/models/url_image_content_value_type.py +96 -0
- adaline_api/models/url_media.py +109 -0
- adaline_api/models/url_media_type.py +109 -0
- adaline_api/models/url_pdf_content_value.py +96 -0
- adaline_api/models/url_pdf_content_value_type.py +96 -0
- adaline_api/models/variable.py +96 -0
- adaline_api/models/variable_type.py +96 -0
- adaline_api/models/variable_type_value.py +196 -0
- adaline_api/models/variable_value.py +196 -0
- adaline_api/models/variables_type.py +96 -0
- adaline_api/py.typed +0 -0
- adaline_api/rest.py +213 -0
- adaline_api-1.0.0.dist-info/METADATA +227 -0
- adaline_api-1.0.0.dist-info/RECORD +233 -0
- adaline_api-1.0.0.dist-info/WHEEL +5 -0
- adaline_api-1.0.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Adaline API
|
|
5
|
+
|
|
6
|
+
API for managing Adaline deployments, logs, and core type definitions.
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1.0.0
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import json
|
|
17
|
+
import pprint
|
|
18
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator
|
|
19
|
+
from typing import Any, List, Optional
|
|
20
|
+
from adaline_api.models.base64_hosted_pdf_content_value import Base64HostedPdfContentValue
|
|
21
|
+
from adaline_api.models.base64_pdf_content_value import Base64PdfContentValue
|
|
22
|
+
from adaline_api.models.url_pdf_content_value import UrlPdfContentValue
|
|
23
|
+
from pydantic import StrictStr, Field
|
|
24
|
+
from typing import Union, List, Set, Optional, Dict
|
|
25
|
+
from typing_extensions import Literal, Self
|
|
26
|
+
|
|
27
|
+
PDFMESSAGECONTENTVALUE_ONE_OF_SCHEMAS = ["Base64HostedPdfContentValue", "Base64PdfContentValue", "UrlPdfContentValue"]
|
|
28
|
+
|
|
29
|
+
class PdfMessageContentValue(BaseModel):
|
|
30
|
+
"""
|
|
31
|
+
PdfMessageContentValue
|
|
32
|
+
"""
|
|
33
|
+
# data type: UrlPdfContentValue
|
|
34
|
+
oneof_schema_1_validator: Optional[UrlPdfContentValue] = None
|
|
35
|
+
# data type: Base64PdfContentValue
|
|
36
|
+
oneof_schema_2_validator: Optional[Base64PdfContentValue] = None
|
|
37
|
+
# data type: Base64HostedPdfContentValue
|
|
38
|
+
oneof_schema_3_validator: Optional[Base64HostedPdfContentValue] = None
|
|
39
|
+
actual_instance: Optional[Union[Base64HostedPdfContentValue, Base64PdfContentValue, UrlPdfContentValue]] = None
|
|
40
|
+
one_of_schemas: Set[str] = { "Base64HostedPdfContentValue", "Base64PdfContentValue", "UrlPdfContentValue" }
|
|
41
|
+
|
|
42
|
+
model_config = ConfigDict(
|
|
43
|
+
validate_assignment=True,
|
|
44
|
+
protected_namespaces=(),
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
discriminator_value_class_map: Dict[str, str] = {
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
def __init__(self, *args, **kwargs) -> None:
|
|
52
|
+
if args:
|
|
53
|
+
if len(args) > 1:
|
|
54
|
+
raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
|
|
55
|
+
if kwargs:
|
|
56
|
+
raise ValueError("If a position argument is used, keyword arguments cannot be used.")
|
|
57
|
+
super().__init__(actual_instance=args[0])
|
|
58
|
+
else:
|
|
59
|
+
super().__init__(**kwargs)
|
|
60
|
+
|
|
61
|
+
@field_validator('actual_instance')
|
|
62
|
+
def actual_instance_must_validate_oneof(cls, v):
|
|
63
|
+
instance = PdfMessageContentValue.model_construct()
|
|
64
|
+
error_messages = []
|
|
65
|
+
match = 0
|
|
66
|
+
# validate data type: UrlPdfContentValue
|
|
67
|
+
if not isinstance(v, UrlPdfContentValue):
|
|
68
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `UrlPdfContentValue`")
|
|
69
|
+
else:
|
|
70
|
+
match += 1
|
|
71
|
+
# validate data type: Base64PdfContentValue
|
|
72
|
+
if not isinstance(v, Base64PdfContentValue):
|
|
73
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `Base64PdfContentValue`")
|
|
74
|
+
else:
|
|
75
|
+
match += 1
|
|
76
|
+
# validate data type: Base64HostedPdfContentValue
|
|
77
|
+
if not isinstance(v, Base64HostedPdfContentValue):
|
|
78
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `Base64HostedPdfContentValue`")
|
|
79
|
+
else:
|
|
80
|
+
match += 1
|
|
81
|
+
if match > 1:
|
|
82
|
+
# more than 1 match
|
|
83
|
+
raise ValueError("Multiple matches found when setting `actual_instance` in PdfMessageContentValue with oneOf schemas: Base64HostedPdfContentValue, Base64PdfContentValue, UrlPdfContentValue. Details: " + ", ".join(error_messages))
|
|
84
|
+
elif match == 0:
|
|
85
|
+
# no match
|
|
86
|
+
raise ValueError("No match found when setting `actual_instance` in PdfMessageContentValue with oneOf schemas: Base64HostedPdfContentValue, Base64PdfContentValue, UrlPdfContentValue. Details: " + ", ".join(error_messages))
|
|
87
|
+
else:
|
|
88
|
+
return v
|
|
89
|
+
|
|
90
|
+
@classmethod
|
|
91
|
+
def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self:
|
|
92
|
+
return cls.from_json(json.dumps(obj))
|
|
93
|
+
|
|
94
|
+
@classmethod
|
|
95
|
+
def from_json(cls, json_str: str) -> Self:
|
|
96
|
+
"""Returns the object represented by the json string"""
|
|
97
|
+
instance = cls.model_construct()
|
|
98
|
+
error_messages = []
|
|
99
|
+
match = 0
|
|
100
|
+
|
|
101
|
+
# deserialize data into UrlPdfContentValue
|
|
102
|
+
try:
|
|
103
|
+
instance.actual_instance = UrlPdfContentValue.from_json(json_str)
|
|
104
|
+
match += 1
|
|
105
|
+
except (ValidationError, ValueError) as e:
|
|
106
|
+
error_messages.append(str(e))
|
|
107
|
+
# deserialize data into Base64PdfContentValue
|
|
108
|
+
try:
|
|
109
|
+
instance.actual_instance = Base64PdfContentValue.from_json(json_str)
|
|
110
|
+
match += 1
|
|
111
|
+
except (ValidationError, ValueError) as e:
|
|
112
|
+
error_messages.append(str(e))
|
|
113
|
+
# deserialize data into Base64HostedPdfContentValue
|
|
114
|
+
try:
|
|
115
|
+
instance.actual_instance = Base64HostedPdfContentValue.from_json(json_str)
|
|
116
|
+
match += 1
|
|
117
|
+
except (ValidationError, ValueError) as e:
|
|
118
|
+
error_messages.append(str(e))
|
|
119
|
+
|
|
120
|
+
if match > 1:
|
|
121
|
+
# more than 1 match
|
|
122
|
+
raise ValueError("Multiple matches found when deserializing the JSON string into PdfMessageContentValue with oneOf schemas: Base64HostedPdfContentValue, Base64PdfContentValue, UrlPdfContentValue. Details: " + ", ".join(error_messages))
|
|
123
|
+
elif match == 0:
|
|
124
|
+
# no match
|
|
125
|
+
raise ValueError("No match found when deserializing the JSON string into PdfMessageContentValue with oneOf schemas: Base64HostedPdfContentValue, Base64PdfContentValue, UrlPdfContentValue. Details: " + ", ".join(error_messages))
|
|
126
|
+
else:
|
|
127
|
+
return instance
|
|
128
|
+
|
|
129
|
+
def to_json(self) -> str:
|
|
130
|
+
"""Returns the JSON representation of the actual instance"""
|
|
131
|
+
if self.actual_instance is None:
|
|
132
|
+
return "null"
|
|
133
|
+
|
|
134
|
+
if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
|
|
135
|
+
return self.actual_instance.to_json()
|
|
136
|
+
else:
|
|
137
|
+
return json.dumps(self.actual_instance)
|
|
138
|
+
|
|
139
|
+
def to_dict(self) -> Optional[Union[Dict[str, Any], Base64HostedPdfContentValue, Base64PdfContentValue, UrlPdfContentValue]]:
|
|
140
|
+
"""Returns the dict representation of the actual instance"""
|
|
141
|
+
if self.actual_instance is None:
|
|
142
|
+
return None
|
|
143
|
+
|
|
144
|
+
if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
|
|
145
|
+
return self.actual_instance.to_dict()
|
|
146
|
+
else:
|
|
147
|
+
# primitive type
|
|
148
|
+
return self.actual_instance
|
|
149
|
+
|
|
150
|
+
def to_str(self) -> str:
|
|
151
|
+
"""Returns the string representation of the actual instance"""
|
|
152
|
+
return pprint.pformat(self.model_dump())
|
|
153
|
+
|
|
154
|
+
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Adaline API
|
|
5
|
+
|
|
6
|
+
API for managing Adaline deployments, logs, and core type definitions.
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1.0.0
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import pprint
|
|
17
|
+
import re # noqa: F401
|
|
18
|
+
import json
|
|
19
|
+
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
|
+
from typing_extensions import Annotated
|
|
23
|
+
from adaline_api.models.prompt_variable_value import PromptVariableValue
|
|
24
|
+
from typing import Optional, Set
|
|
25
|
+
from typing_extensions import Self
|
|
26
|
+
|
|
27
|
+
class PromptVariable(BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
PromptVariable
|
|
30
|
+
""" # noqa: E501
|
|
31
|
+
name: Annotated[str, Field(min_length=1, strict=True, max_length=200)] = Field(description="The name of the variable")
|
|
32
|
+
value: PromptVariableValue
|
|
33
|
+
description: Optional[Annotated[str, Field(min_length=1, strict=True, max_length=200)]] = Field(default=None, description="Optional description of the variable")
|
|
34
|
+
__properties: ClassVar[List[str]] = ["name", "value", "description"]
|
|
35
|
+
|
|
36
|
+
model_config = ConfigDict(
|
|
37
|
+
populate_by_name=True,
|
|
38
|
+
validate_assignment=True,
|
|
39
|
+
protected_namespaces=(),
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def to_str(self) -> str:
|
|
44
|
+
"""Returns the string representation of the model using alias"""
|
|
45
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
46
|
+
|
|
47
|
+
def to_json(self) -> str:
|
|
48
|
+
"""Returns the JSON representation of the model using alias"""
|
|
49
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
50
|
+
return json.dumps(self.to_dict())
|
|
51
|
+
|
|
52
|
+
@classmethod
|
|
53
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
54
|
+
"""Create an instance of PromptVariable from a JSON string"""
|
|
55
|
+
return cls.from_dict(json.loads(json_str))
|
|
56
|
+
|
|
57
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
58
|
+
"""Return the dictionary representation of the model using alias.
|
|
59
|
+
|
|
60
|
+
This has the following differences from calling pydantic's
|
|
61
|
+
`self.model_dump(by_alias=True)`:
|
|
62
|
+
|
|
63
|
+
* `None` is only added to the output dict for nullable fields that
|
|
64
|
+
were set at model initialization. Other fields with value `None`
|
|
65
|
+
are ignored.
|
|
66
|
+
"""
|
|
67
|
+
excluded_fields: Set[str] = set([
|
|
68
|
+
])
|
|
69
|
+
|
|
70
|
+
_dict = self.model_dump(
|
|
71
|
+
by_alias=True,
|
|
72
|
+
exclude=excluded_fields,
|
|
73
|
+
exclude_none=True,
|
|
74
|
+
)
|
|
75
|
+
# override the default output from pydantic by calling `to_dict()` of value
|
|
76
|
+
if self.value:
|
|
77
|
+
_dict['value'] = self.value.to_dict()
|
|
78
|
+
return _dict
|
|
79
|
+
|
|
80
|
+
@classmethod
|
|
81
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
82
|
+
"""Create an instance of PromptVariable from a dict"""
|
|
83
|
+
if obj is None:
|
|
84
|
+
return None
|
|
85
|
+
|
|
86
|
+
if not isinstance(obj, dict):
|
|
87
|
+
return cls.model_validate(obj)
|
|
88
|
+
|
|
89
|
+
_obj = cls.model_validate({
|
|
90
|
+
"name": obj.get("name"),
|
|
91
|
+
"value": PromptVariableValue.from_dict(obj["value"]) if obj.get("value") is not None else None,
|
|
92
|
+
"description": obj.get("description")
|
|
93
|
+
})
|
|
94
|
+
return _obj
|
|
95
|
+
|
|
96
|
+
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Adaline API
|
|
5
|
+
|
|
6
|
+
API for managing Adaline deployments, logs, and core type definitions.
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1.0.0
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import json
|
|
17
|
+
import pprint
|
|
18
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator
|
|
19
|
+
from typing import Any, List, Optional
|
|
20
|
+
from adaline_api.models.api_message_content import ApiMessageContent
|
|
21
|
+
from adaline_api.models.image_message_content import ImageMessageContent
|
|
22
|
+
from adaline_api.models.pdf_message_content import PdfMessageContent
|
|
23
|
+
from adaline_api.models.reasoning_message_content import ReasoningMessageContent
|
|
24
|
+
from adaline_api.models.text_message_content import TextMessageContent
|
|
25
|
+
from adaline_api.models.tool_call_message_content import ToolCallMessageContent
|
|
26
|
+
from adaline_api.models.tool_response_message_content import ToolResponseMessageContent
|
|
27
|
+
from pydantic import StrictStr, Field
|
|
28
|
+
from typing import Union, List, Set, Optional, Dict
|
|
29
|
+
from typing_extensions import Literal, Self
|
|
30
|
+
|
|
31
|
+
PROMPTVARIABLEVALUE_ONE_OF_SCHEMAS = ["ApiMessageContent", "ImageMessageContent", "PdfMessageContent", "ReasoningMessageContent", "TextMessageContent", "ToolCallMessageContent", "ToolResponseMessageContent"]
|
|
32
|
+
|
|
33
|
+
class PromptVariableValue(BaseModel):
|
|
34
|
+
"""
|
|
35
|
+
PromptVariableValue
|
|
36
|
+
"""
|
|
37
|
+
# data type: TextMessageContent
|
|
38
|
+
oneof_schema_1_validator: Optional[TextMessageContent] = None
|
|
39
|
+
# data type: ImageMessageContent
|
|
40
|
+
oneof_schema_2_validator: Optional[ImageMessageContent] = None
|
|
41
|
+
# data type: PdfMessageContent
|
|
42
|
+
oneof_schema_3_validator: Optional[PdfMessageContent] = None
|
|
43
|
+
# data type: ReasoningMessageContent
|
|
44
|
+
oneof_schema_4_validator: Optional[ReasoningMessageContent] = None
|
|
45
|
+
# data type: ToolCallMessageContent
|
|
46
|
+
oneof_schema_5_validator: Optional[ToolCallMessageContent] = None
|
|
47
|
+
# data type: ToolResponseMessageContent
|
|
48
|
+
oneof_schema_6_validator: Optional[ToolResponseMessageContent] = None
|
|
49
|
+
# data type: ApiMessageContent
|
|
50
|
+
oneof_schema_7_validator: Optional[ApiMessageContent] = None
|
|
51
|
+
actual_instance: Optional[Union[ApiMessageContent, ImageMessageContent, PdfMessageContent, ReasoningMessageContent, TextMessageContent, ToolCallMessageContent, ToolResponseMessageContent]] = None
|
|
52
|
+
one_of_schemas: Set[str] = { "ApiMessageContent", "ImageMessageContent", "PdfMessageContent", "ReasoningMessageContent", "TextMessageContent", "ToolCallMessageContent", "ToolResponseMessageContent" }
|
|
53
|
+
|
|
54
|
+
model_config = ConfigDict(
|
|
55
|
+
validate_assignment=True,
|
|
56
|
+
protected_namespaces=(),
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
discriminator_value_class_map: Dict[str, str] = {
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
def __init__(self, *args, **kwargs) -> None:
|
|
64
|
+
if args:
|
|
65
|
+
if len(args) > 1:
|
|
66
|
+
raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
|
|
67
|
+
if kwargs:
|
|
68
|
+
raise ValueError("If a position argument is used, keyword arguments cannot be used.")
|
|
69
|
+
super().__init__(actual_instance=args[0])
|
|
70
|
+
else:
|
|
71
|
+
super().__init__(**kwargs)
|
|
72
|
+
|
|
73
|
+
@field_validator('actual_instance')
|
|
74
|
+
def actual_instance_must_validate_oneof(cls, v):
|
|
75
|
+
instance = PromptVariableValue.model_construct()
|
|
76
|
+
error_messages = []
|
|
77
|
+
match = 0
|
|
78
|
+
# validate data type: TextMessageContent
|
|
79
|
+
if not isinstance(v, TextMessageContent):
|
|
80
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `TextMessageContent`")
|
|
81
|
+
else:
|
|
82
|
+
match += 1
|
|
83
|
+
# validate data type: ImageMessageContent
|
|
84
|
+
if not isinstance(v, ImageMessageContent):
|
|
85
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `ImageMessageContent`")
|
|
86
|
+
else:
|
|
87
|
+
match += 1
|
|
88
|
+
# validate data type: PdfMessageContent
|
|
89
|
+
if not isinstance(v, PdfMessageContent):
|
|
90
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `PdfMessageContent`")
|
|
91
|
+
else:
|
|
92
|
+
match += 1
|
|
93
|
+
# validate data type: ReasoningMessageContent
|
|
94
|
+
if not isinstance(v, ReasoningMessageContent):
|
|
95
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `ReasoningMessageContent`")
|
|
96
|
+
else:
|
|
97
|
+
match += 1
|
|
98
|
+
# validate data type: ToolCallMessageContent
|
|
99
|
+
if not isinstance(v, ToolCallMessageContent):
|
|
100
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `ToolCallMessageContent`")
|
|
101
|
+
else:
|
|
102
|
+
match += 1
|
|
103
|
+
# validate data type: ToolResponseMessageContent
|
|
104
|
+
if not isinstance(v, ToolResponseMessageContent):
|
|
105
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `ToolResponseMessageContent`")
|
|
106
|
+
else:
|
|
107
|
+
match += 1
|
|
108
|
+
# validate data type: ApiMessageContent
|
|
109
|
+
if not isinstance(v, ApiMessageContent):
|
|
110
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `ApiMessageContent`")
|
|
111
|
+
else:
|
|
112
|
+
match += 1
|
|
113
|
+
if match > 1:
|
|
114
|
+
# more than 1 match
|
|
115
|
+
raise ValueError("Multiple matches found when setting `actual_instance` in PromptVariableValue with oneOf schemas: ApiMessageContent, ImageMessageContent, PdfMessageContent, ReasoningMessageContent, TextMessageContent, ToolCallMessageContent, ToolResponseMessageContent. Details: " + ", ".join(error_messages))
|
|
116
|
+
elif match == 0:
|
|
117
|
+
# no match
|
|
118
|
+
raise ValueError("No match found when setting `actual_instance` in PromptVariableValue with oneOf schemas: ApiMessageContent, ImageMessageContent, PdfMessageContent, ReasoningMessageContent, TextMessageContent, ToolCallMessageContent, ToolResponseMessageContent. Details: " + ", ".join(error_messages))
|
|
119
|
+
else:
|
|
120
|
+
return v
|
|
121
|
+
|
|
122
|
+
@classmethod
|
|
123
|
+
def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self:
|
|
124
|
+
return cls.from_json(json.dumps(obj))
|
|
125
|
+
|
|
126
|
+
@classmethod
|
|
127
|
+
def from_json(cls, json_str: str) -> Self:
|
|
128
|
+
"""Returns the object represented by the json string"""
|
|
129
|
+
instance = cls.model_construct()
|
|
130
|
+
error_messages = []
|
|
131
|
+
match = 0
|
|
132
|
+
|
|
133
|
+
# deserialize data into TextMessageContent
|
|
134
|
+
try:
|
|
135
|
+
instance.actual_instance = TextMessageContent.from_json(json_str)
|
|
136
|
+
match += 1
|
|
137
|
+
except (ValidationError, ValueError) as e:
|
|
138
|
+
error_messages.append(str(e))
|
|
139
|
+
# deserialize data into ImageMessageContent
|
|
140
|
+
try:
|
|
141
|
+
instance.actual_instance = ImageMessageContent.from_json(json_str)
|
|
142
|
+
match += 1
|
|
143
|
+
except (ValidationError, ValueError) as e:
|
|
144
|
+
error_messages.append(str(e))
|
|
145
|
+
# deserialize data into PdfMessageContent
|
|
146
|
+
try:
|
|
147
|
+
instance.actual_instance = PdfMessageContent.from_json(json_str)
|
|
148
|
+
match += 1
|
|
149
|
+
except (ValidationError, ValueError) as e:
|
|
150
|
+
error_messages.append(str(e))
|
|
151
|
+
# deserialize data into ReasoningMessageContent
|
|
152
|
+
try:
|
|
153
|
+
instance.actual_instance = ReasoningMessageContent.from_json(json_str)
|
|
154
|
+
match += 1
|
|
155
|
+
except (ValidationError, ValueError) as e:
|
|
156
|
+
error_messages.append(str(e))
|
|
157
|
+
# deserialize data into ToolCallMessageContent
|
|
158
|
+
try:
|
|
159
|
+
instance.actual_instance = ToolCallMessageContent.from_json(json_str)
|
|
160
|
+
match += 1
|
|
161
|
+
except (ValidationError, ValueError) as e:
|
|
162
|
+
error_messages.append(str(e))
|
|
163
|
+
# deserialize data into ToolResponseMessageContent
|
|
164
|
+
try:
|
|
165
|
+
instance.actual_instance = ToolResponseMessageContent.from_json(json_str)
|
|
166
|
+
match += 1
|
|
167
|
+
except (ValidationError, ValueError) as e:
|
|
168
|
+
error_messages.append(str(e))
|
|
169
|
+
# deserialize data into ApiMessageContent
|
|
170
|
+
try:
|
|
171
|
+
instance.actual_instance = ApiMessageContent.from_json(json_str)
|
|
172
|
+
match += 1
|
|
173
|
+
except (ValidationError, ValueError) as e:
|
|
174
|
+
error_messages.append(str(e))
|
|
175
|
+
|
|
176
|
+
if match > 1:
|
|
177
|
+
# more than 1 match
|
|
178
|
+
raise ValueError("Multiple matches found when deserializing the JSON string into PromptVariableValue with oneOf schemas: ApiMessageContent, ImageMessageContent, PdfMessageContent, ReasoningMessageContent, TextMessageContent, ToolCallMessageContent, ToolResponseMessageContent. Details: " + ", ".join(error_messages))
|
|
179
|
+
elif match == 0:
|
|
180
|
+
# no match
|
|
181
|
+
raise ValueError("No match found when deserializing the JSON string into PromptVariableValue with oneOf schemas: ApiMessageContent, ImageMessageContent, PdfMessageContent, ReasoningMessageContent, TextMessageContent, ToolCallMessageContent, ToolResponseMessageContent. Details: " + ", ".join(error_messages))
|
|
182
|
+
else:
|
|
183
|
+
return instance
|
|
184
|
+
|
|
185
|
+
def to_json(self) -> str:
|
|
186
|
+
"""Returns the JSON representation of the actual instance"""
|
|
187
|
+
if self.actual_instance is None:
|
|
188
|
+
return "null"
|
|
189
|
+
|
|
190
|
+
if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
|
|
191
|
+
return self.actual_instance.to_json()
|
|
192
|
+
else:
|
|
193
|
+
return json.dumps(self.actual_instance)
|
|
194
|
+
|
|
195
|
+
def to_dict(self) -> Optional[Union[Dict[str, Any], ApiMessageContent, ImageMessageContent, PdfMessageContent, ReasoningMessageContent, TextMessageContent, ToolCallMessageContent, ToolResponseMessageContent]]:
|
|
196
|
+
"""Returns the dict representation of the actual instance"""
|
|
197
|
+
if self.actual_instance is None:
|
|
198
|
+
return None
|
|
199
|
+
|
|
200
|
+
if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
|
|
201
|
+
return self.actual_instance.to_dict()
|
|
202
|
+
else:
|
|
203
|
+
# primitive type
|
|
204
|
+
return self.actual_instance
|
|
205
|
+
|
|
206
|
+
def to_str(self) -> str:
|
|
207
|
+
"""Returns the string representation of the actual instance"""
|
|
208
|
+
return pprint.pformat(self.model_dump())
|
|
209
|
+
|
|
210
|
+
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Adaline API
|
|
5
|
+
|
|
6
|
+
API for managing Adaline deployments, logs, and core type definitions.
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1.0.0
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import pprint
|
|
17
|
+
import re # noqa: F401
|
|
18
|
+
import json
|
|
19
|
+
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, StrictStr, field_validator
|
|
21
|
+
from typing import Any, ClassVar, Dict, List
|
|
22
|
+
from adaline_api.models.reasoning_content_value_union import ReasoningContentValueUnion
|
|
23
|
+
from typing import Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
25
|
+
|
|
26
|
+
class ReasoningContent(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
Reasoning content type for LLM chain-of-thought and extended thinking responses
|
|
29
|
+
""" # noqa: E501
|
|
30
|
+
modality: StrictStr
|
|
31
|
+
value: ReasoningContentValueUnion
|
|
32
|
+
__properties: ClassVar[List[str]] = ["modality", "value"]
|
|
33
|
+
|
|
34
|
+
@field_validator('modality')
|
|
35
|
+
def modality_validate_enum(cls, value):
|
|
36
|
+
"""Validates the enum"""
|
|
37
|
+
if value not in set(['reasoning']):
|
|
38
|
+
raise ValueError("must be one of enum values ('reasoning')")
|
|
39
|
+
return value
|
|
40
|
+
|
|
41
|
+
model_config = ConfigDict(
|
|
42
|
+
populate_by_name=True,
|
|
43
|
+
validate_assignment=True,
|
|
44
|
+
protected_namespaces=(),
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def to_str(self) -> str:
|
|
49
|
+
"""Returns the string representation of the model using alias"""
|
|
50
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
51
|
+
|
|
52
|
+
def to_json(self) -> str:
|
|
53
|
+
"""Returns the JSON representation of the model using alias"""
|
|
54
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
55
|
+
return json.dumps(self.to_dict())
|
|
56
|
+
|
|
57
|
+
@classmethod
|
|
58
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
59
|
+
"""Create an instance of ReasoningContent from a JSON string"""
|
|
60
|
+
return cls.from_dict(json.loads(json_str))
|
|
61
|
+
|
|
62
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
63
|
+
"""Return the dictionary representation of the model using alias.
|
|
64
|
+
|
|
65
|
+
This has the following differences from calling pydantic's
|
|
66
|
+
`self.model_dump(by_alias=True)`:
|
|
67
|
+
|
|
68
|
+
* `None` is only added to the output dict for nullable fields that
|
|
69
|
+
were set at model initialization. Other fields with value `None`
|
|
70
|
+
are ignored.
|
|
71
|
+
"""
|
|
72
|
+
excluded_fields: Set[str] = set([
|
|
73
|
+
])
|
|
74
|
+
|
|
75
|
+
_dict = self.model_dump(
|
|
76
|
+
by_alias=True,
|
|
77
|
+
exclude=excluded_fields,
|
|
78
|
+
exclude_none=True,
|
|
79
|
+
)
|
|
80
|
+
# override the default output from pydantic by calling `to_dict()` of value
|
|
81
|
+
if self.value:
|
|
82
|
+
_dict['value'] = self.value.to_dict()
|
|
83
|
+
return _dict
|
|
84
|
+
|
|
85
|
+
@classmethod
|
|
86
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
87
|
+
"""Create an instance of ReasoningContent from a dict"""
|
|
88
|
+
if obj is None:
|
|
89
|
+
return None
|
|
90
|
+
|
|
91
|
+
if not isinstance(obj, dict):
|
|
92
|
+
return cls.model_validate(obj)
|
|
93
|
+
|
|
94
|
+
_obj = cls.model_validate({
|
|
95
|
+
"modality": obj.get("modality"),
|
|
96
|
+
"value": ReasoningContentValueUnion.from_dict(obj["value"]) if obj.get("value") is not None else None
|
|
97
|
+
})
|
|
98
|
+
return _obj
|
|
99
|
+
|
|
100
|
+
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Adaline API
|
|
5
|
+
|
|
6
|
+
API for managing Adaline deployments, logs, and core type definitions.
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1.0.0
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import pprint
|
|
17
|
+
import re # noqa: F401
|
|
18
|
+
import json
|
|
19
|
+
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, StrictStr, field_validator
|
|
21
|
+
from typing import Any, ClassVar, Dict, List
|
|
22
|
+
from adaline_api.models.reasoning_content_value_union_type import ReasoningContentValueUnionType
|
|
23
|
+
from typing import Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
25
|
+
|
|
26
|
+
class ReasoningContentType(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
ReasoningContentType
|
|
29
|
+
""" # noqa: E501
|
|
30
|
+
modality: StrictStr
|
|
31
|
+
value: ReasoningContentValueUnionType
|
|
32
|
+
__properties: ClassVar[List[str]] = ["modality", "value"]
|
|
33
|
+
|
|
34
|
+
@field_validator('modality')
|
|
35
|
+
def modality_validate_enum(cls, value):
|
|
36
|
+
"""Validates the enum"""
|
|
37
|
+
if value not in set(['reasoning']):
|
|
38
|
+
raise ValueError("must be one of enum values ('reasoning')")
|
|
39
|
+
return value
|
|
40
|
+
|
|
41
|
+
model_config = ConfigDict(
|
|
42
|
+
populate_by_name=True,
|
|
43
|
+
validate_assignment=True,
|
|
44
|
+
protected_namespaces=(),
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def to_str(self) -> str:
|
|
49
|
+
"""Returns the string representation of the model using alias"""
|
|
50
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
51
|
+
|
|
52
|
+
def to_json(self) -> str:
|
|
53
|
+
"""Returns the JSON representation of the model using alias"""
|
|
54
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
55
|
+
return json.dumps(self.to_dict())
|
|
56
|
+
|
|
57
|
+
@classmethod
|
|
58
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
59
|
+
"""Create an instance of ReasoningContentType from a JSON string"""
|
|
60
|
+
return cls.from_dict(json.loads(json_str))
|
|
61
|
+
|
|
62
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
63
|
+
"""Return the dictionary representation of the model using alias.
|
|
64
|
+
|
|
65
|
+
This has the following differences from calling pydantic's
|
|
66
|
+
`self.model_dump(by_alias=True)`:
|
|
67
|
+
|
|
68
|
+
* `None` is only added to the output dict for nullable fields that
|
|
69
|
+
were set at model initialization. Other fields with value `None`
|
|
70
|
+
are ignored.
|
|
71
|
+
"""
|
|
72
|
+
excluded_fields: Set[str] = set([
|
|
73
|
+
])
|
|
74
|
+
|
|
75
|
+
_dict = self.model_dump(
|
|
76
|
+
by_alias=True,
|
|
77
|
+
exclude=excluded_fields,
|
|
78
|
+
exclude_none=True,
|
|
79
|
+
)
|
|
80
|
+
# override the default output from pydantic by calling `to_dict()` of value
|
|
81
|
+
if self.value:
|
|
82
|
+
_dict['value'] = self.value.to_dict()
|
|
83
|
+
return _dict
|
|
84
|
+
|
|
85
|
+
@classmethod
|
|
86
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
87
|
+
"""Create an instance of ReasoningContentType from a dict"""
|
|
88
|
+
if obj is None:
|
|
89
|
+
return None
|
|
90
|
+
|
|
91
|
+
if not isinstance(obj, dict):
|
|
92
|
+
return cls.model_validate(obj)
|
|
93
|
+
|
|
94
|
+
_obj = cls.model_validate({
|
|
95
|
+
"modality": obj.get("modality"),
|
|
96
|
+
"value": ReasoningContentValueUnionType.from_dict(obj["value"]) if obj.get("value") is not None else None
|
|
97
|
+
})
|
|
98
|
+
return _obj
|
|
99
|
+
|
|
100
|
+
|