phenoml 0.0.2__py3-none-any.whl → 0.0.17__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 (149) hide show
  1. phenoml/agent/__init__.py +6 -8
  2. phenoml/agent/client.py +85 -67
  3. phenoml/agent/raw_client.py +61 -77
  4. phenoml/agent/types/__init__.py +6 -8
  5. phenoml/agent/types/agent_create_request.py +53 -0
  6. phenoml/agent/types/agent_create_request_provider.py +5 -0
  7. phenoml/agent/types/agent_template.py +3 -6
  8. phenoml/agent/types/agent_template_provider.py +5 -0
  9. phenoml/agent/types/json_patch_operation.py +5 -1
  10. phenoml/client.py +12 -0
  11. phenoml/construe/__init__.py +2 -16
  12. phenoml/construe/client.py +0 -90
  13. phenoml/construe/raw_client.py +0 -180
  14. phenoml/construe/types/__init__.py +2 -20
  15. phenoml/construe/types/extract_request_config.py +33 -4
  16. phenoml/construe/types/extract_request_config_chunking_method.py +3 -1
  17. phenoml/construe/types/extract_request_config_validation_method.py +5 -0
  18. phenoml/construe/types/extract_request_system.py +2 -0
  19. phenoml/core/client_wrapper.py +2 -2
  20. phenoml/fhir/__init__.py +36 -0
  21. phenoml/fhir/client.py +1072 -0
  22. phenoml/fhir/errors/__init__.py +10 -0
  23. phenoml/fhir/errors/bad_request_error.py +10 -0
  24. phenoml/fhir/errors/internal_server_error.py +10 -0
  25. phenoml/fhir/errors/not_found_error.py +10 -0
  26. phenoml/fhir/errors/unauthorized_error.py +10 -0
  27. phenoml/fhir/raw_client.py +1469 -0
  28. phenoml/fhir/types/__init__.py +29 -0
  29. phenoml/{agent/types/chat_fhir_client_config.py → fhir/types/error_response.py} +11 -6
  30. phenoml/fhir/types/fhir_bundle.py +43 -0
  31. phenoml/fhir/types/fhir_bundle_entry_item.py +34 -0
  32. phenoml/fhir/types/fhir_bundle_entry_item_request.py +25 -0
  33. phenoml/fhir/types/fhir_bundle_entry_item_request_method.py +5 -0
  34. phenoml/{construe/types/bad_request_error_body.py → fhir/types/fhir_bundle_entry_item_response.py} +4 -7
  35. phenoml/fhir/types/fhir_patch_request_body_item.py +40 -0
  36. phenoml/fhir/types/fhir_patch_request_body_item_op.py +7 -0
  37. phenoml/fhir/types/fhir_resource.py +40 -0
  38. phenoml/fhir/types/fhir_resource_meta.py +28 -0
  39. phenoml/fhir/types/fhir_search_response.py +8 -0
  40. phenoml/fhir_provider/__init__.py +45 -0
  41. phenoml/fhir_provider/client.py +748 -0
  42. phenoml/fhir_provider/errors/__init__.py +11 -0
  43. phenoml/fhir_provider/errors/bad_request_error.py +10 -0
  44. phenoml/fhir_provider/errors/forbidden_error.py +10 -0
  45. phenoml/fhir_provider/errors/internal_server_error.py +10 -0
  46. phenoml/fhir_provider/errors/not_found_error.py +10 -0
  47. phenoml/fhir_provider/errors/unauthorized_error.py +10 -0
  48. phenoml/fhir_provider/raw_client.py +1462 -0
  49. phenoml/fhir_provider/types/__init__.py +37 -0
  50. phenoml/fhir_provider/types/auth_method.py +7 -0
  51. phenoml/fhir_provider/types/fhir_provider_auth_config.py +53 -0
  52. phenoml/fhir_provider/types/fhir_provider_delete_response.py +20 -0
  53. phenoml/fhir_provider/types/fhir_provider_list_response.py +22 -0
  54. phenoml/fhir_provider/types/fhir_provider_remove_auth_config_response.py +22 -0
  55. phenoml/fhir_provider/types/fhir_provider_response.py +22 -0
  56. phenoml/fhir_provider/types/fhir_provider_set_active_auth_config_response.py +22 -0
  57. phenoml/fhir_provider/types/fhir_provider_template.py +66 -0
  58. phenoml/fhir_provider/types/fhir_query_response.py +27 -0
  59. phenoml/fhir_provider/types/fhir_query_response_data.py +5 -0
  60. phenoml/fhir_provider/types/json_web_key.py +51 -0
  61. phenoml/fhir_provider/types/provider.py +8 -0
  62. phenoml/fhir_provider/types/role.py +27 -0
  63. phenoml/fhir_provider/types/service_account_key.py +35 -0
  64. phenoml/fhir_provider/types/smart_configuration.py +46 -0
  65. phenoml/lang2fhir/__init__.py +10 -0
  66. phenoml/lang2fhir/client.py +111 -6
  67. phenoml/lang2fhir/raw_client.py +189 -0
  68. phenoml/lang2fhir/types/__init__.py +10 -0
  69. phenoml/lang2fhir/types/create_multi_response.py +39 -0
  70. phenoml/lang2fhir/types/create_multi_response_bundle.py +28 -0
  71. phenoml/lang2fhir/types/create_multi_response_bundle_entry_item.py +24 -0
  72. phenoml/lang2fhir/types/create_multi_response_bundle_entry_item_request.py +20 -0
  73. phenoml/{construe/types/construe_cohort_response_queries_item_code_extract_results_item_codes_item.py → lang2fhir/types/create_multi_response_resources_item.py} +13 -7
  74. phenoml/summary/__init__.py +41 -0
  75. phenoml/summary/client.py +668 -0
  76. phenoml/summary/errors/__init__.py +11 -0
  77. phenoml/summary/errors/bad_request_error.py +10 -0
  78. phenoml/summary/errors/forbidden_error.py +10 -0
  79. phenoml/summary/errors/internal_server_error.py +10 -0
  80. phenoml/summary/errors/not_found_error.py +10 -0
  81. phenoml/summary/errors/unauthorized_error.py +10 -0
  82. phenoml/summary/raw_client.py +1202 -0
  83. phenoml/summary/types/__init__.py +33 -0
  84. phenoml/summary/types/create_summary_request_fhir_resources.py +8 -0
  85. phenoml/summary/types/create_summary_request_mode.py +5 -0
  86. phenoml/{agent/types/agent_fhir_config.py → summary/types/create_summary_response.py} +7 -9
  87. phenoml/summary/types/create_summary_template_response.py +23 -0
  88. phenoml/{construe/types/unauthorized_error_body.py → summary/types/error_response.py} +4 -8
  89. phenoml/summary/types/fhir_bundle.py +23 -0
  90. phenoml/summary/types/fhir_bundle_entry_item.py +20 -0
  91. phenoml/summary/types/fhir_resource.py +24 -0
  92. phenoml/summary/types/summary_delete_template_response.py +20 -0
  93. phenoml/summary/types/summary_get_template_response.py +21 -0
  94. phenoml/summary/types/summary_list_templates_response.py +21 -0
  95. phenoml/summary/types/summary_template.py +41 -0
  96. phenoml/summary/types/summary_update_template_response.py +22 -0
  97. phenoml/tools/__init__.py +6 -8
  98. phenoml/tools/client.py +259 -44
  99. phenoml/tools/raw_client.py +347 -55
  100. phenoml/tools/types/__init__.py +6 -8
  101. phenoml/tools/types/lang2fhir_and_create_multi_response.py +41 -0
  102. phenoml/{construe/types/construe_cohort_response_queries_item_code_extract_results_item.py → tools/types/lang2fhir_and_create_multi_response_resource_info_item.py} +14 -7
  103. phenoml/tools/types/lang2fhir_and_create_multi_response_response_bundle.py +27 -0
  104. phenoml/workflows/__init__.py +61 -0
  105. phenoml/workflows/client.py +694 -0
  106. phenoml/workflows/errors/__init__.py +11 -0
  107. phenoml/workflows/errors/bad_request_error.py +10 -0
  108. phenoml/workflows/errors/forbidden_error.py +10 -0
  109. phenoml/workflows/errors/internal_server_error.py +10 -0
  110. phenoml/workflows/errors/not_found_error.py +10 -0
  111. phenoml/workflows/errors/unauthorized_error.py +10 -0
  112. phenoml/workflows/raw_client.py +1266 -0
  113. phenoml/workflows/types/__init__.py +53 -0
  114. phenoml/workflows/types/create_workflow_request_fhir_provider_id.py +5 -0
  115. phenoml/workflows/types/create_workflow_response.py +44 -0
  116. phenoml/{tools/types/fhir_client_config.py → workflows/types/decision_node_definition.py} +7 -6
  117. phenoml/workflows/types/execute_workflow_response.py +30 -0
  118. phenoml/{construe/types/internal_server_error_body.py → workflows/types/execute_workflow_response_results.py} +3 -8
  119. phenoml/workflows/types/lang2fhir_create_definition.py +37 -0
  120. phenoml/workflows/types/lang2fhir_search_definition.py +42 -0
  121. phenoml/workflows/types/list_workflows_response.py +39 -0
  122. phenoml/workflows/types/step_operation.py +26 -0
  123. phenoml/workflows/types/sub_workflow_definition.py +32 -0
  124. phenoml/workflows/types/update_workflow_request_fhir_provider_id.py +5 -0
  125. phenoml/workflows/types/workflow_config.py +27 -0
  126. phenoml/workflows/types/workflow_definition.py +57 -0
  127. phenoml/workflows/types/workflow_graph.py +23 -0
  128. phenoml/workflows/types/workflow_response.py +61 -0
  129. phenoml/workflows/types/workflow_response_graph.py +23 -0
  130. phenoml/workflows/types/workflow_step.py +55 -0
  131. phenoml/workflows/types/workflow_step_summary.py +47 -0
  132. phenoml/workflows/types/workflow_step_summary_type.py +5 -0
  133. phenoml/workflows/types/workflow_step_type.py +5 -0
  134. phenoml/workflows/types/workflows_delete_response.py +20 -0
  135. phenoml/workflows/types/workflows_get_response.py +26 -0
  136. phenoml/workflows/types/workflows_update_response.py +31 -0
  137. phenoml-0.0.17.dist-info/LICENSE +21 -0
  138. {phenoml-0.0.2.dist-info → phenoml-0.0.17.dist-info}/METADATA +1 -1
  139. phenoml-0.0.17.dist-info/RECORD +251 -0
  140. phenoml/agent/types/agent_provider.py +0 -7
  141. phenoml/agent/types/provider_type.py +0 -5
  142. phenoml/construe/types/construe_cohort_request_config.py +0 -37
  143. phenoml/construe/types/construe_cohort_response.py +0 -33
  144. phenoml/construe/types/construe_cohort_response_queries_item.py +0 -49
  145. phenoml/tools/types/cohort_request_provider.py +0 -5
  146. phenoml/tools/types/lang2fhir_and_create_request_provider.py +0 -7
  147. phenoml/tools/types/lang2fhir_and_search_request_provider.py +0 -7
  148. phenoml-0.0.2.dist-info/RECORD +0 -153
  149. {phenoml-0.0.2.dist-info → phenoml-0.0.17.dist-info}/WHEEL +0 -0
@@ -16,14 +16,12 @@ from .errors.internal_server_error import InternalServerError
16
16
  from .errors.not_found_error import NotFoundError
17
17
  from .errors.unauthorized_error import UnauthorizedError
18
18
  from .types.agent_chat_response import AgentChatResponse
19
+ from .types.agent_create_request_provider import AgentCreateRequestProvider
19
20
  from .types.agent_delete_response import AgentDeleteResponse
20
- from .types.agent_fhir_config import AgentFhirConfig
21
21
  from .types.agent_get_chat_messages_request_order import AgentGetChatMessagesRequestOrder
22
22
  from .types.agent_get_chat_messages_response import AgentGetChatMessagesResponse
23
23
  from .types.agent_list_response import AgentListResponse
24
- from .types.agent_provider import AgentProvider
25
24
  from .types.agent_response import AgentResponse
26
- from .types.chat_fhir_client_config import ChatFhirClientConfig
27
25
  from .types.json_patch import JsonPatch
28
26
 
29
27
  # this is used as the default value for optional parameters
@@ -43,8 +41,7 @@ class RawAgentClient:
43
41
  description: typing.Optional[str] = OMIT,
44
42
  tools: typing.Optional[typing.Sequence[str]] = OMIT,
45
43
  tags: typing.Optional[typing.Sequence[str]] = OMIT,
46
- provider: typing.Optional[AgentProvider] = OMIT,
47
- meta: typing.Optional[AgentFhirConfig] = OMIT,
44
+ provider: typing.Optional[AgentCreateRequestProvider] = OMIT,
48
45
  request_options: typing.Optional[RequestOptions] = None,
49
46
  ) -> HttpResponse[AgentResponse]:
50
47
  """
@@ -70,10 +67,8 @@ class RawAgentClient:
70
67
  tags : typing.Optional[typing.Sequence[str]]
71
68
  Tags for categorizing the agent
72
69
 
73
- provider : typing.Optional[AgentProvider]
74
- FHIR provider type - can be a single provider or array of providers
75
-
76
- meta : typing.Optional[AgentFhirConfig]
70
+ provider : typing.Optional[AgentCreateRequestProvider]
71
+ FHIR provider ID(s) - must be valid UUIDs from existing FHIR providers
77
72
 
78
73
  request_options : typing.Optional[RequestOptions]
79
74
  Request-specific configuration.
@@ -94,10 +89,7 @@ class RawAgentClient:
94
89
  "is_active": is_active,
95
90
  "tags": tags,
96
91
  "provider": convert_and_respect_annotation_metadata(
97
- object_=provider, annotation=AgentProvider, direction="write"
98
- ),
99
- "meta": convert_and_respect_annotation_metadata(
100
- object_=meta, annotation=AgentFhirConfig, direction="write"
92
+ object_=provider, annotation=AgentCreateRequestProvider, direction="write"
101
93
  ),
102
94
  },
103
95
  headers={
@@ -333,14 +325,13 @@ class RawAgentClient:
333
325
  self,
334
326
  id: str,
335
327
  *,
336
- name: typing.Optional[str] = OMIT,
328
+ name: str,
329
+ prompts: typing.Sequence[str],
330
+ is_active: bool,
337
331
  description: typing.Optional[str] = OMIT,
338
- prompts: typing.Optional[typing.Sequence[str]] = OMIT,
339
332
  tools: typing.Optional[typing.Sequence[str]] = OMIT,
340
- is_active: typing.Optional[bool] = OMIT,
341
333
  tags: typing.Optional[typing.Sequence[str]] = OMIT,
342
- provider: typing.Optional[AgentProvider] = OMIT,
343
- meta: typing.Optional[AgentFhirConfig] = OMIT,
334
+ provider: typing.Optional[AgentCreateRequestProvider] = OMIT,
344
335
  request_options: typing.Optional[RequestOptions] = None,
345
336
  ) -> HttpResponse[AgentResponse]:
346
337
  """
@@ -351,28 +342,26 @@ class RawAgentClient:
351
342
  id : str
352
343
  Agent ID
353
344
 
354
- name : typing.Optional[str]
345
+ name : str
355
346
  Agent name
356
347
 
348
+ prompts : typing.Sequence[str]
349
+ Array of prompt IDs to use for this agent
350
+
351
+ is_active : bool
352
+ Whether the agent is active
353
+
357
354
  description : typing.Optional[str]
358
355
  Agent description
359
356
 
360
- prompts : typing.Optional[typing.Sequence[str]]
361
- Array of prompt IDs to use for this agent
362
-
363
357
  tools : typing.Optional[typing.Sequence[str]]
364
358
  Array of MCP server tool IDs to use for this agent
365
359
 
366
- is_active : typing.Optional[bool]
367
- Whether the agent is active
368
-
369
360
  tags : typing.Optional[typing.Sequence[str]]
370
361
  Tags for categorizing the agent
371
362
 
372
- provider : typing.Optional[AgentProvider]
373
- FHIR provider type - can be a single provider or array of providers
374
-
375
- meta : typing.Optional[AgentFhirConfig]
363
+ provider : typing.Optional[AgentCreateRequestProvider]
364
+ FHIR provider ID(s) - must be valid UUIDs from existing FHIR providers
376
365
 
377
366
  request_options : typing.Optional[RequestOptions]
378
367
  Request-specific configuration.
@@ -393,10 +382,7 @@ class RawAgentClient:
393
382
  "is_active": is_active,
394
383
  "tags": tags,
395
384
  "provider": convert_and_respect_annotation_metadata(
396
- object_=provider, annotation=AgentProvider, direction="write"
397
- ),
398
- "meta": convert_and_respect_annotation_metadata(
399
- object_=meta, annotation=AgentFhirConfig, direction="write"
385
+ object_=provider, annotation=AgentCreateRequestProvider, direction="write"
400
386
  ),
401
387
  },
402
388
  headers={
@@ -664,9 +650,10 @@ class RawAgentClient:
664
650
  *,
665
651
  message: str,
666
652
  agent_id: str,
653
+ phenoml_on_behalf_of: typing.Optional[str] = None,
654
+ phenoml_fhir_provider: typing.Optional[str] = None,
667
655
  context: typing.Optional[str] = OMIT,
668
656
  session_id: typing.Optional[str] = OMIT,
669
- meta: typing.Optional[ChatFhirClientConfig] = OMIT,
670
657
  request_options: typing.Optional[RequestOptions] = None,
671
658
  ) -> HttpResponse[AgentChatResponse]:
672
659
  """
@@ -680,15 +667,20 @@ class RawAgentClient:
680
667
  agent_id : str
681
668
  The ID of the agent to chat with
682
669
 
670
+ phenoml_on_behalf_of : typing.Optional[str]
671
+ Optional header for on-behalf-of authentication. Used when making requests on behalf of another user or entity.
672
+ Must be in the format: Patient/{uuid} or Practitioner/{uuid}
673
+
674
+ phenoml_fhir_provider : typing.Optional[str]
675
+ Optional header for FHIR provider authentication. Contains credentials in the format {fhir_provider_id}:{oauth2_token}.
676
+ Multiple FHIR provider integrations can be provided as comma-separated values.
677
+
683
678
  context : typing.Optional[str]
684
679
  Optional context for the conversation
685
680
 
686
681
  session_id : typing.Optional[str]
687
682
  Optional session ID for conversation continuity
688
683
 
689
- meta : typing.Optional[ChatFhirClientConfig]
690
- Optional user-specific FHIR configuration overrides
691
-
692
684
  request_options : typing.Optional[RequestOptions]
693
685
  Request-specific configuration.
694
686
 
@@ -705,12 +697,11 @@ class RawAgentClient:
705
697
  "context": context,
706
698
  "session_id": session_id,
707
699
  "agent_id": agent_id,
708
- "meta": convert_and_respect_annotation_metadata(
709
- object_=meta, annotation=ChatFhirClientConfig, direction="write"
710
- ),
711
700
  },
712
701
  headers={
713
702
  "content-type": "application/json",
703
+ "X-Phenoml-On-Behalf-Of": str(phenoml_on_behalf_of) if phenoml_on_behalf_of is not None else None,
704
+ "X-Phenoml-Fhir-Provider": str(phenoml_fhir_provider) if phenoml_fhir_provider is not None else None,
714
705
  },
715
706
  request_options=request_options,
716
707
  omit=OMIT,
@@ -881,8 +872,7 @@ class AsyncRawAgentClient:
881
872
  description: typing.Optional[str] = OMIT,
882
873
  tools: typing.Optional[typing.Sequence[str]] = OMIT,
883
874
  tags: typing.Optional[typing.Sequence[str]] = OMIT,
884
- provider: typing.Optional[AgentProvider] = OMIT,
885
- meta: typing.Optional[AgentFhirConfig] = OMIT,
875
+ provider: typing.Optional[AgentCreateRequestProvider] = OMIT,
886
876
  request_options: typing.Optional[RequestOptions] = None,
887
877
  ) -> AsyncHttpResponse[AgentResponse]:
888
878
  """
@@ -908,10 +898,8 @@ class AsyncRawAgentClient:
908
898
  tags : typing.Optional[typing.Sequence[str]]
909
899
  Tags for categorizing the agent
910
900
 
911
- provider : typing.Optional[AgentProvider]
912
- FHIR provider type - can be a single provider or array of providers
913
-
914
- meta : typing.Optional[AgentFhirConfig]
901
+ provider : typing.Optional[AgentCreateRequestProvider]
902
+ FHIR provider ID(s) - must be valid UUIDs from existing FHIR providers
915
903
 
916
904
  request_options : typing.Optional[RequestOptions]
917
905
  Request-specific configuration.
@@ -932,10 +920,7 @@ class AsyncRawAgentClient:
932
920
  "is_active": is_active,
933
921
  "tags": tags,
934
922
  "provider": convert_and_respect_annotation_metadata(
935
- object_=provider, annotation=AgentProvider, direction="write"
936
- ),
937
- "meta": convert_and_respect_annotation_metadata(
938
- object_=meta, annotation=AgentFhirConfig, direction="write"
923
+ object_=provider, annotation=AgentCreateRequestProvider, direction="write"
939
924
  ),
940
925
  },
941
926
  headers={
@@ -1173,14 +1158,13 @@ class AsyncRawAgentClient:
1173
1158
  self,
1174
1159
  id: str,
1175
1160
  *,
1176
- name: typing.Optional[str] = OMIT,
1161
+ name: str,
1162
+ prompts: typing.Sequence[str],
1163
+ is_active: bool,
1177
1164
  description: typing.Optional[str] = OMIT,
1178
- prompts: typing.Optional[typing.Sequence[str]] = OMIT,
1179
1165
  tools: typing.Optional[typing.Sequence[str]] = OMIT,
1180
- is_active: typing.Optional[bool] = OMIT,
1181
1166
  tags: typing.Optional[typing.Sequence[str]] = OMIT,
1182
- provider: typing.Optional[AgentProvider] = OMIT,
1183
- meta: typing.Optional[AgentFhirConfig] = OMIT,
1167
+ provider: typing.Optional[AgentCreateRequestProvider] = OMIT,
1184
1168
  request_options: typing.Optional[RequestOptions] = None,
1185
1169
  ) -> AsyncHttpResponse[AgentResponse]:
1186
1170
  """
@@ -1191,28 +1175,26 @@ class AsyncRawAgentClient:
1191
1175
  id : str
1192
1176
  Agent ID
1193
1177
 
1194
- name : typing.Optional[str]
1178
+ name : str
1195
1179
  Agent name
1196
1180
 
1181
+ prompts : typing.Sequence[str]
1182
+ Array of prompt IDs to use for this agent
1183
+
1184
+ is_active : bool
1185
+ Whether the agent is active
1186
+
1197
1187
  description : typing.Optional[str]
1198
1188
  Agent description
1199
1189
 
1200
- prompts : typing.Optional[typing.Sequence[str]]
1201
- Array of prompt IDs to use for this agent
1202
-
1203
1190
  tools : typing.Optional[typing.Sequence[str]]
1204
1191
  Array of MCP server tool IDs to use for this agent
1205
1192
 
1206
- is_active : typing.Optional[bool]
1207
- Whether the agent is active
1208
-
1209
1193
  tags : typing.Optional[typing.Sequence[str]]
1210
1194
  Tags for categorizing the agent
1211
1195
 
1212
- provider : typing.Optional[AgentProvider]
1213
- FHIR provider type - can be a single provider or array of providers
1214
-
1215
- meta : typing.Optional[AgentFhirConfig]
1196
+ provider : typing.Optional[AgentCreateRequestProvider]
1197
+ FHIR provider ID(s) - must be valid UUIDs from existing FHIR providers
1216
1198
 
1217
1199
  request_options : typing.Optional[RequestOptions]
1218
1200
  Request-specific configuration.
@@ -1233,10 +1215,7 @@ class AsyncRawAgentClient:
1233
1215
  "is_active": is_active,
1234
1216
  "tags": tags,
1235
1217
  "provider": convert_and_respect_annotation_metadata(
1236
- object_=provider, annotation=AgentProvider, direction="write"
1237
- ),
1238
- "meta": convert_and_respect_annotation_metadata(
1239
- object_=meta, annotation=AgentFhirConfig, direction="write"
1218
+ object_=provider, annotation=AgentCreateRequestProvider, direction="write"
1240
1219
  ),
1241
1220
  },
1242
1221
  headers={
@@ -1504,9 +1483,10 @@ class AsyncRawAgentClient:
1504
1483
  *,
1505
1484
  message: str,
1506
1485
  agent_id: str,
1486
+ phenoml_on_behalf_of: typing.Optional[str] = None,
1487
+ phenoml_fhir_provider: typing.Optional[str] = None,
1507
1488
  context: typing.Optional[str] = OMIT,
1508
1489
  session_id: typing.Optional[str] = OMIT,
1509
- meta: typing.Optional[ChatFhirClientConfig] = OMIT,
1510
1490
  request_options: typing.Optional[RequestOptions] = None,
1511
1491
  ) -> AsyncHttpResponse[AgentChatResponse]:
1512
1492
  """
@@ -1520,15 +1500,20 @@ class AsyncRawAgentClient:
1520
1500
  agent_id : str
1521
1501
  The ID of the agent to chat with
1522
1502
 
1503
+ phenoml_on_behalf_of : typing.Optional[str]
1504
+ Optional header for on-behalf-of authentication. Used when making requests on behalf of another user or entity.
1505
+ Must be in the format: Patient/{uuid} or Practitioner/{uuid}
1506
+
1507
+ phenoml_fhir_provider : typing.Optional[str]
1508
+ Optional header for FHIR provider authentication. Contains credentials in the format {fhir_provider_id}:{oauth2_token}.
1509
+ Multiple FHIR provider integrations can be provided as comma-separated values.
1510
+
1523
1511
  context : typing.Optional[str]
1524
1512
  Optional context for the conversation
1525
1513
 
1526
1514
  session_id : typing.Optional[str]
1527
1515
  Optional session ID for conversation continuity
1528
1516
 
1529
- meta : typing.Optional[ChatFhirClientConfig]
1530
- Optional user-specific FHIR configuration overrides
1531
-
1532
1517
  request_options : typing.Optional[RequestOptions]
1533
1518
  Request-specific configuration.
1534
1519
 
@@ -1545,12 +1530,11 @@ class AsyncRawAgentClient:
1545
1530
  "context": context,
1546
1531
  "session_id": session_id,
1547
1532
  "agent_id": agent_id,
1548
- "meta": convert_and_respect_annotation_metadata(
1549
- object_=meta, annotation=ChatFhirClientConfig, direction="write"
1550
- ),
1551
1533
  },
1552
1534
  headers={
1553
1535
  "content-type": "application/json",
1536
+ "X-Phenoml-On-Behalf-Of": str(phenoml_on_behalf_of) if phenoml_on_behalf_of is not None else None,
1537
+ "X-Phenoml-Fhir-Provider": str(phenoml_fhir_provider) if phenoml_fhir_provider is not None else None,
1554
1538
  },
1555
1539
  request_options=request_options,
1556
1540
  omit=OMIT,
@@ -3,43 +3,41 @@
3
3
  # isort: skip_file
4
4
 
5
5
  from .agent_chat_response import AgentChatResponse
6
+ from .agent_create_request import AgentCreateRequest
7
+ from .agent_create_request_provider import AgentCreateRequestProvider
6
8
  from .agent_delete_response import AgentDeleteResponse
7
- from .agent_fhir_config import AgentFhirConfig
8
9
  from .agent_get_chat_messages_request_order import AgentGetChatMessagesRequestOrder
9
10
  from .agent_get_chat_messages_response import AgentGetChatMessagesResponse
10
11
  from .agent_list_response import AgentListResponse
11
12
  from .agent_prompts_response import AgentPromptsResponse
12
- from .agent_provider import AgentProvider
13
13
  from .agent_response import AgentResponse
14
14
  from .agent_template import AgentTemplate
15
- from .chat_fhir_client_config import ChatFhirClientConfig
15
+ from .agent_template_provider import AgentTemplateProvider
16
16
  from .chat_message_template import ChatMessageTemplate
17
17
  from .chat_session_template import ChatSessionTemplate
18
18
  from .json_patch import JsonPatch
19
19
  from .json_patch_operation import JsonPatchOperation
20
20
  from .json_patch_operation_op import JsonPatchOperationOp
21
21
  from .prompt_template import PromptTemplate
22
- from .provider_type import ProviderType
23
22
  from .success_response import SuccessResponse
24
23
 
25
24
  __all__ = [
26
25
  "AgentChatResponse",
26
+ "AgentCreateRequest",
27
+ "AgentCreateRequestProvider",
27
28
  "AgentDeleteResponse",
28
- "AgentFhirConfig",
29
29
  "AgentGetChatMessagesRequestOrder",
30
30
  "AgentGetChatMessagesResponse",
31
31
  "AgentListResponse",
32
32
  "AgentPromptsResponse",
33
- "AgentProvider",
34
33
  "AgentResponse",
35
34
  "AgentTemplate",
36
- "ChatFhirClientConfig",
35
+ "AgentTemplateProvider",
37
36
  "ChatMessageTemplate",
38
37
  "ChatSessionTemplate",
39
38
  "JsonPatch",
40
39
  "JsonPatchOperation",
41
40
  "JsonPatchOperationOp",
42
41
  "PromptTemplate",
43
- "ProviderType",
44
42
  "SuccessResponse",
45
43
  ]
@@ -0,0 +1,53 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ import pydantic
6
+ from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
7
+ from .agent_create_request_provider import AgentCreateRequestProvider
8
+
9
+
10
+ class AgentCreateRequest(UniversalBaseModel):
11
+ name: str = pydantic.Field()
12
+ """
13
+ Agent name
14
+ """
15
+
16
+ description: typing.Optional[str] = pydantic.Field(default=None)
17
+ """
18
+ Agent description
19
+ """
20
+
21
+ prompts: typing.List[str] = pydantic.Field()
22
+ """
23
+ Array of prompt IDs to use for this agent
24
+ """
25
+
26
+ tools: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
27
+ """
28
+ Array of MCP server tool IDs to use for this agent
29
+ """
30
+
31
+ is_active: bool = pydantic.Field()
32
+ """
33
+ Whether the agent is active
34
+ """
35
+
36
+ tags: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
37
+ """
38
+ Tags for categorizing the agent
39
+ """
40
+
41
+ provider: typing.Optional[AgentCreateRequestProvider] = pydantic.Field(default=None)
42
+ """
43
+ FHIR provider ID(s) - must be valid UUIDs from existing FHIR providers
44
+ """
45
+
46
+ if IS_PYDANTIC_V2:
47
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
48
+ else:
49
+
50
+ class Config:
51
+ frozen = True
52
+ smart_union = True
53
+ extra = pydantic.Extra.allow
@@ -0,0 +1,5 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ AgentCreateRequestProvider = typing.Union[str, typing.List[str]]
@@ -4,8 +4,7 @@ import typing
4
4
 
5
5
  import pydantic
6
6
  from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
7
- from .agent_fhir_config import AgentFhirConfig
8
- from .agent_provider import AgentProvider
7
+ from .agent_template_provider import AgentTemplateProvider
9
8
 
10
9
 
11
10
  class AgentTemplate(UniversalBaseModel):
@@ -44,13 +43,11 @@ class AgentTemplate(UniversalBaseModel):
44
43
  Tags for categorizing the agent
45
44
  """
46
45
 
47
- provider: typing.Optional[AgentProvider] = pydantic.Field(default=None)
46
+ provider: typing.Optional[AgentTemplateProvider] = pydantic.Field(default=None)
48
47
  """
49
- FHIR provider type - can be a single provider or array of providers
48
+ FHIR provider ID(s) - must be valid UUIDs from existing FHIR providers
50
49
  """
51
50
 
52
- meta: typing.Optional[AgentFhirConfig] = None
53
-
54
51
  if IS_PYDANTIC_V2:
55
52
  model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
56
53
  else:
@@ -0,0 +1,5 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ AgentTemplateProvider = typing.Union[str, typing.List[str]]
@@ -20,7 +20,11 @@ class JsonPatchOperation(UniversalBaseModel):
20
20
  A JSON Pointer string specifying a location within the target document
21
21
  """
22
22
 
23
- value: typing.Optional[typing.Optional[typing.Any]] = None
23
+ value: typing.Optional[typing.Optional[typing.Any]] = pydantic.Field(default=None)
24
+ """
25
+ The value to be used within the operations
26
+ """
27
+
24
28
  from_: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="from")] = pydantic.Field(default=None)
25
29
  """
26
30
  A JSON Pointer string specifying the location in the target document to move the value from (used with move and copy operations)
phenoml/client.py CHANGED
@@ -9,8 +9,12 @@ from .cohort.client import AsyncCohortClient, CohortClient
9
9
  from .construe.client import AsyncConstrueClient, ConstrueClient
10
10
  from .core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
11
11
  from .environment import phenomlEnvironment
12
+ from .fhir.client import AsyncFhirClient, FhirClient
13
+ from .fhir_provider.client import AsyncFhirProviderClient, FhirProviderClient
12
14
  from .lang2fhir.client import AsyncLang2FhirClient, Lang2FhirClient
15
+ from .summary.client import AsyncSummaryClient, SummaryClient
13
16
  from .tools.client import AsyncToolsClient, ToolsClient
17
+ from .workflows.client import AsyncWorkflowsClient, WorkflowsClient
14
18
 
15
19
 
16
20
  class phenoml:
@@ -82,8 +86,12 @@ class phenoml:
82
86
  self.authtoken = AuthtokenClient(client_wrapper=self._client_wrapper)
83
87
  self.cohort = CohortClient(client_wrapper=self._client_wrapper)
84
88
  self.construe = ConstrueClient(client_wrapper=self._client_wrapper)
89
+ self.fhir = FhirClient(client_wrapper=self._client_wrapper)
90
+ self.fhir_provider = FhirProviderClient(client_wrapper=self._client_wrapper)
85
91
  self.lang2fhir = Lang2FhirClient(client_wrapper=self._client_wrapper)
92
+ self.summary = SummaryClient(client_wrapper=self._client_wrapper)
86
93
  self.tools = ToolsClient(client_wrapper=self._client_wrapper)
94
+ self.workflows = WorkflowsClient(client_wrapper=self._client_wrapper)
87
95
 
88
96
 
89
97
  class Asyncphenoml:
@@ -155,8 +163,12 @@ class Asyncphenoml:
155
163
  self.authtoken = AsyncAuthtokenClient(client_wrapper=self._client_wrapper)
156
164
  self.cohort = AsyncCohortClient(client_wrapper=self._client_wrapper)
157
165
  self.construe = AsyncConstrueClient(client_wrapper=self._client_wrapper)
166
+ self.fhir = AsyncFhirClient(client_wrapper=self._client_wrapper)
167
+ self.fhir_provider = AsyncFhirProviderClient(client_wrapper=self._client_wrapper)
158
168
  self.lang2fhir = AsyncLang2FhirClient(client_wrapper=self._client_wrapper)
169
+ self.summary = AsyncSummaryClient(client_wrapper=self._client_wrapper)
159
170
  self.tools = AsyncToolsClient(client_wrapper=self._client_wrapper)
171
+ self.workflows = AsyncWorkflowsClient(client_wrapper=self._client_wrapper)
160
172
 
161
173
 
162
174
  def _get_base_url(*, base_url: typing.Optional[str] = None, environment: phenomlEnvironment) -> str:
@@ -3,43 +3,29 @@
3
3
  # isort: skip_file
4
4
 
5
5
  from .types import (
6
- BadRequestErrorBody,
7
- ConstrueCohortRequestConfig,
8
- ConstrueCohortResponse,
9
- ConstrueCohortResponseQueriesItem,
10
- ConstrueCohortResponseQueriesItemCodeExtractResultsItem,
11
- ConstrueCohortResponseQueriesItemCodeExtractResultsItemCodesItem,
12
6
  ConstrueUploadCodeSystemResponse,
13
7
  ExtractCodesResult,
14
8
  ExtractRequestConfig,
15
9
  ExtractRequestConfigChunkingMethod,
10
+ ExtractRequestConfigValidationMethod,
16
11
  ExtractRequestSystem,
17
12
  ExtractedCodeResult,
18
- InternalServerErrorBody,
19
- UnauthorizedErrorBody,
20
13
  UploadRequestFormat,
21
14
  )
22
15
  from .errors import BadRequestError, ConflictError, FailedDependencyError, InternalServerError, UnauthorizedError
23
16
 
24
17
  __all__ = [
25
18
  "BadRequestError",
26
- "BadRequestErrorBody",
27
19
  "ConflictError",
28
- "ConstrueCohortRequestConfig",
29
- "ConstrueCohortResponse",
30
- "ConstrueCohortResponseQueriesItem",
31
- "ConstrueCohortResponseQueriesItemCodeExtractResultsItem",
32
- "ConstrueCohortResponseQueriesItemCodeExtractResultsItemCodesItem",
33
20
  "ConstrueUploadCodeSystemResponse",
34
21
  "ExtractCodesResult",
35
22
  "ExtractRequestConfig",
36
23
  "ExtractRequestConfigChunkingMethod",
24
+ "ExtractRequestConfigValidationMethod",
37
25
  "ExtractRequestSystem",
38
26
  "ExtractedCodeResult",
39
27
  "FailedDependencyError",
40
28
  "InternalServerError",
41
- "InternalServerErrorBody",
42
29
  "UnauthorizedError",
43
- "UnauthorizedErrorBody",
44
30
  "UploadRequestFormat",
45
31
  ]
@@ -5,8 +5,6 @@ import typing
5
5
  from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
6
6
  from ..core.request_options import RequestOptions
7
7
  from .raw_client import AsyncRawConstrueClient, RawConstrueClient
8
- from .types.construe_cohort_request_config import ConstrueCohortRequestConfig
9
- from .types.construe_cohort_response import ConstrueCohortResponse
10
8
  from .types.construe_upload_code_system_response import ConstrueUploadCodeSystemResponse
11
9
  from .types.extract_codes_result import ExtractCodesResult
12
10
  from .types.extract_request_config import ExtractRequestConfig
@@ -155,46 +153,6 @@ class ConstrueClient:
155
153
  )
156
154
  return _response.data
157
155
 
158
- def cohort(
159
- self,
160
- *,
161
- text: str,
162
- config: typing.Optional[ConstrueCohortRequestConfig] = OMIT,
163
- request_options: typing.Optional[RequestOptions] = None,
164
- ) -> ConstrueCohortResponse:
165
- """
166
- Creates a patient cohort based on a natural language description.
167
- Translates the description into FHIR search queries and optional SQL queries.
168
-
169
- Parameters
170
- ----------
171
- text : str
172
- Natural language description of the desired patient cohort.
173
-
174
- config : typing.Optional[ConstrueCohortRequestConfig]
175
-
176
- request_options : typing.Optional[RequestOptions]
177
- Request-specific configuration.
178
-
179
- Returns
180
- -------
181
- ConstrueCohortResponse
182
- Cohort creation successful
183
-
184
- Examples
185
- --------
186
- from phenoml import phenoml
187
-
188
- client = phenoml(
189
- token="YOUR_TOKEN",
190
- )
191
- client.construe.cohort(
192
- text="Between 20 and 40 years old with hyperlipidemia",
193
- )
194
- """
195
- _response = self._raw_client.cohort(text=text, config=config, request_options=request_options)
196
- return _response.data
197
-
198
156
 
199
157
  class AsyncConstrueClient:
200
158
  def __init__(self, *, client_wrapper: AsyncClientWrapper):
@@ -349,51 +307,3 @@ class AsyncConstrueClient:
349
307
  text=text, system=system, config=config, request_options=request_options
350
308
  )
351
309
  return _response.data
352
-
353
- async def cohort(
354
- self,
355
- *,
356
- text: str,
357
- config: typing.Optional[ConstrueCohortRequestConfig] = OMIT,
358
- request_options: typing.Optional[RequestOptions] = None,
359
- ) -> ConstrueCohortResponse:
360
- """
361
- Creates a patient cohort based on a natural language description.
362
- Translates the description into FHIR search queries and optional SQL queries.
363
-
364
- Parameters
365
- ----------
366
- text : str
367
- Natural language description of the desired patient cohort.
368
-
369
- config : typing.Optional[ConstrueCohortRequestConfig]
370
-
371
- request_options : typing.Optional[RequestOptions]
372
- Request-specific configuration.
373
-
374
- Returns
375
- -------
376
- ConstrueCohortResponse
377
- Cohort creation successful
378
-
379
- Examples
380
- --------
381
- import asyncio
382
-
383
- from phenoml import Asyncphenoml
384
-
385
- client = Asyncphenoml(
386
- token="YOUR_TOKEN",
387
- )
388
-
389
-
390
- async def main() -> None:
391
- await client.construe.cohort(
392
- text="Between 20 and 40 years old with hyperlipidemia",
393
- )
394
-
395
-
396
- asyncio.run(main())
397
- """
398
- _response = await self._raw_client.cohort(text=text, config=config, request_options=request_options)
399
- return _response.data