assistant-runtime-sdk 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.
- assistant_runtime_sdk/__init__.py +235 -0
- assistant_runtime_sdk/async_client.py +1989 -0
- assistant_runtime_sdk/auth.py +161 -0
- assistant_runtime_sdk/base.py +2277 -0
- assistant_runtime_sdk/client.py +3039 -0
- assistant_runtime_sdk/exceptions.py +146 -0
- assistant_runtime_sdk/skills.py +328 -0
- assistant_runtime_sdk/streaming.py +223 -0
- assistant_runtime_sdk/types.py +546 -0
- assistant_runtime_sdk-1.0.0.dist-info/METADATA +259 -0
- assistant_runtime_sdk-1.0.0.dist-info/RECORD +13 -0
- assistant_runtime_sdk-1.0.0.dist-info/WHEEL +4 -0
- assistant_runtime_sdk-1.0.0.dist-info/licenses/LICENSE +17 -0
|
@@ -0,0 +1,546 @@
|
|
|
1
|
+
# Assistant Runtime SDK - Type Definitions
|
|
2
|
+
# Copyright (C) 2025 Paul Clinton
|
|
3
|
+
# AGPL-3.0 License
|
|
4
|
+
|
|
5
|
+
"""
|
|
6
|
+
Type definitions for Assistant Runtime API responses.
|
|
7
|
+
|
|
8
|
+
Uses TypedDict for better IDE support and documentation.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
from typing import TypedDict, List, Optional, Any
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# =============================================================================
|
|
15
|
+
# Model Types
|
|
16
|
+
# =============================================================================
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class ModelInfo(TypedDict):
|
|
20
|
+
"""Information about an available AI model."""
|
|
21
|
+
|
|
22
|
+
model_id: str
|
|
23
|
+
display_name: str
|
|
24
|
+
provider: str
|
|
25
|
+
tier: str
|
|
26
|
+
multiplier: float
|
|
27
|
+
context_length: Optional[int]
|
|
28
|
+
max_output_tokens: Optional[int]
|
|
29
|
+
is_auto_eligible: Optional[bool]
|
|
30
|
+
fallback_priority: Optional[int]
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class AutoModeInfo(TypedDict):
|
|
34
|
+
"""Auto-mode configuration information."""
|
|
35
|
+
|
|
36
|
+
enabled: bool
|
|
37
|
+
description: str
|
|
38
|
+
model_id: str
|
|
39
|
+
fallback_chain_length: int
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
class ModelsResponse(TypedDict):
|
|
43
|
+
"""Response from list_available_models endpoint."""
|
|
44
|
+
|
|
45
|
+
success: bool
|
|
46
|
+
models: List[ModelInfo]
|
|
47
|
+
max_tier_rank: float
|
|
48
|
+
default_model: Optional[str]
|
|
49
|
+
auto_mode: Optional[AutoModeInfo]
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
# =============================================================================
|
|
53
|
+
# Streaming Types
|
|
54
|
+
# =============================================================================
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
class StreamEvent(TypedDict):
|
|
58
|
+
"""A single SSE event from the streaming API."""
|
|
59
|
+
|
|
60
|
+
event: str
|
|
61
|
+
data: dict
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
class StreamStartData(TypedDict):
|
|
65
|
+
"""Data from stream_start event."""
|
|
66
|
+
|
|
67
|
+
session_id: str
|
|
68
|
+
message_id: str
|
|
69
|
+
timestamp: int
|
|
70
|
+
model_id: Optional[str]
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
class StreamChunkData(TypedDict):
|
|
74
|
+
"""Data from stream_chunk event."""
|
|
75
|
+
|
|
76
|
+
content: str
|
|
77
|
+
chunk_index: Optional[int]
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
class StreamCompleteData(TypedDict):
|
|
81
|
+
"""Data from stream_complete event."""
|
|
82
|
+
|
|
83
|
+
full_response: str
|
|
84
|
+
tokens_used: int
|
|
85
|
+
tokens_actual: int
|
|
86
|
+
model_id: str
|
|
87
|
+
session_id: str
|
|
88
|
+
message_id: str
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
class ModelFallbackData(TypedDict):
|
|
92
|
+
"""Data from model_fallback event (auto-mode)."""
|
|
93
|
+
|
|
94
|
+
original: str
|
|
95
|
+
selected: str
|
|
96
|
+
provider: str
|
|
97
|
+
tier: str
|
|
98
|
+
fallback_attempted: bool
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
class RateLimitedData(TypedDict):
|
|
102
|
+
"""Data from rate_limited event."""
|
|
103
|
+
|
|
104
|
+
error: str
|
|
105
|
+
error_code: str
|
|
106
|
+
retry_after: float
|
|
107
|
+
models_checked: List[str]
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
class ToolCallStartData(TypedDict):
|
|
111
|
+
"""Data from tool_call_start event."""
|
|
112
|
+
|
|
113
|
+
tool_name: str
|
|
114
|
+
tool_id: str
|
|
115
|
+
arguments: dict
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
class ToolCallResultData(TypedDict):
|
|
119
|
+
"""Data from tool_call_result event."""
|
|
120
|
+
|
|
121
|
+
tool_id: str
|
|
122
|
+
tool_name: str
|
|
123
|
+
result: Any
|
|
124
|
+
success: bool
|
|
125
|
+
duration_ms: Optional[int]
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
class ApprovalRequiredData(TypedDict):
|
|
129
|
+
"""Data from approval_required event (HITL)."""
|
|
130
|
+
|
|
131
|
+
tool_name: str
|
|
132
|
+
tool_id: str
|
|
133
|
+
arguments: dict
|
|
134
|
+
reason: Optional[str]
|
|
135
|
+
timeout_seconds: Optional[int]
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
# =============================================================================
|
|
139
|
+
# Conversation Types
|
|
140
|
+
# =============================================================================
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
class ConversationInfo(TypedDict):
|
|
144
|
+
"""Information about a conversation."""
|
|
145
|
+
|
|
146
|
+
conversation_id: str
|
|
147
|
+
title: Optional[str]
|
|
148
|
+
user_id: Optional[str]
|
|
149
|
+
created_at: str
|
|
150
|
+
updated_at: str
|
|
151
|
+
message_count: int
|
|
152
|
+
total_tokens: int
|
|
153
|
+
is_deleted: bool
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
class MessageInfo(TypedDict):
|
|
157
|
+
"""Information about a message."""
|
|
158
|
+
|
|
159
|
+
message_id: str
|
|
160
|
+
conversation_id: str
|
|
161
|
+
role: str
|
|
162
|
+
content: str
|
|
163
|
+
user_id: Optional[str]
|
|
164
|
+
tokens_used: int
|
|
165
|
+
created_at: str
|
|
166
|
+
is_deleted: bool
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
class PaginationInfo(TypedDict):
|
|
170
|
+
"""Pagination information."""
|
|
171
|
+
|
|
172
|
+
total: int
|
|
173
|
+
limit: int
|
|
174
|
+
offset: int
|
|
175
|
+
has_more: bool
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
class ConversationsResponse(TypedDict):
|
|
179
|
+
"""Response from list_conversations endpoint."""
|
|
180
|
+
|
|
181
|
+
conversations: List[ConversationInfo]
|
|
182
|
+
pagination: PaginationInfo
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
class MessagesResponse(TypedDict):
|
|
186
|
+
"""Response from get_messages endpoint."""
|
|
187
|
+
|
|
188
|
+
messages: List[MessageInfo]
|
|
189
|
+
pagination: PaginationInfo
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
# =============================================================================
|
|
193
|
+
# User Types
|
|
194
|
+
# =============================================================================
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
class UserInfo(TypedDict):
|
|
198
|
+
"""Information about a user."""
|
|
199
|
+
|
|
200
|
+
user_id: str
|
|
201
|
+
display_name: Optional[str]
|
|
202
|
+
status: str
|
|
203
|
+
custom_instructions: Optional[str]
|
|
204
|
+
last_activity: Optional[str]
|
|
205
|
+
mcp_server_count: int
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
class MCPServerInfo(TypedDict):
|
|
209
|
+
"""Information about an MCP server."""
|
|
210
|
+
|
|
211
|
+
server_name: str
|
|
212
|
+
endpoint_url: str
|
|
213
|
+
transport_type: str
|
|
214
|
+
auth_type: str
|
|
215
|
+
status: str
|
|
216
|
+
enabled: bool
|
|
217
|
+
last_connected: Optional[str]
|
|
218
|
+
token_expiry: Optional[str]
|
|
219
|
+
error_message: Optional[str]
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
class UserAuthStatus(TypedDict):
|
|
223
|
+
"""User authentication status."""
|
|
224
|
+
|
|
225
|
+
user_exists: bool
|
|
226
|
+
user_status: Optional[str]
|
|
227
|
+
has_mcp_servers: bool
|
|
228
|
+
active_server_count: int
|
|
229
|
+
servers_with_expired_tokens: List[str]
|
|
230
|
+
ready_for_streaming: bool
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
class UserListItem(TypedDict):
|
|
234
|
+
"""User information for list responses."""
|
|
235
|
+
|
|
236
|
+
user_id: str
|
|
237
|
+
display_name: Optional[str]
|
|
238
|
+
status: str
|
|
239
|
+
custom_instructions: Optional[str]
|
|
240
|
+
last_activity: Optional[str]
|
|
241
|
+
created_at: Optional[str]
|
|
242
|
+
mcp_server_count: Optional[int]
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
class UsersListResponse(TypedDict):
|
|
246
|
+
"""Response from list_users endpoint."""
|
|
247
|
+
|
|
248
|
+
users: List[UserListItem]
|
|
249
|
+
pagination: PaginationInfo
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
class UserUpdateResponse(TypedDict):
|
|
253
|
+
"""Response from update_user endpoint."""
|
|
254
|
+
|
|
255
|
+
success: bool
|
|
256
|
+
user_id: str
|
|
257
|
+
message: str
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
class UserDeregisterResponse(TypedDict):
|
|
261
|
+
"""Response from deregister_user endpoint."""
|
|
262
|
+
|
|
263
|
+
success: bool
|
|
264
|
+
user_id: str
|
|
265
|
+
deleted_mcp_servers: int
|
|
266
|
+
message: str
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
class UserLimitStatus(TypedDict):
|
|
270
|
+
"""User limit status for a tenant."""
|
|
271
|
+
|
|
272
|
+
plan: str
|
|
273
|
+
max_users: int
|
|
274
|
+
active_users: int
|
|
275
|
+
remaining: int
|
|
276
|
+
is_unlimited: bool
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
# =============================================================================
|
|
280
|
+
# Billing Types
|
|
281
|
+
# =============================================================================
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
class UsageDashboard(TypedDict):
|
|
285
|
+
"""Usage dashboard data."""
|
|
286
|
+
|
|
287
|
+
plan: str
|
|
288
|
+
status: str
|
|
289
|
+
payment_status: str
|
|
290
|
+
quota: int
|
|
291
|
+
used: int
|
|
292
|
+
remaining: int
|
|
293
|
+
usage_percentage: float
|
|
294
|
+
billing_cycle_start: str
|
|
295
|
+
next_billing_date: Optional[str]
|
|
296
|
+
currency: str
|
|
297
|
+
warnings: dict
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
class UsageHistoryEntry(TypedDict):
|
|
301
|
+
"""Single day's usage history."""
|
|
302
|
+
|
|
303
|
+
date: str
|
|
304
|
+
tokens_used: int
|
|
305
|
+
tokens_actual: int
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
class UsageHistoryResponse(TypedDict):
|
|
309
|
+
"""Response from get_usage_history endpoint."""
|
|
310
|
+
|
|
311
|
+
history: List[UsageHistoryEntry]
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
# =============================================================================
|
|
315
|
+
# Gateway Types
|
|
316
|
+
# =============================================================================
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
class GatewayPlanPricing(TypedDict):
|
|
320
|
+
"""Pricing for a single plan on a gateway."""
|
|
321
|
+
|
|
322
|
+
monthly: Optional[float]
|
|
323
|
+
annual: Optional[float]
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
class PlanPricing(TypedDict):
|
|
327
|
+
"""Gateway-specific plan pricing with currency."""
|
|
328
|
+
|
|
329
|
+
currency: str # "USD" or "INR"
|
|
330
|
+
monthly: Optional[float]
|
|
331
|
+
annual: Optional[float]
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
class PlanPricingByGateway(TypedDict):
|
|
335
|
+
"""Plan pricing organized by gateway."""
|
|
336
|
+
|
|
337
|
+
stripe: PlanPricing
|
|
338
|
+
razorpay: PlanPricing
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
class PlanInfo(TypedDict):
|
|
342
|
+
"""Information about a subscription plan with gateway-specific pricing."""
|
|
343
|
+
|
|
344
|
+
name: str
|
|
345
|
+
quota: int # Monthly token quota (-1 for unlimited)
|
|
346
|
+
max_tier_rank: float
|
|
347
|
+
max_users: int # -1 for unlimited
|
|
348
|
+
features: List[str]
|
|
349
|
+
pricing: PlanPricingByGateway
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
class PlanComparisonResponse(TypedDict):
|
|
353
|
+
"""Response from get_plan_comparison endpoint."""
|
|
354
|
+
|
|
355
|
+
plans: List[PlanInfo]
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
class AvailablePlanInfo(TypedDict):
|
|
359
|
+
"""Plan information for upgrade/downgrade options."""
|
|
360
|
+
|
|
361
|
+
name: str
|
|
362
|
+
action: str # "current", "upgrade", or "downgrade"
|
|
363
|
+
quota: int
|
|
364
|
+
max_tier_rank: float
|
|
365
|
+
max_users: int
|
|
366
|
+
features: List[str]
|
|
367
|
+
pricing: PlanPricingByGateway
|
|
368
|
+
|
|
369
|
+
|
|
370
|
+
class GatewayInfo(TypedDict):
|
|
371
|
+
"""Information about a payment gateway."""
|
|
372
|
+
|
|
373
|
+
name: str # "stripe" or "razorpay"
|
|
374
|
+
display_name: str
|
|
375
|
+
currency: str # "USD" or "INR"
|
|
376
|
+
currency_symbol: str # "$" or "₹"
|
|
377
|
+
description: str
|
|
378
|
+
is_recommended: bool
|
|
379
|
+
plans: dict # Plan name -> GatewayPlanPricing
|
|
380
|
+
|
|
381
|
+
|
|
382
|
+
class AvailableGatewaysResponse(TypedDict):
|
|
383
|
+
"""Response from get_available_gateways endpoint."""
|
|
384
|
+
|
|
385
|
+
gateways: List[GatewayInfo]
|
|
386
|
+
recommended_gateway: Optional[str]
|
|
387
|
+
tenant_country: str
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
class CheckoutResponse(TypedDict):
|
|
391
|
+
"""Response from initiate_checkout endpoint."""
|
|
392
|
+
|
|
393
|
+
checkout_url: str
|
|
394
|
+
session_id: str
|
|
395
|
+
gateway: str # "stripe" or "razorpay"
|
|
396
|
+
|
|
397
|
+
|
|
398
|
+
class UpgradePlanResponse(TypedDict):
|
|
399
|
+
"""Response from upgrade_plan endpoint."""
|
|
400
|
+
|
|
401
|
+
success: bool
|
|
402
|
+
checkout_url: Optional[str]
|
|
403
|
+
message: str
|
|
404
|
+
|
|
405
|
+
|
|
406
|
+
# =============================================================================
|
|
407
|
+
# Tenant Types
|
|
408
|
+
# =============================================================================
|
|
409
|
+
|
|
410
|
+
|
|
411
|
+
class TenantInfo(TypedDict):
|
|
412
|
+
"""Tenant information."""
|
|
413
|
+
|
|
414
|
+
tenant_id: str
|
|
415
|
+
site_url: str
|
|
416
|
+
status: str
|
|
417
|
+
subscription: dict
|
|
418
|
+
terms_accepted: bool
|
|
419
|
+
terms_version: Optional[str]
|
|
420
|
+
|
|
421
|
+
|
|
422
|
+
class TermsInfo(TypedDict):
|
|
423
|
+
"""Terms and conditions information."""
|
|
424
|
+
|
|
425
|
+
version: str
|
|
426
|
+
effective_date: str
|
|
427
|
+
terms_of_service: str
|
|
428
|
+
privacy_policy: str
|
|
429
|
+
data_processing_agreement: str
|
|
430
|
+
summary: str
|
|
431
|
+
grace_period_days: int
|
|
432
|
+
|
|
433
|
+
|
|
434
|
+
# =============================================================================
|
|
435
|
+
# Prompt Types
|
|
436
|
+
# =============================================================================
|
|
437
|
+
|
|
438
|
+
|
|
439
|
+
class PromptArgument(TypedDict):
|
|
440
|
+
"""Prompt template argument definition."""
|
|
441
|
+
|
|
442
|
+
name: str
|
|
443
|
+
description: Optional[str]
|
|
444
|
+
required: bool
|
|
445
|
+
|
|
446
|
+
|
|
447
|
+
class PromptInfo(TypedDict):
|
|
448
|
+
"""Information about a prompt template."""
|
|
449
|
+
|
|
450
|
+
name: str
|
|
451
|
+
title: Optional[str]
|
|
452
|
+
description: Optional[str]
|
|
453
|
+
arguments: List[PromptArgument]
|
|
454
|
+
server: str
|
|
455
|
+
|
|
456
|
+
|
|
457
|
+
class PromptsResponse(TypedDict):
|
|
458
|
+
"""Response from list_prompts endpoint."""
|
|
459
|
+
|
|
460
|
+
prompts: List[PromptInfo]
|
|
461
|
+
servers_queried: List[str]
|
|
462
|
+
errors: List[str]
|
|
463
|
+
|
|
464
|
+
|
|
465
|
+
# =============================================================================
|
|
466
|
+
# Document Types
|
|
467
|
+
# =============================================================================
|
|
468
|
+
|
|
469
|
+
|
|
470
|
+
class DocumentInfo(TypedDict):
|
|
471
|
+
"""Summary info for a RAG document."""
|
|
472
|
+
|
|
473
|
+
document_id: str
|
|
474
|
+
file_name: str
|
|
475
|
+
file_size_mb: float
|
|
476
|
+
document_type: str
|
|
477
|
+
embedding_status: str
|
|
478
|
+
total_chunks: int
|
|
479
|
+
created_at: Optional[str]
|
|
480
|
+
processed_at: Optional[str]
|
|
481
|
+
visibility: str
|
|
482
|
+
uploaded_by: str
|
|
483
|
+
is_owner: bool
|
|
484
|
+
|
|
485
|
+
|
|
486
|
+
class DocumentDetailInfo(TypedDict):
|
|
487
|
+
"""Detailed info including processing errors."""
|
|
488
|
+
|
|
489
|
+
document_id: str
|
|
490
|
+
file_name: str
|
|
491
|
+
file_size_mb: float
|
|
492
|
+
document_type: str
|
|
493
|
+
embedding_status: str
|
|
494
|
+
total_chunks: int
|
|
495
|
+
created_at: Optional[str]
|
|
496
|
+
processed_at: Optional[str]
|
|
497
|
+
processing_error: Optional[str]
|
|
498
|
+
visibility: str
|
|
499
|
+
uploaded_by: str
|
|
500
|
+
shared_with: Optional[List[dict]]
|
|
501
|
+
|
|
502
|
+
|
|
503
|
+
class DocumentUploadResponse(TypedDict):
|
|
504
|
+
"""Response from upload_document."""
|
|
505
|
+
|
|
506
|
+
status: str
|
|
507
|
+
document_id: str
|
|
508
|
+
file_name: str
|
|
509
|
+
file_size_mb: float
|
|
510
|
+
visibility: str
|
|
511
|
+
message: str
|
|
512
|
+
|
|
513
|
+
|
|
514
|
+
class DocumentAccessUpdateResponse(TypedDict):
|
|
515
|
+
"""Response from update_document_access."""
|
|
516
|
+
|
|
517
|
+
status: str
|
|
518
|
+
document_id: str
|
|
519
|
+
visibility: str
|
|
520
|
+
shared_with: List[str]
|
|
521
|
+
|
|
522
|
+
|
|
523
|
+
class DocumentDeleteResponse(TypedDict):
|
|
524
|
+
"""Response from delete_document."""
|
|
525
|
+
|
|
526
|
+
status: str
|
|
527
|
+
document_id: str
|
|
528
|
+
file_size_mb: float
|
|
529
|
+
|
|
530
|
+
|
|
531
|
+
class StorageInfo(TypedDict):
|
|
532
|
+
"""Storage quota and usage stats."""
|
|
533
|
+
|
|
534
|
+
quota_mb: float # -1 for unlimited
|
|
535
|
+
used_mb: float
|
|
536
|
+
available_mb: float # -1 if unlimited
|
|
537
|
+
usage_percentage: float
|
|
538
|
+
document_count: int
|
|
539
|
+
|
|
540
|
+
|
|
541
|
+
class DocumentsListResponse(TypedDict):
|
|
542
|
+
"""Response from list_documents."""
|
|
543
|
+
|
|
544
|
+
documents: List[DocumentInfo]
|
|
545
|
+
pagination: PaginationInfo
|
|
546
|
+
storage: StorageInfo
|