assistant-runtime-sdk 1.12.1__tar.gz → 1.13.0__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: assistant_runtime_sdk
3
- Version: 1.12.1
3
+ Version: 1.13.0
4
4
  Summary: Python SDK for FAC Cloud - the Assistant Runtime AI assistant backend
5
5
  Keywords: frappe,ai,assistant,llm,mcp,anthropic,openai,streaming
6
6
  Author: Paul Clinton
@@ -53,7 +53,7 @@ Standalone Functions:
53
53
 
54
54
  """
55
55
 
56
- __version__ = "1.12.1"
56
+ __version__ = "1.13.0"
57
57
  __author__ = "Paul Clinton"
58
58
  __license__ = "AGPL-3.0"
59
59
 
@@ -385,11 +385,18 @@ class AsyncAssistantRuntimeClient(BaseAssistantRuntimeClient):
385
385
  web_search: Optional[bool] = None,
386
386
  thinking_enabled: Optional[bool] = None,
387
387
  reasoning_effort: Optional[str] = None,
388
+ confirm_low_balance: Optional[bool] = None,
389
+ low_balance_preview: bool = True,
388
390
  ) -> AsyncGenerator[Dict[str, Any], None]:
389
391
  """Async version of AssistantRuntimeClient.stream_chat.
390
392
 
391
393
  On ``stream_complete``, ``event['session_state']`` is the updated signed
392
394
  blob — store it and pass it as ``session_state`` on the next turn.
395
+
396
+ ``confirm_low_balance`` proceeds after the user acknowledged a low-balance
397
+ warning (sent as ``1``; omitted otherwise). ``low_balance_preview`` declares
398
+ that this client can show the low-balance "Send anyway" preview (sent as
399
+ ``1`` by default); pass False only for a client that cannot.
393
400
  """
394
401
  session = self._ensure_session()
395
402
  payload = self._prepare_stream_payload(
@@ -402,6 +409,8 @@ class AsyncAssistantRuntimeClient(BaseAssistantRuntimeClient):
402
409
  web_search=web_search,
403
410
  thinking_enabled=thinking_enabled,
404
411
  reasoning_effort=reasoning_effort,
412
+ confirm_low_balance=confirm_low_balance,
413
+ low_balance_preview=low_balance_preview,
405
414
  )
406
415
  url = self._build_endpoint_url("streaming.stream_chat")
407
416
  payload = self._with_site_url(payload)
@@ -317,6 +317,8 @@ class BaseAssistantRuntimeClient:
317
317
  web_search: Optional[bool] = None,
318
318
  thinking_enabled: Optional[bool] = None,
319
319
  reasoning_effort: Optional[str] = None,
320
+ confirm_low_balance: Optional[bool] = None,
321
+ low_balance_preview: bool = True,
320
322
  ) -> Dict[str, Any]:
321
323
  """
322
324
  Prepare JSON payload for stream_chat POST request.
@@ -350,6 +352,11 @@ class BaseAssistantRuntimeClient:
350
352
  thinking_enabled: Optional explicit extended-thinking toggle for this turn
351
353
  reasoning_effort: Optional thinking level for this turn — "off", "low", "medium",
352
354
  "high", "xhigh" or "max"
355
+ confirm_low_balance: Set True to proceed with this turn after the user
356
+ acknowledged a low-balance warning (sent as ``1``; omitted otherwise)
357
+ low_balance_preview: Declares that this client can show the low-balance
358
+ "Send anyway" preview (sent as ``1`` by default). Pass False only for
359
+ a client that cannot, so the server does not refuse the turn.
353
360
 
354
361
  Returns:
355
362
  Payload dict ready for JSON body
@@ -406,6 +413,12 @@ class BaseAssistantRuntimeClient:
406
413
  if reasoning_effort is not None:
407
414
  payload["reasoning_effort"] = str(reasoning_effort).strip().lower()
408
415
 
416
+ if confirm_low_balance:
417
+ payload["confirm_low_balance"] = 1
418
+
419
+ if low_balance_preview:
420
+ payload["low_balance_preview"] = 1
421
+
409
422
  return payload
410
423
 
411
424
  def _prepare_resource_params(
@@ -330,6 +330,8 @@ class AssistantRuntimeClient(BaseAssistantRuntimeClient):
330
330
  web_search: Optional[bool] = None,
331
331
  thinking_enabled: Optional[bool] = None,
332
332
  reasoning_effort: Optional[str] = None,
333
+ confirm_low_balance: Optional[bool] = None,
334
+ low_balance_preview: bool = True,
333
335
  ) -> Generator[Dict[str, Any], None, None]:
334
336
  """
335
337
  Stream chat response from Assistant Runtime.
@@ -365,6 +367,11 @@ class AssistantRuntimeClient(BaseAssistantRuntimeClient):
365
367
  reasoning_effort: Optional thinking level for this turn — "off", "low", "medium",
366
368
  "high", "xhigh" or "max". Servers that predate it ignore it, so callers
367
369
  should also send thinking_enabled.
370
+ confirm_low_balance: Set True to proceed after the user acknowledged a
371
+ low-balance warning (sent as ``1``; omitted otherwise)
372
+ low_balance_preview: Declares that this client can show the low-balance
373
+ "Send anyway" preview (sent as ``1`` by default). Pass False only for
374
+ a client that cannot, so the server does not refuse the turn.
368
375
 
369
376
  Yields:
370
377
  Parsed SSE events with structure:
@@ -395,6 +402,8 @@ class AssistantRuntimeClient(BaseAssistantRuntimeClient):
395
402
  web_search=web_search,
396
403
  thinking_enabled=thinking_enabled,
397
404
  reasoning_effort=reasoning_effort,
405
+ confirm_low_balance=confirm_low_balance,
406
+ low_balance_preview=low_balance_preview,
398
407
  )
399
408
  url = self._build_endpoint_url("streaming.stream_chat")
400
409
  payload = self._with_site_url(payload)
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "assistant_runtime_sdk"
3
- version = "1.12.1"
3
+ version = "1.13.0"
4
4
  description = "Python SDK for FAC Cloud - the Assistant Runtime AI assistant backend"
5
5
  readme = "README.md"
6
6
  license = {text = "AGPL-3.0"}