assistant-runtime-sdk 1.6.0__tar.gz → 1.7.1__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.6.0
3
+ Version: 1.7.1
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.6.0"
56
+ __version__ = "1.7.1"
57
57
  __author__ = "Paul Clinton"
58
58
  __license__ = "AGPL-3.0"
59
59
 
@@ -826,6 +826,14 @@ class AsyncAssistantRuntimeClient(BaseAssistantRuntimeClient):
826
826
  user_id, preference_id, status)
827
827
  return await self._request_post_json(endpoint, payload)
828
828
 
829
+ async def set_routing_preference_mode(
830
+ self, user_id: str, preference_id: str, rule_mode: str,
831
+ ) -> Optional[Dict[str, Any]]:
832
+ """Async version of AssistantRuntimeClient.set_routing_preference_mode."""
833
+ endpoint, payload = self._prepare_set_routing_preference_mode(
834
+ user_id, preference_id, rule_mode)
835
+ return await self._request_post_json(endpoint, payload)
836
+
829
837
  async def delete_routing_preference(
830
838
  self, user_id: str, preference_id: str,
831
839
  ) -> Optional[Dict[str, Any]]:
@@ -1737,6 +1745,18 @@ class AsyncAssistantRuntimeClient(BaseAssistantRuntimeClient):
1737
1745
  user_id, rating, comment, category, conversation_id, environment)
1738
1746
  return await self._request_post_json(endpoint, payload)
1739
1747
 
1748
+ async def download_ticket_attachment(self, user_id: str, ticket_id: str,
1749
+ file_url: str) -> tuple:
1750
+ """Download one attachment from a ticket the user owns.
1751
+
1752
+ Returns:
1753
+ (content_bytes, content_type, filename) tuple.
1754
+ """
1755
+ endpoint, params = self._prepare_download_ticket_attachment(
1756
+ user_id, ticket_id, file_url
1757
+ )
1758
+ return await self._request_get_raw(endpoint, params)
1759
+
1740
1760
  async def list_tickets(self, user_id: str, status: Optional[str] = None) -> Optional[Dict[str, Any]]:
1741
1761
  """List the user's support tickets. Returns {tickets: [...]}."""
1742
1762
  endpoint, payload = self._prepare_list_tickets(user_id, status)
@@ -883,6 +883,16 @@ class BaseAssistantRuntimeClient:
883
883
  "status": status,
884
884
  }
885
885
 
886
+ def _prepare_set_routing_preference_mode(
887
+ self, user_id: str, preference_id: str, rule_mode: str,
888
+ ) -> tuple:
889
+ return "routing_preferences.set_routing_preference_mode", {
890
+ "tenant_id": self.tenant_id,
891
+ "user_id": user_id,
892
+ "preference_id": preference_id,
893
+ "rule_mode": rule_mode,
894
+ }
895
+
886
896
  def _prepare_delete_routing_preference(
887
897
  self, user_id: str, preference_id: str,
888
898
  ) -> tuple:
@@ -1924,6 +1934,16 @@ class BaseAssistantRuntimeClient:
1924
1934
  "ticket_id": ticket_id,
1925
1935
  }
1926
1936
 
1937
+ def _prepare_download_ticket_attachment(self, user_id: str, ticket_id: str,
1938
+ file_url: str) -> tuple:
1939
+ """Returns (endpoint, params)."""
1940
+ return "support.download_ticket_attachment", {
1941
+ "tenant_id": self.tenant_id,
1942
+ "user_id": user_id,
1943
+ "ticket_id": ticket_id,
1944
+ "file_url": file_url,
1945
+ }
1946
+
1927
1947
  def _prepare_reply_to_ticket(self, user_id: str, ticket_id: str, message: str,
1928
1948
  attachment_ids: Optional[List[str]] = None) -> tuple:
1929
1949
  """Returns (endpoint, payload)."""
@@ -1189,6 +1189,28 @@ class AssistantRuntimeClient(BaseAssistantRuntimeClient):
1189
1189
  user_id, preference_id, status)
1190
1190
  return self._request_post_json(endpoint, payload)
1191
1191
 
1192
+ def set_routing_preference_mode(
1193
+ self, user_id: str, preference_id: str, rule_mode: str,
1194
+ ) -> Optional[Dict[str, Any]]:
1195
+ """Finish a rule's trial, or send it back to one.
1196
+
1197
+ Every rule carries its own mode, so this changes nothing about any
1198
+ other rule. Platform defaults are not reachable here — they are
1199
+ managed in AR Admin.
1200
+
1201
+ Args:
1202
+ user_id: User identifier
1203
+ preference_id: the rule
1204
+ rule_mode: "shadow" (matched and recorded, never applied) or
1205
+ "on" (applied)
1206
+
1207
+ Returns:
1208
+ {"preference_id": ..., "rule_mode": ...}
1209
+ """
1210
+ endpoint, payload = self._prepare_set_routing_preference_mode(
1211
+ user_id, preference_id, rule_mode)
1212
+ return self._request_post_json(endpoint, payload)
1213
+
1192
1214
  def delete_routing_preference(
1193
1215
  self, user_id: str, preference_id: str,
1194
1216
  ) -> Optional[Dict[str, Any]]:
@@ -2593,6 +2615,21 @@ class AssistantRuntimeClient(BaseAssistantRuntimeClient):
2593
2615
  user_id, rating, comment, category, conversation_id, environment)
2594
2616
  return self._request_post_json(endpoint, payload)
2595
2617
 
2618
+ def download_ticket_attachment(self, user_id: str, ticket_id: str,
2619
+ file_url: str) -> tuple:
2620
+ """Download one attachment from a ticket the user owns.
2621
+
2622
+ Raw bytes rather than JSON, so a 10 MB screenshot doesn't get
2623
+ base64-inflated through two hops.
2624
+
2625
+ Returns:
2626
+ (content_bytes, content_type, filename) tuple.
2627
+ """
2628
+ endpoint, params = self._prepare_download_ticket_attachment(
2629
+ user_id, ticket_id, file_url
2630
+ )
2631
+ return self._request_get_raw(endpoint, params)
2632
+
2596
2633
  def list_tickets(self, user_id: str, status: Optional[str] = None) -> Optional[Dict[str, Any]]:
2597
2634
  """List the user's support tickets. Returns {tickets: [...]}."""
2598
2635
  endpoint, payload = self._prepare_list_tickets(user_id, status)
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "assistant_runtime_sdk"
3
- version = "1.6.0"
3
+ version = "1.7.1"
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"}