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,118 @@
|
|
|
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, StrictStr, field_validator
|
|
21
|
+
from typing import Any, ClassVar, Dict, List
|
|
22
|
+
from typing import Optional, Set
|
|
23
|
+
from typing_extensions import Self
|
|
24
|
+
|
|
25
|
+
class Base64MediaType(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
Base64MediaType
|
|
28
|
+
""" # noqa: E501
|
|
29
|
+
type: StrictStr = Field(description="Indicates this is a base64-encoded media object")
|
|
30
|
+
var_base64: StrictStr = Field(description="The base64-encoded content", alias="base64")
|
|
31
|
+
media_type: StrictStr = Field(description="The image format", alias="mediaType")
|
|
32
|
+
additional_properties: Dict[str, Any] = {}
|
|
33
|
+
__properties: ClassVar[List[str]] = ["type", "base64", "mediaType"]
|
|
34
|
+
|
|
35
|
+
@field_validator('type')
|
|
36
|
+
def type_validate_enum(cls, value):
|
|
37
|
+
"""Validates the enum"""
|
|
38
|
+
if value not in set(['base64']):
|
|
39
|
+
raise ValueError("must be one of enum values ('base64')")
|
|
40
|
+
return value
|
|
41
|
+
|
|
42
|
+
@field_validator('media_type')
|
|
43
|
+
def media_type_validate_enum(cls, value):
|
|
44
|
+
"""Validates the enum"""
|
|
45
|
+
if value not in set(['png', 'jpeg', 'webp', 'gif']):
|
|
46
|
+
raise ValueError("must be one of enum values ('png', 'jpeg', 'webp', 'gif')")
|
|
47
|
+
return value
|
|
48
|
+
|
|
49
|
+
model_config = ConfigDict(
|
|
50
|
+
populate_by_name=True,
|
|
51
|
+
validate_assignment=True,
|
|
52
|
+
protected_namespaces=(),
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def to_str(self) -> str:
|
|
57
|
+
"""Returns the string representation of the model using alias"""
|
|
58
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
59
|
+
|
|
60
|
+
def to_json(self) -> str:
|
|
61
|
+
"""Returns the JSON representation of the model using alias"""
|
|
62
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
63
|
+
return json.dumps(self.to_dict())
|
|
64
|
+
|
|
65
|
+
@classmethod
|
|
66
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
67
|
+
"""Create an instance of Base64MediaType from a JSON string"""
|
|
68
|
+
return cls.from_dict(json.loads(json_str))
|
|
69
|
+
|
|
70
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
71
|
+
"""Return the dictionary representation of the model using alias.
|
|
72
|
+
|
|
73
|
+
This has the following differences from calling pydantic's
|
|
74
|
+
`self.model_dump(by_alias=True)`:
|
|
75
|
+
|
|
76
|
+
* `None` is only added to the output dict for nullable fields that
|
|
77
|
+
were set at model initialization. Other fields with value `None`
|
|
78
|
+
are ignored.
|
|
79
|
+
* Fields in `self.additional_properties` are added to the output dict.
|
|
80
|
+
"""
|
|
81
|
+
excluded_fields: Set[str] = set([
|
|
82
|
+
"additional_properties",
|
|
83
|
+
])
|
|
84
|
+
|
|
85
|
+
_dict = self.model_dump(
|
|
86
|
+
by_alias=True,
|
|
87
|
+
exclude=excluded_fields,
|
|
88
|
+
exclude_none=True,
|
|
89
|
+
)
|
|
90
|
+
# puts key-value pairs in additional_properties in the top level
|
|
91
|
+
if self.additional_properties is not None:
|
|
92
|
+
for _key, _value in self.additional_properties.items():
|
|
93
|
+
_dict[_key] = _value
|
|
94
|
+
|
|
95
|
+
return _dict
|
|
96
|
+
|
|
97
|
+
@classmethod
|
|
98
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
99
|
+
"""Create an instance of Base64MediaType from a dict"""
|
|
100
|
+
if obj is None:
|
|
101
|
+
return None
|
|
102
|
+
|
|
103
|
+
if not isinstance(obj, dict):
|
|
104
|
+
return cls.model_validate(obj)
|
|
105
|
+
|
|
106
|
+
_obj = cls.model_validate({
|
|
107
|
+
"type": obj.get("type"),
|
|
108
|
+
"base64": obj.get("base64"),
|
|
109
|
+
"mediaType": obj.get("mediaType")
|
|
110
|
+
})
|
|
111
|
+
# store additional fields in additional_properties
|
|
112
|
+
for _key in obj.keys():
|
|
113
|
+
if _key not in cls.__properties:
|
|
114
|
+
_obj.additional_properties[_key] = obj.get(_key)
|
|
115
|
+
|
|
116
|
+
return _obj
|
|
117
|
+
|
|
118
|
+
|
|
@@ -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, StrictStr, field_validator
|
|
21
|
+
from typing import Any, ClassVar, Dict, List
|
|
22
|
+
from typing import Optional, Set
|
|
23
|
+
from typing_extensions import Self
|
|
24
|
+
|
|
25
|
+
class Base64PdfContentValue(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
Base64-encoded PDF document data
|
|
28
|
+
""" # noqa: E501
|
|
29
|
+
type: StrictStr
|
|
30
|
+
var_base64: StrictStr = Field(alias="base64")
|
|
31
|
+
__properties: ClassVar[List[str]] = ["type", "base64"]
|
|
32
|
+
|
|
33
|
+
@field_validator('type')
|
|
34
|
+
def type_validate_enum(cls, value):
|
|
35
|
+
"""Validates the enum"""
|
|
36
|
+
if value not in set(['base64']):
|
|
37
|
+
raise ValueError("must be one of enum values ('base64')")
|
|
38
|
+
return value
|
|
39
|
+
|
|
40
|
+
model_config = ConfigDict(
|
|
41
|
+
populate_by_name=True,
|
|
42
|
+
validate_assignment=True,
|
|
43
|
+
protected_namespaces=(),
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def to_str(self) -> str:
|
|
48
|
+
"""Returns the string representation of the model using alias"""
|
|
49
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
50
|
+
|
|
51
|
+
def to_json(self) -> str:
|
|
52
|
+
"""Returns the JSON representation of the model using alias"""
|
|
53
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
54
|
+
return json.dumps(self.to_dict())
|
|
55
|
+
|
|
56
|
+
@classmethod
|
|
57
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
58
|
+
"""Create an instance of Base64PdfContentValue from a JSON string"""
|
|
59
|
+
return cls.from_dict(json.loads(json_str))
|
|
60
|
+
|
|
61
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
62
|
+
"""Return the dictionary representation of the model using alias.
|
|
63
|
+
|
|
64
|
+
This has the following differences from calling pydantic's
|
|
65
|
+
`self.model_dump(by_alias=True)`:
|
|
66
|
+
|
|
67
|
+
* `None` is only added to the output dict for nullable fields that
|
|
68
|
+
were set at model initialization. Other fields with value `None`
|
|
69
|
+
are ignored.
|
|
70
|
+
"""
|
|
71
|
+
excluded_fields: Set[str] = set([
|
|
72
|
+
])
|
|
73
|
+
|
|
74
|
+
_dict = self.model_dump(
|
|
75
|
+
by_alias=True,
|
|
76
|
+
exclude=excluded_fields,
|
|
77
|
+
exclude_none=True,
|
|
78
|
+
)
|
|
79
|
+
return _dict
|
|
80
|
+
|
|
81
|
+
@classmethod
|
|
82
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
83
|
+
"""Create an instance of Base64PdfContentValue from a dict"""
|
|
84
|
+
if obj is None:
|
|
85
|
+
return None
|
|
86
|
+
|
|
87
|
+
if not isinstance(obj, dict):
|
|
88
|
+
return cls.model_validate(obj)
|
|
89
|
+
|
|
90
|
+
_obj = cls.model_validate({
|
|
91
|
+
"type": obj.get("type"),
|
|
92
|
+
"base64": obj.get("base64")
|
|
93
|
+
})
|
|
94
|
+
return _obj
|
|
95
|
+
|
|
96
|
+
|
|
@@ -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, StrictStr, field_validator
|
|
21
|
+
from typing import Any, ClassVar, Dict, List
|
|
22
|
+
from typing import Optional, Set
|
|
23
|
+
from typing_extensions import Self
|
|
24
|
+
|
|
25
|
+
class Base64PdfContentValueType(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
Base64PdfContentValueType
|
|
28
|
+
""" # noqa: E501
|
|
29
|
+
type: StrictStr
|
|
30
|
+
var_base64: StrictStr = Field(alias="base64")
|
|
31
|
+
__properties: ClassVar[List[str]] = ["type", "base64"]
|
|
32
|
+
|
|
33
|
+
@field_validator('type')
|
|
34
|
+
def type_validate_enum(cls, value):
|
|
35
|
+
"""Validates the enum"""
|
|
36
|
+
if value not in set(['base64']):
|
|
37
|
+
raise ValueError("must be one of enum values ('base64')")
|
|
38
|
+
return value
|
|
39
|
+
|
|
40
|
+
model_config = ConfigDict(
|
|
41
|
+
populate_by_name=True,
|
|
42
|
+
validate_assignment=True,
|
|
43
|
+
protected_namespaces=(),
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def to_str(self) -> str:
|
|
48
|
+
"""Returns the string representation of the model using alias"""
|
|
49
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
50
|
+
|
|
51
|
+
def to_json(self) -> str:
|
|
52
|
+
"""Returns the JSON representation of the model using alias"""
|
|
53
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
54
|
+
return json.dumps(self.to_dict())
|
|
55
|
+
|
|
56
|
+
@classmethod
|
|
57
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
58
|
+
"""Create an instance of Base64PdfContentValueType from a JSON string"""
|
|
59
|
+
return cls.from_dict(json.loads(json_str))
|
|
60
|
+
|
|
61
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
62
|
+
"""Return the dictionary representation of the model using alias.
|
|
63
|
+
|
|
64
|
+
This has the following differences from calling pydantic's
|
|
65
|
+
`self.model_dump(by_alias=True)`:
|
|
66
|
+
|
|
67
|
+
* `None` is only added to the output dict for nullable fields that
|
|
68
|
+
were set at model initialization. Other fields with value `None`
|
|
69
|
+
are ignored.
|
|
70
|
+
"""
|
|
71
|
+
excluded_fields: Set[str] = set([
|
|
72
|
+
])
|
|
73
|
+
|
|
74
|
+
_dict = self.model_dump(
|
|
75
|
+
by_alias=True,
|
|
76
|
+
exclude=excluded_fields,
|
|
77
|
+
exclude_none=True,
|
|
78
|
+
)
|
|
79
|
+
return _dict
|
|
80
|
+
|
|
81
|
+
@classmethod
|
|
82
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
83
|
+
"""Create an instance of Base64PdfContentValueType from a dict"""
|
|
84
|
+
if obj is None:
|
|
85
|
+
return None
|
|
86
|
+
|
|
87
|
+
if not isinstance(obj, dict):
|
|
88
|
+
return cls.model_validate(obj)
|
|
89
|
+
|
|
90
|
+
_obj = cls.model_validate({
|
|
91
|
+
"type": obj.get("type"),
|
|
92
|
+
"base64": obj.get("base64")
|
|
93
|
+
})
|
|
94
|
+
return _obj
|
|
95
|
+
|
|
96
|
+
|
|
@@ -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
|
|
22
|
+
from typing_extensions import Annotated
|
|
23
|
+
from typing import Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
25
|
+
|
|
26
|
+
class BaseEntity(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
Base entity model with common fields for all database entities including audit trail metadata
|
|
29
|
+
""" # noqa: E501
|
|
30
|
+
id: Annotated[str, Field(min_length=20, strict=True, max_length=80)] = Field(description="Unique identifier for entities. Supports composite IDs with two UUIDs.")
|
|
31
|
+
created_at: Annotated[int, Field(le=33229420200000, strict=True, ge=1672511400000)] = Field(description="Unix timestamp in milliseconds", alias="createdAt")
|
|
32
|
+
updated_at: Annotated[int, Field(le=33229420200000, strict=True, ge=1672511400000)] = Field(description="Unix timestamp in milliseconds", alias="updatedAt")
|
|
33
|
+
created_by_user_id: Annotated[str, Field(min_length=20, strict=True, max_length=80)] = Field(description="Unique identifier for entities. Supports composite IDs with two UUIDs.", alias="createdByUserId")
|
|
34
|
+
updated_by_user_id: Annotated[str, Field(min_length=20, strict=True, max_length=80)] = Field(description="Unique identifier for entities. Supports composite IDs with two UUIDs.", alias="updatedByUserId")
|
|
35
|
+
__properties: ClassVar[List[str]] = ["id", "createdAt", "updatedAt", "createdByUserId", "updatedByUserId"]
|
|
36
|
+
|
|
37
|
+
model_config = ConfigDict(
|
|
38
|
+
populate_by_name=True,
|
|
39
|
+
validate_assignment=True,
|
|
40
|
+
protected_namespaces=(),
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def to_str(self) -> str:
|
|
45
|
+
"""Returns the string representation of the model using alias"""
|
|
46
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
47
|
+
|
|
48
|
+
def to_json(self) -> str:
|
|
49
|
+
"""Returns the JSON representation of the model using alias"""
|
|
50
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
51
|
+
return json.dumps(self.to_dict())
|
|
52
|
+
|
|
53
|
+
@classmethod
|
|
54
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
55
|
+
"""Create an instance of BaseEntity from a JSON string"""
|
|
56
|
+
return cls.from_dict(json.loads(json_str))
|
|
57
|
+
|
|
58
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
59
|
+
"""Return the dictionary representation of the model using alias.
|
|
60
|
+
|
|
61
|
+
This has the following differences from calling pydantic's
|
|
62
|
+
`self.model_dump(by_alias=True)`:
|
|
63
|
+
|
|
64
|
+
* `None` is only added to the output dict for nullable fields that
|
|
65
|
+
were set at model initialization. Other fields with value `None`
|
|
66
|
+
are ignored.
|
|
67
|
+
"""
|
|
68
|
+
excluded_fields: Set[str] = set([
|
|
69
|
+
])
|
|
70
|
+
|
|
71
|
+
_dict = self.model_dump(
|
|
72
|
+
by_alias=True,
|
|
73
|
+
exclude=excluded_fields,
|
|
74
|
+
exclude_none=True,
|
|
75
|
+
)
|
|
76
|
+
return _dict
|
|
77
|
+
|
|
78
|
+
@classmethod
|
|
79
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
80
|
+
"""Create an instance of BaseEntity from a dict"""
|
|
81
|
+
if obj is None:
|
|
82
|
+
return None
|
|
83
|
+
|
|
84
|
+
if not isinstance(obj, dict):
|
|
85
|
+
return cls.model_validate(obj)
|
|
86
|
+
|
|
87
|
+
_obj = cls.model_validate({
|
|
88
|
+
"id": obj.get("id"),
|
|
89
|
+
"createdAt": obj.get("createdAt"),
|
|
90
|
+
"updatedAt": obj.get("updatedAt"),
|
|
91
|
+
"createdByUserId": obj.get("createdByUserId"),
|
|
92
|
+
"updatedByUserId": obj.get("updatedByUserId")
|
|
93
|
+
})
|
|
94
|
+
return _obj
|
|
95
|
+
|
|
96
|
+
|
|
@@ -0,0 +1,94 @@
|
|
|
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
|
|
22
|
+
from typing_extensions import Annotated
|
|
23
|
+
from typing import Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
25
|
+
|
|
26
|
+
class ConfigType(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
ConfigType
|
|
29
|
+
""" # noqa: E501
|
|
30
|
+
provider_name: Annotated[str, Field(min_length=1, strict=True)] = Field(description="Name of the LLM provider.", alias="providerName")
|
|
31
|
+
provider_id: Annotated[str, Field(min_length=1, strict=True)] = Field(description="Adaline internal UUID for provider.", alias="providerId")
|
|
32
|
+
model: Annotated[str, Field(min_length=1, strict=True)] = Field(description="Model name to use for the prompt.")
|
|
33
|
+
settings: Dict[str, Any] = Field(description="Runtime configuration settings passed to the LLM provider, flexible key-value pairs.")
|
|
34
|
+
__properties: ClassVar[List[str]] = ["providerName", "providerId", "model", "settings"]
|
|
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 ConfigType 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
|
+
return _dict
|
|
76
|
+
|
|
77
|
+
@classmethod
|
|
78
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
79
|
+
"""Create an instance of ConfigType from a dict"""
|
|
80
|
+
if obj is None:
|
|
81
|
+
return None
|
|
82
|
+
|
|
83
|
+
if not isinstance(obj, dict):
|
|
84
|
+
return cls.model_validate(obj)
|
|
85
|
+
|
|
86
|
+
_obj = cls.model_validate({
|
|
87
|
+
"providerName": obj.get("providerName"),
|
|
88
|
+
"providerId": obj.get("providerId"),
|
|
89
|
+
"model": obj.get("model"),
|
|
90
|
+
"settings": obj.get("settings")
|
|
91
|
+
})
|
|
92
|
+
return _obj
|
|
93
|
+
|
|
94
|
+
|
|
@@ -0,0 +1,196 @@
|
|
|
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.image_content import ImageContent
|
|
21
|
+
from adaline_api.models.pdf_content import PdfContent
|
|
22
|
+
from adaline_api.models.reasoning_content import ReasoningContent
|
|
23
|
+
from adaline_api.models.text_content import TextContent
|
|
24
|
+
from adaline_api.models.tool_call_content import ToolCallContent
|
|
25
|
+
from adaline_api.models.tool_response_content import ToolResponseContent
|
|
26
|
+
from pydantic import StrictStr, Field
|
|
27
|
+
from typing import Union, List, Set, Optional, Dict
|
|
28
|
+
from typing_extensions import Literal, Self
|
|
29
|
+
|
|
30
|
+
CONTENT_ONE_OF_SCHEMAS = ["ImageContent", "PdfContent", "ReasoningContent", "TextContent", "ToolCallContent", "ToolResponseContent"]
|
|
31
|
+
|
|
32
|
+
class Content(BaseModel):
|
|
33
|
+
"""
|
|
34
|
+
Polymorphic content type supporting multiple modalities in prompt messages
|
|
35
|
+
"""
|
|
36
|
+
# data type: TextContent
|
|
37
|
+
oneof_schema_1_validator: Optional[TextContent] = None
|
|
38
|
+
# data type: ImageContent
|
|
39
|
+
oneof_schema_2_validator: Optional[ImageContent] = None
|
|
40
|
+
# data type: PdfContent
|
|
41
|
+
oneof_schema_3_validator: Optional[PdfContent] = None
|
|
42
|
+
# data type: ToolCallContent
|
|
43
|
+
oneof_schema_4_validator: Optional[ToolCallContent] = None
|
|
44
|
+
# data type: ToolResponseContent
|
|
45
|
+
oneof_schema_5_validator: Optional[ToolResponseContent] = None
|
|
46
|
+
# data type: ReasoningContent
|
|
47
|
+
oneof_schema_6_validator: Optional[ReasoningContent] = None
|
|
48
|
+
actual_instance: Optional[Union[ImageContent, PdfContent, ReasoningContent, TextContent, ToolCallContent, ToolResponseContent]] = None
|
|
49
|
+
one_of_schemas: Set[str] = { "ImageContent", "PdfContent", "ReasoningContent", "TextContent", "ToolCallContent", "ToolResponseContent" }
|
|
50
|
+
|
|
51
|
+
model_config = ConfigDict(
|
|
52
|
+
validate_assignment=True,
|
|
53
|
+
protected_namespaces=(),
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
discriminator_value_class_map: Dict[str, str] = {
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
def __init__(self, *args, **kwargs) -> None:
|
|
61
|
+
if args:
|
|
62
|
+
if len(args) > 1:
|
|
63
|
+
raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
|
|
64
|
+
if kwargs:
|
|
65
|
+
raise ValueError("If a position argument is used, keyword arguments cannot be used.")
|
|
66
|
+
super().__init__(actual_instance=args[0])
|
|
67
|
+
else:
|
|
68
|
+
super().__init__(**kwargs)
|
|
69
|
+
|
|
70
|
+
@field_validator('actual_instance')
|
|
71
|
+
def actual_instance_must_validate_oneof(cls, v):
|
|
72
|
+
instance = Content.model_construct()
|
|
73
|
+
error_messages = []
|
|
74
|
+
match = 0
|
|
75
|
+
# validate data type: TextContent
|
|
76
|
+
if not isinstance(v, TextContent):
|
|
77
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `TextContent`")
|
|
78
|
+
else:
|
|
79
|
+
match += 1
|
|
80
|
+
# validate data type: ImageContent
|
|
81
|
+
if not isinstance(v, ImageContent):
|
|
82
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `ImageContent`")
|
|
83
|
+
else:
|
|
84
|
+
match += 1
|
|
85
|
+
# validate data type: PdfContent
|
|
86
|
+
if not isinstance(v, PdfContent):
|
|
87
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `PdfContent`")
|
|
88
|
+
else:
|
|
89
|
+
match += 1
|
|
90
|
+
# validate data type: ToolCallContent
|
|
91
|
+
if not isinstance(v, ToolCallContent):
|
|
92
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `ToolCallContent`")
|
|
93
|
+
else:
|
|
94
|
+
match += 1
|
|
95
|
+
# validate data type: ToolResponseContent
|
|
96
|
+
if not isinstance(v, ToolResponseContent):
|
|
97
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `ToolResponseContent`")
|
|
98
|
+
else:
|
|
99
|
+
match += 1
|
|
100
|
+
# validate data type: ReasoningContent
|
|
101
|
+
if not isinstance(v, ReasoningContent):
|
|
102
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `ReasoningContent`")
|
|
103
|
+
else:
|
|
104
|
+
match += 1
|
|
105
|
+
if match > 1:
|
|
106
|
+
# more than 1 match
|
|
107
|
+
raise ValueError("Multiple matches found when setting `actual_instance` in Content with oneOf schemas: ImageContent, PdfContent, ReasoningContent, TextContent, ToolCallContent, ToolResponseContent. Details: " + ", ".join(error_messages))
|
|
108
|
+
elif match == 0:
|
|
109
|
+
# no match
|
|
110
|
+
raise ValueError("No match found when setting `actual_instance` in Content with oneOf schemas: ImageContent, PdfContent, ReasoningContent, TextContent, ToolCallContent, ToolResponseContent. Details: " + ", ".join(error_messages))
|
|
111
|
+
else:
|
|
112
|
+
return v
|
|
113
|
+
|
|
114
|
+
@classmethod
|
|
115
|
+
def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self:
|
|
116
|
+
return cls.from_json(json.dumps(obj))
|
|
117
|
+
|
|
118
|
+
@classmethod
|
|
119
|
+
def from_json(cls, json_str: str) -> Self:
|
|
120
|
+
"""Returns the object represented by the json string"""
|
|
121
|
+
instance = cls.model_construct()
|
|
122
|
+
error_messages = []
|
|
123
|
+
match = 0
|
|
124
|
+
|
|
125
|
+
# deserialize data into TextContent
|
|
126
|
+
try:
|
|
127
|
+
instance.actual_instance = TextContent.from_json(json_str)
|
|
128
|
+
match += 1
|
|
129
|
+
except (ValidationError, ValueError) as e:
|
|
130
|
+
error_messages.append(str(e))
|
|
131
|
+
# deserialize data into ImageContent
|
|
132
|
+
try:
|
|
133
|
+
instance.actual_instance = ImageContent.from_json(json_str)
|
|
134
|
+
match += 1
|
|
135
|
+
except (ValidationError, ValueError) as e:
|
|
136
|
+
error_messages.append(str(e))
|
|
137
|
+
# deserialize data into PdfContent
|
|
138
|
+
try:
|
|
139
|
+
instance.actual_instance = PdfContent.from_json(json_str)
|
|
140
|
+
match += 1
|
|
141
|
+
except (ValidationError, ValueError) as e:
|
|
142
|
+
error_messages.append(str(e))
|
|
143
|
+
# deserialize data into ToolCallContent
|
|
144
|
+
try:
|
|
145
|
+
instance.actual_instance = ToolCallContent.from_json(json_str)
|
|
146
|
+
match += 1
|
|
147
|
+
except (ValidationError, ValueError) as e:
|
|
148
|
+
error_messages.append(str(e))
|
|
149
|
+
# deserialize data into ToolResponseContent
|
|
150
|
+
try:
|
|
151
|
+
instance.actual_instance = ToolResponseContent.from_json(json_str)
|
|
152
|
+
match += 1
|
|
153
|
+
except (ValidationError, ValueError) as e:
|
|
154
|
+
error_messages.append(str(e))
|
|
155
|
+
# deserialize data into ReasoningContent
|
|
156
|
+
try:
|
|
157
|
+
instance.actual_instance = ReasoningContent.from_json(json_str)
|
|
158
|
+
match += 1
|
|
159
|
+
except (ValidationError, ValueError) as e:
|
|
160
|
+
error_messages.append(str(e))
|
|
161
|
+
|
|
162
|
+
if match > 1:
|
|
163
|
+
# more than 1 match
|
|
164
|
+
raise ValueError("Multiple matches found when deserializing the JSON string into Content with oneOf schemas: ImageContent, PdfContent, ReasoningContent, TextContent, ToolCallContent, ToolResponseContent. Details: " + ", ".join(error_messages))
|
|
165
|
+
elif match == 0:
|
|
166
|
+
# no match
|
|
167
|
+
raise ValueError("No match found when deserializing the JSON string into Content with oneOf schemas: ImageContent, PdfContent, ReasoningContent, TextContent, ToolCallContent, ToolResponseContent. Details: " + ", ".join(error_messages))
|
|
168
|
+
else:
|
|
169
|
+
return instance
|
|
170
|
+
|
|
171
|
+
def to_json(self) -> str:
|
|
172
|
+
"""Returns the JSON representation of the actual instance"""
|
|
173
|
+
if self.actual_instance is None:
|
|
174
|
+
return "null"
|
|
175
|
+
|
|
176
|
+
if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
|
|
177
|
+
return self.actual_instance.to_json()
|
|
178
|
+
else:
|
|
179
|
+
return json.dumps(self.actual_instance)
|
|
180
|
+
|
|
181
|
+
def to_dict(self) -> Optional[Union[Dict[str, Any], ImageContent, PdfContent, ReasoningContent, TextContent, ToolCallContent, ToolResponseContent]]:
|
|
182
|
+
"""Returns the dict representation of the actual instance"""
|
|
183
|
+
if self.actual_instance is None:
|
|
184
|
+
return None
|
|
185
|
+
|
|
186
|
+
if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
|
|
187
|
+
return self.actual_instance.to_dict()
|
|
188
|
+
else:
|
|
189
|
+
# primitive type
|
|
190
|
+
return self.actual_instance
|
|
191
|
+
|
|
192
|
+
def to_str(self) -> str:
|
|
193
|
+
"""Returns the string representation of the actual instance"""
|
|
194
|
+
return pprint.pformat(self.model_dump())
|
|
195
|
+
|
|
196
|
+
|