orq-ai-sdk 4.2.0rc48__py3-none-any.whl → 4.2.12__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/_hooks/globalhook.py +0 -1
- orq_ai_sdk/_version.py +3 -3
- orq_ai_sdk/audio.py +30 -0
- orq_ai_sdk/chat.py +22 -0
- orq_ai_sdk/completions.py +438 -0
- orq_ai_sdk/contacts.py +43 -886
- 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/images.py +28 -0
- orq_ai_sdk/models/__init__.py +3839 -424
- orq_ai_sdk/models/conversationresponse.py +1 -1
- orq_ai_sdk/models/conversationwithmessagesresponse.py +1 -1
- orq_ai_sdk/models/createagentrequestop.py +768 -12
- orq_ai_sdk/models/createagentresponse.py +68 -2
- orq_ai_sdk/models/createchatcompletionop.py +538 -313
- orq_ai_sdk/models/createcompletionop.py +2078 -0
- orq_ai_sdk/models/createcontactop.py +5 -10
- orq_ai_sdk/models/createconversationop.py +1 -1
- orq_ai_sdk/models/createconversationresponseop.py +2 -2
- orq_ai_sdk/models/createdatasetitemop.py +4 -4
- orq_ai_sdk/models/createdatasetop.py +1 -1
- orq_ai_sdk/models/createdatasourceop.py +1 -1
- orq_ai_sdk/models/createembeddingop.py +579 -0
- orq_ai_sdk/models/createevalop.py +14 -14
- orq_ai_sdk/models/createidentityop.py +1 -1
- orq_ai_sdk/models/createimageeditop.py +715 -0
- orq_ai_sdk/models/createimageop.py +228 -82
- orq_ai_sdk/models/createimagevariationop.py +706 -0
- orq_ai_sdk/models/creatememoryop.py +4 -2
- orq_ai_sdk/models/createmoderationop.py +521 -0
- orq_ai_sdk/models/createpromptop.py +375 -6
- 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 +6 -6
- orq_ai_sdk/models/createtranscriptionop.py +732 -0
- orq_ai_sdk/models/createtranslationop.py +702 -0
- orq_ai_sdk/models/deploymentgetconfigop.py +17 -7
- orq_ai_sdk/models/deploymentsop.py +1 -0
- orq_ai_sdk/models/deploymentstreamop.py +7 -0
- orq_ai_sdk/models/filegetop.py +1 -1
- orq_ai_sdk/models/filelistop.py +1 -1
- orq_ai_sdk/models/fileuploadop.py +1 -1
- orq_ai_sdk/models/generateconversationnameop.py +1 -1
- orq_ai_sdk/models/getallmemoriesop.py +4 -2
- orq_ai_sdk/models/getallpromptsop.py +188 -3
- orq_ai_sdk/models/getalltoolsop.py +6 -6
- orq_ai_sdk/models/getevalsop.py +17 -17
- orq_ai_sdk/models/getonepromptop.py +188 -3
- orq_ai_sdk/models/getpromptversionop.py +188 -3
- orq_ai_sdk/models/invokedeploymentrequest.py +11 -4
- orq_ai_sdk/models/listagentsop.py +372 -0
- orq_ai_sdk/models/listdatasetdatapointsop.py +4 -4
- orq_ai_sdk/models/listdatasetsop.py +1 -1
- orq_ai_sdk/models/listdatasourcesop.py +1 -1
- orq_ai_sdk/models/listidentitiesop.py +1 -1
- orq_ai_sdk/models/listmodelsop.py +1 -0
- orq_ai_sdk/models/listpromptversionsop.py +188 -3
- orq_ai_sdk/models/partdoneevent.py +1 -1
- orq_ai_sdk/models/post_v2_router_ocrop.py +408 -0
- orq_ai_sdk/models/publiccontact.py +9 -3
- orq_ai_sdk/models/publicidentity.py +62 -0
- orq_ai_sdk/models/reasoningpart.py +1 -1
- orq_ai_sdk/models/responsedoneevent.py +14 -11
- orq_ai_sdk/models/retrieveagentrequestop.py +382 -0
- orq_ai_sdk/models/retrievedatapointop.py +4 -4
- orq_ai_sdk/models/retrievedatasetop.py +1 -1
- orq_ai_sdk/models/retrievedatasourceop.py +1 -1
- orq_ai_sdk/models/retrieveidentityop.py +1 -1
- orq_ai_sdk/models/retrievememoryop.py +4 -2
- orq_ai_sdk/models/retrievetoolop.py +6 -6
- orq_ai_sdk/models/runagentop.py +379 -9
- orq_ai_sdk/models/streamrunagentop.py +385 -9
- orq_ai_sdk/models/updateagentop.py +770 -12
- orq_ai_sdk/models/updateconversationop.py +1 -1
- orq_ai_sdk/models/updatedatapointop.py +4 -4
- orq_ai_sdk/models/updatedatasetop.py +1 -1
- orq_ai_sdk/models/updatedatasourceop.py +1 -1
- orq_ai_sdk/models/updateevalop.py +14 -14
- orq_ai_sdk/models/updateidentityop.py +1 -1
- orq_ai_sdk/models/updatememoryop.py +4 -2
- orq_ai_sdk/models/updatepromptop.py +375 -6
- orq_ai_sdk/models/updatetoolop.py +7 -7
- 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/rerank.py +330 -0
- orq_ai_sdk/router.py +89 -641
- orq_ai_sdk/speech.py +333 -0
- orq_ai_sdk/transcriptions.py +416 -0
- orq_ai_sdk/translations.py +384 -0
- orq_ai_sdk/variations.py +364 -0
- orq_ai_sdk-4.2.12.dist-info/METADATA +888 -0
- {orq_ai_sdk-4.2.0rc48.dist-info → orq_ai_sdk-4.2.12.dist-info}/RECORD +98 -75
- {orq_ai_sdk-4.2.0rc48.dist-info → orq_ai_sdk-4.2.12.dist-info}/WHEEL +1 -1
- orq_ai_sdk/models/deletecontactop.py +0 -44
- orq_ai_sdk/models/listcontactsop.py +0 -265
- orq_ai_sdk/models/retrievecontactop.py +0 -142
- orq_ai_sdk/models/updatecontactop.py +0 -233
- orq_ai_sdk-4.2.0rc48.dist-info/METADATA +0 -788
- {orq_ai_sdk-4.2.0rc48.dist-info → orq_ai_sdk-4.2.12.dist-info}/top_level.txt +0 -0
|
@@ -1041,6 +1041,154 @@ class CreatePromptGuardrails(BaseModel):
|
|
|
1041
1041
|
r"""Determines whether the guardrail runs on the input (user message) or output (model response)."""
|
|
1042
1042
|
|
|
1043
1043
|
|
|
1044
|
+
class CreatePromptFallbacksTypedDict(TypedDict):
|
|
1045
|
+
model: str
|
|
1046
|
+
r"""Fallback model identifier"""
|
|
1047
|
+
|
|
1048
|
+
|
|
1049
|
+
class CreatePromptFallbacks(BaseModel):
|
|
1050
|
+
model: str
|
|
1051
|
+
r"""Fallback model identifier"""
|
|
1052
|
+
|
|
1053
|
+
|
|
1054
|
+
class CreatePromptRetryTypedDict(TypedDict):
|
|
1055
|
+
r"""Retry configuration for the request"""
|
|
1056
|
+
|
|
1057
|
+
count: NotRequired[float]
|
|
1058
|
+
r"""Number of retry attempts (1-5)"""
|
|
1059
|
+
on_codes: NotRequired[List[float]]
|
|
1060
|
+
r"""HTTP status codes that trigger retry logic"""
|
|
1061
|
+
|
|
1062
|
+
|
|
1063
|
+
class CreatePromptRetry(BaseModel):
|
|
1064
|
+
r"""Retry configuration for the request"""
|
|
1065
|
+
|
|
1066
|
+
count: Optional[float] = 3
|
|
1067
|
+
r"""Number of retry attempts (1-5)"""
|
|
1068
|
+
|
|
1069
|
+
on_codes: Optional[List[float]] = None
|
|
1070
|
+
r"""HTTP status codes that trigger retry logic"""
|
|
1071
|
+
|
|
1072
|
+
@model_serializer(mode="wrap")
|
|
1073
|
+
def serialize_model(self, handler):
|
|
1074
|
+
optional_fields = set(["count", "on_codes"])
|
|
1075
|
+
serialized = handler(self)
|
|
1076
|
+
m = {}
|
|
1077
|
+
|
|
1078
|
+
for n, f in type(self).model_fields.items():
|
|
1079
|
+
k = f.alias or n
|
|
1080
|
+
val = serialized.get(k)
|
|
1081
|
+
|
|
1082
|
+
if val != UNSET_SENTINEL:
|
|
1083
|
+
if val is not None or k not in optional_fields:
|
|
1084
|
+
m[k] = val
|
|
1085
|
+
|
|
1086
|
+
return m
|
|
1087
|
+
|
|
1088
|
+
|
|
1089
|
+
CreatePromptType = Literal["exact_match",]
|
|
1090
|
+
|
|
1091
|
+
|
|
1092
|
+
class CreatePromptCacheTypedDict(TypedDict):
|
|
1093
|
+
r"""Cache configuration for the request."""
|
|
1094
|
+
|
|
1095
|
+
type: CreatePromptType
|
|
1096
|
+
ttl: NotRequired[float]
|
|
1097
|
+
r"""Time to live for cached responses in seconds. Maximum 259200 seconds (3 days)."""
|
|
1098
|
+
|
|
1099
|
+
|
|
1100
|
+
class CreatePromptCache(BaseModel):
|
|
1101
|
+
r"""Cache configuration for the request."""
|
|
1102
|
+
|
|
1103
|
+
type: CreatePromptType
|
|
1104
|
+
|
|
1105
|
+
ttl: Optional[float] = 1800
|
|
1106
|
+
r"""Time to live for cached responses in seconds. Maximum 259200 seconds (3 days)."""
|
|
1107
|
+
|
|
1108
|
+
@model_serializer(mode="wrap")
|
|
1109
|
+
def serialize_model(self, handler):
|
|
1110
|
+
optional_fields = set(["ttl"])
|
|
1111
|
+
serialized = handler(self)
|
|
1112
|
+
m = {}
|
|
1113
|
+
|
|
1114
|
+
for n, f in type(self).model_fields.items():
|
|
1115
|
+
k = f.alias or n
|
|
1116
|
+
val = serialized.get(k)
|
|
1117
|
+
|
|
1118
|
+
if val != UNSET_SENTINEL:
|
|
1119
|
+
if val is not None or k not in optional_fields:
|
|
1120
|
+
m[k] = val
|
|
1121
|
+
|
|
1122
|
+
return m
|
|
1123
|
+
|
|
1124
|
+
|
|
1125
|
+
CreatePromptLoadBalancerType = Literal["weight_based",]
|
|
1126
|
+
|
|
1127
|
+
|
|
1128
|
+
class CreatePromptLoadBalancerModelsTypedDict(TypedDict):
|
|
1129
|
+
model: str
|
|
1130
|
+
r"""Model identifier for load balancing"""
|
|
1131
|
+
weight: NotRequired[float]
|
|
1132
|
+
r"""Weight assigned to this model for load balancing"""
|
|
1133
|
+
|
|
1134
|
+
|
|
1135
|
+
class CreatePromptLoadBalancerModels(BaseModel):
|
|
1136
|
+
model: str
|
|
1137
|
+
r"""Model identifier for load balancing"""
|
|
1138
|
+
|
|
1139
|
+
weight: Optional[float] = 0.5
|
|
1140
|
+
r"""Weight assigned to this model for load balancing"""
|
|
1141
|
+
|
|
1142
|
+
@model_serializer(mode="wrap")
|
|
1143
|
+
def serialize_model(self, handler):
|
|
1144
|
+
optional_fields = set(["weight"])
|
|
1145
|
+
serialized = handler(self)
|
|
1146
|
+
m = {}
|
|
1147
|
+
|
|
1148
|
+
for n, f in type(self).model_fields.items():
|
|
1149
|
+
k = f.alias or n
|
|
1150
|
+
val = serialized.get(k)
|
|
1151
|
+
|
|
1152
|
+
if val != UNSET_SENTINEL:
|
|
1153
|
+
if val is not None or k not in optional_fields:
|
|
1154
|
+
m[k] = val
|
|
1155
|
+
|
|
1156
|
+
return m
|
|
1157
|
+
|
|
1158
|
+
|
|
1159
|
+
class CreatePromptLoadBalancer1TypedDict(TypedDict):
|
|
1160
|
+
type: CreatePromptLoadBalancerType
|
|
1161
|
+
models: List[CreatePromptLoadBalancerModelsTypedDict]
|
|
1162
|
+
|
|
1163
|
+
|
|
1164
|
+
class CreatePromptLoadBalancer1(BaseModel):
|
|
1165
|
+
type: CreatePromptLoadBalancerType
|
|
1166
|
+
|
|
1167
|
+
models: List[CreatePromptLoadBalancerModels]
|
|
1168
|
+
|
|
1169
|
+
|
|
1170
|
+
CreatePromptLoadBalancerTypedDict = CreatePromptLoadBalancer1TypedDict
|
|
1171
|
+
r"""Load balancer configuration for the request."""
|
|
1172
|
+
|
|
1173
|
+
|
|
1174
|
+
CreatePromptLoadBalancer = CreatePromptLoadBalancer1
|
|
1175
|
+
r"""Load balancer configuration for the request."""
|
|
1176
|
+
|
|
1177
|
+
|
|
1178
|
+
class CreatePromptTimeoutTypedDict(TypedDict):
|
|
1179
|
+
r"""Timeout configuration to apply to the request. If the request exceeds the timeout, it will be retried or fallback to the next model if configured."""
|
|
1180
|
+
|
|
1181
|
+
call_timeout: float
|
|
1182
|
+
r"""Timeout value in milliseconds"""
|
|
1183
|
+
|
|
1184
|
+
|
|
1185
|
+
class CreatePromptTimeout(BaseModel):
|
|
1186
|
+
r"""Timeout configuration to apply to the request. If the request exceeds the timeout, it will be retried or fallback to the next model if configured."""
|
|
1187
|
+
|
|
1188
|
+
call_timeout: float
|
|
1189
|
+
r"""Timeout value in milliseconds"""
|
|
1190
|
+
|
|
1191
|
+
|
|
1044
1192
|
class PromptInputTypedDict(TypedDict):
|
|
1045
1193
|
r"""Prompt configuration with model and messages."""
|
|
1046
1194
|
|
|
@@ -1048,6 +1196,8 @@ class PromptInputTypedDict(TypedDict):
|
|
|
1048
1196
|
r"""Array of messages that make up the conversation. Each message has a role (system, user, assistant, or tool) and content."""
|
|
1049
1197
|
model: NotRequired[str]
|
|
1050
1198
|
r"""Model ID used to generate the response, like `openai/gpt-4o` or `anthropic/claude-3-5-sonnet-20241022`. For private models, use format: `{workspaceKey}@{provider}/{model}`. The full list of models can be found at https://docs.orq.ai/docs/ai-gateway-supported-models. Only chat models are supported."""
|
|
1199
|
+
name: NotRequired[str]
|
|
1200
|
+
r"""The name to display on the trace. If not specified, the default system name will be used."""
|
|
1051
1201
|
audio: NotRequired[Nullable[CreatePromptAudioTypedDict]]
|
|
1052
1202
|
r"""Parameters for audio output. Required when audio output is requested with modalities: [\"audio\"]. Learn more."""
|
|
1053
1203
|
frequency_penalty: NotRequired[Nullable[float]]
|
|
@@ -1102,6 +1252,16 @@ class PromptInputTypedDict(TypedDict):
|
|
|
1102
1252
|
r"""Output types that you would like the model to generate. Most models are capable of generating text, which is the default: [\"text\"]. The gpt-4o-audio-preview model can also be used to generate audio. To request that this model generate both text and audio responses, you can use: [\"text\", \"audio\"]."""
|
|
1103
1253
|
guardrails: NotRequired[List[CreatePromptGuardrailsTypedDict]]
|
|
1104
1254
|
r"""A list of guardrails to apply to the request."""
|
|
1255
|
+
fallbacks: NotRequired[List[CreatePromptFallbacksTypedDict]]
|
|
1256
|
+
r"""Array of fallback models to use if primary model fails"""
|
|
1257
|
+
retry: NotRequired[CreatePromptRetryTypedDict]
|
|
1258
|
+
r"""Retry configuration for the request"""
|
|
1259
|
+
cache: NotRequired[CreatePromptCacheTypedDict]
|
|
1260
|
+
r"""Cache configuration for the request."""
|
|
1261
|
+
load_balancer: NotRequired[CreatePromptLoadBalancerTypedDict]
|
|
1262
|
+
r"""Load balancer configuration for the request."""
|
|
1263
|
+
timeout: NotRequired[CreatePromptTimeoutTypedDict]
|
|
1264
|
+
r"""Timeout configuration to apply to the request. If the request exceeds the timeout, it will be retried or fallback to the next model if configured."""
|
|
1105
1265
|
|
|
1106
1266
|
|
|
1107
1267
|
class PromptInput(BaseModel):
|
|
@@ -1113,6 +1273,9 @@ class PromptInput(BaseModel):
|
|
|
1113
1273
|
model: Optional[str] = None
|
|
1114
1274
|
r"""Model ID used to generate the response, like `openai/gpt-4o` or `anthropic/claude-3-5-sonnet-20241022`. For private models, use format: `{workspaceKey}@{provider}/{model}`. The full list of models can be found at https://docs.orq.ai/docs/ai-gateway-supported-models. Only chat models are supported."""
|
|
1115
1275
|
|
|
1276
|
+
name: Optional[str] = None
|
|
1277
|
+
r"""The name to display on the trace. If not specified, the default system name will be used."""
|
|
1278
|
+
|
|
1116
1279
|
audio: OptionalNullable[CreatePromptAudio] = UNSET
|
|
1117
1280
|
r"""Parameters for audio output. Required when audio output is requested with modalities: [\"audio\"]. Learn more."""
|
|
1118
1281
|
|
|
@@ -1189,11 +1352,27 @@ class PromptInput(BaseModel):
|
|
|
1189
1352
|
guardrails: Optional[List[CreatePromptGuardrails]] = None
|
|
1190
1353
|
r"""A list of guardrails to apply to the request."""
|
|
1191
1354
|
|
|
1355
|
+
fallbacks: Optional[List[CreatePromptFallbacks]] = None
|
|
1356
|
+
r"""Array of fallback models to use if primary model fails"""
|
|
1357
|
+
|
|
1358
|
+
retry: Optional[CreatePromptRetry] = None
|
|
1359
|
+
r"""Retry configuration for the request"""
|
|
1360
|
+
|
|
1361
|
+
cache: Optional[CreatePromptCache] = None
|
|
1362
|
+
r"""Cache configuration for the request."""
|
|
1363
|
+
|
|
1364
|
+
load_balancer: Optional[CreatePromptLoadBalancer] = None
|
|
1365
|
+
r"""Load balancer configuration for the request."""
|
|
1366
|
+
|
|
1367
|
+
timeout: Optional[CreatePromptTimeout] = None
|
|
1368
|
+
r"""Timeout configuration to apply to the request. If the request exceeds the timeout, it will be retried or fallback to the next model if configured."""
|
|
1369
|
+
|
|
1192
1370
|
@model_serializer(mode="wrap")
|
|
1193
1371
|
def serialize_model(self, handler):
|
|
1194
1372
|
optional_fields = set(
|
|
1195
1373
|
[
|
|
1196
1374
|
"model",
|
|
1375
|
+
"name",
|
|
1197
1376
|
"audio",
|
|
1198
1377
|
"frequency_penalty",
|
|
1199
1378
|
"max_tokens",
|
|
@@ -1216,6 +1395,11 @@ class PromptInput(BaseModel):
|
|
|
1216
1395
|
"parallel_tool_calls",
|
|
1217
1396
|
"modalities",
|
|
1218
1397
|
"guardrails",
|
|
1398
|
+
"fallbacks",
|
|
1399
|
+
"retry",
|
|
1400
|
+
"cache",
|
|
1401
|
+
"load_balancer",
|
|
1402
|
+
"timeout",
|
|
1219
1403
|
]
|
|
1220
1404
|
)
|
|
1221
1405
|
nullable_fields = set(
|
|
@@ -1322,7 +1506,7 @@ class CreatePromptRequestBody(BaseModel):
|
|
|
1322
1506
|
return m
|
|
1323
1507
|
|
|
1324
1508
|
|
|
1325
|
-
|
|
1509
|
+
CreatePromptPromptsType = Literal["prompt",]
|
|
1326
1510
|
|
|
1327
1511
|
|
|
1328
1512
|
ModelType = Literal[
|
|
@@ -1333,6 +1517,7 @@ ModelType = Literal[
|
|
|
1333
1517
|
"tts",
|
|
1334
1518
|
"stt",
|
|
1335
1519
|
"rerank",
|
|
1520
|
+
"ocr",
|
|
1336
1521
|
"moderation",
|
|
1337
1522
|
"vision",
|
|
1338
1523
|
]
|
|
@@ -1940,7 +2125,7 @@ CreatePromptContent = TypeAliasType(
|
|
|
1940
2125
|
r"""The contents of the user message. Either the text content of the message or an array of content parts with a defined type, each can be of type `text` or `image_url` when passing in images. You can pass multiple images by adding multiple `image_url` content parts. Can be null for tool messages in certain scenarios."""
|
|
1941
2126
|
|
|
1942
2127
|
|
|
1943
|
-
|
|
2128
|
+
CreatePromptPromptsResponse200Type = Literal["function",]
|
|
1944
2129
|
|
|
1945
2130
|
|
|
1946
2131
|
class CreatePromptFunctionTypedDict(TypedDict):
|
|
@@ -1957,14 +2142,14 @@ class CreatePromptFunction(BaseModel):
|
|
|
1957
2142
|
|
|
1958
2143
|
|
|
1959
2144
|
class CreatePromptToolCallsTypedDict(TypedDict):
|
|
1960
|
-
type:
|
|
2145
|
+
type: CreatePromptPromptsResponse200Type
|
|
1961
2146
|
function: CreatePromptFunctionTypedDict
|
|
1962
2147
|
id: NotRequired[str]
|
|
1963
2148
|
index: NotRequired[float]
|
|
1964
2149
|
|
|
1965
2150
|
|
|
1966
2151
|
class CreatePromptToolCalls(BaseModel):
|
|
1967
|
-
type:
|
|
2152
|
+
type: CreatePromptPromptsResponse200Type
|
|
1968
2153
|
|
|
1969
2154
|
function: CreatePromptFunction
|
|
1970
2155
|
|
|
@@ -2482,6 +2667,154 @@ class CreatePromptPromptsGuardrails(BaseModel):
|
|
|
2482
2667
|
r"""Determines whether the guardrail runs on the input (user message) or output (model response)."""
|
|
2483
2668
|
|
|
2484
2669
|
|
|
2670
|
+
class CreatePromptPromptsFallbacksTypedDict(TypedDict):
|
|
2671
|
+
model: str
|
|
2672
|
+
r"""Fallback model identifier"""
|
|
2673
|
+
|
|
2674
|
+
|
|
2675
|
+
class CreatePromptPromptsFallbacks(BaseModel):
|
|
2676
|
+
model: str
|
|
2677
|
+
r"""Fallback model identifier"""
|
|
2678
|
+
|
|
2679
|
+
|
|
2680
|
+
class CreatePromptPromptsRetryTypedDict(TypedDict):
|
|
2681
|
+
r"""Retry configuration for the request"""
|
|
2682
|
+
|
|
2683
|
+
count: NotRequired[float]
|
|
2684
|
+
r"""Number of retry attempts (1-5)"""
|
|
2685
|
+
on_codes: NotRequired[List[float]]
|
|
2686
|
+
r"""HTTP status codes that trigger retry logic"""
|
|
2687
|
+
|
|
2688
|
+
|
|
2689
|
+
class CreatePromptPromptsRetry(BaseModel):
|
|
2690
|
+
r"""Retry configuration for the request"""
|
|
2691
|
+
|
|
2692
|
+
count: Optional[float] = 3
|
|
2693
|
+
r"""Number of retry attempts (1-5)"""
|
|
2694
|
+
|
|
2695
|
+
on_codes: Optional[List[float]] = None
|
|
2696
|
+
r"""HTTP status codes that trigger retry logic"""
|
|
2697
|
+
|
|
2698
|
+
@model_serializer(mode="wrap")
|
|
2699
|
+
def serialize_model(self, handler):
|
|
2700
|
+
optional_fields = set(["count", "on_codes"])
|
|
2701
|
+
serialized = handler(self)
|
|
2702
|
+
m = {}
|
|
2703
|
+
|
|
2704
|
+
for n, f in type(self).model_fields.items():
|
|
2705
|
+
k = f.alias or n
|
|
2706
|
+
val = serialized.get(k)
|
|
2707
|
+
|
|
2708
|
+
if val != UNSET_SENTINEL:
|
|
2709
|
+
if val is not None or k not in optional_fields:
|
|
2710
|
+
m[k] = val
|
|
2711
|
+
|
|
2712
|
+
return m
|
|
2713
|
+
|
|
2714
|
+
|
|
2715
|
+
CreatePromptPromptsResponseType = Literal["exact_match",]
|
|
2716
|
+
|
|
2717
|
+
|
|
2718
|
+
class CreatePromptPromptsCacheTypedDict(TypedDict):
|
|
2719
|
+
r"""Cache configuration for the request."""
|
|
2720
|
+
|
|
2721
|
+
type: CreatePromptPromptsResponseType
|
|
2722
|
+
ttl: NotRequired[float]
|
|
2723
|
+
r"""Time to live for cached responses in seconds. Maximum 259200 seconds (3 days)."""
|
|
2724
|
+
|
|
2725
|
+
|
|
2726
|
+
class CreatePromptPromptsCache(BaseModel):
|
|
2727
|
+
r"""Cache configuration for the request."""
|
|
2728
|
+
|
|
2729
|
+
type: CreatePromptPromptsResponseType
|
|
2730
|
+
|
|
2731
|
+
ttl: Optional[float] = 1800
|
|
2732
|
+
r"""Time to live for cached responses in seconds. Maximum 259200 seconds (3 days)."""
|
|
2733
|
+
|
|
2734
|
+
@model_serializer(mode="wrap")
|
|
2735
|
+
def serialize_model(self, handler):
|
|
2736
|
+
optional_fields = set(["ttl"])
|
|
2737
|
+
serialized = handler(self)
|
|
2738
|
+
m = {}
|
|
2739
|
+
|
|
2740
|
+
for n, f in type(self).model_fields.items():
|
|
2741
|
+
k = f.alias or n
|
|
2742
|
+
val = serialized.get(k)
|
|
2743
|
+
|
|
2744
|
+
if val != UNSET_SENTINEL:
|
|
2745
|
+
if val is not None or k not in optional_fields:
|
|
2746
|
+
m[k] = val
|
|
2747
|
+
|
|
2748
|
+
return m
|
|
2749
|
+
|
|
2750
|
+
|
|
2751
|
+
CreatePromptLoadBalancerPromptsType = Literal["weight_based",]
|
|
2752
|
+
|
|
2753
|
+
|
|
2754
|
+
class CreatePromptLoadBalancerPromptsModelsTypedDict(TypedDict):
|
|
2755
|
+
model: str
|
|
2756
|
+
r"""Model identifier for load balancing"""
|
|
2757
|
+
weight: NotRequired[float]
|
|
2758
|
+
r"""Weight assigned to this model for load balancing"""
|
|
2759
|
+
|
|
2760
|
+
|
|
2761
|
+
class CreatePromptLoadBalancerPromptsModels(BaseModel):
|
|
2762
|
+
model: str
|
|
2763
|
+
r"""Model identifier for load balancing"""
|
|
2764
|
+
|
|
2765
|
+
weight: Optional[float] = 0.5
|
|
2766
|
+
r"""Weight assigned to this model for load balancing"""
|
|
2767
|
+
|
|
2768
|
+
@model_serializer(mode="wrap")
|
|
2769
|
+
def serialize_model(self, handler):
|
|
2770
|
+
optional_fields = set(["weight"])
|
|
2771
|
+
serialized = handler(self)
|
|
2772
|
+
m = {}
|
|
2773
|
+
|
|
2774
|
+
for n, f in type(self).model_fields.items():
|
|
2775
|
+
k = f.alias or n
|
|
2776
|
+
val = serialized.get(k)
|
|
2777
|
+
|
|
2778
|
+
if val != UNSET_SENTINEL:
|
|
2779
|
+
if val is not None or k not in optional_fields:
|
|
2780
|
+
m[k] = val
|
|
2781
|
+
|
|
2782
|
+
return m
|
|
2783
|
+
|
|
2784
|
+
|
|
2785
|
+
class CreatePromptLoadBalancerPrompts1TypedDict(TypedDict):
|
|
2786
|
+
type: CreatePromptLoadBalancerPromptsType
|
|
2787
|
+
models: List[CreatePromptLoadBalancerPromptsModelsTypedDict]
|
|
2788
|
+
|
|
2789
|
+
|
|
2790
|
+
class CreatePromptLoadBalancerPrompts1(BaseModel):
|
|
2791
|
+
type: CreatePromptLoadBalancerPromptsType
|
|
2792
|
+
|
|
2793
|
+
models: List[CreatePromptLoadBalancerPromptsModels]
|
|
2794
|
+
|
|
2795
|
+
|
|
2796
|
+
CreatePromptPromptsLoadBalancerTypedDict = CreatePromptLoadBalancerPrompts1TypedDict
|
|
2797
|
+
r"""Load balancer configuration for the request."""
|
|
2798
|
+
|
|
2799
|
+
|
|
2800
|
+
CreatePromptPromptsLoadBalancer = CreatePromptLoadBalancerPrompts1
|
|
2801
|
+
r"""Load balancer configuration for the request."""
|
|
2802
|
+
|
|
2803
|
+
|
|
2804
|
+
class CreatePromptPromptsTimeoutTypedDict(TypedDict):
|
|
2805
|
+
r"""Timeout configuration to apply to the request. If the request exceeds the timeout, it will be retried or fallback to the next model if configured."""
|
|
2806
|
+
|
|
2807
|
+
call_timeout: float
|
|
2808
|
+
r"""Timeout value in milliseconds"""
|
|
2809
|
+
|
|
2810
|
+
|
|
2811
|
+
class CreatePromptPromptsTimeout(BaseModel):
|
|
2812
|
+
r"""Timeout configuration to apply to the request. If the request exceeds the timeout, it will be retried or fallback to the next model if configured."""
|
|
2813
|
+
|
|
2814
|
+
call_timeout: float
|
|
2815
|
+
r"""Timeout value in milliseconds"""
|
|
2816
|
+
|
|
2817
|
+
|
|
2485
2818
|
CreatePromptMessagesPromptsResponse200ApplicationJSONResponseBodyRole = Literal["tool",]
|
|
2486
2819
|
r"""The role of the messages author, in this case tool."""
|
|
2487
2820
|
|
|
@@ -3078,6 +3411,8 @@ CreatePromptPromptsResponseMessages = Annotated[
|
|
|
3078
3411
|
class PromptFieldTypedDict(TypedDict):
|
|
3079
3412
|
r"""Prompt configuration with model and messages. Use this instead of prompt_config."""
|
|
3080
3413
|
|
|
3414
|
+
name: NotRequired[str]
|
|
3415
|
+
r"""The name to display on the trace. If not specified, the default system name will be used."""
|
|
3081
3416
|
audio: NotRequired[Nullable[CreatePromptPromptsAudioTypedDict]]
|
|
3082
3417
|
r"""Parameters for audio output. Required when audio output is requested with modalities: [\"audio\"]. Learn more."""
|
|
3083
3418
|
frequency_penalty: NotRequired[Nullable[float]]
|
|
@@ -3132,6 +3467,16 @@ class PromptFieldTypedDict(TypedDict):
|
|
|
3132
3467
|
r"""Output types that you would like the model to generate. Most models are capable of generating text, which is the default: [\"text\"]. The gpt-4o-audio-preview model can also be used to generate audio. To request that this model generate both text and audio responses, you can use: [\"text\", \"audio\"]."""
|
|
3133
3468
|
guardrails: NotRequired[List[CreatePromptPromptsGuardrailsTypedDict]]
|
|
3134
3469
|
r"""A list of guardrails to apply to the request."""
|
|
3470
|
+
fallbacks: NotRequired[List[CreatePromptPromptsFallbacksTypedDict]]
|
|
3471
|
+
r"""Array of fallback models to use if primary model fails"""
|
|
3472
|
+
retry: NotRequired[CreatePromptPromptsRetryTypedDict]
|
|
3473
|
+
r"""Retry configuration for the request"""
|
|
3474
|
+
cache: NotRequired[CreatePromptPromptsCacheTypedDict]
|
|
3475
|
+
r"""Cache configuration for the request."""
|
|
3476
|
+
load_balancer: NotRequired[CreatePromptPromptsLoadBalancerTypedDict]
|
|
3477
|
+
r"""Load balancer configuration for the request."""
|
|
3478
|
+
timeout: NotRequired[CreatePromptPromptsTimeoutTypedDict]
|
|
3479
|
+
r"""Timeout configuration to apply to the request. If the request exceeds the timeout, it will be retried or fallback to the next model if configured."""
|
|
3135
3480
|
messages: NotRequired[List[CreatePromptPromptsResponseMessagesTypedDict]]
|
|
3136
3481
|
r"""Array of messages that make up the conversation. Each message has a role (system, user, assistant, or tool) and content."""
|
|
3137
3482
|
model: NotRequired[Nullable[str]]
|
|
@@ -3142,6 +3487,9 @@ class PromptFieldTypedDict(TypedDict):
|
|
|
3142
3487
|
class PromptField(BaseModel):
|
|
3143
3488
|
r"""Prompt configuration with model and messages. Use this instead of prompt_config."""
|
|
3144
3489
|
|
|
3490
|
+
name: Optional[str] = None
|
|
3491
|
+
r"""The name to display on the trace. If not specified, the default system name will be used."""
|
|
3492
|
+
|
|
3145
3493
|
audio: OptionalNullable[CreatePromptPromptsAudio] = UNSET
|
|
3146
3494
|
r"""Parameters for audio output. Required when audio output is requested with modalities: [\"audio\"]. Learn more."""
|
|
3147
3495
|
|
|
@@ -3218,6 +3566,21 @@ class PromptField(BaseModel):
|
|
|
3218
3566
|
guardrails: Optional[List[CreatePromptPromptsGuardrails]] = None
|
|
3219
3567
|
r"""A list of guardrails to apply to the request."""
|
|
3220
3568
|
|
|
3569
|
+
fallbacks: Optional[List[CreatePromptPromptsFallbacks]] = None
|
|
3570
|
+
r"""Array of fallback models to use if primary model fails"""
|
|
3571
|
+
|
|
3572
|
+
retry: Optional[CreatePromptPromptsRetry] = None
|
|
3573
|
+
r"""Retry configuration for the request"""
|
|
3574
|
+
|
|
3575
|
+
cache: Optional[CreatePromptPromptsCache] = None
|
|
3576
|
+
r"""Cache configuration for the request."""
|
|
3577
|
+
|
|
3578
|
+
load_balancer: Optional[CreatePromptPromptsLoadBalancer] = None
|
|
3579
|
+
r"""Load balancer configuration for the request."""
|
|
3580
|
+
|
|
3581
|
+
timeout: Optional[CreatePromptPromptsTimeout] = None
|
|
3582
|
+
r"""Timeout configuration to apply to the request. If the request exceeds the timeout, it will be retried or fallback to the next model if configured."""
|
|
3583
|
+
|
|
3221
3584
|
messages: Optional[List[CreatePromptPromptsResponseMessages]] = None
|
|
3222
3585
|
r"""Array of messages that make up the conversation. Each message has a role (system, user, assistant, or tool) and content."""
|
|
3223
3586
|
|
|
@@ -3230,6 +3593,7 @@ class PromptField(BaseModel):
|
|
|
3230
3593
|
def serialize_model(self, handler):
|
|
3231
3594
|
optional_fields = set(
|
|
3232
3595
|
[
|
|
3596
|
+
"name",
|
|
3233
3597
|
"audio",
|
|
3234
3598
|
"frequency_penalty",
|
|
3235
3599
|
"max_tokens",
|
|
@@ -3252,6 +3616,11 @@ class PromptField(BaseModel):
|
|
|
3252
3616
|
"parallel_tool_calls",
|
|
3253
3617
|
"modalities",
|
|
3254
3618
|
"guardrails",
|
|
3619
|
+
"fallbacks",
|
|
3620
|
+
"retry",
|
|
3621
|
+
"cache",
|
|
3622
|
+
"load_balancer",
|
|
3623
|
+
"timeout",
|
|
3255
3624
|
"messages",
|
|
3256
3625
|
"model",
|
|
3257
3626
|
"version",
|
|
@@ -3379,7 +3748,7 @@ class CreatePromptPromptTypedDict(TypedDict):
|
|
|
3379
3748
|
r"""A prompt entity with configuration, metadata, and versioning."""
|
|
3380
3749
|
|
|
3381
3750
|
id: str
|
|
3382
|
-
type:
|
|
3751
|
+
type: CreatePromptPromptsType
|
|
3383
3752
|
owner: str
|
|
3384
3753
|
domain_id: str
|
|
3385
3754
|
created: str
|
|
@@ -3402,7 +3771,7 @@ class CreatePromptPrompt(BaseModel):
|
|
|
3402
3771
|
|
|
3403
3772
|
id: Annotated[str, pydantic.Field(alias="_id")]
|
|
3404
3773
|
|
|
3405
|
-
type:
|
|
3774
|
+
type: CreatePromptPromptsType
|
|
3406
3775
|
|
|
3407
3776
|
owner: str
|
|
3408
3777
|
|