phenoml 0.0.6__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.
Files changed (244) hide show
  1. phenoml/__init__.py +30 -0
  2. phenoml/agent/__init__.py +56 -0
  3. phenoml/agent/client.py +939 -0
  4. phenoml/agent/errors/__init__.py +11 -0
  5. phenoml/agent/errors/bad_request_error.py +10 -0
  6. phenoml/agent/errors/forbidden_error.py +10 -0
  7. phenoml/agent/errors/internal_server_error.py +10 -0
  8. phenoml/agent/errors/not_found_error.py +10 -0
  9. phenoml/agent/errors/unauthorized_error.py +10 -0
  10. phenoml/agent/prompts/__init__.py +7 -0
  11. phenoml/agent/prompts/client.py +707 -0
  12. phenoml/agent/prompts/raw_client.py +1345 -0
  13. phenoml/agent/prompts/types/__init__.py +8 -0
  14. phenoml/agent/prompts/types/prompts_delete_response.py +20 -0
  15. phenoml/agent/prompts/types/prompts_list_response.py +22 -0
  16. phenoml/agent/raw_client.py +1668 -0
  17. phenoml/agent/types/__init__.py +43 -0
  18. phenoml/agent/types/agent_chat_response.py +33 -0
  19. phenoml/agent/types/agent_create_request.py +53 -0
  20. phenoml/agent/types/agent_create_request_provider.py +5 -0
  21. phenoml/agent/types/agent_delete_response.py +20 -0
  22. phenoml/agent/types/agent_get_chat_messages_request_order.py +5 -0
  23. phenoml/agent/types/agent_get_chat_messages_response.py +22 -0
  24. phenoml/agent/types/agent_list_response.py +22 -0
  25. phenoml/agent/types/agent_prompts_response.py +22 -0
  26. phenoml/agent/types/agent_response.py +22 -0
  27. phenoml/agent/types/agent_template.py +58 -0
  28. phenoml/agent/types/agent_template_provider.py +5 -0
  29. phenoml/agent/types/chat_message_template.py +72 -0
  30. phenoml/agent/types/chat_session_template.py +67 -0
  31. phenoml/agent/types/json_patch.py +7 -0
  32. phenoml/agent/types/json_patch_operation.py +40 -0
  33. phenoml/agent/types/json_patch_operation_op.py +5 -0
  34. phenoml/agent/types/prompt_template.py +52 -0
  35. phenoml/agent/types/success_response.py +20 -0
  36. phenoml/authtoken/__init__.py +17 -0
  37. phenoml/authtoken/auth/__init__.py +7 -0
  38. phenoml/authtoken/auth/client.py +129 -0
  39. phenoml/authtoken/auth/raw_client.py +173 -0
  40. phenoml/authtoken/auth/types/__init__.py +7 -0
  41. phenoml/authtoken/auth/types/auth_generate_token_response.py +22 -0
  42. phenoml/authtoken/client.py +39 -0
  43. phenoml/authtoken/errors/__init__.py +8 -0
  44. phenoml/authtoken/errors/bad_request_error.py +10 -0
  45. phenoml/authtoken/errors/unauthorized_error.py +10 -0
  46. phenoml/authtoken/raw_client.py +13 -0
  47. phenoml/authtoken/types/__init__.py +8 -0
  48. phenoml/authtoken/types/bad_request_error_body.py +21 -0
  49. phenoml/authtoken/types/unauthorized_error_body.py +21 -0
  50. phenoml/client.py +177 -0
  51. phenoml/cohort/__init__.py +8 -0
  52. phenoml/cohort/client.py +113 -0
  53. phenoml/cohort/errors/__init__.py +9 -0
  54. phenoml/cohort/errors/bad_request_error.py +10 -0
  55. phenoml/cohort/errors/internal_server_error.py +10 -0
  56. phenoml/cohort/errors/unauthorized_error.py +10 -0
  57. phenoml/cohort/raw_client.py +185 -0
  58. phenoml/cohort/types/__init__.py +8 -0
  59. phenoml/cohort/types/cohort_response.py +33 -0
  60. phenoml/cohort/types/search_concept.py +37 -0
  61. phenoml/construe/__init__.py +45 -0
  62. phenoml/construe/client.py +399 -0
  63. phenoml/construe/errors/__init__.py +11 -0
  64. phenoml/construe/errors/bad_request_error.py +10 -0
  65. phenoml/construe/errors/conflict_error.py +10 -0
  66. phenoml/construe/errors/failed_dependency_error.py +10 -0
  67. phenoml/construe/errors/internal_server_error.py +10 -0
  68. phenoml/construe/errors/unauthorized_error.py +10 -0
  69. phenoml/construe/raw_client.py +706 -0
  70. phenoml/construe/types/__init__.py +41 -0
  71. phenoml/construe/types/bad_request_error_body.py +27 -0
  72. phenoml/construe/types/construe_cohort_request_config.py +37 -0
  73. phenoml/construe/types/construe_cohort_response.py +33 -0
  74. phenoml/construe/types/construe_cohort_response_queries_item.py +49 -0
  75. phenoml/construe/types/construe_cohort_response_queries_item_code_extract_results_item.py +31 -0
  76. phenoml/construe/types/construe_cohort_response_queries_item_code_extract_results_item_codes_item.py +32 -0
  77. phenoml/construe/types/construe_upload_code_system_response.py +19 -0
  78. phenoml/construe/types/extract_codes_result.py +22 -0
  79. phenoml/construe/types/extract_request_config.py +23 -0
  80. phenoml/construe/types/extract_request_config_chunking_method.py +5 -0
  81. phenoml/construe/types/extract_request_system.py +37 -0
  82. phenoml/construe/types/extracted_code_result.py +41 -0
  83. phenoml/construe/types/internal_server_error_body.py +27 -0
  84. phenoml/construe/types/unauthorized_error_body.py +27 -0
  85. phenoml/construe/types/upload_request_format.py +5 -0
  86. phenoml/core/__init__.py +52 -0
  87. phenoml/core/api_error.py +23 -0
  88. phenoml/core/client_wrapper.py +87 -0
  89. phenoml/core/datetime_utils.py +28 -0
  90. phenoml/core/file.py +67 -0
  91. phenoml/core/force_multipart.py +16 -0
  92. phenoml/core/http_client.py +543 -0
  93. phenoml/core/http_response.py +55 -0
  94. phenoml/core/jsonable_encoder.py +100 -0
  95. phenoml/core/pydantic_utilities.py +255 -0
  96. phenoml/core/query_encoder.py +58 -0
  97. phenoml/core/remove_none_from_dict.py +11 -0
  98. phenoml/core/request_options.py +35 -0
  99. phenoml/core/serialization.py +276 -0
  100. phenoml/environment.py +7 -0
  101. phenoml/fhir/__init__.py +36 -0
  102. phenoml/fhir/client.py +970 -0
  103. phenoml/fhir/errors/__init__.py +10 -0
  104. phenoml/fhir/errors/bad_request_error.py +10 -0
  105. phenoml/fhir/errors/internal_server_error.py +10 -0
  106. phenoml/fhir/errors/not_found_error.py +10 -0
  107. phenoml/fhir/errors/unauthorized_error.py +10 -0
  108. phenoml/fhir/raw_client.py +1385 -0
  109. phenoml/fhir/types/__init__.py +29 -0
  110. phenoml/fhir/types/error_response.py +36 -0
  111. phenoml/fhir/types/fhir_bundle.py +43 -0
  112. phenoml/fhir/types/fhir_bundle_entry_item.py +34 -0
  113. phenoml/fhir/types/fhir_bundle_entry_item_request.py +25 -0
  114. phenoml/fhir/types/fhir_bundle_entry_item_request_method.py +5 -0
  115. phenoml/fhir/types/fhir_bundle_entry_item_response.py +24 -0
  116. phenoml/fhir/types/fhir_patch_request_body_item.py +40 -0
  117. phenoml/fhir/types/fhir_patch_request_body_item_op.py +7 -0
  118. phenoml/fhir/types/fhir_resource.py +40 -0
  119. phenoml/fhir/types/fhir_resource_meta.py +28 -0
  120. phenoml/fhir/types/fhir_search_response.py +8 -0
  121. phenoml/fhir_provider/__init__.py +43 -0
  122. phenoml/fhir_provider/client.py +731 -0
  123. phenoml/fhir_provider/errors/__init__.py +11 -0
  124. phenoml/fhir_provider/errors/bad_request_error.py +10 -0
  125. phenoml/fhir_provider/errors/forbidden_error.py +10 -0
  126. phenoml/fhir_provider/errors/internal_server_error.py +10 -0
  127. phenoml/fhir_provider/errors/not_found_error.py +10 -0
  128. phenoml/fhir_provider/errors/unauthorized_error.py +10 -0
  129. phenoml/fhir_provider/raw_client.py +1445 -0
  130. phenoml/fhir_provider/types/__init__.py +35 -0
  131. phenoml/fhir_provider/types/auth_method.py +7 -0
  132. phenoml/fhir_provider/types/fhir_provider_auth_config.py +53 -0
  133. phenoml/fhir_provider/types/fhir_provider_delete_response.py +20 -0
  134. phenoml/fhir_provider/types/fhir_provider_list_response.py +22 -0
  135. phenoml/fhir_provider/types/fhir_provider_remove_auth_config_response.py +22 -0
  136. phenoml/fhir_provider/types/fhir_provider_response.py +22 -0
  137. phenoml/fhir_provider/types/fhir_provider_set_active_auth_config_response.py +22 -0
  138. phenoml/fhir_provider/types/fhir_provider_template.py +66 -0
  139. phenoml/fhir_provider/types/fhir_query_response.py +27 -0
  140. phenoml/fhir_provider/types/fhir_query_response_data.py +5 -0
  141. phenoml/fhir_provider/types/json_web_key.py +51 -0
  142. phenoml/fhir_provider/types/provider.py +8 -0
  143. phenoml/fhir_provider/types/service_account_key.py +35 -0
  144. phenoml/fhir_provider/types/smart_configuration.py +46 -0
  145. phenoml/lang2fhir/__init__.py +27 -0
  146. phenoml/lang2fhir/client.py +430 -0
  147. phenoml/lang2fhir/errors/__init__.py +11 -0
  148. phenoml/lang2fhir/errors/bad_request_error.py +10 -0
  149. phenoml/lang2fhir/errors/failed_dependency_error.py +10 -0
  150. phenoml/lang2fhir/errors/forbidden_error.py +10 -0
  151. phenoml/lang2fhir/errors/internal_server_error.py +10 -0
  152. phenoml/lang2fhir/errors/unauthorized_error.py +10 -0
  153. phenoml/lang2fhir/raw_client.py +788 -0
  154. phenoml/lang2fhir/types/__init__.py +19 -0
  155. phenoml/lang2fhir/types/create_request_resource.py +25 -0
  156. phenoml/lang2fhir/types/document_request_file_type.py +7 -0
  157. phenoml/lang2fhir/types/document_request_resource.py +5 -0
  158. phenoml/lang2fhir/types/fhir_resource.py +5 -0
  159. phenoml/lang2fhir/types/lang2fhir_upload_profile_response.py +23 -0
  160. phenoml/lang2fhir/types/search_response.py +33 -0
  161. phenoml/py.typed +0 -0
  162. phenoml/tools/__init__.py +37 -0
  163. phenoml/tools/client.py +359 -0
  164. phenoml/tools/errors/__init__.py +11 -0
  165. phenoml/tools/errors/bad_request_error.py +10 -0
  166. phenoml/tools/errors/failed_dependency_error.py +10 -0
  167. phenoml/tools/errors/forbidden_error.py +10 -0
  168. phenoml/tools/errors/internal_server_error.py +10 -0
  169. phenoml/tools/errors/unauthorized_error.py +10 -0
  170. phenoml/tools/mcp_server/__init__.py +7 -0
  171. phenoml/tools/mcp_server/client.py +336 -0
  172. phenoml/tools/mcp_server/raw_client.py +641 -0
  173. phenoml/tools/mcp_server/tools/__init__.py +4 -0
  174. phenoml/tools/mcp_server/tools/client.py +358 -0
  175. phenoml/tools/mcp_server/tools/raw_client.py +656 -0
  176. phenoml/tools/raw_client.py +696 -0
  177. phenoml/tools/types/__init__.py +27 -0
  178. phenoml/tools/types/cohort_response.py +49 -0
  179. phenoml/tools/types/lang2fhir_and_create_request_resource.py +25 -0
  180. phenoml/tools/types/lang2fhir_and_create_response.py +33 -0
  181. phenoml/tools/types/lang2fhir_and_search_response.py +40 -0
  182. phenoml/tools/types/mcp_server_response.py +33 -0
  183. phenoml/tools/types/mcp_server_response_data.py +51 -0
  184. phenoml/tools/types/mcp_server_tool_call_response.py +37 -0
  185. phenoml/tools/types/mcp_server_tool_response.py +33 -0
  186. phenoml/tools/types/mcp_server_tool_response_data.py +61 -0
  187. phenoml/tools/types/search_concept.py +41 -0
  188. phenoml/types/__init__.py +21 -0
  189. phenoml/types/cohort_response.py +5 -0
  190. phenoml/types/lang2fhir_and_create_response.py +5 -0
  191. phenoml/types/lang2fhir_and_search_response.py +5 -0
  192. phenoml/types/mcp_server_response.py +5 -0
  193. phenoml/types/mcp_server_tool_call_response.py +5 -0
  194. phenoml/types/mcp_server_tool_response.py +5 -0
  195. phenoml/types/search_concept.py +5 -0
  196. phenoml/version.py +3 -0
  197. phenoml/workflows/__init__.py +66 -0
  198. phenoml/workflows/client.py +210 -0
  199. phenoml/workflows/errors/__init__.py +11 -0
  200. phenoml/workflows/errors/bad_request_error.py +10 -0
  201. phenoml/workflows/errors/forbidden_error.py +10 -0
  202. phenoml/workflows/errors/internal_server_error.py +10 -0
  203. phenoml/workflows/errors/not_found_error.py +10 -0
  204. phenoml/workflows/errors/unauthorized_error.py +10 -0
  205. phenoml/workflows/mcp_server/__init__.py +7 -0
  206. phenoml/workflows/mcp_server/client.py +274 -0
  207. phenoml/workflows/mcp_server/raw_client.py +226 -0
  208. phenoml/workflows/mcp_server/tools/__init__.py +4 -0
  209. phenoml/workflows/mcp_server/tools/client.py +287 -0
  210. phenoml/workflows/mcp_server/tools/raw_client.py +244 -0
  211. phenoml/workflows/raw_client.py +169 -0
  212. phenoml/workflows/types/__init__.py +43 -0
  213. phenoml/workflows/types/create_workflow_response.py +44 -0
  214. phenoml/workflows/types/decision_node_definition.py +32 -0
  215. phenoml/workflows/types/execute_workflow_response.py +30 -0
  216. phenoml/workflows/types/execute_workflow_response_results.py +22 -0
  217. phenoml/workflows/types/lang2fhir_create_definition.py +37 -0
  218. phenoml/workflows/types/lang2fhir_search_definition.py +42 -0
  219. phenoml/workflows/types/list_workflows_response.py +39 -0
  220. phenoml/workflows/types/step_operation.py +26 -0
  221. phenoml/workflows/types/sub_workflow_definition.py +32 -0
  222. phenoml/workflows/types/workflow_config.py +27 -0
  223. phenoml/workflows/types/workflow_definition.py +57 -0
  224. phenoml/workflows/types/workflow_graph.py +23 -0
  225. phenoml/workflows/types/workflow_response.py +61 -0
  226. phenoml/workflows/types/workflow_response_graph.py +23 -0
  227. phenoml/workflows/types/workflow_step.py +55 -0
  228. phenoml/workflows/types/workflow_step_summary.py +47 -0
  229. phenoml/workflows/types/workflow_step_summary_type.py +5 -0
  230. phenoml/workflows/types/workflow_step_type.py +5 -0
  231. phenoml/workflows/workflows/__init__.py +19 -0
  232. phenoml/workflows/workflows/client.py +694 -0
  233. phenoml/workflows/workflows/raw_client.py +1266 -0
  234. phenoml/workflows/workflows/types/__init__.py +17 -0
  235. phenoml/workflows/workflows/types/create_workflow_request_fhir_provider_id.py +5 -0
  236. phenoml/workflows/workflows/types/update_workflow_request_fhir_provider_id.py +5 -0
  237. phenoml/workflows/workflows/types/workflows_delete_response.py +20 -0
  238. phenoml/workflows/workflows/types/workflows_get_response.py +26 -0
  239. phenoml/workflows/workflows/types/workflows_update_response.py +31 -0
  240. phenoml/wrapper_client.py +123 -0
  241. phenoml-0.0.6.dist-info/LICENSE +21 -0
  242. phenoml-0.0.6.dist-info/METADATA +192 -0
  243. phenoml-0.0.6.dist-info/RECORD +244 -0
  244. phenoml-0.0.6.dist-info/WHEEL +4 -0
@@ -0,0 +1,1345 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+ from json.decoder import JSONDecodeError
5
+
6
+ from ...core.api_error import ApiError
7
+ from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
8
+ from ...core.http_response import AsyncHttpResponse, HttpResponse
9
+ from ...core.jsonable_encoder import jsonable_encoder
10
+ from ...core.pydantic_utilities import parse_obj_as
11
+ from ...core.request_options import RequestOptions
12
+ from ...core.serialization import convert_and_respect_annotation_metadata
13
+ from ..errors.bad_request_error import BadRequestError
14
+ from ..errors.forbidden_error import ForbiddenError
15
+ from ..errors.internal_server_error import InternalServerError
16
+ from ..errors.not_found_error import NotFoundError
17
+ from ..errors.unauthorized_error import UnauthorizedError
18
+ from ..types.agent_prompts_response import AgentPromptsResponse
19
+ from ..types.json_patch import JsonPatch
20
+ from ..types.success_response import SuccessResponse
21
+ from .types.prompts_delete_response import PromptsDeleteResponse
22
+ from .types.prompts_list_response import PromptsListResponse
23
+
24
+ # this is used as the default value for optional parameters
25
+ OMIT = typing.cast(typing.Any, ...)
26
+
27
+
28
+ class RawPromptsClient:
29
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
30
+ self._client_wrapper = client_wrapper
31
+
32
+ def create(
33
+ self,
34
+ *,
35
+ name: str,
36
+ content: str,
37
+ is_active: bool,
38
+ description: typing.Optional[str] = OMIT,
39
+ is_default: typing.Optional[bool] = OMIT,
40
+ tags: typing.Optional[typing.Sequence[str]] = OMIT,
41
+ request_options: typing.Optional[RequestOptions] = None,
42
+ ) -> HttpResponse[AgentPromptsResponse]:
43
+ """
44
+ Creates a new agent prompt
45
+
46
+ Parameters
47
+ ----------
48
+ name : str
49
+ Prompt name
50
+
51
+ content : str
52
+ Prompt content
53
+
54
+ is_active : bool
55
+ Whether the prompt is active
56
+
57
+ description : typing.Optional[str]
58
+ Prompt description
59
+
60
+ is_default : typing.Optional[bool]
61
+ Whether this is a default prompt
62
+
63
+ tags : typing.Optional[typing.Sequence[str]]
64
+ Tags for categorizing the prompt
65
+
66
+ request_options : typing.Optional[RequestOptions]
67
+ Request-specific configuration.
68
+
69
+ Returns
70
+ -------
71
+ HttpResponse[AgentPromptsResponse]
72
+ Prompt created successfully
73
+ """
74
+ _response = self._client_wrapper.httpx_client.request(
75
+ "agent/prompts",
76
+ method="POST",
77
+ json={
78
+ "name": name,
79
+ "description": description,
80
+ "content": content,
81
+ "is_default": is_default,
82
+ "is_active": is_active,
83
+ "tags": tags,
84
+ },
85
+ headers={
86
+ "content-type": "application/json",
87
+ },
88
+ request_options=request_options,
89
+ omit=OMIT,
90
+ )
91
+ try:
92
+ if 200 <= _response.status_code < 300:
93
+ _data = typing.cast(
94
+ AgentPromptsResponse,
95
+ parse_obj_as(
96
+ type_=AgentPromptsResponse, # type: ignore
97
+ object_=_response.json(),
98
+ ),
99
+ )
100
+ return HttpResponse(response=_response, data=_data)
101
+ if _response.status_code == 400:
102
+ raise BadRequestError(
103
+ headers=dict(_response.headers),
104
+ body=typing.cast(
105
+ typing.Optional[typing.Any],
106
+ parse_obj_as(
107
+ type_=typing.Optional[typing.Any], # type: ignore
108
+ object_=_response.json(),
109
+ ),
110
+ ),
111
+ )
112
+ if _response.status_code == 401:
113
+ raise UnauthorizedError(
114
+ headers=dict(_response.headers),
115
+ body=typing.cast(
116
+ typing.Optional[typing.Any],
117
+ parse_obj_as(
118
+ type_=typing.Optional[typing.Any], # type: ignore
119
+ object_=_response.json(),
120
+ ),
121
+ ),
122
+ )
123
+ if _response.status_code == 403:
124
+ raise ForbiddenError(
125
+ headers=dict(_response.headers),
126
+ body=typing.cast(
127
+ typing.Optional[typing.Any],
128
+ parse_obj_as(
129
+ type_=typing.Optional[typing.Any], # type: ignore
130
+ object_=_response.json(),
131
+ ),
132
+ ),
133
+ )
134
+ if _response.status_code == 500:
135
+ raise InternalServerError(
136
+ headers=dict(_response.headers),
137
+ body=typing.cast(
138
+ typing.Optional[typing.Any],
139
+ parse_obj_as(
140
+ type_=typing.Optional[typing.Any], # type: ignore
141
+ object_=_response.json(),
142
+ ),
143
+ ),
144
+ )
145
+ _response_json = _response.json()
146
+ except JSONDecodeError:
147
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
148
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
149
+
150
+ def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[PromptsListResponse]:
151
+ """
152
+ Retrieves a list of agent prompts belonging to the authenticated user
153
+
154
+ Parameters
155
+ ----------
156
+ request_options : typing.Optional[RequestOptions]
157
+ Request-specific configuration.
158
+
159
+ Returns
160
+ -------
161
+ HttpResponse[PromptsListResponse]
162
+ Prompts retrieved successfully
163
+ """
164
+ _response = self._client_wrapper.httpx_client.request(
165
+ "agent/prompts/list",
166
+ method="GET",
167
+ request_options=request_options,
168
+ )
169
+ try:
170
+ if 200 <= _response.status_code < 300:
171
+ _data = typing.cast(
172
+ PromptsListResponse,
173
+ parse_obj_as(
174
+ type_=PromptsListResponse, # type: ignore
175
+ object_=_response.json(),
176
+ ),
177
+ )
178
+ return HttpResponse(response=_response, data=_data)
179
+ if _response.status_code == 401:
180
+ raise UnauthorizedError(
181
+ headers=dict(_response.headers),
182
+ body=typing.cast(
183
+ typing.Optional[typing.Any],
184
+ parse_obj_as(
185
+ type_=typing.Optional[typing.Any], # type: ignore
186
+ object_=_response.json(),
187
+ ),
188
+ ),
189
+ )
190
+ if _response.status_code == 403:
191
+ raise ForbiddenError(
192
+ headers=dict(_response.headers),
193
+ body=typing.cast(
194
+ typing.Optional[typing.Any],
195
+ parse_obj_as(
196
+ type_=typing.Optional[typing.Any], # type: ignore
197
+ object_=_response.json(),
198
+ ),
199
+ ),
200
+ )
201
+ if _response.status_code == 500:
202
+ raise InternalServerError(
203
+ headers=dict(_response.headers),
204
+ body=typing.cast(
205
+ typing.Optional[typing.Any],
206
+ parse_obj_as(
207
+ type_=typing.Optional[typing.Any], # type: ignore
208
+ object_=_response.json(),
209
+ ),
210
+ ),
211
+ )
212
+ _response_json = _response.json()
213
+ except JSONDecodeError:
214
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
215
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
216
+
217
+ def get(
218
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
219
+ ) -> HttpResponse[AgentPromptsResponse]:
220
+ """
221
+ Retrieves a specific prompt by its ID
222
+
223
+ Parameters
224
+ ----------
225
+ id : str
226
+ Prompt ID
227
+
228
+ request_options : typing.Optional[RequestOptions]
229
+ Request-specific configuration.
230
+
231
+ Returns
232
+ -------
233
+ HttpResponse[AgentPromptsResponse]
234
+ Prompt retrieved successfully
235
+ """
236
+ _response = self._client_wrapper.httpx_client.request(
237
+ f"agent/prompts/{jsonable_encoder(id)}",
238
+ method="GET",
239
+ request_options=request_options,
240
+ )
241
+ try:
242
+ if 200 <= _response.status_code < 300:
243
+ _data = typing.cast(
244
+ AgentPromptsResponse,
245
+ parse_obj_as(
246
+ type_=AgentPromptsResponse, # type: ignore
247
+ object_=_response.json(),
248
+ ),
249
+ )
250
+ return HttpResponse(response=_response, data=_data)
251
+ if _response.status_code == 401:
252
+ raise UnauthorizedError(
253
+ headers=dict(_response.headers),
254
+ body=typing.cast(
255
+ typing.Optional[typing.Any],
256
+ parse_obj_as(
257
+ type_=typing.Optional[typing.Any], # type: ignore
258
+ object_=_response.json(),
259
+ ),
260
+ ),
261
+ )
262
+ if _response.status_code == 403:
263
+ raise ForbiddenError(
264
+ headers=dict(_response.headers),
265
+ body=typing.cast(
266
+ typing.Optional[typing.Any],
267
+ parse_obj_as(
268
+ type_=typing.Optional[typing.Any], # type: ignore
269
+ object_=_response.json(),
270
+ ),
271
+ ),
272
+ )
273
+ if _response.status_code == 404:
274
+ raise NotFoundError(
275
+ headers=dict(_response.headers),
276
+ body=typing.cast(
277
+ typing.Optional[typing.Any],
278
+ parse_obj_as(
279
+ type_=typing.Optional[typing.Any], # type: ignore
280
+ object_=_response.json(),
281
+ ),
282
+ ),
283
+ )
284
+ if _response.status_code == 500:
285
+ raise InternalServerError(
286
+ headers=dict(_response.headers),
287
+ body=typing.cast(
288
+ typing.Optional[typing.Any],
289
+ parse_obj_as(
290
+ type_=typing.Optional[typing.Any], # type: ignore
291
+ object_=_response.json(),
292
+ ),
293
+ ),
294
+ )
295
+ _response_json = _response.json()
296
+ except JSONDecodeError:
297
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
298
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
299
+
300
+ def update(
301
+ self,
302
+ id: str,
303
+ *,
304
+ name: typing.Optional[str] = OMIT,
305
+ description: typing.Optional[str] = OMIT,
306
+ content: typing.Optional[str] = OMIT,
307
+ is_default: typing.Optional[bool] = OMIT,
308
+ is_active: typing.Optional[bool] = OMIT,
309
+ tags: typing.Optional[typing.Sequence[str]] = OMIT,
310
+ request_options: typing.Optional[RequestOptions] = None,
311
+ ) -> HttpResponse[AgentPromptsResponse]:
312
+ """
313
+ Updates an existing prompt
314
+
315
+ Parameters
316
+ ----------
317
+ id : str
318
+ Prompt ID
319
+
320
+ name : typing.Optional[str]
321
+ Prompt name
322
+
323
+ description : typing.Optional[str]
324
+ Prompt description
325
+
326
+ content : typing.Optional[str]
327
+ Prompt content
328
+
329
+ is_default : typing.Optional[bool]
330
+ Whether this is a default prompt
331
+
332
+ is_active : typing.Optional[bool]
333
+ Whether the prompt is active
334
+
335
+ tags : typing.Optional[typing.Sequence[str]]
336
+ Tags for categorizing the prompt
337
+
338
+ request_options : typing.Optional[RequestOptions]
339
+ Request-specific configuration.
340
+
341
+ Returns
342
+ -------
343
+ HttpResponse[AgentPromptsResponse]
344
+ Prompt updated successfully
345
+ """
346
+ _response = self._client_wrapper.httpx_client.request(
347
+ f"agent/prompts/{jsonable_encoder(id)}",
348
+ method="PUT",
349
+ json={
350
+ "name": name,
351
+ "description": description,
352
+ "content": content,
353
+ "is_default": is_default,
354
+ "is_active": is_active,
355
+ "tags": tags,
356
+ },
357
+ headers={
358
+ "content-type": "application/json",
359
+ },
360
+ request_options=request_options,
361
+ omit=OMIT,
362
+ )
363
+ try:
364
+ if 200 <= _response.status_code < 300:
365
+ _data = typing.cast(
366
+ AgentPromptsResponse,
367
+ parse_obj_as(
368
+ type_=AgentPromptsResponse, # type: ignore
369
+ object_=_response.json(),
370
+ ),
371
+ )
372
+ return HttpResponse(response=_response, data=_data)
373
+ if _response.status_code == 400:
374
+ raise BadRequestError(
375
+ headers=dict(_response.headers),
376
+ body=typing.cast(
377
+ typing.Optional[typing.Any],
378
+ parse_obj_as(
379
+ type_=typing.Optional[typing.Any], # type: ignore
380
+ object_=_response.json(),
381
+ ),
382
+ ),
383
+ )
384
+ if _response.status_code == 401:
385
+ raise UnauthorizedError(
386
+ headers=dict(_response.headers),
387
+ body=typing.cast(
388
+ typing.Optional[typing.Any],
389
+ parse_obj_as(
390
+ type_=typing.Optional[typing.Any], # type: ignore
391
+ object_=_response.json(),
392
+ ),
393
+ ),
394
+ )
395
+ if _response.status_code == 403:
396
+ raise ForbiddenError(
397
+ headers=dict(_response.headers),
398
+ body=typing.cast(
399
+ typing.Optional[typing.Any],
400
+ parse_obj_as(
401
+ type_=typing.Optional[typing.Any], # type: ignore
402
+ object_=_response.json(),
403
+ ),
404
+ ),
405
+ )
406
+ if _response.status_code == 404:
407
+ raise NotFoundError(
408
+ headers=dict(_response.headers),
409
+ body=typing.cast(
410
+ typing.Optional[typing.Any],
411
+ parse_obj_as(
412
+ type_=typing.Optional[typing.Any], # type: ignore
413
+ object_=_response.json(),
414
+ ),
415
+ ),
416
+ )
417
+ if _response.status_code == 500:
418
+ raise InternalServerError(
419
+ headers=dict(_response.headers),
420
+ body=typing.cast(
421
+ typing.Optional[typing.Any],
422
+ parse_obj_as(
423
+ type_=typing.Optional[typing.Any], # type: ignore
424
+ object_=_response.json(),
425
+ ),
426
+ ),
427
+ )
428
+ _response_json = _response.json()
429
+ except JSONDecodeError:
430
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
431
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
432
+
433
+ def delete(
434
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
435
+ ) -> HttpResponse[PromptsDeleteResponse]:
436
+ """
437
+ Soft deletes a prompt by setting is_active to false
438
+
439
+ Parameters
440
+ ----------
441
+ id : str
442
+ Prompt ID
443
+
444
+ request_options : typing.Optional[RequestOptions]
445
+ Request-specific configuration.
446
+
447
+ Returns
448
+ -------
449
+ HttpResponse[PromptsDeleteResponse]
450
+ Prompt deleted successfully
451
+ """
452
+ _response = self._client_wrapper.httpx_client.request(
453
+ f"agent/prompts/{jsonable_encoder(id)}",
454
+ method="DELETE",
455
+ request_options=request_options,
456
+ )
457
+ try:
458
+ if 200 <= _response.status_code < 300:
459
+ _data = typing.cast(
460
+ PromptsDeleteResponse,
461
+ parse_obj_as(
462
+ type_=PromptsDeleteResponse, # type: ignore
463
+ object_=_response.json(),
464
+ ),
465
+ )
466
+ return HttpResponse(response=_response, data=_data)
467
+ if _response.status_code == 401:
468
+ raise UnauthorizedError(
469
+ headers=dict(_response.headers),
470
+ body=typing.cast(
471
+ typing.Optional[typing.Any],
472
+ parse_obj_as(
473
+ type_=typing.Optional[typing.Any], # type: ignore
474
+ object_=_response.json(),
475
+ ),
476
+ ),
477
+ )
478
+ if _response.status_code == 403:
479
+ raise ForbiddenError(
480
+ headers=dict(_response.headers),
481
+ body=typing.cast(
482
+ typing.Optional[typing.Any],
483
+ parse_obj_as(
484
+ type_=typing.Optional[typing.Any], # type: ignore
485
+ object_=_response.json(),
486
+ ),
487
+ ),
488
+ )
489
+ if _response.status_code == 404:
490
+ raise NotFoundError(
491
+ headers=dict(_response.headers),
492
+ body=typing.cast(
493
+ typing.Optional[typing.Any],
494
+ parse_obj_as(
495
+ type_=typing.Optional[typing.Any], # type: ignore
496
+ object_=_response.json(),
497
+ ),
498
+ ),
499
+ )
500
+ if _response.status_code == 500:
501
+ raise InternalServerError(
502
+ headers=dict(_response.headers),
503
+ body=typing.cast(
504
+ typing.Optional[typing.Any],
505
+ parse_obj_as(
506
+ type_=typing.Optional[typing.Any], # type: ignore
507
+ object_=_response.json(),
508
+ ),
509
+ ),
510
+ )
511
+ _response_json = _response.json()
512
+ except JSONDecodeError:
513
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
514
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
515
+
516
+ def patch(
517
+ self, id: str, *, request: JsonPatch, request_options: typing.Optional[RequestOptions] = None
518
+ ) -> HttpResponse[AgentPromptsResponse]:
519
+ """
520
+ Patches an existing prompt
521
+
522
+ Parameters
523
+ ----------
524
+ id : str
525
+ Agent Prompt ID
526
+
527
+ request : JsonPatch
528
+
529
+ request_options : typing.Optional[RequestOptions]
530
+ Request-specific configuration.
531
+
532
+ Returns
533
+ -------
534
+ HttpResponse[AgentPromptsResponse]
535
+ Prompt patched successfully
536
+ """
537
+ _response = self._client_wrapper.httpx_client.request(
538
+ f"agent/prompts/{jsonable_encoder(id)}",
539
+ method="PATCH",
540
+ json=convert_and_respect_annotation_metadata(object_=request, annotation=JsonPatch, direction="write"),
541
+ headers={
542
+ "content-type": "application/json+patch",
543
+ },
544
+ request_options=request_options,
545
+ omit=OMIT,
546
+ )
547
+ try:
548
+ if 200 <= _response.status_code < 300:
549
+ _data = typing.cast(
550
+ AgentPromptsResponse,
551
+ parse_obj_as(
552
+ type_=AgentPromptsResponse, # type: ignore
553
+ object_=_response.json(),
554
+ ),
555
+ )
556
+ return HttpResponse(response=_response, data=_data)
557
+ if _response.status_code == 400:
558
+ raise BadRequestError(
559
+ headers=dict(_response.headers),
560
+ body=typing.cast(
561
+ typing.Optional[typing.Any],
562
+ parse_obj_as(
563
+ type_=typing.Optional[typing.Any], # type: ignore
564
+ object_=_response.json(),
565
+ ),
566
+ ),
567
+ )
568
+ if _response.status_code == 401:
569
+ raise UnauthorizedError(
570
+ headers=dict(_response.headers),
571
+ body=typing.cast(
572
+ typing.Optional[typing.Any],
573
+ parse_obj_as(
574
+ type_=typing.Optional[typing.Any], # type: ignore
575
+ object_=_response.json(),
576
+ ),
577
+ ),
578
+ )
579
+ if _response.status_code == 403:
580
+ raise ForbiddenError(
581
+ headers=dict(_response.headers),
582
+ body=typing.cast(
583
+ typing.Optional[typing.Any],
584
+ parse_obj_as(
585
+ type_=typing.Optional[typing.Any], # type: ignore
586
+ object_=_response.json(),
587
+ ),
588
+ ),
589
+ )
590
+ if _response.status_code == 404:
591
+ raise NotFoundError(
592
+ headers=dict(_response.headers),
593
+ body=typing.cast(
594
+ typing.Optional[typing.Any],
595
+ parse_obj_as(
596
+ type_=typing.Optional[typing.Any], # type: ignore
597
+ object_=_response.json(),
598
+ ),
599
+ ),
600
+ )
601
+ if _response.status_code == 500:
602
+ raise InternalServerError(
603
+ headers=dict(_response.headers),
604
+ body=typing.cast(
605
+ typing.Optional[typing.Any],
606
+ parse_obj_as(
607
+ type_=typing.Optional[typing.Any], # type: ignore
608
+ object_=_response.json(),
609
+ ),
610
+ ),
611
+ )
612
+ _response_json = _response.json()
613
+ except JSONDecodeError:
614
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
615
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
616
+
617
+ def load_defaults(
618
+ self, *, request_options: typing.Optional[RequestOptions] = None
619
+ ) -> HttpResponse[SuccessResponse]:
620
+ """
621
+ Loads default agent prompts for the authenticated user
622
+
623
+ Parameters
624
+ ----------
625
+ request_options : typing.Optional[RequestOptions]
626
+ Request-specific configuration.
627
+
628
+ Returns
629
+ -------
630
+ HttpResponse[SuccessResponse]
631
+ Default prompts loaded successfully
632
+ """
633
+ _response = self._client_wrapper.httpx_client.request(
634
+ "agent/prompts/load-defaults",
635
+ method="POST",
636
+ request_options=request_options,
637
+ )
638
+ try:
639
+ if 200 <= _response.status_code < 300:
640
+ _data = typing.cast(
641
+ SuccessResponse,
642
+ parse_obj_as(
643
+ type_=SuccessResponse, # type: ignore
644
+ object_=_response.json(),
645
+ ),
646
+ )
647
+ return HttpResponse(response=_response, data=_data)
648
+ if _response.status_code == 401:
649
+ raise UnauthorizedError(
650
+ headers=dict(_response.headers),
651
+ body=typing.cast(
652
+ typing.Optional[typing.Any],
653
+ parse_obj_as(
654
+ type_=typing.Optional[typing.Any], # type: ignore
655
+ object_=_response.json(),
656
+ ),
657
+ ),
658
+ )
659
+ if _response.status_code == 403:
660
+ raise ForbiddenError(
661
+ headers=dict(_response.headers),
662
+ body=typing.cast(
663
+ typing.Optional[typing.Any],
664
+ parse_obj_as(
665
+ type_=typing.Optional[typing.Any], # type: ignore
666
+ object_=_response.json(),
667
+ ),
668
+ ),
669
+ )
670
+ if _response.status_code == 500:
671
+ raise InternalServerError(
672
+ headers=dict(_response.headers),
673
+ body=typing.cast(
674
+ typing.Optional[typing.Any],
675
+ parse_obj_as(
676
+ type_=typing.Optional[typing.Any], # type: ignore
677
+ object_=_response.json(),
678
+ ),
679
+ ),
680
+ )
681
+ _response_json = _response.json()
682
+ except JSONDecodeError:
683
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
684
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
685
+
686
+
687
+ class AsyncRawPromptsClient:
688
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
689
+ self._client_wrapper = client_wrapper
690
+
691
+ async def create(
692
+ self,
693
+ *,
694
+ name: str,
695
+ content: str,
696
+ is_active: bool,
697
+ description: typing.Optional[str] = OMIT,
698
+ is_default: typing.Optional[bool] = OMIT,
699
+ tags: typing.Optional[typing.Sequence[str]] = OMIT,
700
+ request_options: typing.Optional[RequestOptions] = None,
701
+ ) -> AsyncHttpResponse[AgentPromptsResponse]:
702
+ """
703
+ Creates a new agent prompt
704
+
705
+ Parameters
706
+ ----------
707
+ name : str
708
+ Prompt name
709
+
710
+ content : str
711
+ Prompt content
712
+
713
+ is_active : bool
714
+ Whether the prompt is active
715
+
716
+ description : typing.Optional[str]
717
+ Prompt description
718
+
719
+ is_default : typing.Optional[bool]
720
+ Whether this is a default prompt
721
+
722
+ tags : typing.Optional[typing.Sequence[str]]
723
+ Tags for categorizing the prompt
724
+
725
+ request_options : typing.Optional[RequestOptions]
726
+ Request-specific configuration.
727
+
728
+ Returns
729
+ -------
730
+ AsyncHttpResponse[AgentPromptsResponse]
731
+ Prompt created successfully
732
+ """
733
+ _response = await self._client_wrapper.httpx_client.request(
734
+ "agent/prompts",
735
+ method="POST",
736
+ json={
737
+ "name": name,
738
+ "description": description,
739
+ "content": content,
740
+ "is_default": is_default,
741
+ "is_active": is_active,
742
+ "tags": tags,
743
+ },
744
+ headers={
745
+ "content-type": "application/json",
746
+ },
747
+ request_options=request_options,
748
+ omit=OMIT,
749
+ )
750
+ try:
751
+ if 200 <= _response.status_code < 300:
752
+ _data = typing.cast(
753
+ AgentPromptsResponse,
754
+ parse_obj_as(
755
+ type_=AgentPromptsResponse, # type: ignore
756
+ object_=_response.json(),
757
+ ),
758
+ )
759
+ return AsyncHttpResponse(response=_response, data=_data)
760
+ if _response.status_code == 400:
761
+ raise BadRequestError(
762
+ headers=dict(_response.headers),
763
+ body=typing.cast(
764
+ typing.Optional[typing.Any],
765
+ parse_obj_as(
766
+ type_=typing.Optional[typing.Any], # type: ignore
767
+ object_=_response.json(),
768
+ ),
769
+ ),
770
+ )
771
+ if _response.status_code == 401:
772
+ raise UnauthorizedError(
773
+ headers=dict(_response.headers),
774
+ body=typing.cast(
775
+ typing.Optional[typing.Any],
776
+ parse_obj_as(
777
+ type_=typing.Optional[typing.Any], # type: ignore
778
+ object_=_response.json(),
779
+ ),
780
+ ),
781
+ )
782
+ if _response.status_code == 403:
783
+ raise ForbiddenError(
784
+ headers=dict(_response.headers),
785
+ body=typing.cast(
786
+ typing.Optional[typing.Any],
787
+ parse_obj_as(
788
+ type_=typing.Optional[typing.Any], # type: ignore
789
+ object_=_response.json(),
790
+ ),
791
+ ),
792
+ )
793
+ if _response.status_code == 500:
794
+ raise InternalServerError(
795
+ headers=dict(_response.headers),
796
+ body=typing.cast(
797
+ typing.Optional[typing.Any],
798
+ parse_obj_as(
799
+ type_=typing.Optional[typing.Any], # type: ignore
800
+ object_=_response.json(),
801
+ ),
802
+ ),
803
+ )
804
+ _response_json = _response.json()
805
+ except JSONDecodeError:
806
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
807
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
808
+
809
+ async def list(
810
+ self, *, request_options: typing.Optional[RequestOptions] = None
811
+ ) -> AsyncHttpResponse[PromptsListResponse]:
812
+ """
813
+ Retrieves a list of agent prompts belonging to the authenticated user
814
+
815
+ Parameters
816
+ ----------
817
+ request_options : typing.Optional[RequestOptions]
818
+ Request-specific configuration.
819
+
820
+ Returns
821
+ -------
822
+ AsyncHttpResponse[PromptsListResponse]
823
+ Prompts retrieved successfully
824
+ """
825
+ _response = await self._client_wrapper.httpx_client.request(
826
+ "agent/prompts/list",
827
+ method="GET",
828
+ request_options=request_options,
829
+ )
830
+ try:
831
+ if 200 <= _response.status_code < 300:
832
+ _data = typing.cast(
833
+ PromptsListResponse,
834
+ parse_obj_as(
835
+ type_=PromptsListResponse, # type: ignore
836
+ object_=_response.json(),
837
+ ),
838
+ )
839
+ return AsyncHttpResponse(response=_response, data=_data)
840
+ if _response.status_code == 401:
841
+ raise UnauthorizedError(
842
+ headers=dict(_response.headers),
843
+ body=typing.cast(
844
+ typing.Optional[typing.Any],
845
+ parse_obj_as(
846
+ type_=typing.Optional[typing.Any], # type: ignore
847
+ object_=_response.json(),
848
+ ),
849
+ ),
850
+ )
851
+ if _response.status_code == 403:
852
+ raise ForbiddenError(
853
+ headers=dict(_response.headers),
854
+ body=typing.cast(
855
+ typing.Optional[typing.Any],
856
+ parse_obj_as(
857
+ type_=typing.Optional[typing.Any], # type: ignore
858
+ object_=_response.json(),
859
+ ),
860
+ ),
861
+ )
862
+ if _response.status_code == 500:
863
+ raise InternalServerError(
864
+ headers=dict(_response.headers),
865
+ body=typing.cast(
866
+ typing.Optional[typing.Any],
867
+ parse_obj_as(
868
+ type_=typing.Optional[typing.Any], # type: ignore
869
+ object_=_response.json(),
870
+ ),
871
+ ),
872
+ )
873
+ _response_json = _response.json()
874
+ except JSONDecodeError:
875
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
876
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
877
+
878
+ async def get(
879
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
880
+ ) -> AsyncHttpResponse[AgentPromptsResponse]:
881
+ """
882
+ Retrieves a specific prompt by its ID
883
+
884
+ Parameters
885
+ ----------
886
+ id : str
887
+ Prompt ID
888
+
889
+ request_options : typing.Optional[RequestOptions]
890
+ Request-specific configuration.
891
+
892
+ Returns
893
+ -------
894
+ AsyncHttpResponse[AgentPromptsResponse]
895
+ Prompt retrieved successfully
896
+ """
897
+ _response = await self._client_wrapper.httpx_client.request(
898
+ f"agent/prompts/{jsonable_encoder(id)}",
899
+ method="GET",
900
+ request_options=request_options,
901
+ )
902
+ try:
903
+ if 200 <= _response.status_code < 300:
904
+ _data = typing.cast(
905
+ AgentPromptsResponse,
906
+ parse_obj_as(
907
+ type_=AgentPromptsResponse, # type: ignore
908
+ object_=_response.json(),
909
+ ),
910
+ )
911
+ return AsyncHttpResponse(response=_response, data=_data)
912
+ if _response.status_code == 401:
913
+ raise UnauthorizedError(
914
+ headers=dict(_response.headers),
915
+ body=typing.cast(
916
+ typing.Optional[typing.Any],
917
+ parse_obj_as(
918
+ type_=typing.Optional[typing.Any], # type: ignore
919
+ object_=_response.json(),
920
+ ),
921
+ ),
922
+ )
923
+ if _response.status_code == 403:
924
+ raise ForbiddenError(
925
+ headers=dict(_response.headers),
926
+ body=typing.cast(
927
+ typing.Optional[typing.Any],
928
+ parse_obj_as(
929
+ type_=typing.Optional[typing.Any], # type: ignore
930
+ object_=_response.json(),
931
+ ),
932
+ ),
933
+ )
934
+ if _response.status_code == 404:
935
+ raise NotFoundError(
936
+ headers=dict(_response.headers),
937
+ body=typing.cast(
938
+ typing.Optional[typing.Any],
939
+ parse_obj_as(
940
+ type_=typing.Optional[typing.Any], # type: ignore
941
+ object_=_response.json(),
942
+ ),
943
+ ),
944
+ )
945
+ if _response.status_code == 500:
946
+ raise InternalServerError(
947
+ headers=dict(_response.headers),
948
+ body=typing.cast(
949
+ typing.Optional[typing.Any],
950
+ parse_obj_as(
951
+ type_=typing.Optional[typing.Any], # type: ignore
952
+ object_=_response.json(),
953
+ ),
954
+ ),
955
+ )
956
+ _response_json = _response.json()
957
+ except JSONDecodeError:
958
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
959
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
960
+
961
+ async def update(
962
+ self,
963
+ id: str,
964
+ *,
965
+ name: typing.Optional[str] = OMIT,
966
+ description: typing.Optional[str] = OMIT,
967
+ content: typing.Optional[str] = OMIT,
968
+ is_default: typing.Optional[bool] = OMIT,
969
+ is_active: typing.Optional[bool] = OMIT,
970
+ tags: typing.Optional[typing.Sequence[str]] = OMIT,
971
+ request_options: typing.Optional[RequestOptions] = None,
972
+ ) -> AsyncHttpResponse[AgentPromptsResponse]:
973
+ """
974
+ Updates an existing prompt
975
+
976
+ Parameters
977
+ ----------
978
+ id : str
979
+ Prompt ID
980
+
981
+ name : typing.Optional[str]
982
+ Prompt name
983
+
984
+ description : typing.Optional[str]
985
+ Prompt description
986
+
987
+ content : typing.Optional[str]
988
+ Prompt content
989
+
990
+ is_default : typing.Optional[bool]
991
+ Whether this is a default prompt
992
+
993
+ is_active : typing.Optional[bool]
994
+ Whether the prompt is active
995
+
996
+ tags : typing.Optional[typing.Sequence[str]]
997
+ Tags for categorizing the prompt
998
+
999
+ request_options : typing.Optional[RequestOptions]
1000
+ Request-specific configuration.
1001
+
1002
+ Returns
1003
+ -------
1004
+ AsyncHttpResponse[AgentPromptsResponse]
1005
+ Prompt updated successfully
1006
+ """
1007
+ _response = await self._client_wrapper.httpx_client.request(
1008
+ f"agent/prompts/{jsonable_encoder(id)}",
1009
+ method="PUT",
1010
+ json={
1011
+ "name": name,
1012
+ "description": description,
1013
+ "content": content,
1014
+ "is_default": is_default,
1015
+ "is_active": is_active,
1016
+ "tags": tags,
1017
+ },
1018
+ headers={
1019
+ "content-type": "application/json",
1020
+ },
1021
+ request_options=request_options,
1022
+ omit=OMIT,
1023
+ )
1024
+ try:
1025
+ if 200 <= _response.status_code < 300:
1026
+ _data = typing.cast(
1027
+ AgentPromptsResponse,
1028
+ parse_obj_as(
1029
+ type_=AgentPromptsResponse, # type: ignore
1030
+ object_=_response.json(),
1031
+ ),
1032
+ )
1033
+ return AsyncHttpResponse(response=_response, data=_data)
1034
+ if _response.status_code == 400:
1035
+ raise BadRequestError(
1036
+ headers=dict(_response.headers),
1037
+ body=typing.cast(
1038
+ typing.Optional[typing.Any],
1039
+ parse_obj_as(
1040
+ type_=typing.Optional[typing.Any], # type: ignore
1041
+ object_=_response.json(),
1042
+ ),
1043
+ ),
1044
+ )
1045
+ if _response.status_code == 401:
1046
+ raise UnauthorizedError(
1047
+ headers=dict(_response.headers),
1048
+ body=typing.cast(
1049
+ typing.Optional[typing.Any],
1050
+ parse_obj_as(
1051
+ type_=typing.Optional[typing.Any], # type: ignore
1052
+ object_=_response.json(),
1053
+ ),
1054
+ ),
1055
+ )
1056
+ if _response.status_code == 403:
1057
+ raise ForbiddenError(
1058
+ headers=dict(_response.headers),
1059
+ body=typing.cast(
1060
+ typing.Optional[typing.Any],
1061
+ parse_obj_as(
1062
+ type_=typing.Optional[typing.Any], # type: ignore
1063
+ object_=_response.json(),
1064
+ ),
1065
+ ),
1066
+ )
1067
+ if _response.status_code == 404:
1068
+ raise NotFoundError(
1069
+ headers=dict(_response.headers),
1070
+ body=typing.cast(
1071
+ typing.Optional[typing.Any],
1072
+ parse_obj_as(
1073
+ type_=typing.Optional[typing.Any], # type: ignore
1074
+ object_=_response.json(),
1075
+ ),
1076
+ ),
1077
+ )
1078
+ if _response.status_code == 500:
1079
+ raise InternalServerError(
1080
+ headers=dict(_response.headers),
1081
+ body=typing.cast(
1082
+ typing.Optional[typing.Any],
1083
+ parse_obj_as(
1084
+ type_=typing.Optional[typing.Any], # type: ignore
1085
+ object_=_response.json(),
1086
+ ),
1087
+ ),
1088
+ )
1089
+ _response_json = _response.json()
1090
+ except JSONDecodeError:
1091
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1092
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1093
+
1094
+ async def delete(
1095
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
1096
+ ) -> AsyncHttpResponse[PromptsDeleteResponse]:
1097
+ """
1098
+ Soft deletes a prompt by setting is_active to false
1099
+
1100
+ Parameters
1101
+ ----------
1102
+ id : str
1103
+ Prompt ID
1104
+
1105
+ request_options : typing.Optional[RequestOptions]
1106
+ Request-specific configuration.
1107
+
1108
+ Returns
1109
+ -------
1110
+ AsyncHttpResponse[PromptsDeleteResponse]
1111
+ Prompt deleted successfully
1112
+ """
1113
+ _response = await self._client_wrapper.httpx_client.request(
1114
+ f"agent/prompts/{jsonable_encoder(id)}",
1115
+ method="DELETE",
1116
+ request_options=request_options,
1117
+ )
1118
+ try:
1119
+ if 200 <= _response.status_code < 300:
1120
+ _data = typing.cast(
1121
+ PromptsDeleteResponse,
1122
+ parse_obj_as(
1123
+ type_=PromptsDeleteResponse, # type: ignore
1124
+ object_=_response.json(),
1125
+ ),
1126
+ )
1127
+ return AsyncHttpResponse(response=_response, data=_data)
1128
+ if _response.status_code == 401:
1129
+ raise UnauthorizedError(
1130
+ headers=dict(_response.headers),
1131
+ body=typing.cast(
1132
+ typing.Optional[typing.Any],
1133
+ parse_obj_as(
1134
+ type_=typing.Optional[typing.Any], # type: ignore
1135
+ object_=_response.json(),
1136
+ ),
1137
+ ),
1138
+ )
1139
+ if _response.status_code == 403:
1140
+ raise ForbiddenError(
1141
+ headers=dict(_response.headers),
1142
+ body=typing.cast(
1143
+ typing.Optional[typing.Any],
1144
+ parse_obj_as(
1145
+ type_=typing.Optional[typing.Any], # type: ignore
1146
+ object_=_response.json(),
1147
+ ),
1148
+ ),
1149
+ )
1150
+ if _response.status_code == 404:
1151
+ raise NotFoundError(
1152
+ headers=dict(_response.headers),
1153
+ body=typing.cast(
1154
+ typing.Optional[typing.Any],
1155
+ parse_obj_as(
1156
+ type_=typing.Optional[typing.Any], # type: ignore
1157
+ object_=_response.json(),
1158
+ ),
1159
+ ),
1160
+ )
1161
+ if _response.status_code == 500:
1162
+ raise InternalServerError(
1163
+ headers=dict(_response.headers),
1164
+ body=typing.cast(
1165
+ typing.Optional[typing.Any],
1166
+ parse_obj_as(
1167
+ type_=typing.Optional[typing.Any], # type: ignore
1168
+ object_=_response.json(),
1169
+ ),
1170
+ ),
1171
+ )
1172
+ _response_json = _response.json()
1173
+ except JSONDecodeError:
1174
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1175
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1176
+
1177
+ async def patch(
1178
+ self, id: str, *, request: JsonPatch, request_options: typing.Optional[RequestOptions] = None
1179
+ ) -> AsyncHttpResponse[AgentPromptsResponse]:
1180
+ """
1181
+ Patches an existing prompt
1182
+
1183
+ Parameters
1184
+ ----------
1185
+ id : str
1186
+ Agent Prompt ID
1187
+
1188
+ request : JsonPatch
1189
+
1190
+ request_options : typing.Optional[RequestOptions]
1191
+ Request-specific configuration.
1192
+
1193
+ Returns
1194
+ -------
1195
+ AsyncHttpResponse[AgentPromptsResponse]
1196
+ Prompt patched successfully
1197
+ """
1198
+ _response = await self._client_wrapper.httpx_client.request(
1199
+ f"agent/prompts/{jsonable_encoder(id)}",
1200
+ method="PATCH",
1201
+ json=convert_and_respect_annotation_metadata(object_=request, annotation=JsonPatch, direction="write"),
1202
+ headers={
1203
+ "content-type": "application/json+patch",
1204
+ },
1205
+ request_options=request_options,
1206
+ omit=OMIT,
1207
+ )
1208
+ try:
1209
+ if 200 <= _response.status_code < 300:
1210
+ _data = typing.cast(
1211
+ AgentPromptsResponse,
1212
+ parse_obj_as(
1213
+ type_=AgentPromptsResponse, # type: ignore
1214
+ object_=_response.json(),
1215
+ ),
1216
+ )
1217
+ return AsyncHttpResponse(response=_response, data=_data)
1218
+ if _response.status_code == 400:
1219
+ raise BadRequestError(
1220
+ headers=dict(_response.headers),
1221
+ body=typing.cast(
1222
+ typing.Optional[typing.Any],
1223
+ parse_obj_as(
1224
+ type_=typing.Optional[typing.Any], # type: ignore
1225
+ object_=_response.json(),
1226
+ ),
1227
+ ),
1228
+ )
1229
+ if _response.status_code == 401:
1230
+ raise UnauthorizedError(
1231
+ headers=dict(_response.headers),
1232
+ body=typing.cast(
1233
+ typing.Optional[typing.Any],
1234
+ parse_obj_as(
1235
+ type_=typing.Optional[typing.Any], # type: ignore
1236
+ object_=_response.json(),
1237
+ ),
1238
+ ),
1239
+ )
1240
+ if _response.status_code == 403:
1241
+ raise ForbiddenError(
1242
+ headers=dict(_response.headers),
1243
+ body=typing.cast(
1244
+ typing.Optional[typing.Any],
1245
+ parse_obj_as(
1246
+ type_=typing.Optional[typing.Any], # type: ignore
1247
+ object_=_response.json(),
1248
+ ),
1249
+ ),
1250
+ )
1251
+ if _response.status_code == 404:
1252
+ raise NotFoundError(
1253
+ headers=dict(_response.headers),
1254
+ body=typing.cast(
1255
+ typing.Optional[typing.Any],
1256
+ parse_obj_as(
1257
+ type_=typing.Optional[typing.Any], # type: ignore
1258
+ object_=_response.json(),
1259
+ ),
1260
+ ),
1261
+ )
1262
+ if _response.status_code == 500:
1263
+ raise InternalServerError(
1264
+ headers=dict(_response.headers),
1265
+ body=typing.cast(
1266
+ typing.Optional[typing.Any],
1267
+ parse_obj_as(
1268
+ type_=typing.Optional[typing.Any], # type: ignore
1269
+ object_=_response.json(),
1270
+ ),
1271
+ ),
1272
+ )
1273
+ _response_json = _response.json()
1274
+ except JSONDecodeError:
1275
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1276
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1277
+
1278
+ async def load_defaults(
1279
+ self, *, request_options: typing.Optional[RequestOptions] = None
1280
+ ) -> AsyncHttpResponse[SuccessResponse]:
1281
+ """
1282
+ Loads default agent prompts for the authenticated user
1283
+
1284
+ Parameters
1285
+ ----------
1286
+ request_options : typing.Optional[RequestOptions]
1287
+ Request-specific configuration.
1288
+
1289
+ Returns
1290
+ -------
1291
+ AsyncHttpResponse[SuccessResponse]
1292
+ Default prompts loaded successfully
1293
+ """
1294
+ _response = await self._client_wrapper.httpx_client.request(
1295
+ "agent/prompts/load-defaults",
1296
+ method="POST",
1297
+ request_options=request_options,
1298
+ )
1299
+ try:
1300
+ if 200 <= _response.status_code < 300:
1301
+ _data = typing.cast(
1302
+ SuccessResponse,
1303
+ parse_obj_as(
1304
+ type_=SuccessResponse, # type: ignore
1305
+ object_=_response.json(),
1306
+ ),
1307
+ )
1308
+ return AsyncHttpResponse(response=_response, data=_data)
1309
+ if _response.status_code == 401:
1310
+ raise UnauthorizedError(
1311
+ headers=dict(_response.headers),
1312
+ body=typing.cast(
1313
+ typing.Optional[typing.Any],
1314
+ parse_obj_as(
1315
+ type_=typing.Optional[typing.Any], # type: ignore
1316
+ object_=_response.json(),
1317
+ ),
1318
+ ),
1319
+ )
1320
+ if _response.status_code == 403:
1321
+ raise ForbiddenError(
1322
+ headers=dict(_response.headers),
1323
+ body=typing.cast(
1324
+ typing.Optional[typing.Any],
1325
+ parse_obj_as(
1326
+ type_=typing.Optional[typing.Any], # type: ignore
1327
+ object_=_response.json(),
1328
+ ),
1329
+ ),
1330
+ )
1331
+ if _response.status_code == 500:
1332
+ raise InternalServerError(
1333
+ headers=dict(_response.headers),
1334
+ body=typing.cast(
1335
+ typing.Optional[typing.Any],
1336
+ parse_obj_as(
1337
+ type_=typing.Optional[typing.Any], # type: ignore
1338
+ object_=_response.json(),
1339
+ ),
1340
+ ),
1341
+ )
1342
+ _response_json = _response.json()
1343
+ except JSONDecodeError:
1344
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1345
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)