orq-ai-sdk 4.2.0rc28__py3-none-any.whl → 4.3.0rc7__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.
- orq_ai_sdk/_version.py +3 -3
- orq_ai_sdk/agents.py +186 -186
- orq_ai_sdk/audio.py +30 -0
- orq_ai_sdk/basesdk.py +20 -6
- orq_ai_sdk/chat.py +22 -0
- orq_ai_sdk/completions.py +438 -0
- orq_ai_sdk/contacts.py +43 -855
- orq_ai_sdk/deployments.py +61 -0
- orq_ai_sdk/edits.py +364 -0
- orq_ai_sdk/embeddings.py +344 -0
- orq_ai_sdk/generations.py +370 -0
- orq_ai_sdk/identities.py +1037 -0
- orq_ai_sdk/images.py +28 -0
- orq_ai_sdk/models/__init__.py +5746 -737
- orq_ai_sdk/models/actionreviewedstreamingevent.py +18 -1
- orq_ai_sdk/models/actionreviewrequestedstreamingevent.py +44 -1
- orq_ai_sdk/models/agenterroredstreamingevent.py +18 -1
- orq_ai_sdk/models/agentinactivestreamingevent.py +168 -70
- orq_ai_sdk/models/agentmessagecreatedstreamingevent.py +18 -2
- orq_ai_sdk/models/agentresponsemessage.py +18 -2
- orq_ai_sdk/models/agentstartedstreamingevent.py +127 -2
- orq_ai_sdk/models/agentthoughtstreamingevent.py +178 -211
- orq_ai_sdk/models/conversationresponse.py +31 -20
- orq_ai_sdk/models/conversationwithmessagesresponse.py +31 -20
- orq_ai_sdk/models/createagentrequestop.py +1945 -383
- orq_ai_sdk/models/createagentresponse.py +147 -91
- orq_ai_sdk/models/createagentresponserequestop.py +111 -2
- orq_ai_sdk/models/createchatcompletionop.py +1381 -861
- orq_ai_sdk/models/createchunkop.py +46 -19
- orq_ai_sdk/models/createcompletionop.py +2078 -0
- orq_ai_sdk/models/createcontactop.py +45 -56
- orq_ai_sdk/models/createconversationop.py +61 -39
- orq_ai_sdk/models/createconversationresponseop.py +68 -4
- orq_ai_sdk/models/createdatasetitemop.py +424 -80
- orq_ai_sdk/models/createdatasetop.py +19 -2
- orq_ai_sdk/models/createdatasourceop.py +92 -26
- orq_ai_sdk/models/createembeddingop.py +579 -0
- orq_ai_sdk/models/createevalop.py +552 -24
- orq_ai_sdk/models/createidentityop.py +176 -0
- orq_ai_sdk/models/createimageeditop.py +715 -0
- orq_ai_sdk/models/createimageop.py +407 -128
- orq_ai_sdk/models/createimagevariationop.py +706 -0
- orq_ai_sdk/models/createknowledgeop.py +186 -121
- orq_ai_sdk/models/creatememorydocumentop.py +50 -1
- orq_ai_sdk/models/creatememoryop.py +34 -21
- orq_ai_sdk/models/creatememorystoreop.py +34 -1
- orq_ai_sdk/models/createmoderationop.py +521 -0
- orq_ai_sdk/models/createpromptop.py +2759 -1251
- orq_ai_sdk/models/creatererankop.py +608 -0
- orq_ai_sdk/models/createresponseop.py +2567 -0
- orq_ai_sdk/models/createspeechop.py +466 -0
- orq_ai_sdk/models/createtoolop.py +537 -12
- orq_ai_sdk/models/createtranscriptionop.py +732 -0
- orq_ai_sdk/models/createtranslationop.py +702 -0
- orq_ai_sdk/models/datapart.py +18 -1
- orq_ai_sdk/models/deletechunksop.py +34 -1
- orq_ai_sdk/models/{deletecontactop.py → deleteidentityop.py} +9 -9
- orq_ai_sdk/models/deletepromptop.py +26 -0
- orq_ai_sdk/models/deploymentcreatemetricop.py +362 -76
- orq_ai_sdk/models/deploymentgetconfigop.py +635 -194
- orq_ai_sdk/models/deploymentinvokeop.py +168 -173
- orq_ai_sdk/models/deploymentsop.py +195 -58
- orq_ai_sdk/models/deploymentstreamop.py +652 -304
- orq_ai_sdk/models/errorpart.py +18 -1
- orq_ai_sdk/models/filecontentpartschema.py +18 -1
- orq_ai_sdk/models/filegetop.py +19 -2
- orq_ai_sdk/models/filelistop.py +35 -2
- orq_ai_sdk/models/filepart.py +50 -1
- orq_ai_sdk/models/fileuploadop.py +51 -2
- orq_ai_sdk/models/generateconversationnameop.py +31 -20
- orq_ai_sdk/models/get_v2_evaluators_id_versionsop.py +34 -1
- orq_ai_sdk/models/get_v2_tools_tool_id_versions_version_id_op.py +18 -1
- orq_ai_sdk/models/get_v2_tools_tool_id_versionsop.py +34 -1
- orq_ai_sdk/models/getallmemoriesop.py +34 -21
- orq_ai_sdk/models/getallmemorydocumentsop.py +42 -1
- orq_ai_sdk/models/getallmemorystoresop.py +34 -1
- orq_ai_sdk/models/getallpromptsop.py +1696 -230
- orq_ai_sdk/models/getalltoolsop.py +325 -8
- orq_ai_sdk/models/getchunkscountop.py +34 -1
- orq_ai_sdk/models/getevalsop.py +395 -43
- orq_ai_sdk/models/getonechunkop.py +14 -19
- orq_ai_sdk/models/getoneknowledgeop.py +116 -96
- orq_ai_sdk/models/getonepromptop.py +1679 -230
- orq_ai_sdk/models/getpromptversionop.py +1676 -216
- orq_ai_sdk/models/imagecontentpartschema.py +50 -1
- orq_ai_sdk/models/internal/globals.py +18 -1
- orq_ai_sdk/models/invokeagentop.py +140 -2
- orq_ai_sdk/models/invokedeploymentrequest.py +418 -80
- orq_ai_sdk/models/invokeevalop.py +160 -131
- orq_ai_sdk/models/listagentsop.py +805 -166
- orq_ai_sdk/models/listchunksop.py +32 -19
- orq_ai_sdk/models/listchunkspaginatedop.py +46 -19
- orq_ai_sdk/models/listconversationsop.py +18 -1
- orq_ai_sdk/models/listdatasetdatapointsop.py +252 -42
- orq_ai_sdk/models/listdatasetsop.py +35 -2
- orq_ai_sdk/models/listdatasourcesop.py +35 -26
- orq_ai_sdk/models/{listcontactsop.py → listidentitiesop.py} +89 -79
- orq_ai_sdk/models/listknowledgebasesop.py +132 -96
- orq_ai_sdk/models/listmodelsop.py +1 -0
- orq_ai_sdk/models/listpromptversionsop.py +1690 -216
- orq_ai_sdk/models/parseop.py +161 -17
- orq_ai_sdk/models/partdoneevent.py +19 -2
- orq_ai_sdk/models/post_v2_router_ocrop.py +408 -0
- orq_ai_sdk/models/publiccontact.py +27 -4
- orq_ai_sdk/models/publicidentity.py +62 -0
- orq_ai_sdk/models/reasoningpart.py +19 -2
- orq_ai_sdk/models/refusalpartschema.py +18 -1
- orq_ai_sdk/models/remoteconfigsgetconfigop.py +34 -1
- orq_ai_sdk/models/responsedoneevent.py +114 -84
- orq_ai_sdk/models/responsestartedevent.py +18 -1
- orq_ai_sdk/models/retrieveagentrequestop.py +799 -166
- orq_ai_sdk/models/retrievedatapointop.py +236 -42
- orq_ai_sdk/models/retrievedatasetop.py +19 -2
- orq_ai_sdk/models/retrievedatasourceop.py +17 -26
- orq_ai_sdk/models/{retrievecontactop.py → retrieveidentityop.py} +38 -41
- orq_ai_sdk/models/retrievememorydocumentop.py +18 -1
- orq_ai_sdk/models/retrievememoryop.py +18 -21
- orq_ai_sdk/models/retrievememorystoreop.py +18 -1
- orq_ai_sdk/models/retrievetoolop.py +309 -8
- orq_ai_sdk/models/runagentop.py +1462 -196
- orq_ai_sdk/models/searchknowledgeop.py +108 -1
- orq_ai_sdk/models/security.py +18 -1
- orq_ai_sdk/models/streamagentop.py +93 -2
- orq_ai_sdk/models/streamrunagentop.py +1439 -194
- orq_ai_sdk/models/textcontentpartschema.py +34 -1
- orq_ai_sdk/models/thinkingconfigenabledschema.py +18 -1
- orq_ai_sdk/models/toolcallpart.py +18 -1
- orq_ai_sdk/models/tooldoneevent.py +18 -1
- orq_ai_sdk/models/toolexecutionfailedstreamingevent.py +50 -1
- orq_ai_sdk/models/toolexecutionfinishedstreamingevent.py +34 -1
- orq_ai_sdk/models/toolexecutionstartedstreamingevent.py +34 -1
- orq_ai_sdk/models/toolresultpart.py +18 -1
- orq_ai_sdk/models/toolreviewrequestedevent.py +18 -1
- orq_ai_sdk/models/toolstartedevent.py +18 -1
- orq_ai_sdk/models/updateagentop.py +1968 -397
- orq_ai_sdk/models/updatechunkop.py +46 -19
- orq_ai_sdk/models/updateconversationop.py +61 -39
- orq_ai_sdk/models/updatedatapointop.py +424 -80
- orq_ai_sdk/models/updatedatasetop.py +51 -2
- orq_ai_sdk/models/updatedatasourceop.py +17 -26
- orq_ai_sdk/models/updateevalop.py +577 -16
- orq_ai_sdk/models/{updatecontactop.py → updateidentityop.py} +78 -68
- orq_ai_sdk/models/updateknowledgeop.py +234 -190
- orq_ai_sdk/models/updatememorydocumentop.py +50 -1
- orq_ai_sdk/models/updatememoryop.py +50 -21
- orq_ai_sdk/models/updatememorystoreop.py +66 -1
- orq_ai_sdk/models/updatepromptop.py +2854 -1448
- orq_ai_sdk/models/updatetoolop.py +592 -9
- orq_ai_sdk/models/usermessagerequest.py +18 -2
- orq_ai_sdk/moderations.py +218 -0
- orq_ai_sdk/orq_completions.py +666 -0
- orq_ai_sdk/orq_responses.py +398 -0
- orq_ai_sdk/prompts.py +28 -36
- orq_ai_sdk/rerank.py +330 -0
- orq_ai_sdk/router.py +89 -641
- orq_ai_sdk/sdk.py +3 -0
- orq_ai_sdk/speech.py +333 -0
- orq_ai_sdk/transcriptions.py +416 -0
- orq_ai_sdk/translations.py +384 -0
- orq_ai_sdk/utils/__init__.py +13 -1
- orq_ai_sdk/variations.py +364 -0
- {orq_ai_sdk-4.2.0rc28.dist-info → orq_ai_sdk-4.3.0rc7.dist-info}/METADATA +169 -148
- orq_ai_sdk-4.3.0rc7.dist-info/RECORD +263 -0
- {orq_ai_sdk-4.2.0rc28.dist-info → orq_ai_sdk-4.3.0rc7.dist-info}/WHEEL +2 -1
- orq_ai_sdk-4.3.0rc7.dist-info/top_level.txt +1 -0
- orq_ai_sdk-4.2.0rc28.dist-info/RECORD +0 -233
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
|
-
from orq_ai_sdk.types import BaseModel
|
|
4
|
+
from orq_ai_sdk.types import BaseModel, UNSET_SENTINEL
|
|
5
5
|
import pydantic
|
|
6
|
+
from pydantic import model_serializer
|
|
6
7
|
from typing import Any, Dict, Literal, Optional
|
|
7
8
|
from typing_extensions import Annotated, NotRequired, TypedDict
|
|
8
9
|
|
|
@@ -44,6 +45,22 @@ class ActionReviewedStreamingEventData(BaseModel):
|
|
|
44
45
|
|
|
45
46
|
reviewed_by_id: Optional[str] = None
|
|
46
47
|
|
|
48
|
+
@model_serializer(mode="wrap")
|
|
49
|
+
def serialize_model(self, handler):
|
|
50
|
+
optional_fields = set(["mock_output", "review_source", "reviewed_by_id"])
|
|
51
|
+
serialized = handler(self)
|
|
52
|
+
m = {}
|
|
53
|
+
|
|
54
|
+
for n, f in type(self).model_fields.items():
|
|
55
|
+
k = f.alias or n
|
|
56
|
+
val = serialized.get(k)
|
|
57
|
+
|
|
58
|
+
if val != UNSET_SENTINEL:
|
|
59
|
+
if val is not None or k not in optional_fields:
|
|
60
|
+
m[k] = val
|
|
61
|
+
|
|
62
|
+
return m
|
|
63
|
+
|
|
47
64
|
|
|
48
65
|
class ActionReviewedStreamingEventTypedDict(TypedDict):
|
|
49
66
|
r"""Emitted after a tool action has been reviewed. Contains the review decision (approved/rejected), optional mock output for rejected actions, and reviewer information."""
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
|
-
from orq_ai_sdk.types import BaseModel
|
|
4
|
+
from orq_ai_sdk.types import BaseModel, UNSET_SENTINEL
|
|
5
5
|
import pydantic
|
|
6
|
+
from pydantic import model_serializer
|
|
6
7
|
from typing import Any, Dict, List, Literal, Optional
|
|
7
8
|
from typing_extensions import Annotated, NotRequired, TypedDict
|
|
8
9
|
|
|
@@ -73,6 +74,32 @@ class Tool(BaseModel):
|
|
|
73
74
|
timeout: Optional[float] = 120
|
|
74
75
|
r"""Tool execution timeout in seconds (default: 2 minutes, max: 10 minutes)"""
|
|
75
76
|
|
|
77
|
+
@model_serializer(mode="wrap")
|
|
78
|
+
def serialize_model(self, handler):
|
|
79
|
+
optional_fields = set(
|
|
80
|
+
[
|
|
81
|
+
"key",
|
|
82
|
+
"display_name",
|
|
83
|
+
"description",
|
|
84
|
+
"requires_approval",
|
|
85
|
+
"tool_id",
|
|
86
|
+
"conditions",
|
|
87
|
+
"timeout",
|
|
88
|
+
]
|
|
89
|
+
)
|
|
90
|
+
serialized = handler(self)
|
|
91
|
+
m = {}
|
|
92
|
+
|
|
93
|
+
for n, f in type(self).model_fields.items():
|
|
94
|
+
k = f.alias or n
|
|
95
|
+
val = serialized.get(k)
|
|
96
|
+
|
|
97
|
+
if val != UNSET_SENTINEL:
|
|
98
|
+
if val is not None or k not in optional_fields:
|
|
99
|
+
m[k] = val
|
|
100
|
+
|
|
101
|
+
return m
|
|
102
|
+
|
|
76
103
|
|
|
77
104
|
class ActionReviewRequestedStreamingEventDataTypedDict(TypedDict):
|
|
78
105
|
agent_id: str
|
|
@@ -99,6 +126,22 @@ class ActionReviewRequestedStreamingEventData(BaseModel):
|
|
|
99
126
|
|
|
100
127
|
response_id: Annotated[Optional[str], pydantic.Field(alias="responseId")] = None
|
|
101
128
|
|
|
129
|
+
@model_serializer(mode="wrap")
|
|
130
|
+
def serialize_model(self, handler):
|
|
131
|
+
optional_fields = set(["responseId"])
|
|
132
|
+
serialized = handler(self)
|
|
133
|
+
m = {}
|
|
134
|
+
|
|
135
|
+
for n, f in type(self).model_fields.items():
|
|
136
|
+
k = f.alias or n
|
|
137
|
+
val = serialized.get(k)
|
|
138
|
+
|
|
139
|
+
if val != UNSET_SENTINEL:
|
|
140
|
+
if val is not None or k not in optional_fields:
|
|
141
|
+
m[k] = val
|
|
142
|
+
|
|
143
|
+
return m
|
|
144
|
+
|
|
102
145
|
|
|
103
146
|
class ActionReviewRequestedStreamingEventTypedDict(TypedDict):
|
|
104
147
|
r"""Emitted when a tool action requires approval before execution. Contains the tool details, input arguments, and whether approval is mandatory."""
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
|
-
from orq_ai_sdk.types import BaseModel
|
|
4
|
+
from orq_ai_sdk.types import BaseModel, UNSET_SENTINEL
|
|
5
5
|
import pydantic
|
|
6
|
+
from pydantic import model_serializer
|
|
6
7
|
from typing import Literal, Optional
|
|
7
8
|
from typing_extensions import Annotated, NotRequired, TypedDict
|
|
8
9
|
|
|
@@ -28,6 +29,22 @@ class AgentErroredStreamingEventData(BaseModel):
|
|
|
28
29
|
response_id: Annotated[Optional[str], pydantic.Field(alias="responseId")] = None
|
|
29
30
|
r"""ID of the response tracking this execution"""
|
|
30
31
|
|
|
32
|
+
@model_serializer(mode="wrap")
|
|
33
|
+
def serialize_model(self, handler):
|
|
34
|
+
optional_fields = set(["responseId"])
|
|
35
|
+
serialized = handler(self)
|
|
36
|
+
m = {}
|
|
37
|
+
|
|
38
|
+
for n, f in type(self).model_fields.items():
|
|
39
|
+
k = f.alias or n
|
|
40
|
+
val = serialized.get(k)
|
|
41
|
+
|
|
42
|
+
if val != UNSET_SENTINEL:
|
|
43
|
+
if val is not None or k not in optional_fields:
|
|
44
|
+
m[k] = val
|
|
45
|
+
|
|
46
|
+
return m
|
|
47
|
+
|
|
31
48
|
|
|
32
49
|
class AgentErroredStreamingEventTypedDict(TypedDict):
|
|
33
50
|
r"""Emitted when an error occurs during agent execution. Contains the error message and HTTP status code indicating the failure type."""
|
|
@@ -81,6 +81,22 @@ class LastMessageFull(BaseModel):
|
|
|
81
81
|
|
|
82
82
|
metadata: Optional[Dict[str, Any]] = None
|
|
83
83
|
|
|
84
|
+
@model_serializer(mode="wrap")
|
|
85
|
+
def serialize_model(self, handler):
|
|
86
|
+
optional_fields = set(["messageId", "metadata"])
|
|
87
|
+
serialized = handler(self)
|
|
88
|
+
m = {}
|
|
89
|
+
|
|
90
|
+
for n, f in type(self).model_fields.items():
|
|
91
|
+
k = f.alias or n
|
|
92
|
+
val = serialized.get(k)
|
|
93
|
+
|
|
94
|
+
if val != UNSET_SENTINEL:
|
|
95
|
+
if val is not None or k not in optional_fields:
|
|
96
|
+
m[k] = val
|
|
97
|
+
|
|
98
|
+
return m
|
|
99
|
+
|
|
84
100
|
|
|
85
101
|
AgentInactiveStreamingEventFinishReason = Literal[
|
|
86
102
|
"stop",
|
|
@@ -107,6 +123,22 @@ class AgentInactiveStreamingEventFunction(BaseModel):
|
|
|
107
123
|
|
|
108
124
|
arguments: Optional[str] = None
|
|
109
125
|
|
|
126
|
+
@model_serializer(mode="wrap")
|
|
127
|
+
def serialize_model(self, handler):
|
|
128
|
+
optional_fields = set(["name", "arguments"])
|
|
129
|
+
serialized = handler(self)
|
|
130
|
+
m = {}
|
|
131
|
+
|
|
132
|
+
for n, f in type(self).model_fields.items():
|
|
133
|
+
k = f.alias or n
|
|
134
|
+
val = serialized.get(k)
|
|
135
|
+
|
|
136
|
+
if val != UNSET_SENTINEL:
|
|
137
|
+
if val is not None or k not in optional_fields:
|
|
138
|
+
m[k] = val
|
|
139
|
+
|
|
140
|
+
return m
|
|
141
|
+
|
|
110
142
|
|
|
111
143
|
class AgentInactiveStreamingEventPendingToolCallsTypedDict(TypedDict):
|
|
112
144
|
id: str
|
|
@@ -139,31 +171,30 @@ class AgentInactiveStreamingEventPromptTokensDetails(BaseModel):
|
|
|
139
171
|
|
|
140
172
|
@model_serializer(mode="wrap")
|
|
141
173
|
def serialize_model(self, handler):
|
|
142
|
-
optional_fields =
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
174
|
+
optional_fields = set(
|
|
175
|
+
["cached_tokens", "cache_creation_tokens", "audio_tokens"]
|
|
176
|
+
)
|
|
177
|
+
nullable_fields = set(
|
|
178
|
+
["cached_tokens", "cache_creation_tokens", "audio_tokens"]
|
|
179
|
+
)
|
|
146
180
|
serialized = handler(self)
|
|
147
|
-
|
|
148
181
|
m = {}
|
|
149
182
|
|
|
150
183
|
for n, f in type(self).model_fields.items():
|
|
151
184
|
k = f.alias or n
|
|
152
185
|
val = serialized.get(k)
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
):
|
|
166
|
-
m[k] = val
|
|
186
|
+
is_nullable_and_explicitly_set = (
|
|
187
|
+
k in nullable_fields
|
|
188
|
+
and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
|
|
189
|
+
)
|
|
190
|
+
|
|
191
|
+
if val != UNSET_SENTINEL:
|
|
192
|
+
if (
|
|
193
|
+
val is not None
|
|
194
|
+
or k not in optional_fields
|
|
195
|
+
or is_nullable_and_explicitly_set
|
|
196
|
+
):
|
|
197
|
+
m[k] = val
|
|
167
198
|
|
|
168
199
|
return m
|
|
169
200
|
|
|
@@ -188,41 +219,40 @@ class AgentInactiveStreamingEventCompletionTokensDetails(BaseModel):
|
|
|
188
219
|
|
|
189
220
|
@model_serializer(mode="wrap")
|
|
190
221
|
def serialize_model(self, handler):
|
|
191
|
-
optional_fields =
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
222
|
+
optional_fields = set(
|
|
223
|
+
[
|
|
224
|
+
"reasoning_tokens",
|
|
225
|
+
"accepted_prediction_tokens",
|
|
226
|
+
"rejected_prediction_tokens",
|
|
227
|
+
"audio_tokens",
|
|
228
|
+
]
|
|
229
|
+
)
|
|
230
|
+
nullable_fields = set(
|
|
231
|
+
[
|
|
232
|
+
"reasoning_tokens",
|
|
233
|
+
"accepted_prediction_tokens",
|
|
234
|
+
"rejected_prediction_tokens",
|
|
235
|
+
"audio_tokens",
|
|
236
|
+
]
|
|
237
|
+
)
|
|
205
238
|
serialized = handler(self)
|
|
206
|
-
|
|
207
239
|
m = {}
|
|
208
240
|
|
|
209
241
|
for n, f in type(self).model_fields.items():
|
|
210
242
|
k = f.alias or n
|
|
211
243
|
val = serialized.get(k)
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
):
|
|
225
|
-
m[k] = val
|
|
244
|
+
is_nullable_and_explicitly_set = (
|
|
245
|
+
k in nullable_fields
|
|
246
|
+
and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
|
|
247
|
+
)
|
|
248
|
+
|
|
249
|
+
if val != UNSET_SENTINEL:
|
|
250
|
+
if (
|
|
251
|
+
val is not None
|
|
252
|
+
or k not in optional_fields
|
|
253
|
+
or is_nullable_and_explicitly_set
|
|
254
|
+
):
|
|
255
|
+
m[k] = val
|
|
226
256
|
|
|
227
257
|
return m
|
|
228
258
|
|
|
@@ -242,6 +272,7 @@ class AgentInactiveStreamingEventUsageTypedDict(TypedDict):
|
|
|
242
272
|
completion_tokens_details: NotRequired[
|
|
243
273
|
Nullable[AgentInactiveStreamingEventCompletionTokensDetailsTypedDict]
|
|
244
274
|
]
|
|
275
|
+
time_to_first_token: NotRequired[float]
|
|
245
276
|
|
|
246
277
|
|
|
247
278
|
class AgentInactiveStreamingEventUsage(BaseModel):
|
|
@@ -264,38 +295,76 @@ class AgentInactiveStreamingEventUsage(BaseModel):
|
|
|
264
295
|
AgentInactiveStreamingEventCompletionTokensDetails
|
|
265
296
|
] = UNSET
|
|
266
297
|
|
|
298
|
+
time_to_first_token: Optional[float] = None
|
|
299
|
+
|
|
267
300
|
@model_serializer(mode="wrap")
|
|
268
301
|
def serialize_model(self, handler):
|
|
269
|
-
optional_fields =
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
302
|
+
optional_fields = set(
|
|
303
|
+
[
|
|
304
|
+
"completion_tokens",
|
|
305
|
+
"prompt_tokens",
|
|
306
|
+
"total_tokens",
|
|
307
|
+
"prompt_tokens_details",
|
|
308
|
+
"completion_tokens_details",
|
|
309
|
+
"time_to_first_token",
|
|
310
|
+
]
|
|
311
|
+
)
|
|
312
|
+
nullable_fields = set(["prompt_tokens_details", "completion_tokens_details"])
|
|
279
313
|
serialized = handler(self)
|
|
280
|
-
|
|
281
314
|
m = {}
|
|
282
315
|
|
|
283
316
|
for n, f in type(self).model_fields.items():
|
|
284
317
|
k = f.alias or n
|
|
285
318
|
val = serialized.get(k)
|
|
286
|
-
|
|
319
|
+
is_nullable_and_explicitly_set = (
|
|
320
|
+
k in nullable_fields
|
|
321
|
+
and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
|
|
322
|
+
)
|
|
323
|
+
|
|
324
|
+
if val != UNSET_SENTINEL:
|
|
325
|
+
if (
|
|
326
|
+
val is not None
|
|
327
|
+
or k not in optional_fields
|
|
328
|
+
or is_nullable_and_explicitly_set
|
|
329
|
+
):
|
|
330
|
+
m[k] = val
|
|
287
331
|
|
|
288
|
-
|
|
289
|
-
is_set = (
|
|
290
|
-
self.__pydantic_fields_set__.intersection({n})
|
|
291
|
-
or k in null_default_fields
|
|
292
|
-
) # pylint: disable=no-member
|
|
332
|
+
return m
|
|
293
333
|
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
334
|
+
|
|
335
|
+
class BillingTypedDict(TypedDict):
|
|
336
|
+
r"""Billing information for the agent execution"""
|
|
337
|
+
|
|
338
|
+
total_cost: float
|
|
339
|
+
input_cost: float
|
|
340
|
+
output_cost: float
|
|
341
|
+
billable: bool
|
|
342
|
+
integration_id: Nullable[str]
|
|
343
|
+
|
|
344
|
+
|
|
345
|
+
class Billing(BaseModel):
|
|
346
|
+
r"""Billing information for the agent execution"""
|
|
347
|
+
|
|
348
|
+
total_cost: float
|
|
349
|
+
|
|
350
|
+
input_cost: float
|
|
351
|
+
|
|
352
|
+
output_cost: float
|
|
353
|
+
|
|
354
|
+
billable: bool
|
|
355
|
+
|
|
356
|
+
integration_id: Nullable[str]
|
|
357
|
+
|
|
358
|
+
@model_serializer(mode="wrap")
|
|
359
|
+
def serialize_model(self, handler):
|
|
360
|
+
serialized = handler(self)
|
|
361
|
+
m = {}
|
|
362
|
+
|
|
363
|
+
for n, f in type(self).model_fields.items():
|
|
364
|
+
k = f.alias or n
|
|
365
|
+
val = serialized.get(k)
|
|
366
|
+
|
|
367
|
+
if val != UNSET_SENTINEL:
|
|
299
368
|
m[k] = val
|
|
300
369
|
|
|
301
370
|
return m
|
|
@@ -314,6 +383,8 @@ class AgentInactiveStreamingEventDataTypedDict(TypedDict):
|
|
|
314
383
|
r"""Tool calls that are pending user response (for function_call finish reason)"""
|
|
315
384
|
usage: NotRequired[AgentInactiveStreamingEventUsageTypedDict]
|
|
316
385
|
r"""Token usage from the last agent message"""
|
|
386
|
+
billing: NotRequired[BillingTypedDict]
|
|
387
|
+
r"""Billing information for the agent execution"""
|
|
317
388
|
response_id: NotRequired[str]
|
|
318
389
|
r"""ID of the response tracking this execution"""
|
|
319
390
|
|
|
@@ -337,9 +408,36 @@ class AgentInactiveStreamingEventData(BaseModel):
|
|
|
337
408
|
usage: Optional[AgentInactiveStreamingEventUsage] = None
|
|
338
409
|
r"""Token usage from the last agent message"""
|
|
339
410
|
|
|
411
|
+
billing: Optional[Billing] = None
|
|
412
|
+
r"""Billing information for the agent execution"""
|
|
413
|
+
|
|
340
414
|
response_id: Annotated[Optional[str], pydantic.Field(alias="responseId")] = None
|
|
341
415
|
r"""ID of the response tracking this execution"""
|
|
342
416
|
|
|
417
|
+
@model_serializer(mode="wrap")
|
|
418
|
+
def serialize_model(self, handler):
|
|
419
|
+
optional_fields = set(
|
|
420
|
+
[
|
|
421
|
+
"last_message_full",
|
|
422
|
+
"pending_tool_calls",
|
|
423
|
+
"usage",
|
|
424
|
+
"billing",
|
|
425
|
+
"responseId",
|
|
426
|
+
]
|
|
427
|
+
)
|
|
428
|
+
serialized = handler(self)
|
|
429
|
+
m = {}
|
|
430
|
+
|
|
431
|
+
for n, f in type(self).model_fields.items():
|
|
432
|
+
k = f.alias or n
|
|
433
|
+
val = serialized.get(k)
|
|
434
|
+
|
|
435
|
+
if val != UNSET_SENTINEL:
|
|
436
|
+
if val is not None or k not in optional_fields:
|
|
437
|
+
m[k] = val
|
|
438
|
+
|
|
439
|
+
return m
|
|
440
|
+
|
|
343
441
|
|
|
344
442
|
class AgentInactiveStreamingEventTypedDict(TypedDict):
|
|
345
443
|
r"""Emitted when the agent completes processing or pauses for input. Contains the final message, finish reason (stop, tool_calls, max_iterations, etc.), and any pending tool calls awaiting user response."""
|
|
@@ -7,10 +7,10 @@ from .filepart import FilePart, FilePartTypedDict
|
|
|
7
7
|
from .textpart import TextPart, TextPartTypedDict
|
|
8
8
|
from .toolcallpart import ToolCallPart, ToolCallPartTypedDict
|
|
9
9
|
from .toolresultpart import ToolResultPart, ToolResultPartTypedDict
|
|
10
|
-
from orq_ai_sdk.types import BaseModel
|
|
10
|
+
from orq_ai_sdk.types import BaseModel, UNSET_SENTINEL
|
|
11
11
|
from orq_ai_sdk.utils import get_discriminator
|
|
12
12
|
import pydantic
|
|
13
|
-
from pydantic import Discriminator, Tag
|
|
13
|
+
from pydantic import Discriminator, Tag, model_serializer
|
|
14
14
|
from typing import Any, Dict, List, Literal, Optional, Union
|
|
15
15
|
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
|
|
16
16
|
|
|
@@ -66,6 +66,22 @@ class Message(BaseModel):
|
|
|
66
66
|
|
|
67
67
|
metadata: Optional[Dict[str, Any]] = None
|
|
68
68
|
|
|
69
|
+
@model_serializer(mode="wrap")
|
|
70
|
+
def serialize_model(self, handler):
|
|
71
|
+
optional_fields = set(["messageId", "metadata"])
|
|
72
|
+
serialized = handler(self)
|
|
73
|
+
m = {}
|
|
74
|
+
|
|
75
|
+
for n, f in type(self).model_fields.items():
|
|
76
|
+
k = f.alias or n
|
|
77
|
+
val = serialized.get(k)
|
|
78
|
+
|
|
79
|
+
if val != UNSET_SENTINEL:
|
|
80
|
+
if val is not None or k not in optional_fields:
|
|
81
|
+
m[k] = val
|
|
82
|
+
|
|
83
|
+
return m
|
|
84
|
+
|
|
69
85
|
|
|
70
86
|
class AgentMessageCreatedStreamingEventDataTypedDict(TypedDict):
|
|
71
87
|
workflow_run_id: str
|
|
@@ -7,10 +7,10 @@ from .filepart import FilePart, FilePartTypedDict
|
|
|
7
7
|
from .textpart import TextPart, TextPartTypedDict
|
|
8
8
|
from .toolcallpart import ToolCallPart, ToolCallPartTypedDict
|
|
9
9
|
from .toolresultpart import ToolResultPart, ToolResultPartTypedDict
|
|
10
|
-
from orq_ai_sdk.types import BaseModel
|
|
10
|
+
from orq_ai_sdk.types import BaseModel, UNSET_SENTINEL
|
|
11
11
|
from orq_ai_sdk.utils import get_discriminator
|
|
12
12
|
import pydantic
|
|
13
|
-
from pydantic import Discriminator, Tag
|
|
13
|
+
from pydantic import Discriminator, Tag, model_serializer
|
|
14
14
|
from typing import Any, Dict, List, Literal, Optional, Union
|
|
15
15
|
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
|
|
16
16
|
|
|
@@ -68,3 +68,19 @@ class AgentResponseMessage(BaseModel):
|
|
|
68
68
|
parts: List[Parts]
|
|
69
69
|
|
|
70
70
|
metadata: Optional[Dict[str, Any]] = None
|
|
71
|
+
|
|
72
|
+
@model_serializer(mode="wrap")
|
|
73
|
+
def serialize_model(self, handler):
|
|
74
|
+
optional_fields = set(["metadata"])
|
|
75
|
+
serialized = handler(self)
|
|
76
|
+
m = {}
|
|
77
|
+
|
|
78
|
+
for n, f in type(self).model_fields.items():
|
|
79
|
+
k = f.alias or n
|
|
80
|
+
val = serialized.get(k)
|
|
81
|
+
|
|
82
|
+
if val != UNSET_SENTINEL:
|
|
83
|
+
if val is not None or k not in optional_fields:
|
|
84
|
+
m[k] = val
|
|
85
|
+
|
|
86
|
+
return m
|