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,224 @@
|
|
|
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.log_span_embeddings_content import LogSpanEmbeddingsContent
|
|
21
|
+
from adaline_api.models.log_span_function_content import LogSpanFunctionContent
|
|
22
|
+
from adaline_api.models.log_span_guardrail_content import LogSpanGuardrailContent
|
|
23
|
+
from adaline_api.models.log_span_model_content import LogSpanModelContent
|
|
24
|
+
from adaline_api.models.log_span_model_stream_content import LogSpanModelStreamContent
|
|
25
|
+
from adaline_api.models.log_span_other_content import LogSpanOtherContent
|
|
26
|
+
from adaline_api.models.log_span_retrieval_content import LogSpanRetrievalContent
|
|
27
|
+
from adaline_api.models.log_span_tool_content import LogSpanToolContent
|
|
28
|
+
from pydantic import StrictStr, Field
|
|
29
|
+
from typing import Union, List, Set, Optional, Dict
|
|
30
|
+
from typing_extensions import Literal, Self
|
|
31
|
+
|
|
32
|
+
LOGSPANCONTENT_ONE_OF_SCHEMAS = ["LogSpanEmbeddingsContent", "LogSpanFunctionContent", "LogSpanGuardrailContent", "LogSpanModelContent", "LogSpanModelStreamContent", "LogSpanOtherContent", "LogSpanRetrievalContent", "LogSpanToolContent"]
|
|
33
|
+
|
|
34
|
+
class LogSpanContent(BaseModel):
|
|
35
|
+
"""
|
|
36
|
+
Polymorphic content type for different span categories in LLM observability tracing
|
|
37
|
+
"""
|
|
38
|
+
# data type: LogSpanModelContent
|
|
39
|
+
oneof_schema_1_validator: Optional[LogSpanModelContent] = None
|
|
40
|
+
# data type: LogSpanModelStreamContent
|
|
41
|
+
oneof_schema_2_validator: Optional[LogSpanModelStreamContent] = None
|
|
42
|
+
# data type: LogSpanEmbeddingsContent
|
|
43
|
+
oneof_schema_3_validator: Optional[LogSpanEmbeddingsContent] = None
|
|
44
|
+
# data type: LogSpanFunctionContent
|
|
45
|
+
oneof_schema_4_validator: Optional[LogSpanFunctionContent] = None
|
|
46
|
+
# data type: LogSpanToolContent
|
|
47
|
+
oneof_schema_5_validator: Optional[LogSpanToolContent] = None
|
|
48
|
+
# data type: LogSpanGuardrailContent
|
|
49
|
+
oneof_schema_6_validator: Optional[LogSpanGuardrailContent] = None
|
|
50
|
+
# data type: LogSpanRetrievalContent
|
|
51
|
+
oneof_schema_7_validator: Optional[LogSpanRetrievalContent] = None
|
|
52
|
+
# data type: LogSpanOtherContent
|
|
53
|
+
oneof_schema_8_validator: Optional[LogSpanOtherContent] = None
|
|
54
|
+
actual_instance: Optional[Union[LogSpanEmbeddingsContent, LogSpanFunctionContent, LogSpanGuardrailContent, LogSpanModelContent, LogSpanModelStreamContent, LogSpanOtherContent, LogSpanRetrievalContent, LogSpanToolContent]] = None
|
|
55
|
+
one_of_schemas: Set[str] = { "LogSpanEmbeddingsContent", "LogSpanFunctionContent", "LogSpanGuardrailContent", "LogSpanModelContent", "LogSpanModelStreamContent", "LogSpanOtherContent", "LogSpanRetrievalContent", "LogSpanToolContent" }
|
|
56
|
+
|
|
57
|
+
model_config = ConfigDict(
|
|
58
|
+
validate_assignment=True,
|
|
59
|
+
protected_namespaces=(),
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
discriminator_value_class_map: Dict[str, str] = {
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
def __init__(self, *args, **kwargs) -> None:
|
|
67
|
+
if args:
|
|
68
|
+
if len(args) > 1:
|
|
69
|
+
raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
|
|
70
|
+
if kwargs:
|
|
71
|
+
raise ValueError("If a position argument is used, keyword arguments cannot be used.")
|
|
72
|
+
super().__init__(actual_instance=args[0])
|
|
73
|
+
else:
|
|
74
|
+
super().__init__(**kwargs)
|
|
75
|
+
|
|
76
|
+
@field_validator('actual_instance')
|
|
77
|
+
def actual_instance_must_validate_oneof(cls, v):
|
|
78
|
+
instance = LogSpanContent.model_construct()
|
|
79
|
+
error_messages = []
|
|
80
|
+
match = 0
|
|
81
|
+
# validate data type: LogSpanModelContent
|
|
82
|
+
if not isinstance(v, LogSpanModelContent):
|
|
83
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `LogSpanModelContent`")
|
|
84
|
+
else:
|
|
85
|
+
match += 1
|
|
86
|
+
# validate data type: LogSpanModelStreamContent
|
|
87
|
+
if not isinstance(v, LogSpanModelStreamContent):
|
|
88
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `LogSpanModelStreamContent`")
|
|
89
|
+
else:
|
|
90
|
+
match += 1
|
|
91
|
+
# validate data type: LogSpanEmbeddingsContent
|
|
92
|
+
if not isinstance(v, LogSpanEmbeddingsContent):
|
|
93
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `LogSpanEmbeddingsContent`")
|
|
94
|
+
else:
|
|
95
|
+
match += 1
|
|
96
|
+
# validate data type: LogSpanFunctionContent
|
|
97
|
+
if not isinstance(v, LogSpanFunctionContent):
|
|
98
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `LogSpanFunctionContent`")
|
|
99
|
+
else:
|
|
100
|
+
match += 1
|
|
101
|
+
# validate data type: LogSpanToolContent
|
|
102
|
+
if not isinstance(v, LogSpanToolContent):
|
|
103
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `LogSpanToolContent`")
|
|
104
|
+
else:
|
|
105
|
+
match += 1
|
|
106
|
+
# validate data type: LogSpanGuardrailContent
|
|
107
|
+
if not isinstance(v, LogSpanGuardrailContent):
|
|
108
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `LogSpanGuardrailContent`")
|
|
109
|
+
else:
|
|
110
|
+
match += 1
|
|
111
|
+
# validate data type: LogSpanRetrievalContent
|
|
112
|
+
if not isinstance(v, LogSpanRetrievalContent):
|
|
113
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `LogSpanRetrievalContent`")
|
|
114
|
+
else:
|
|
115
|
+
match += 1
|
|
116
|
+
# validate data type: LogSpanOtherContent
|
|
117
|
+
if not isinstance(v, LogSpanOtherContent):
|
|
118
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `LogSpanOtherContent`")
|
|
119
|
+
else:
|
|
120
|
+
match += 1
|
|
121
|
+
if match > 1:
|
|
122
|
+
# more than 1 match
|
|
123
|
+
raise ValueError("Multiple matches found when setting `actual_instance` in LogSpanContent with oneOf schemas: LogSpanEmbeddingsContent, LogSpanFunctionContent, LogSpanGuardrailContent, LogSpanModelContent, LogSpanModelStreamContent, LogSpanOtherContent, LogSpanRetrievalContent, LogSpanToolContent. Details: " + ", ".join(error_messages))
|
|
124
|
+
elif match == 0:
|
|
125
|
+
# no match
|
|
126
|
+
raise ValueError("No match found when setting `actual_instance` in LogSpanContent with oneOf schemas: LogSpanEmbeddingsContent, LogSpanFunctionContent, LogSpanGuardrailContent, LogSpanModelContent, LogSpanModelStreamContent, LogSpanOtherContent, LogSpanRetrievalContent, LogSpanToolContent. Details: " + ", ".join(error_messages))
|
|
127
|
+
else:
|
|
128
|
+
return v
|
|
129
|
+
|
|
130
|
+
@classmethod
|
|
131
|
+
def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self:
|
|
132
|
+
return cls.from_json(json.dumps(obj))
|
|
133
|
+
|
|
134
|
+
@classmethod
|
|
135
|
+
def from_json(cls, json_str: str) -> Self:
|
|
136
|
+
"""Returns the object represented by the json string"""
|
|
137
|
+
instance = cls.model_construct()
|
|
138
|
+
error_messages = []
|
|
139
|
+
match = 0
|
|
140
|
+
|
|
141
|
+
# deserialize data into LogSpanModelContent
|
|
142
|
+
try:
|
|
143
|
+
instance.actual_instance = LogSpanModelContent.from_json(json_str)
|
|
144
|
+
match += 1
|
|
145
|
+
except (ValidationError, ValueError) as e:
|
|
146
|
+
error_messages.append(str(e))
|
|
147
|
+
# deserialize data into LogSpanModelStreamContent
|
|
148
|
+
try:
|
|
149
|
+
instance.actual_instance = LogSpanModelStreamContent.from_json(json_str)
|
|
150
|
+
match += 1
|
|
151
|
+
except (ValidationError, ValueError) as e:
|
|
152
|
+
error_messages.append(str(e))
|
|
153
|
+
# deserialize data into LogSpanEmbeddingsContent
|
|
154
|
+
try:
|
|
155
|
+
instance.actual_instance = LogSpanEmbeddingsContent.from_json(json_str)
|
|
156
|
+
match += 1
|
|
157
|
+
except (ValidationError, ValueError) as e:
|
|
158
|
+
error_messages.append(str(e))
|
|
159
|
+
# deserialize data into LogSpanFunctionContent
|
|
160
|
+
try:
|
|
161
|
+
instance.actual_instance = LogSpanFunctionContent.from_json(json_str)
|
|
162
|
+
match += 1
|
|
163
|
+
except (ValidationError, ValueError) as e:
|
|
164
|
+
error_messages.append(str(e))
|
|
165
|
+
# deserialize data into LogSpanToolContent
|
|
166
|
+
try:
|
|
167
|
+
instance.actual_instance = LogSpanToolContent.from_json(json_str)
|
|
168
|
+
match += 1
|
|
169
|
+
except (ValidationError, ValueError) as e:
|
|
170
|
+
error_messages.append(str(e))
|
|
171
|
+
# deserialize data into LogSpanGuardrailContent
|
|
172
|
+
try:
|
|
173
|
+
instance.actual_instance = LogSpanGuardrailContent.from_json(json_str)
|
|
174
|
+
match += 1
|
|
175
|
+
except (ValidationError, ValueError) as e:
|
|
176
|
+
error_messages.append(str(e))
|
|
177
|
+
# deserialize data into LogSpanRetrievalContent
|
|
178
|
+
try:
|
|
179
|
+
instance.actual_instance = LogSpanRetrievalContent.from_json(json_str)
|
|
180
|
+
match += 1
|
|
181
|
+
except (ValidationError, ValueError) as e:
|
|
182
|
+
error_messages.append(str(e))
|
|
183
|
+
# deserialize data into LogSpanOtherContent
|
|
184
|
+
try:
|
|
185
|
+
instance.actual_instance = LogSpanOtherContent.from_json(json_str)
|
|
186
|
+
match += 1
|
|
187
|
+
except (ValidationError, ValueError) as e:
|
|
188
|
+
error_messages.append(str(e))
|
|
189
|
+
|
|
190
|
+
if match > 1:
|
|
191
|
+
# more than 1 match
|
|
192
|
+
raise ValueError("Multiple matches found when deserializing the JSON string into LogSpanContent with oneOf schemas: LogSpanEmbeddingsContent, LogSpanFunctionContent, LogSpanGuardrailContent, LogSpanModelContent, LogSpanModelStreamContent, LogSpanOtherContent, LogSpanRetrievalContent, LogSpanToolContent. Details: " + ", ".join(error_messages))
|
|
193
|
+
elif match == 0:
|
|
194
|
+
# no match
|
|
195
|
+
raise ValueError("No match found when deserializing the JSON string into LogSpanContent with oneOf schemas: LogSpanEmbeddingsContent, LogSpanFunctionContent, LogSpanGuardrailContent, LogSpanModelContent, LogSpanModelStreamContent, LogSpanOtherContent, LogSpanRetrievalContent, LogSpanToolContent. Details: " + ", ".join(error_messages))
|
|
196
|
+
else:
|
|
197
|
+
return instance
|
|
198
|
+
|
|
199
|
+
def to_json(self) -> str:
|
|
200
|
+
"""Returns the JSON representation of the actual instance"""
|
|
201
|
+
if self.actual_instance is None:
|
|
202
|
+
return "null"
|
|
203
|
+
|
|
204
|
+
if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
|
|
205
|
+
return self.actual_instance.to_json()
|
|
206
|
+
else:
|
|
207
|
+
return json.dumps(self.actual_instance)
|
|
208
|
+
|
|
209
|
+
def to_dict(self) -> Optional[Union[Dict[str, Any], LogSpanEmbeddingsContent, LogSpanFunctionContent, LogSpanGuardrailContent, LogSpanModelContent, LogSpanModelStreamContent, LogSpanOtherContent, LogSpanRetrievalContent, LogSpanToolContent]]:
|
|
210
|
+
"""Returns the dict representation of the actual instance"""
|
|
211
|
+
if self.actual_instance is None:
|
|
212
|
+
return None
|
|
213
|
+
|
|
214
|
+
if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
|
|
215
|
+
return self.actual_instance.to_dict()
|
|
216
|
+
else:
|
|
217
|
+
# primitive type
|
|
218
|
+
return self.actual_instance
|
|
219
|
+
|
|
220
|
+
def to_str(self) -> str:
|
|
221
|
+
"""Returns the string representation of the actual instance"""
|
|
222
|
+
return pprint.pformat(self.model_dump())
|
|
223
|
+
|
|
224
|
+
|
|
@@ -0,0 +1,101 @@
|
|
|
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, Optional
|
|
22
|
+
from typing_extensions import Annotated
|
|
23
|
+
from typing import Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
25
|
+
|
|
26
|
+
class LogSpanEmbeddingsContent(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
Content for embedding generation span for vector database operations and semantic search
|
|
29
|
+
""" # noqa: E501
|
|
30
|
+
type: StrictStr
|
|
31
|
+
input: Annotated[str, Field(min_length=1, strict=True)] = Field(description="JSON string that must be valid JSON")
|
|
32
|
+
output: Annotated[str, Field(min_length=1, strict=True)] = Field(description="JSON string that must be valid JSON")
|
|
33
|
+
expected: Optional[Annotated[str, Field(min_length=1, strict=True)]] = Field(default=None, description="JSON string that must be valid JSON")
|
|
34
|
+
__properties: ClassVar[List[str]] = ["type", "input", "output", "expected"]
|
|
35
|
+
|
|
36
|
+
@field_validator('type')
|
|
37
|
+
def type_validate_enum(cls, value):
|
|
38
|
+
"""Validates the enum"""
|
|
39
|
+
if value not in set(['Embeddings']):
|
|
40
|
+
raise ValueError("must be one of enum values ('Embeddings')")
|
|
41
|
+
return value
|
|
42
|
+
|
|
43
|
+
model_config = ConfigDict(
|
|
44
|
+
populate_by_name=True,
|
|
45
|
+
validate_assignment=True,
|
|
46
|
+
protected_namespaces=(),
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def to_str(self) -> str:
|
|
51
|
+
"""Returns the string representation of the model using alias"""
|
|
52
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
53
|
+
|
|
54
|
+
def to_json(self) -> str:
|
|
55
|
+
"""Returns the JSON representation of the model using alias"""
|
|
56
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
57
|
+
return json.dumps(self.to_dict())
|
|
58
|
+
|
|
59
|
+
@classmethod
|
|
60
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
61
|
+
"""Create an instance of LogSpanEmbeddingsContent from a JSON string"""
|
|
62
|
+
return cls.from_dict(json.loads(json_str))
|
|
63
|
+
|
|
64
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
65
|
+
"""Return the dictionary representation of the model using alias.
|
|
66
|
+
|
|
67
|
+
This has the following differences from calling pydantic's
|
|
68
|
+
`self.model_dump(by_alias=True)`:
|
|
69
|
+
|
|
70
|
+
* `None` is only added to the output dict for nullable fields that
|
|
71
|
+
were set at model initialization. Other fields with value `None`
|
|
72
|
+
are ignored.
|
|
73
|
+
"""
|
|
74
|
+
excluded_fields: Set[str] = set([
|
|
75
|
+
])
|
|
76
|
+
|
|
77
|
+
_dict = self.model_dump(
|
|
78
|
+
by_alias=True,
|
|
79
|
+
exclude=excluded_fields,
|
|
80
|
+
exclude_none=True,
|
|
81
|
+
)
|
|
82
|
+
return _dict
|
|
83
|
+
|
|
84
|
+
@classmethod
|
|
85
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
86
|
+
"""Create an instance of LogSpanEmbeddingsContent from a dict"""
|
|
87
|
+
if obj is None:
|
|
88
|
+
return None
|
|
89
|
+
|
|
90
|
+
if not isinstance(obj, dict):
|
|
91
|
+
return cls.model_validate(obj)
|
|
92
|
+
|
|
93
|
+
_obj = cls.model_validate({
|
|
94
|
+
"type": obj.get("type"),
|
|
95
|
+
"input": obj.get("input"),
|
|
96
|
+
"output": obj.get("output"),
|
|
97
|
+
"expected": obj.get("expected")
|
|
98
|
+
})
|
|
99
|
+
return _obj
|
|
100
|
+
|
|
101
|
+
|
|
@@ -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 typing import Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
25
|
+
|
|
26
|
+
class LogSpanEvent(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
Timestamped event within a span for tracking intermediate steps and state changes
|
|
29
|
+
""" # noqa: E501
|
|
30
|
+
created_at: Annotated[int, Field(le=33229420200000, strict=True, ge=1672511400000)] = Field(description="Unix timestamp in milliseconds", alias="createdAt")
|
|
31
|
+
id: Optional[Annotated[str, Field(min_length=1, strict=True, max_length=128)]] = None
|
|
32
|
+
name: Optional[Annotated[str, Field(min_length=1, strict=True, max_length=128)]] = None
|
|
33
|
+
message: Annotated[str, Field(min_length=1, strict=True, max_length=16384)]
|
|
34
|
+
attributes: Optional[Dict[str, Annotated[str, Field(min_length=1, strict=True, max_length=128)]]] = None
|
|
35
|
+
__properties: ClassVar[List[str]] = ["createdAt", "id", "name", "message", "attributes"]
|
|
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 LogSpanEvent 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 LogSpanEvent 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
|
+
"createdAt": obj.get("createdAt"),
|
|
89
|
+
"id": obj.get("id"),
|
|
90
|
+
"name": obj.get("name"),
|
|
91
|
+
"message": obj.get("message"),
|
|
92
|
+
"attributes": obj.get("attributes")
|
|
93
|
+
})
|
|
94
|
+
return _obj
|
|
95
|
+
|
|
96
|
+
|
|
@@ -0,0 +1,101 @@
|
|
|
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, Optional
|
|
22
|
+
from typing_extensions import Annotated
|
|
23
|
+
from typing import Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
25
|
+
|
|
26
|
+
class LogSpanFunctionContent(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
Content for function execution span tracking custom application logic
|
|
29
|
+
""" # noqa: E501
|
|
30
|
+
type: StrictStr
|
|
31
|
+
input: Annotated[str, Field(min_length=1, strict=True)] = Field(description="JSON string that must be valid JSON")
|
|
32
|
+
output: Annotated[str, Field(min_length=1, strict=True)] = Field(description="JSON string that must be valid JSON")
|
|
33
|
+
expected: Optional[Annotated[str, Field(min_length=1, strict=True)]] = Field(default=None, description="JSON string that must be valid JSON")
|
|
34
|
+
__properties: ClassVar[List[str]] = ["type", "input", "output", "expected"]
|
|
35
|
+
|
|
36
|
+
@field_validator('type')
|
|
37
|
+
def type_validate_enum(cls, value):
|
|
38
|
+
"""Validates the enum"""
|
|
39
|
+
if value not in set(['Function']):
|
|
40
|
+
raise ValueError("must be one of enum values ('Function')")
|
|
41
|
+
return value
|
|
42
|
+
|
|
43
|
+
model_config = ConfigDict(
|
|
44
|
+
populate_by_name=True,
|
|
45
|
+
validate_assignment=True,
|
|
46
|
+
protected_namespaces=(),
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def to_str(self) -> str:
|
|
51
|
+
"""Returns the string representation of the model using alias"""
|
|
52
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
53
|
+
|
|
54
|
+
def to_json(self) -> str:
|
|
55
|
+
"""Returns the JSON representation of the model using alias"""
|
|
56
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
57
|
+
return json.dumps(self.to_dict())
|
|
58
|
+
|
|
59
|
+
@classmethod
|
|
60
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
61
|
+
"""Create an instance of LogSpanFunctionContent from a JSON string"""
|
|
62
|
+
return cls.from_dict(json.loads(json_str))
|
|
63
|
+
|
|
64
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
65
|
+
"""Return the dictionary representation of the model using alias.
|
|
66
|
+
|
|
67
|
+
This has the following differences from calling pydantic's
|
|
68
|
+
`self.model_dump(by_alias=True)`:
|
|
69
|
+
|
|
70
|
+
* `None` is only added to the output dict for nullable fields that
|
|
71
|
+
were set at model initialization. Other fields with value `None`
|
|
72
|
+
are ignored.
|
|
73
|
+
"""
|
|
74
|
+
excluded_fields: Set[str] = set([
|
|
75
|
+
])
|
|
76
|
+
|
|
77
|
+
_dict = self.model_dump(
|
|
78
|
+
by_alias=True,
|
|
79
|
+
exclude=excluded_fields,
|
|
80
|
+
exclude_none=True,
|
|
81
|
+
)
|
|
82
|
+
return _dict
|
|
83
|
+
|
|
84
|
+
@classmethod
|
|
85
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
86
|
+
"""Create an instance of LogSpanFunctionContent from a dict"""
|
|
87
|
+
if obj is None:
|
|
88
|
+
return None
|
|
89
|
+
|
|
90
|
+
if not isinstance(obj, dict):
|
|
91
|
+
return cls.model_validate(obj)
|
|
92
|
+
|
|
93
|
+
_obj = cls.model_validate({
|
|
94
|
+
"type": obj.get("type"),
|
|
95
|
+
"input": obj.get("input"),
|
|
96
|
+
"output": obj.get("output"),
|
|
97
|
+
"expected": obj.get("expected")
|
|
98
|
+
})
|
|
99
|
+
return _obj
|
|
100
|
+
|
|
101
|
+
|
|
@@ -0,0 +1,101 @@
|
|
|
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, Optional
|
|
22
|
+
from typing_extensions import Annotated
|
|
23
|
+
from typing import Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
25
|
+
|
|
26
|
+
class LogSpanGuardrailContent(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
Content for guardrail/safety check span ensuring LLM output compliance and safety
|
|
29
|
+
""" # noqa: E501
|
|
30
|
+
type: StrictStr
|
|
31
|
+
input: Annotated[str, Field(min_length=1, strict=True)] = Field(description="JSON string that must be valid JSON")
|
|
32
|
+
output: Annotated[str, Field(min_length=1, strict=True)] = Field(description="JSON string that must be valid JSON")
|
|
33
|
+
expected: Optional[Annotated[str, Field(min_length=1, strict=True)]] = Field(default=None, description="JSON string that must be valid JSON")
|
|
34
|
+
__properties: ClassVar[List[str]] = ["type", "input", "output", "expected"]
|
|
35
|
+
|
|
36
|
+
@field_validator('type')
|
|
37
|
+
def type_validate_enum(cls, value):
|
|
38
|
+
"""Validates the enum"""
|
|
39
|
+
if value not in set(['Guardrail']):
|
|
40
|
+
raise ValueError("must be one of enum values ('Guardrail')")
|
|
41
|
+
return value
|
|
42
|
+
|
|
43
|
+
model_config = ConfigDict(
|
|
44
|
+
populate_by_name=True,
|
|
45
|
+
validate_assignment=True,
|
|
46
|
+
protected_namespaces=(),
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def to_str(self) -> str:
|
|
51
|
+
"""Returns the string representation of the model using alias"""
|
|
52
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
53
|
+
|
|
54
|
+
def to_json(self) -> str:
|
|
55
|
+
"""Returns the JSON representation of the model using alias"""
|
|
56
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
57
|
+
return json.dumps(self.to_dict())
|
|
58
|
+
|
|
59
|
+
@classmethod
|
|
60
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
61
|
+
"""Create an instance of LogSpanGuardrailContent from a JSON string"""
|
|
62
|
+
return cls.from_dict(json.loads(json_str))
|
|
63
|
+
|
|
64
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
65
|
+
"""Return the dictionary representation of the model using alias.
|
|
66
|
+
|
|
67
|
+
This has the following differences from calling pydantic's
|
|
68
|
+
`self.model_dump(by_alias=True)`:
|
|
69
|
+
|
|
70
|
+
* `None` is only added to the output dict for nullable fields that
|
|
71
|
+
were set at model initialization. Other fields with value `None`
|
|
72
|
+
are ignored.
|
|
73
|
+
"""
|
|
74
|
+
excluded_fields: Set[str] = set([
|
|
75
|
+
])
|
|
76
|
+
|
|
77
|
+
_dict = self.model_dump(
|
|
78
|
+
by_alias=True,
|
|
79
|
+
exclude=excluded_fields,
|
|
80
|
+
exclude_none=True,
|
|
81
|
+
)
|
|
82
|
+
return _dict
|
|
83
|
+
|
|
84
|
+
@classmethod
|
|
85
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
86
|
+
"""Create an instance of LogSpanGuardrailContent from a dict"""
|
|
87
|
+
if obj is None:
|
|
88
|
+
return None
|
|
89
|
+
|
|
90
|
+
if not isinstance(obj, dict):
|
|
91
|
+
return cls.model_validate(obj)
|
|
92
|
+
|
|
93
|
+
_obj = cls.model_validate({
|
|
94
|
+
"type": obj.get("type"),
|
|
95
|
+
"input": obj.get("input"),
|
|
96
|
+
"output": obj.get("output"),
|
|
97
|
+
"expected": obj.get("expected")
|
|
98
|
+
})
|
|
99
|
+
return _obj
|
|
100
|
+
|
|
101
|
+
|