phenoml 0.0.1__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.

Potentially problematic release.


This version of phenoml might be problematic. Click here for more details.

Files changed (143) hide show
  1. phenoml/__init__.py +30 -0
  2. phenoml/agent/__init__.py +58 -0
  3. phenoml/agent/client.py +820 -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 +1501 -0
  17. phenoml/agent/types/__init__.py +45 -0
  18. phenoml/agent/types/agent_chat_response.py +33 -0
  19. phenoml/agent/types/agent_create_request_provider.py +13 -0
  20. phenoml/agent/types/agent_create_request_provider_item.py +7 -0
  21. phenoml/agent/types/agent_delete_response.py +20 -0
  22. phenoml/agent/types/agent_fhir_config.py +31 -0
  23. phenoml/agent/types/agent_list_response.py +22 -0
  24. phenoml/agent/types/agent_prompts_response.py +22 -0
  25. phenoml/agent/types/agent_response.py +22 -0
  26. phenoml/agent/types/agent_template.py +56 -0
  27. phenoml/agent/types/agent_template_provider.py +13 -0
  28. phenoml/agent/types/agent_template_provider_item.py +5 -0
  29. phenoml/agent/types/agent_update_request_provider.py +13 -0
  30. phenoml/agent/types/agent_update_request_provider_item.py +7 -0
  31. phenoml/agent/types/chat_fhir_client_config.py +31 -0
  32. phenoml/agent/types/json_patch.py +7 -0
  33. phenoml/agent/types/json_patch_operation.py +36 -0
  34. phenoml/agent/types/json_patch_operation_op.py +5 -0
  35. phenoml/agent/types/prompt_template.py +52 -0
  36. phenoml/agent/types/success_response.py +20 -0
  37. phenoml/authtoken/__init__.py +17 -0
  38. phenoml/authtoken/auth/__init__.py +7 -0
  39. phenoml/authtoken/auth/client.py +129 -0
  40. phenoml/authtoken/auth/raw_client.py +173 -0
  41. phenoml/authtoken/auth/types/__init__.py +7 -0
  42. phenoml/authtoken/auth/types/auth_generate_token_response.py +22 -0
  43. phenoml/authtoken/client.py +39 -0
  44. phenoml/authtoken/errors/__init__.py +8 -0
  45. phenoml/authtoken/errors/bad_request_error.py +10 -0
  46. phenoml/authtoken/errors/unauthorized_error.py +10 -0
  47. phenoml/authtoken/raw_client.py +13 -0
  48. phenoml/authtoken/types/__init__.py +8 -0
  49. phenoml/authtoken/types/bad_request_error_body.py +21 -0
  50. phenoml/authtoken/types/unauthorized_error_body.py +21 -0
  51. phenoml/client.py +168 -0
  52. phenoml/cohort/__init__.py +8 -0
  53. phenoml/cohort/client.py +113 -0
  54. phenoml/cohort/errors/__init__.py +9 -0
  55. phenoml/cohort/errors/bad_request_error.py +10 -0
  56. phenoml/cohort/errors/internal_server_error.py +10 -0
  57. phenoml/cohort/errors/unauthorized_error.py +10 -0
  58. phenoml/cohort/raw_client.py +185 -0
  59. phenoml/cohort/types/__init__.py +8 -0
  60. phenoml/cohort/types/cohort_response.py +33 -0
  61. phenoml/cohort/types/search_concept.py +37 -0
  62. phenoml/construe/__init__.py +45 -0
  63. phenoml/construe/client.py +399 -0
  64. phenoml/construe/errors/__init__.py +11 -0
  65. phenoml/construe/errors/bad_request_error.py +10 -0
  66. phenoml/construe/errors/conflict_error.py +10 -0
  67. phenoml/construe/errors/failed_dependency_error.py +10 -0
  68. phenoml/construe/errors/internal_server_error.py +10 -0
  69. phenoml/construe/errors/unauthorized_error.py +10 -0
  70. phenoml/construe/raw_client.py +706 -0
  71. phenoml/construe/types/__init__.py +41 -0
  72. phenoml/construe/types/bad_request_error_body.py +27 -0
  73. phenoml/construe/types/construe_cohort_request_config.py +37 -0
  74. phenoml/construe/types/construe_cohort_response.py +33 -0
  75. phenoml/construe/types/construe_cohort_response_queries_item.py +49 -0
  76. phenoml/construe/types/construe_cohort_response_queries_item_code_extract_results_item.py +31 -0
  77. phenoml/construe/types/construe_cohort_response_queries_item_code_extract_results_item_codes_item.py +32 -0
  78. phenoml/construe/types/construe_upload_code_system_response.py +19 -0
  79. phenoml/construe/types/extract_codes_result.py +22 -0
  80. phenoml/construe/types/extract_request_config.py +23 -0
  81. phenoml/construe/types/extract_request_config_chunking_method.py +5 -0
  82. phenoml/construe/types/extract_request_system.py +37 -0
  83. phenoml/construe/types/extracted_code_result.py +41 -0
  84. phenoml/construe/types/internal_server_error_body.py +27 -0
  85. phenoml/construe/types/unauthorized_error_body.py +27 -0
  86. phenoml/construe/types/upload_request_format.py +5 -0
  87. phenoml/core/__init__.py +52 -0
  88. phenoml/core/api_error.py +23 -0
  89. phenoml/core/client_wrapper.py +85 -0
  90. phenoml/core/datetime_utils.py +28 -0
  91. phenoml/core/file.py +67 -0
  92. phenoml/core/force_multipart.py +16 -0
  93. phenoml/core/http_client.py +543 -0
  94. phenoml/core/http_response.py +55 -0
  95. phenoml/core/jsonable_encoder.py +100 -0
  96. phenoml/core/pydantic_utilities.py +255 -0
  97. phenoml/core/query_encoder.py +58 -0
  98. phenoml/core/remove_none_from_dict.py +11 -0
  99. phenoml/core/request_options.py +35 -0
  100. phenoml/core/serialization.py +276 -0
  101. phenoml/environment.py +7 -0
  102. phenoml/lang2fhir/__init__.py +27 -0
  103. phenoml/lang2fhir/client.py +430 -0
  104. phenoml/lang2fhir/errors/__init__.py +11 -0
  105. phenoml/lang2fhir/errors/bad_request_error.py +10 -0
  106. phenoml/lang2fhir/errors/failed_dependency_error.py +10 -0
  107. phenoml/lang2fhir/errors/forbidden_error.py +10 -0
  108. phenoml/lang2fhir/errors/internal_server_error.py +10 -0
  109. phenoml/lang2fhir/errors/unauthorized_error.py +10 -0
  110. phenoml/lang2fhir/raw_client.py +788 -0
  111. phenoml/lang2fhir/types/__init__.py +19 -0
  112. phenoml/lang2fhir/types/create_request_resource.py +25 -0
  113. phenoml/lang2fhir/types/document_request_file_type.py +7 -0
  114. phenoml/lang2fhir/types/document_request_resource.py +5 -0
  115. phenoml/lang2fhir/types/fhir_resource.py +5 -0
  116. phenoml/lang2fhir/types/lang2fhir_upload_profile_response.py +23 -0
  117. phenoml/lang2fhir/types/search_response.py +33 -0
  118. phenoml/py.typed +0 -0
  119. phenoml/tools/__init__.py +33 -0
  120. phenoml/tools/client.py +392 -0
  121. phenoml/tools/errors/__init__.py +11 -0
  122. phenoml/tools/errors/bad_request_error.py +10 -0
  123. phenoml/tools/errors/failed_dependency_error.py +10 -0
  124. phenoml/tools/errors/forbidden_error.py +10 -0
  125. phenoml/tools/errors/internal_server_error.py +10 -0
  126. phenoml/tools/errors/unauthorized_error.py +10 -0
  127. phenoml/tools/raw_client.py +745 -0
  128. phenoml/tools/types/__init__.py +25 -0
  129. phenoml/tools/types/cohort_request_provider.py +5 -0
  130. phenoml/tools/types/cohort_response.py +49 -0
  131. phenoml/tools/types/fhir_client_config.py +31 -0
  132. phenoml/tools/types/lang2fhir_and_create_request_provider.py +7 -0
  133. phenoml/tools/types/lang2fhir_and_create_request_resource.py +25 -0
  134. phenoml/tools/types/lang2fhir_and_create_response.py +33 -0
  135. phenoml/tools/types/lang2fhir_and_search_request_provider.py +7 -0
  136. phenoml/tools/types/lang2fhir_and_search_response.py +40 -0
  137. phenoml/tools/types/search_concept.py +41 -0
  138. phenoml/version.py +3 -0
  139. phenoml/wrapper_client.py +123 -0
  140. phenoml-0.0.1.dist-info/LICENSE +21 -0
  141. phenoml-0.0.1.dist-info/METADATA +192 -0
  142. phenoml-0.0.1.dist-info/RECORD +143 -0
  143. phenoml-0.0.1.dist-info/WHEEL +4 -0
@@ -0,0 +1,707 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
6
+ from ...core.request_options import RequestOptions
7
+ from ..types.agent_prompts_response import AgentPromptsResponse
8
+ from ..types.json_patch import JsonPatch
9
+ from ..types.success_response import SuccessResponse
10
+ from .raw_client import AsyncRawPromptsClient, RawPromptsClient
11
+ from .types.prompts_delete_response import PromptsDeleteResponse
12
+ from .types.prompts_list_response import PromptsListResponse
13
+
14
+ # this is used as the default value for optional parameters
15
+ OMIT = typing.cast(typing.Any, ...)
16
+
17
+
18
+ class PromptsClient:
19
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
20
+ self._raw_client = RawPromptsClient(client_wrapper=client_wrapper)
21
+
22
+ @property
23
+ def with_raw_response(self) -> RawPromptsClient:
24
+ """
25
+ Retrieves a raw implementation of this client that returns raw responses.
26
+
27
+ Returns
28
+ -------
29
+ RawPromptsClient
30
+ """
31
+ return self._raw_client
32
+
33
+ def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> PromptsListResponse:
34
+ """
35
+ Retrieves a list of agent prompts belonging to the authenticated user
36
+
37
+ Parameters
38
+ ----------
39
+ request_options : typing.Optional[RequestOptions]
40
+ Request-specific configuration.
41
+
42
+ Returns
43
+ -------
44
+ PromptsListResponse
45
+ Prompts retrieved successfully
46
+
47
+ Examples
48
+ --------
49
+ from phenoml import phenoml
50
+
51
+ client = phenoml(
52
+ token="YOUR_TOKEN",
53
+ )
54
+ client.agent.prompts.list()
55
+ """
56
+ _response = self._raw_client.list(request_options=request_options)
57
+ return _response.data
58
+
59
+ def create(
60
+ self,
61
+ *,
62
+ name: str,
63
+ content: str,
64
+ is_active: bool,
65
+ description: typing.Optional[str] = OMIT,
66
+ is_default: typing.Optional[bool] = OMIT,
67
+ tags: typing.Optional[typing.Sequence[str]] = OMIT,
68
+ request_options: typing.Optional[RequestOptions] = None,
69
+ ) -> AgentPromptsResponse:
70
+ """
71
+ Creates a new agent prompt
72
+
73
+ Parameters
74
+ ----------
75
+ name : str
76
+ Prompt name
77
+
78
+ content : str
79
+ Prompt content
80
+
81
+ is_active : bool
82
+ Whether the prompt is active
83
+
84
+ description : typing.Optional[str]
85
+ Prompt description
86
+
87
+ is_default : typing.Optional[bool]
88
+ Whether this is a default prompt
89
+
90
+ tags : typing.Optional[typing.Sequence[str]]
91
+ Tags for categorizing the prompt
92
+
93
+ request_options : typing.Optional[RequestOptions]
94
+ Request-specific configuration.
95
+
96
+ Returns
97
+ -------
98
+ AgentPromptsResponse
99
+ Prompt created successfully
100
+
101
+ Examples
102
+ --------
103
+ from phenoml import phenoml
104
+
105
+ client = phenoml(
106
+ token="YOUR_TOKEN",
107
+ )
108
+ client.agent.prompts.create(
109
+ name="Medical Assistant System Prompt",
110
+ content="You are a helpful medical assistant specialized in FHIR data processing...",
111
+ is_active=True,
112
+ )
113
+ """
114
+ _response = self._raw_client.create(
115
+ name=name,
116
+ content=content,
117
+ is_active=is_active,
118
+ description=description,
119
+ is_default=is_default,
120
+ tags=tags,
121
+ request_options=request_options,
122
+ )
123
+ return _response.data
124
+
125
+ def get(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> AgentPromptsResponse:
126
+ """
127
+ Retrieves a specific prompt by its ID
128
+
129
+ Parameters
130
+ ----------
131
+ id : str
132
+ Prompt ID
133
+
134
+ request_options : typing.Optional[RequestOptions]
135
+ Request-specific configuration.
136
+
137
+ Returns
138
+ -------
139
+ AgentPromptsResponse
140
+ Prompt retrieved successfully
141
+
142
+ Examples
143
+ --------
144
+ from phenoml import phenoml
145
+
146
+ client = phenoml(
147
+ token="YOUR_TOKEN",
148
+ )
149
+ client.agent.prompts.get(
150
+ id="id",
151
+ )
152
+ """
153
+ _response = self._raw_client.get(id, request_options=request_options)
154
+ return _response.data
155
+
156
+ def update(
157
+ self,
158
+ id: str,
159
+ *,
160
+ name: typing.Optional[str] = OMIT,
161
+ description: typing.Optional[str] = OMIT,
162
+ content: typing.Optional[str] = OMIT,
163
+ is_default: typing.Optional[bool] = OMIT,
164
+ is_active: typing.Optional[bool] = OMIT,
165
+ tags: typing.Optional[typing.Sequence[str]] = OMIT,
166
+ request_options: typing.Optional[RequestOptions] = None,
167
+ ) -> AgentPromptsResponse:
168
+ """
169
+ Updates an existing prompt
170
+
171
+ Parameters
172
+ ----------
173
+ id : str
174
+ Prompt ID
175
+
176
+ name : typing.Optional[str]
177
+ Prompt name
178
+
179
+ description : typing.Optional[str]
180
+ Prompt description
181
+
182
+ content : typing.Optional[str]
183
+ Prompt content
184
+
185
+ is_default : typing.Optional[bool]
186
+ Whether this is a default prompt
187
+
188
+ is_active : typing.Optional[bool]
189
+ Whether the prompt is active
190
+
191
+ tags : typing.Optional[typing.Sequence[str]]
192
+ Tags for categorizing the prompt
193
+
194
+ request_options : typing.Optional[RequestOptions]
195
+ Request-specific configuration.
196
+
197
+ Returns
198
+ -------
199
+ AgentPromptsResponse
200
+ Prompt updated successfully
201
+
202
+ Examples
203
+ --------
204
+ from phenoml import phenoml
205
+
206
+ client = phenoml(
207
+ token="YOUR_TOKEN",
208
+ )
209
+ client.agent.prompts.update(
210
+ id="id",
211
+ )
212
+ """
213
+ _response = self._raw_client.update(
214
+ id,
215
+ name=name,
216
+ description=description,
217
+ content=content,
218
+ is_default=is_default,
219
+ is_active=is_active,
220
+ tags=tags,
221
+ request_options=request_options,
222
+ )
223
+ return _response.data
224
+
225
+ def delete(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> PromptsDeleteResponse:
226
+ """
227
+ Soft deletes a prompt by setting is_active to false
228
+
229
+ Parameters
230
+ ----------
231
+ id : str
232
+ Prompt ID
233
+
234
+ request_options : typing.Optional[RequestOptions]
235
+ Request-specific configuration.
236
+
237
+ Returns
238
+ -------
239
+ PromptsDeleteResponse
240
+ Prompt deleted successfully
241
+
242
+ Examples
243
+ --------
244
+ from phenoml import phenoml
245
+
246
+ client = phenoml(
247
+ token="YOUR_TOKEN",
248
+ )
249
+ client.agent.prompts.delete(
250
+ id="id",
251
+ )
252
+ """
253
+ _response = self._raw_client.delete(id, request_options=request_options)
254
+ return _response.data
255
+
256
+ def patch(
257
+ self, id: str, *, request: JsonPatch, request_options: typing.Optional[RequestOptions] = None
258
+ ) -> AgentPromptsResponse:
259
+ """
260
+ Patches an existing prompt
261
+
262
+ Parameters
263
+ ----------
264
+ id : str
265
+ Agent Prompt ID
266
+
267
+ request : JsonPatch
268
+
269
+ request_options : typing.Optional[RequestOptions]
270
+ Request-specific configuration.
271
+
272
+ Returns
273
+ -------
274
+ AgentPromptsResponse
275
+ Prompt patched successfully
276
+
277
+ Examples
278
+ --------
279
+ from phenoml import phenoml
280
+ from phenoml.agent import JsonPatchOperation
281
+
282
+ client = phenoml(
283
+ token="YOUR_TOKEN",
284
+ )
285
+ client.agent.prompts.patch(
286
+ id="id",
287
+ request=[
288
+ JsonPatchOperation(
289
+ op="replace",
290
+ path="/name",
291
+ value="Updated Agent Name",
292
+ ),
293
+ JsonPatchOperation(
294
+ op="add",
295
+ path="/tags/-",
296
+ value="new-tag",
297
+ ),
298
+ JsonPatchOperation(
299
+ op="remove",
300
+ path="/description",
301
+ ),
302
+ ],
303
+ )
304
+ """
305
+ _response = self._raw_client.patch(id, request=request, request_options=request_options)
306
+ return _response.data
307
+
308
+ def load_defaults(self, *, request_options: typing.Optional[RequestOptions] = None) -> SuccessResponse:
309
+ """
310
+ Loads default agent prompts for the authenticated user
311
+
312
+ Parameters
313
+ ----------
314
+ request_options : typing.Optional[RequestOptions]
315
+ Request-specific configuration.
316
+
317
+ Returns
318
+ -------
319
+ SuccessResponse
320
+ Default prompts loaded successfully
321
+
322
+ Examples
323
+ --------
324
+ from phenoml import phenoml
325
+
326
+ client = phenoml(
327
+ token="YOUR_TOKEN",
328
+ )
329
+ client.agent.prompts.load_defaults()
330
+ """
331
+ _response = self._raw_client.load_defaults(request_options=request_options)
332
+ return _response.data
333
+
334
+
335
+ class AsyncPromptsClient:
336
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
337
+ self._raw_client = AsyncRawPromptsClient(client_wrapper=client_wrapper)
338
+
339
+ @property
340
+ def with_raw_response(self) -> AsyncRawPromptsClient:
341
+ """
342
+ Retrieves a raw implementation of this client that returns raw responses.
343
+
344
+ Returns
345
+ -------
346
+ AsyncRawPromptsClient
347
+ """
348
+ return self._raw_client
349
+
350
+ async def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> PromptsListResponse:
351
+ """
352
+ Retrieves a list of agent prompts belonging to the authenticated user
353
+
354
+ Parameters
355
+ ----------
356
+ request_options : typing.Optional[RequestOptions]
357
+ Request-specific configuration.
358
+
359
+ Returns
360
+ -------
361
+ PromptsListResponse
362
+ Prompts retrieved successfully
363
+
364
+ Examples
365
+ --------
366
+ import asyncio
367
+
368
+ from phenoml import Asyncphenoml
369
+
370
+ client = Asyncphenoml(
371
+ token="YOUR_TOKEN",
372
+ )
373
+
374
+
375
+ async def main() -> None:
376
+ await client.agent.prompts.list()
377
+
378
+
379
+ asyncio.run(main())
380
+ """
381
+ _response = await self._raw_client.list(request_options=request_options)
382
+ return _response.data
383
+
384
+ async def create(
385
+ self,
386
+ *,
387
+ name: str,
388
+ content: str,
389
+ is_active: bool,
390
+ description: typing.Optional[str] = OMIT,
391
+ is_default: typing.Optional[bool] = OMIT,
392
+ tags: typing.Optional[typing.Sequence[str]] = OMIT,
393
+ request_options: typing.Optional[RequestOptions] = None,
394
+ ) -> AgentPromptsResponse:
395
+ """
396
+ Creates a new agent prompt
397
+
398
+ Parameters
399
+ ----------
400
+ name : str
401
+ Prompt name
402
+
403
+ content : str
404
+ Prompt content
405
+
406
+ is_active : bool
407
+ Whether the prompt is active
408
+
409
+ description : typing.Optional[str]
410
+ Prompt description
411
+
412
+ is_default : typing.Optional[bool]
413
+ Whether this is a default prompt
414
+
415
+ tags : typing.Optional[typing.Sequence[str]]
416
+ Tags for categorizing the prompt
417
+
418
+ request_options : typing.Optional[RequestOptions]
419
+ Request-specific configuration.
420
+
421
+ Returns
422
+ -------
423
+ AgentPromptsResponse
424
+ Prompt created successfully
425
+
426
+ Examples
427
+ --------
428
+ import asyncio
429
+
430
+ from phenoml import Asyncphenoml
431
+
432
+ client = Asyncphenoml(
433
+ token="YOUR_TOKEN",
434
+ )
435
+
436
+
437
+ async def main() -> None:
438
+ await client.agent.prompts.create(
439
+ name="Medical Assistant System Prompt",
440
+ content="You are a helpful medical assistant specialized in FHIR data processing...",
441
+ is_active=True,
442
+ )
443
+
444
+
445
+ asyncio.run(main())
446
+ """
447
+ _response = await self._raw_client.create(
448
+ name=name,
449
+ content=content,
450
+ is_active=is_active,
451
+ description=description,
452
+ is_default=is_default,
453
+ tags=tags,
454
+ request_options=request_options,
455
+ )
456
+ return _response.data
457
+
458
+ async def get(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> AgentPromptsResponse:
459
+ """
460
+ Retrieves a specific prompt by its ID
461
+
462
+ Parameters
463
+ ----------
464
+ id : str
465
+ Prompt ID
466
+
467
+ request_options : typing.Optional[RequestOptions]
468
+ Request-specific configuration.
469
+
470
+ Returns
471
+ -------
472
+ AgentPromptsResponse
473
+ Prompt retrieved successfully
474
+
475
+ Examples
476
+ --------
477
+ import asyncio
478
+
479
+ from phenoml import Asyncphenoml
480
+
481
+ client = Asyncphenoml(
482
+ token="YOUR_TOKEN",
483
+ )
484
+
485
+
486
+ async def main() -> None:
487
+ await client.agent.prompts.get(
488
+ id="id",
489
+ )
490
+
491
+
492
+ asyncio.run(main())
493
+ """
494
+ _response = await self._raw_client.get(id, request_options=request_options)
495
+ return _response.data
496
+
497
+ async def update(
498
+ self,
499
+ id: str,
500
+ *,
501
+ name: typing.Optional[str] = OMIT,
502
+ description: typing.Optional[str] = OMIT,
503
+ content: typing.Optional[str] = OMIT,
504
+ is_default: typing.Optional[bool] = OMIT,
505
+ is_active: typing.Optional[bool] = OMIT,
506
+ tags: typing.Optional[typing.Sequence[str]] = OMIT,
507
+ request_options: typing.Optional[RequestOptions] = None,
508
+ ) -> AgentPromptsResponse:
509
+ """
510
+ Updates an existing prompt
511
+
512
+ Parameters
513
+ ----------
514
+ id : str
515
+ Prompt ID
516
+
517
+ name : typing.Optional[str]
518
+ Prompt name
519
+
520
+ description : typing.Optional[str]
521
+ Prompt description
522
+
523
+ content : typing.Optional[str]
524
+ Prompt content
525
+
526
+ is_default : typing.Optional[bool]
527
+ Whether this is a default prompt
528
+
529
+ is_active : typing.Optional[bool]
530
+ Whether the prompt is active
531
+
532
+ tags : typing.Optional[typing.Sequence[str]]
533
+ Tags for categorizing the prompt
534
+
535
+ request_options : typing.Optional[RequestOptions]
536
+ Request-specific configuration.
537
+
538
+ Returns
539
+ -------
540
+ AgentPromptsResponse
541
+ Prompt updated successfully
542
+
543
+ Examples
544
+ --------
545
+ import asyncio
546
+
547
+ from phenoml import Asyncphenoml
548
+
549
+ client = Asyncphenoml(
550
+ token="YOUR_TOKEN",
551
+ )
552
+
553
+
554
+ async def main() -> None:
555
+ await client.agent.prompts.update(
556
+ id="id",
557
+ )
558
+
559
+
560
+ asyncio.run(main())
561
+ """
562
+ _response = await self._raw_client.update(
563
+ id,
564
+ name=name,
565
+ description=description,
566
+ content=content,
567
+ is_default=is_default,
568
+ is_active=is_active,
569
+ tags=tags,
570
+ request_options=request_options,
571
+ )
572
+ return _response.data
573
+
574
+ async def delete(
575
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
576
+ ) -> PromptsDeleteResponse:
577
+ """
578
+ Soft deletes a prompt by setting is_active to false
579
+
580
+ Parameters
581
+ ----------
582
+ id : str
583
+ Prompt ID
584
+
585
+ request_options : typing.Optional[RequestOptions]
586
+ Request-specific configuration.
587
+
588
+ Returns
589
+ -------
590
+ PromptsDeleteResponse
591
+ Prompt deleted successfully
592
+
593
+ Examples
594
+ --------
595
+ import asyncio
596
+
597
+ from phenoml import Asyncphenoml
598
+
599
+ client = Asyncphenoml(
600
+ token="YOUR_TOKEN",
601
+ )
602
+
603
+
604
+ async def main() -> None:
605
+ await client.agent.prompts.delete(
606
+ id="id",
607
+ )
608
+
609
+
610
+ asyncio.run(main())
611
+ """
612
+ _response = await self._raw_client.delete(id, request_options=request_options)
613
+ return _response.data
614
+
615
+ async def patch(
616
+ self, id: str, *, request: JsonPatch, request_options: typing.Optional[RequestOptions] = None
617
+ ) -> AgentPromptsResponse:
618
+ """
619
+ Patches an existing prompt
620
+
621
+ Parameters
622
+ ----------
623
+ id : str
624
+ Agent Prompt ID
625
+
626
+ request : JsonPatch
627
+
628
+ request_options : typing.Optional[RequestOptions]
629
+ Request-specific configuration.
630
+
631
+ Returns
632
+ -------
633
+ AgentPromptsResponse
634
+ Prompt patched successfully
635
+
636
+ Examples
637
+ --------
638
+ import asyncio
639
+
640
+ from phenoml import Asyncphenoml
641
+ from phenoml.agent import JsonPatchOperation
642
+
643
+ client = Asyncphenoml(
644
+ token="YOUR_TOKEN",
645
+ )
646
+
647
+
648
+ async def main() -> None:
649
+ await client.agent.prompts.patch(
650
+ id="id",
651
+ request=[
652
+ JsonPatchOperation(
653
+ op="replace",
654
+ path="/name",
655
+ value="Updated Agent Name",
656
+ ),
657
+ JsonPatchOperation(
658
+ op="add",
659
+ path="/tags/-",
660
+ value="new-tag",
661
+ ),
662
+ JsonPatchOperation(
663
+ op="remove",
664
+ path="/description",
665
+ ),
666
+ ],
667
+ )
668
+
669
+
670
+ asyncio.run(main())
671
+ """
672
+ _response = await self._raw_client.patch(id, request=request, request_options=request_options)
673
+ return _response.data
674
+
675
+ async def load_defaults(self, *, request_options: typing.Optional[RequestOptions] = None) -> SuccessResponse:
676
+ """
677
+ Loads default agent prompts for the authenticated user
678
+
679
+ Parameters
680
+ ----------
681
+ request_options : typing.Optional[RequestOptions]
682
+ Request-specific configuration.
683
+
684
+ Returns
685
+ -------
686
+ SuccessResponse
687
+ Default prompts loaded successfully
688
+
689
+ Examples
690
+ --------
691
+ import asyncio
692
+
693
+ from phenoml import Asyncphenoml
694
+
695
+ client = Asyncphenoml(
696
+ token="YOUR_TOKEN",
697
+ )
698
+
699
+
700
+ async def main() -> None:
701
+ await client.agent.prompts.load_defaults()
702
+
703
+
704
+ asyncio.run(main())
705
+ """
706
+ _response = await self._raw_client.load_defaults(request_options=request_options)
707
+ return _response.data