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,820 @@
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 .prompts.client import AsyncPromptsClient, PromptsClient
8
+ from .raw_client import AsyncRawAgentClient, RawAgentClient
9
+ from .types.agent_chat_response import AgentChatResponse
10
+ from .types.agent_create_request_provider import AgentCreateRequestProvider
11
+ from .types.agent_delete_response import AgentDeleteResponse
12
+ from .types.agent_fhir_config import AgentFhirConfig
13
+ from .types.agent_list_response import AgentListResponse
14
+ from .types.agent_response import AgentResponse
15
+ from .types.agent_update_request_provider import AgentUpdateRequestProvider
16
+ from .types.chat_fhir_client_config import ChatFhirClientConfig
17
+ from .types.json_patch import JsonPatch
18
+
19
+ # this is used as the default value for optional parameters
20
+ OMIT = typing.cast(typing.Any, ...)
21
+
22
+
23
+ class AgentClient:
24
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
25
+ self._raw_client = RawAgentClient(client_wrapper=client_wrapper)
26
+ self.prompts = PromptsClient(client_wrapper=client_wrapper)
27
+
28
+ @property
29
+ def with_raw_response(self) -> RawAgentClient:
30
+ """
31
+ Retrieves a raw implementation of this client that returns raw responses.
32
+
33
+ Returns
34
+ -------
35
+ RawAgentClient
36
+ """
37
+ return self._raw_client
38
+
39
+ def create(
40
+ self,
41
+ *,
42
+ name: str,
43
+ prompts: typing.Sequence[str],
44
+ is_active: bool,
45
+ description: typing.Optional[str] = OMIT,
46
+ tags: typing.Optional[typing.Sequence[str]] = OMIT,
47
+ provider: typing.Optional[AgentCreateRequestProvider] = OMIT,
48
+ meta: typing.Optional[AgentFhirConfig] = OMIT,
49
+ request_options: typing.Optional[RequestOptions] = None,
50
+ ) -> AgentResponse:
51
+ """
52
+ Creates a new PhenoAgent with specified configuration
53
+
54
+ Parameters
55
+ ----------
56
+ name : str
57
+ Agent name
58
+
59
+ prompts : typing.Sequence[str]
60
+ Array of prompt IDs to use for this agent
61
+
62
+ is_active : bool
63
+ Whether the agent is active
64
+
65
+ description : typing.Optional[str]
66
+ Agent description
67
+
68
+ tags : typing.Optional[typing.Sequence[str]]
69
+ Tags for categorizing the agent
70
+
71
+ provider : typing.Optional[AgentCreateRequestProvider]
72
+ FHIR provider type - can be a single provider or array of providers
73
+
74
+ meta : typing.Optional[AgentFhirConfig]
75
+
76
+ request_options : typing.Optional[RequestOptions]
77
+ Request-specific configuration.
78
+
79
+ Returns
80
+ -------
81
+ AgentResponse
82
+ Agent created successfully
83
+
84
+ Examples
85
+ --------
86
+ from phenoml import phenoml
87
+
88
+ client = phenoml(
89
+ token="YOUR_TOKEN",
90
+ )
91
+ client.agent.create(
92
+ name="name",
93
+ prompts=["prompt_123", "prompt_456"],
94
+ is_active=True,
95
+ )
96
+ """
97
+ _response = self._raw_client.create(
98
+ name=name,
99
+ prompts=prompts,
100
+ is_active=is_active,
101
+ description=description,
102
+ tags=tags,
103
+ provider=provider,
104
+ meta=meta,
105
+ request_options=request_options,
106
+ )
107
+ return _response.data
108
+
109
+ def list(
110
+ self,
111
+ *,
112
+ is_active: typing.Optional[bool] = None,
113
+ tags: typing.Optional[str] = None,
114
+ request_options: typing.Optional[RequestOptions] = None,
115
+ ) -> AgentListResponse:
116
+ """
117
+ Retrieves a list of PhenoAgents belonging to the authenticated user
118
+
119
+ Parameters
120
+ ----------
121
+ is_active : typing.Optional[bool]
122
+ Filter by active status
123
+
124
+ tags : typing.Optional[str]
125
+ Filter by tags
126
+
127
+ request_options : typing.Optional[RequestOptions]
128
+ Request-specific configuration.
129
+
130
+ Returns
131
+ -------
132
+ AgentListResponse
133
+ Agents retrieved successfully
134
+
135
+ Examples
136
+ --------
137
+ from phenoml import phenoml
138
+
139
+ client = phenoml(
140
+ token="YOUR_TOKEN",
141
+ )
142
+ client.agent.list()
143
+ """
144
+ _response = self._raw_client.list(is_active=is_active, tags=tags, request_options=request_options)
145
+ return _response.data
146
+
147
+ def get(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> AgentResponse:
148
+ """
149
+ Retrieves a specific agent by its ID
150
+
151
+ Parameters
152
+ ----------
153
+ id : str
154
+ Agent ID
155
+
156
+ request_options : typing.Optional[RequestOptions]
157
+ Request-specific configuration.
158
+
159
+ Returns
160
+ -------
161
+ AgentResponse
162
+ Agent retrieved successfully
163
+
164
+ Examples
165
+ --------
166
+ from phenoml import phenoml
167
+
168
+ client = phenoml(
169
+ token="YOUR_TOKEN",
170
+ )
171
+ client.agent.get(
172
+ id="id",
173
+ )
174
+ """
175
+ _response = self._raw_client.get(id, request_options=request_options)
176
+ return _response.data
177
+
178
+ def update(
179
+ self,
180
+ id: str,
181
+ *,
182
+ name: typing.Optional[str] = OMIT,
183
+ description: typing.Optional[str] = OMIT,
184
+ prompts: typing.Optional[typing.Sequence[str]] = OMIT,
185
+ is_active: typing.Optional[bool] = OMIT,
186
+ tags: typing.Optional[typing.Sequence[str]] = OMIT,
187
+ provider: typing.Optional[AgentUpdateRequestProvider] = OMIT,
188
+ meta: typing.Optional[AgentFhirConfig] = OMIT,
189
+ request_options: typing.Optional[RequestOptions] = None,
190
+ ) -> AgentResponse:
191
+ """
192
+ Updates an existing agent's configuration
193
+
194
+ Parameters
195
+ ----------
196
+ id : str
197
+ Agent ID
198
+
199
+ name : typing.Optional[str]
200
+ Agent name
201
+
202
+ description : typing.Optional[str]
203
+ Agent description
204
+
205
+ prompts : typing.Optional[typing.Sequence[str]]
206
+ Array of prompt IDs to use for this agent
207
+
208
+ is_active : typing.Optional[bool]
209
+ Whether the agent is active
210
+
211
+ tags : typing.Optional[typing.Sequence[str]]
212
+ Tags for categorizing the agent
213
+
214
+ provider : typing.Optional[AgentUpdateRequestProvider]
215
+ FHIR provider type - can be a single provider or array of providers
216
+
217
+ meta : typing.Optional[AgentFhirConfig]
218
+
219
+ request_options : typing.Optional[RequestOptions]
220
+ Request-specific configuration.
221
+
222
+ Returns
223
+ -------
224
+ AgentResponse
225
+ Agent updated successfully
226
+
227
+ Examples
228
+ --------
229
+ from phenoml import phenoml
230
+
231
+ client = phenoml(
232
+ token="YOUR_TOKEN",
233
+ )
234
+ client.agent.update(
235
+ id="id",
236
+ )
237
+ """
238
+ _response = self._raw_client.update(
239
+ id,
240
+ name=name,
241
+ description=description,
242
+ prompts=prompts,
243
+ is_active=is_active,
244
+ tags=tags,
245
+ provider=provider,
246
+ meta=meta,
247
+ request_options=request_options,
248
+ )
249
+ return _response.data
250
+
251
+ def delete(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> AgentDeleteResponse:
252
+ """
253
+ Deletes an existing agent
254
+
255
+ Parameters
256
+ ----------
257
+ id : str
258
+ Agent ID
259
+
260
+ request_options : typing.Optional[RequestOptions]
261
+ Request-specific configuration.
262
+
263
+ Returns
264
+ -------
265
+ AgentDeleteResponse
266
+ Agent deleted successfully
267
+
268
+ Examples
269
+ --------
270
+ from phenoml import phenoml
271
+
272
+ client = phenoml(
273
+ token="YOUR_TOKEN",
274
+ )
275
+ client.agent.delete(
276
+ id="id",
277
+ )
278
+ """
279
+ _response = self._raw_client.delete(id, request_options=request_options)
280
+ return _response.data
281
+
282
+ def patch(
283
+ self, id: str, *, request: JsonPatch, request_options: typing.Optional[RequestOptions] = None
284
+ ) -> AgentResponse:
285
+ """
286
+ Patches an existing agent's configuration
287
+
288
+ Parameters
289
+ ----------
290
+ id : str
291
+ Agent ID
292
+
293
+ request : JsonPatch
294
+
295
+ request_options : typing.Optional[RequestOptions]
296
+ Request-specific configuration.
297
+
298
+ Returns
299
+ -------
300
+ AgentResponse
301
+ Agent patched successfully
302
+
303
+ Examples
304
+ --------
305
+ from phenoml import phenoml
306
+ from phenoml.agent import JsonPatchOperation
307
+
308
+ client = phenoml(
309
+ token="YOUR_TOKEN",
310
+ )
311
+ client.agent.patch(
312
+ id="id",
313
+ request=[
314
+ JsonPatchOperation(
315
+ op="replace",
316
+ path="/name",
317
+ value="Updated Agent Name",
318
+ ),
319
+ JsonPatchOperation(
320
+ op="add",
321
+ path="/tags/-",
322
+ value="new-tag",
323
+ ),
324
+ JsonPatchOperation(
325
+ op="remove",
326
+ path="/description",
327
+ ),
328
+ ],
329
+ )
330
+ """
331
+ _response = self._raw_client.patch(id, request=request, request_options=request_options)
332
+ return _response.data
333
+
334
+ def chat(
335
+ self,
336
+ *,
337
+ message: str,
338
+ agent_id: str,
339
+ context: typing.Optional[str] = OMIT,
340
+ session_id: typing.Optional[str] = OMIT,
341
+ meta: typing.Optional[ChatFhirClientConfig] = OMIT,
342
+ request_options: typing.Optional[RequestOptions] = None,
343
+ ) -> AgentChatResponse:
344
+ """
345
+ Send a message to an agent and receive a response
346
+
347
+ Parameters
348
+ ----------
349
+ message : str
350
+ The message to send to the agent
351
+
352
+ agent_id : str
353
+ The ID of the agent to chat with
354
+
355
+ context : typing.Optional[str]
356
+ Optional context for the conversation
357
+
358
+ session_id : typing.Optional[str]
359
+ Optional session ID for conversation continuity
360
+
361
+ meta : typing.Optional[ChatFhirClientConfig]
362
+ Optional user-specific FHIR configuration overrides
363
+
364
+ request_options : typing.Optional[RequestOptions]
365
+ Request-specific configuration.
366
+
367
+ Returns
368
+ -------
369
+ AgentChatResponse
370
+ Chat response received successfully
371
+
372
+ Examples
373
+ --------
374
+ from phenoml import phenoml
375
+
376
+ client = phenoml(
377
+ token="YOUR_TOKEN",
378
+ )
379
+ client.agent.chat(
380
+ message="What is the patient's current condition?",
381
+ agent_id="agent-123",
382
+ )
383
+ """
384
+ _response = self._raw_client.chat(
385
+ message=message,
386
+ agent_id=agent_id,
387
+ context=context,
388
+ session_id=session_id,
389
+ meta=meta,
390
+ request_options=request_options,
391
+ )
392
+ return _response.data
393
+
394
+
395
+ class AsyncAgentClient:
396
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
397
+ self._raw_client = AsyncRawAgentClient(client_wrapper=client_wrapper)
398
+ self.prompts = AsyncPromptsClient(client_wrapper=client_wrapper)
399
+
400
+ @property
401
+ def with_raw_response(self) -> AsyncRawAgentClient:
402
+ """
403
+ Retrieves a raw implementation of this client that returns raw responses.
404
+
405
+ Returns
406
+ -------
407
+ AsyncRawAgentClient
408
+ """
409
+ return self._raw_client
410
+
411
+ async def create(
412
+ self,
413
+ *,
414
+ name: str,
415
+ prompts: typing.Sequence[str],
416
+ is_active: bool,
417
+ description: typing.Optional[str] = OMIT,
418
+ tags: typing.Optional[typing.Sequence[str]] = OMIT,
419
+ provider: typing.Optional[AgentCreateRequestProvider] = OMIT,
420
+ meta: typing.Optional[AgentFhirConfig] = OMIT,
421
+ request_options: typing.Optional[RequestOptions] = None,
422
+ ) -> AgentResponse:
423
+ """
424
+ Creates a new PhenoAgent with specified configuration
425
+
426
+ Parameters
427
+ ----------
428
+ name : str
429
+ Agent name
430
+
431
+ prompts : typing.Sequence[str]
432
+ Array of prompt IDs to use for this agent
433
+
434
+ is_active : bool
435
+ Whether the agent is active
436
+
437
+ description : typing.Optional[str]
438
+ Agent description
439
+
440
+ tags : typing.Optional[typing.Sequence[str]]
441
+ Tags for categorizing the agent
442
+
443
+ provider : typing.Optional[AgentCreateRequestProvider]
444
+ FHIR provider type - can be a single provider or array of providers
445
+
446
+ meta : typing.Optional[AgentFhirConfig]
447
+
448
+ request_options : typing.Optional[RequestOptions]
449
+ Request-specific configuration.
450
+
451
+ Returns
452
+ -------
453
+ AgentResponse
454
+ Agent created successfully
455
+
456
+ Examples
457
+ --------
458
+ import asyncio
459
+
460
+ from phenoml import Asyncphenoml
461
+
462
+ client = Asyncphenoml(
463
+ token="YOUR_TOKEN",
464
+ )
465
+
466
+
467
+ async def main() -> None:
468
+ await client.agent.create(
469
+ name="name",
470
+ prompts=["prompt_123", "prompt_456"],
471
+ is_active=True,
472
+ )
473
+
474
+
475
+ asyncio.run(main())
476
+ """
477
+ _response = await self._raw_client.create(
478
+ name=name,
479
+ prompts=prompts,
480
+ is_active=is_active,
481
+ description=description,
482
+ tags=tags,
483
+ provider=provider,
484
+ meta=meta,
485
+ request_options=request_options,
486
+ )
487
+ return _response.data
488
+
489
+ async def list(
490
+ self,
491
+ *,
492
+ is_active: typing.Optional[bool] = None,
493
+ tags: typing.Optional[str] = None,
494
+ request_options: typing.Optional[RequestOptions] = None,
495
+ ) -> AgentListResponse:
496
+ """
497
+ Retrieves a list of PhenoAgents belonging to the authenticated user
498
+
499
+ Parameters
500
+ ----------
501
+ is_active : typing.Optional[bool]
502
+ Filter by active status
503
+
504
+ tags : typing.Optional[str]
505
+ Filter by tags
506
+
507
+ request_options : typing.Optional[RequestOptions]
508
+ Request-specific configuration.
509
+
510
+ Returns
511
+ -------
512
+ AgentListResponse
513
+ Agents retrieved successfully
514
+
515
+ Examples
516
+ --------
517
+ import asyncio
518
+
519
+ from phenoml import Asyncphenoml
520
+
521
+ client = Asyncphenoml(
522
+ token="YOUR_TOKEN",
523
+ )
524
+
525
+
526
+ async def main() -> None:
527
+ await client.agent.list()
528
+
529
+
530
+ asyncio.run(main())
531
+ """
532
+ _response = await self._raw_client.list(is_active=is_active, tags=tags, request_options=request_options)
533
+ return _response.data
534
+
535
+ async def get(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> AgentResponse:
536
+ """
537
+ Retrieves a specific agent by its ID
538
+
539
+ Parameters
540
+ ----------
541
+ id : str
542
+ Agent ID
543
+
544
+ request_options : typing.Optional[RequestOptions]
545
+ Request-specific configuration.
546
+
547
+ Returns
548
+ -------
549
+ AgentResponse
550
+ Agent retrieved successfully
551
+
552
+ Examples
553
+ --------
554
+ import asyncio
555
+
556
+ from phenoml import Asyncphenoml
557
+
558
+ client = Asyncphenoml(
559
+ token="YOUR_TOKEN",
560
+ )
561
+
562
+
563
+ async def main() -> None:
564
+ await client.agent.get(
565
+ id="id",
566
+ )
567
+
568
+
569
+ asyncio.run(main())
570
+ """
571
+ _response = await self._raw_client.get(id, request_options=request_options)
572
+ return _response.data
573
+
574
+ async def update(
575
+ self,
576
+ id: str,
577
+ *,
578
+ name: typing.Optional[str] = OMIT,
579
+ description: typing.Optional[str] = OMIT,
580
+ prompts: typing.Optional[typing.Sequence[str]] = OMIT,
581
+ is_active: typing.Optional[bool] = OMIT,
582
+ tags: typing.Optional[typing.Sequence[str]] = OMIT,
583
+ provider: typing.Optional[AgentUpdateRequestProvider] = OMIT,
584
+ meta: typing.Optional[AgentFhirConfig] = OMIT,
585
+ request_options: typing.Optional[RequestOptions] = None,
586
+ ) -> AgentResponse:
587
+ """
588
+ Updates an existing agent's configuration
589
+
590
+ Parameters
591
+ ----------
592
+ id : str
593
+ Agent ID
594
+
595
+ name : typing.Optional[str]
596
+ Agent name
597
+
598
+ description : typing.Optional[str]
599
+ Agent description
600
+
601
+ prompts : typing.Optional[typing.Sequence[str]]
602
+ Array of prompt IDs to use for this agent
603
+
604
+ is_active : typing.Optional[bool]
605
+ Whether the agent is active
606
+
607
+ tags : typing.Optional[typing.Sequence[str]]
608
+ Tags for categorizing the agent
609
+
610
+ provider : typing.Optional[AgentUpdateRequestProvider]
611
+ FHIR provider type - can be a single provider or array of providers
612
+
613
+ meta : typing.Optional[AgentFhirConfig]
614
+
615
+ request_options : typing.Optional[RequestOptions]
616
+ Request-specific configuration.
617
+
618
+ Returns
619
+ -------
620
+ AgentResponse
621
+ Agent updated successfully
622
+
623
+ Examples
624
+ --------
625
+ import asyncio
626
+
627
+ from phenoml import Asyncphenoml
628
+
629
+ client = Asyncphenoml(
630
+ token="YOUR_TOKEN",
631
+ )
632
+
633
+
634
+ async def main() -> None:
635
+ await client.agent.update(
636
+ id="id",
637
+ )
638
+
639
+
640
+ asyncio.run(main())
641
+ """
642
+ _response = await self._raw_client.update(
643
+ id,
644
+ name=name,
645
+ description=description,
646
+ prompts=prompts,
647
+ is_active=is_active,
648
+ tags=tags,
649
+ provider=provider,
650
+ meta=meta,
651
+ request_options=request_options,
652
+ )
653
+ return _response.data
654
+
655
+ async def delete(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> AgentDeleteResponse:
656
+ """
657
+ Deletes an existing agent
658
+
659
+ Parameters
660
+ ----------
661
+ id : str
662
+ Agent ID
663
+
664
+ request_options : typing.Optional[RequestOptions]
665
+ Request-specific configuration.
666
+
667
+ Returns
668
+ -------
669
+ AgentDeleteResponse
670
+ Agent deleted successfully
671
+
672
+ Examples
673
+ --------
674
+ import asyncio
675
+
676
+ from phenoml import Asyncphenoml
677
+
678
+ client = Asyncphenoml(
679
+ token="YOUR_TOKEN",
680
+ )
681
+
682
+
683
+ async def main() -> None:
684
+ await client.agent.delete(
685
+ id="id",
686
+ )
687
+
688
+
689
+ asyncio.run(main())
690
+ """
691
+ _response = await self._raw_client.delete(id, request_options=request_options)
692
+ return _response.data
693
+
694
+ async def patch(
695
+ self, id: str, *, request: JsonPatch, request_options: typing.Optional[RequestOptions] = None
696
+ ) -> AgentResponse:
697
+ """
698
+ Patches an existing agent's configuration
699
+
700
+ Parameters
701
+ ----------
702
+ id : str
703
+ Agent ID
704
+
705
+ request : JsonPatch
706
+
707
+ request_options : typing.Optional[RequestOptions]
708
+ Request-specific configuration.
709
+
710
+ Returns
711
+ -------
712
+ AgentResponse
713
+ Agent patched successfully
714
+
715
+ Examples
716
+ --------
717
+ import asyncio
718
+
719
+ from phenoml import Asyncphenoml
720
+ from phenoml.agent import JsonPatchOperation
721
+
722
+ client = Asyncphenoml(
723
+ token="YOUR_TOKEN",
724
+ )
725
+
726
+
727
+ async def main() -> None:
728
+ await client.agent.patch(
729
+ id="id",
730
+ request=[
731
+ JsonPatchOperation(
732
+ op="replace",
733
+ path="/name",
734
+ value="Updated Agent Name",
735
+ ),
736
+ JsonPatchOperation(
737
+ op="add",
738
+ path="/tags/-",
739
+ value="new-tag",
740
+ ),
741
+ JsonPatchOperation(
742
+ op="remove",
743
+ path="/description",
744
+ ),
745
+ ],
746
+ )
747
+
748
+
749
+ asyncio.run(main())
750
+ """
751
+ _response = await self._raw_client.patch(id, request=request, request_options=request_options)
752
+ return _response.data
753
+
754
+ async def chat(
755
+ self,
756
+ *,
757
+ message: str,
758
+ agent_id: str,
759
+ context: typing.Optional[str] = OMIT,
760
+ session_id: typing.Optional[str] = OMIT,
761
+ meta: typing.Optional[ChatFhirClientConfig] = OMIT,
762
+ request_options: typing.Optional[RequestOptions] = None,
763
+ ) -> AgentChatResponse:
764
+ """
765
+ Send a message to an agent and receive a response
766
+
767
+ Parameters
768
+ ----------
769
+ message : str
770
+ The message to send to the agent
771
+
772
+ agent_id : str
773
+ The ID of the agent to chat with
774
+
775
+ context : typing.Optional[str]
776
+ Optional context for the conversation
777
+
778
+ session_id : typing.Optional[str]
779
+ Optional session ID for conversation continuity
780
+
781
+ meta : typing.Optional[ChatFhirClientConfig]
782
+ Optional user-specific FHIR configuration overrides
783
+
784
+ request_options : typing.Optional[RequestOptions]
785
+ Request-specific configuration.
786
+
787
+ Returns
788
+ -------
789
+ AgentChatResponse
790
+ Chat response received successfully
791
+
792
+ Examples
793
+ --------
794
+ import asyncio
795
+
796
+ from phenoml import Asyncphenoml
797
+
798
+ client = Asyncphenoml(
799
+ token="YOUR_TOKEN",
800
+ )
801
+
802
+
803
+ async def main() -> None:
804
+ await client.agent.chat(
805
+ message="What is the patient's current condition?",
806
+ agent_id="agent-123",
807
+ )
808
+
809
+
810
+ asyncio.run(main())
811
+ """
812
+ _response = await self._raw_client.chat(
813
+ message=message,
814
+ agent_id=agent_id,
815
+ context=context,
816
+ session_id=session_id,
817
+ meta=meta,
818
+ request_options=request_options,
819
+ )
820
+ return _response.data