phenoml 0.0.1__py3-none-any.whl → 0.0.2__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.
- phenoml/agent/__init__.py +12 -12
- phenoml/agent/client.py +147 -10
- phenoml/agent/prompts/client.py +60 -60
- phenoml/agent/prompts/raw_client.py +134 -134
- phenoml/agent/raw_client.py +221 -14
- phenoml/agent/types/__init__.py +12 -12
- phenoml/agent/types/agent_get_chat_messages_request_order.py +5 -0
- phenoml/agent/types/agent_get_chat_messages_response.py +22 -0
- phenoml/agent/types/agent_provider.py +7 -0
- phenoml/agent/types/agent_template.py +7 -2
- phenoml/agent/types/chat_message_template.py +72 -0
- phenoml/agent/types/chat_session_template.py +67 -0
- phenoml/agent/types/provider_type.py +5 -0
- phenoml/core/client_wrapper.py +2 -2
- phenoml/tools/__init__.py +12 -0
- phenoml/tools/client.py +3 -0
- phenoml/tools/mcp_server/__init__.py +7 -0
- phenoml/tools/mcp_server/client.py +336 -0
- phenoml/tools/mcp_server/raw_client.py +641 -0
- phenoml/tools/mcp_server/tools/__init__.py +4 -0
- phenoml/tools/mcp_server/tools/client.py +358 -0
- phenoml/tools/mcp_server/tools/raw_client.py +656 -0
- phenoml/tools/types/__init__.py +10 -0
- phenoml/tools/types/mcp_server_response.py +33 -0
- phenoml/tools/types/mcp_server_response_data.py +51 -0
- phenoml/tools/types/mcp_server_tool_call_response.py +37 -0
- phenoml/tools/types/mcp_server_tool_response.py +33 -0
- phenoml/tools/types/mcp_server_tool_response_data.py +61 -0
- {phenoml-0.0.1.dist-info → phenoml-0.0.2.dist-info}/METADATA +1 -1
- {phenoml-0.0.1.dist-info → phenoml-0.0.2.dist-info}/RECORD +31 -21
- phenoml/agent/types/agent_create_request_provider.py +0 -13
- phenoml/agent/types/agent_create_request_provider_item.py +0 -7
- phenoml/agent/types/agent_template_provider.py +0 -13
- phenoml/agent/types/agent_template_provider_item.py +0 -5
- phenoml/agent/types/agent_update_request_provider.py +0 -13
- phenoml/agent/types/agent_update_request_provider_item.py +0 -7
- phenoml-0.0.1.dist-info/LICENSE +0 -21
- {phenoml-0.0.1.dist-info → phenoml-0.0.2.dist-info}/WHEEL +0 -0
phenoml/agent/raw_client.py
CHANGED
|
@@ -16,12 +16,13 @@ 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
|
|
20
19
|
from .types.agent_delete_response import AgentDeleteResponse
|
|
21
20
|
from .types.agent_fhir_config import AgentFhirConfig
|
|
21
|
+
from .types.agent_get_chat_messages_request_order import AgentGetChatMessagesRequestOrder
|
|
22
|
+
from .types.agent_get_chat_messages_response import AgentGetChatMessagesResponse
|
|
22
23
|
from .types.agent_list_response import AgentListResponse
|
|
24
|
+
from .types.agent_provider import AgentProvider
|
|
23
25
|
from .types.agent_response import AgentResponse
|
|
24
|
-
from .types.agent_update_request_provider import AgentUpdateRequestProvider
|
|
25
26
|
from .types.chat_fhir_client_config import ChatFhirClientConfig
|
|
26
27
|
from .types.json_patch import JsonPatch
|
|
27
28
|
|
|
@@ -40,8 +41,9 @@ class RawAgentClient:
|
|
|
40
41
|
prompts: typing.Sequence[str],
|
|
41
42
|
is_active: bool,
|
|
42
43
|
description: typing.Optional[str] = OMIT,
|
|
44
|
+
tools: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
43
45
|
tags: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
44
|
-
provider: typing.Optional[
|
|
46
|
+
provider: typing.Optional[AgentProvider] = OMIT,
|
|
45
47
|
meta: typing.Optional[AgentFhirConfig] = OMIT,
|
|
46
48
|
request_options: typing.Optional[RequestOptions] = None,
|
|
47
49
|
) -> HttpResponse[AgentResponse]:
|
|
@@ -62,10 +64,13 @@ class RawAgentClient:
|
|
|
62
64
|
description : typing.Optional[str]
|
|
63
65
|
Agent description
|
|
64
66
|
|
|
67
|
+
tools : typing.Optional[typing.Sequence[str]]
|
|
68
|
+
Array of MCP server tool IDs to use for this agent
|
|
69
|
+
|
|
65
70
|
tags : typing.Optional[typing.Sequence[str]]
|
|
66
71
|
Tags for categorizing the agent
|
|
67
72
|
|
|
68
|
-
provider : typing.Optional[
|
|
73
|
+
provider : typing.Optional[AgentProvider]
|
|
69
74
|
FHIR provider type - can be a single provider or array of providers
|
|
70
75
|
|
|
71
76
|
meta : typing.Optional[AgentFhirConfig]
|
|
@@ -85,10 +90,11 @@ class RawAgentClient:
|
|
|
85
90
|
"name": name,
|
|
86
91
|
"description": description,
|
|
87
92
|
"prompts": prompts,
|
|
93
|
+
"tools": tools,
|
|
88
94
|
"is_active": is_active,
|
|
89
95
|
"tags": tags,
|
|
90
96
|
"provider": convert_and_respect_annotation_metadata(
|
|
91
|
-
object_=provider, annotation=
|
|
97
|
+
object_=provider, annotation=AgentProvider, direction="write"
|
|
92
98
|
),
|
|
93
99
|
"meta": convert_and_respect_annotation_metadata(
|
|
94
100
|
object_=meta, annotation=AgentFhirConfig, direction="write"
|
|
@@ -330,9 +336,10 @@ class RawAgentClient:
|
|
|
330
336
|
name: typing.Optional[str] = OMIT,
|
|
331
337
|
description: typing.Optional[str] = OMIT,
|
|
332
338
|
prompts: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
339
|
+
tools: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
333
340
|
is_active: typing.Optional[bool] = OMIT,
|
|
334
341
|
tags: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
335
|
-
provider: typing.Optional[
|
|
342
|
+
provider: typing.Optional[AgentProvider] = OMIT,
|
|
336
343
|
meta: typing.Optional[AgentFhirConfig] = OMIT,
|
|
337
344
|
request_options: typing.Optional[RequestOptions] = None,
|
|
338
345
|
) -> HttpResponse[AgentResponse]:
|
|
@@ -353,13 +360,16 @@ class RawAgentClient:
|
|
|
353
360
|
prompts : typing.Optional[typing.Sequence[str]]
|
|
354
361
|
Array of prompt IDs to use for this agent
|
|
355
362
|
|
|
363
|
+
tools : typing.Optional[typing.Sequence[str]]
|
|
364
|
+
Array of MCP server tool IDs to use for this agent
|
|
365
|
+
|
|
356
366
|
is_active : typing.Optional[bool]
|
|
357
367
|
Whether the agent is active
|
|
358
368
|
|
|
359
369
|
tags : typing.Optional[typing.Sequence[str]]
|
|
360
370
|
Tags for categorizing the agent
|
|
361
371
|
|
|
362
|
-
provider : typing.Optional[
|
|
372
|
+
provider : typing.Optional[AgentProvider]
|
|
363
373
|
FHIR provider type - can be a single provider or array of providers
|
|
364
374
|
|
|
365
375
|
meta : typing.Optional[AgentFhirConfig]
|
|
@@ -379,10 +389,11 @@ class RawAgentClient:
|
|
|
379
389
|
"name": name,
|
|
380
390
|
"description": description,
|
|
381
391
|
"prompts": prompts,
|
|
392
|
+
"tools": tools,
|
|
382
393
|
"is_active": is_active,
|
|
383
394
|
"tags": tags,
|
|
384
395
|
"provider": convert_and_respect_annotation_metadata(
|
|
385
|
-
object_=provider, annotation=
|
|
396
|
+
object_=provider, annotation=AgentProvider, direction="write"
|
|
386
397
|
),
|
|
387
398
|
"meta": convert_and_respect_annotation_metadata(
|
|
388
399
|
object_=meta, annotation=AgentFhirConfig, direction="write"
|
|
@@ -763,6 +774,99 @@ class RawAgentClient:
|
|
|
763
774
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
764
775
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
765
776
|
|
|
777
|
+
def get_chat_messages(
|
|
778
|
+
self,
|
|
779
|
+
*,
|
|
780
|
+
chat_session_id: str,
|
|
781
|
+
num_messages: typing.Optional[int] = None,
|
|
782
|
+
role: typing.Optional[str] = None,
|
|
783
|
+
order: typing.Optional[AgentGetChatMessagesRequestOrder] = None,
|
|
784
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
785
|
+
) -> HttpResponse[AgentGetChatMessagesResponse]:
|
|
786
|
+
"""
|
|
787
|
+
Retrieves a list of chat messages for a given chat session
|
|
788
|
+
|
|
789
|
+
Parameters
|
|
790
|
+
----------
|
|
791
|
+
chat_session_id : str
|
|
792
|
+
Chat session ID
|
|
793
|
+
|
|
794
|
+
num_messages : typing.Optional[int]
|
|
795
|
+
Number of messages to return
|
|
796
|
+
|
|
797
|
+
role : typing.Optional[str]
|
|
798
|
+
Filter by role
|
|
799
|
+
|
|
800
|
+
order : typing.Optional[AgentGetChatMessagesRequestOrder]
|
|
801
|
+
Order of messages
|
|
802
|
+
|
|
803
|
+
request_options : typing.Optional[RequestOptions]
|
|
804
|
+
Request-specific configuration.
|
|
805
|
+
|
|
806
|
+
Returns
|
|
807
|
+
-------
|
|
808
|
+
HttpResponse[AgentGetChatMessagesResponse]
|
|
809
|
+
Chat messages retrieved successfully
|
|
810
|
+
"""
|
|
811
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
812
|
+
"agent/chat/messages",
|
|
813
|
+
method="GET",
|
|
814
|
+
params={
|
|
815
|
+
"chat_session_id": chat_session_id,
|
|
816
|
+
"num_messages": num_messages,
|
|
817
|
+
"role": role,
|
|
818
|
+
"order": order,
|
|
819
|
+
},
|
|
820
|
+
request_options=request_options,
|
|
821
|
+
)
|
|
822
|
+
try:
|
|
823
|
+
if 200 <= _response.status_code < 300:
|
|
824
|
+
_data = typing.cast(
|
|
825
|
+
AgentGetChatMessagesResponse,
|
|
826
|
+
parse_obj_as(
|
|
827
|
+
type_=AgentGetChatMessagesResponse, # type: ignore
|
|
828
|
+
object_=_response.json(),
|
|
829
|
+
),
|
|
830
|
+
)
|
|
831
|
+
return HttpResponse(response=_response, data=_data)
|
|
832
|
+
if _response.status_code == 401:
|
|
833
|
+
raise UnauthorizedError(
|
|
834
|
+
headers=dict(_response.headers),
|
|
835
|
+
body=typing.cast(
|
|
836
|
+
typing.Optional[typing.Any],
|
|
837
|
+
parse_obj_as(
|
|
838
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
839
|
+
object_=_response.json(),
|
|
840
|
+
),
|
|
841
|
+
),
|
|
842
|
+
)
|
|
843
|
+
if _response.status_code == 403:
|
|
844
|
+
raise ForbiddenError(
|
|
845
|
+
headers=dict(_response.headers),
|
|
846
|
+
body=typing.cast(
|
|
847
|
+
typing.Optional[typing.Any],
|
|
848
|
+
parse_obj_as(
|
|
849
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
850
|
+
object_=_response.json(),
|
|
851
|
+
),
|
|
852
|
+
),
|
|
853
|
+
)
|
|
854
|
+
if _response.status_code == 500:
|
|
855
|
+
raise InternalServerError(
|
|
856
|
+
headers=dict(_response.headers),
|
|
857
|
+
body=typing.cast(
|
|
858
|
+
typing.Optional[typing.Any],
|
|
859
|
+
parse_obj_as(
|
|
860
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
861
|
+
object_=_response.json(),
|
|
862
|
+
),
|
|
863
|
+
),
|
|
864
|
+
)
|
|
865
|
+
_response_json = _response.json()
|
|
866
|
+
except JSONDecodeError:
|
|
867
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
868
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
869
|
+
|
|
766
870
|
|
|
767
871
|
class AsyncRawAgentClient:
|
|
768
872
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
@@ -775,8 +879,9 @@ class AsyncRawAgentClient:
|
|
|
775
879
|
prompts: typing.Sequence[str],
|
|
776
880
|
is_active: bool,
|
|
777
881
|
description: typing.Optional[str] = OMIT,
|
|
882
|
+
tools: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
778
883
|
tags: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
779
|
-
provider: typing.Optional[
|
|
884
|
+
provider: typing.Optional[AgentProvider] = OMIT,
|
|
780
885
|
meta: typing.Optional[AgentFhirConfig] = OMIT,
|
|
781
886
|
request_options: typing.Optional[RequestOptions] = None,
|
|
782
887
|
) -> AsyncHttpResponse[AgentResponse]:
|
|
@@ -797,10 +902,13 @@ class AsyncRawAgentClient:
|
|
|
797
902
|
description : typing.Optional[str]
|
|
798
903
|
Agent description
|
|
799
904
|
|
|
905
|
+
tools : typing.Optional[typing.Sequence[str]]
|
|
906
|
+
Array of MCP server tool IDs to use for this agent
|
|
907
|
+
|
|
800
908
|
tags : typing.Optional[typing.Sequence[str]]
|
|
801
909
|
Tags for categorizing the agent
|
|
802
910
|
|
|
803
|
-
provider : typing.Optional[
|
|
911
|
+
provider : typing.Optional[AgentProvider]
|
|
804
912
|
FHIR provider type - can be a single provider or array of providers
|
|
805
913
|
|
|
806
914
|
meta : typing.Optional[AgentFhirConfig]
|
|
@@ -820,10 +928,11 @@ class AsyncRawAgentClient:
|
|
|
820
928
|
"name": name,
|
|
821
929
|
"description": description,
|
|
822
930
|
"prompts": prompts,
|
|
931
|
+
"tools": tools,
|
|
823
932
|
"is_active": is_active,
|
|
824
933
|
"tags": tags,
|
|
825
934
|
"provider": convert_and_respect_annotation_metadata(
|
|
826
|
-
object_=provider, annotation=
|
|
935
|
+
object_=provider, annotation=AgentProvider, direction="write"
|
|
827
936
|
),
|
|
828
937
|
"meta": convert_and_respect_annotation_metadata(
|
|
829
938
|
object_=meta, annotation=AgentFhirConfig, direction="write"
|
|
@@ -1067,9 +1176,10 @@ class AsyncRawAgentClient:
|
|
|
1067
1176
|
name: typing.Optional[str] = OMIT,
|
|
1068
1177
|
description: typing.Optional[str] = OMIT,
|
|
1069
1178
|
prompts: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
1179
|
+
tools: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
1070
1180
|
is_active: typing.Optional[bool] = OMIT,
|
|
1071
1181
|
tags: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
1072
|
-
provider: typing.Optional[
|
|
1182
|
+
provider: typing.Optional[AgentProvider] = OMIT,
|
|
1073
1183
|
meta: typing.Optional[AgentFhirConfig] = OMIT,
|
|
1074
1184
|
request_options: typing.Optional[RequestOptions] = None,
|
|
1075
1185
|
) -> AsyncHttpResponse[AgentResponse]:
|
|
@@ -1090,13 +1200,16 @@ class AsyncRawAgentClient:
|
|
|
1090
1200
|
prompts : typing.Optional[typing.Sequence[str]]
|
|
1091
1201
|
Array of prompt IDs to use for this agent
|
|
1092
1202
|
|
|
1203
|
+
tools : typing.Optional[typing.Sequence[str]]
|
|
1204
|
+
Array of MCP server tool IDs to use for this agent
|
|
1205
|
+
|
|
1093
1206
|
is_active : typing.Optional[bool]
|
|
1094
1207
|
Whether the agent is active
|
|
1095
1208
|
|
|
1096
1209
|
tags : typing.Optional[typing.Sequence[str]]
|
|
1097
1210
|
Tags for categorizing the agent
|
|
1098
1211
|
|
|
1099
|
-
provider : typing.Optional[
|
|
1212
|
+
provider : typing.Optional[AgentProvider]
|
|
1100
1213
|
FHIR provider type - can be a single provider or array of providers
|
|
1101
1214
|
|
|
1102
1215
|
meta : typing.Optional[AgentFhirConfig]
|
|
@@ -1116,10 +1229,11 @@ class AsyncRawAgentClient:
|
|
|
1116
1229
|
"name": name,
|
|
1117
1230
|
"description": description,
|
|
1118
1231
|
"prompts": prompts,
|
|
1232
|
+
"tools": tools,
|
|
1119
1233
|
"is_active": is_active,
|
|
1120
1234
|
"tags": tags,
|
|
1121
1235
|
"provider": convert_and_respect_annotation_metadata(
|
|
1122
|
-
object_=provider, annotation=
|
|
1236
|
+
object_=provider, annotation=AgentProvider, direction="write"
|
|
1123
1237
|
),
|
|
1124
1238
|
"meta": convert_and_respect_annotation_metadata(
|
|
1125
1239
|
object_=meta, annotation=AgentFhirConfig, direction="write"
|
|
@@ -1499,3 +1613,96 @@ class AsyncRawAgentClient:
|
|
|
1499
1613
|
except JSONDecodeError:
|
|
1500
1614
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
1501
1615
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
1616
|
+
|
|
1617
|
+
async def get_chat_messages(
|
|
1618
|
+
self,
|
|
1619
|
+
*,
|
|
1620
|
+
chat_session_id: str,
|
|
1621
|
+
num_messages: typing.Optional[int] = None,
|
|
1622
|
+
role: typing.Optional[str] = None,
|
|
1623
|
+
order: typing.Optional[AgentGetChatMessagesRequestOrder] = None,
|
|
1624
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1625
|
+
) -> AsyncHttpResponse[AgentGetChatMessagesResponse]:
|
|
1626
|
+
"""
|
|
1627
|
+
Retrieves a list of chat messages for a given chat session
|
|
1628
|
+
|
|
1629
|
+
Parameters
|
|
1630
|
+
----------
|
|
1631
|
+
chat_session_id : str
|
|
1632
|
+
Chat session ID
|
|
1633
|
+
|
|
1634
|
+
num_messages : typing.Optional[int]
|
|
1635
|
+
Number of messages to return
|
|
1636
|
+
|
|
1637
|
+
role : typing.Optional[str]
|
|
1638
|
+
Filter by role
|
|
1639
|
+
|
|
1640
|
+
order : typing.Optional[AgentGetChatMessagesRequestOrder]
|
|
1641
|
+
Order of messages
|
|
1642
|
+
|
|
1643
|
+
request_options : typing.Optional[RequestOptions]
|
|
1644
|
+
Request-specific configuration.
|
|
1645
|
+
|
|
1646
|
+
Returns
|
|
1647
|
+
-------
|
|
1648
|
+
AsyncHttpResponse[AgentGetChatMessagesResponse]
|
|
1649
|
+
Chat messages retrieved successfully
|
|
1650
|
+
"""
|
|
1651
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1652
|
+
"agent/chat/messages",
|
|
1653
|
+
method="GET",
|
|
1654
|
+
params={
|
|
1655
|
+
"chat_session_id": chat_session_id,
|
|
1656
|
+
"num_messages": num_messages,
|
|
1657
|
+
"role": role,
|
|
1658
|
+
"order": order,
|
|
1659
|
+
},
|
|
1660
|
+
request_options=request_options,
|
|
1661
|
+
)
|
|
1662
|
+
try:
|
|
1663
|
+
if 200 <= _response.status_code < 300:
|
|
1664
|
+
_data = typing.cast(
|
|
1665
|
+
AgentGetChatMessagesResponse,
|
|
1666
|
+
parse_obj_as(
|
|
1667
|
+
type_=AgentGetChatMessagesResponse, # type: ignore
|
|
1668
|
+
object_=_response.json(),
|
|
1669
|
+
),
|
|
1670
|
+
)
|
|
1671
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
1672
|
+
if _response.status_code == 401:
|
|
1673
|
+
raise UnauthorizedError(
|
|
1674
|
+
headers=dict(_response.headers),
|
|
1675
|
+
body=typing.cast(
|
|
1676
|
+
typing.Optional[typing.Any],
|
|
1677
|
+
parse_obj_as(
|
|
1678
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1679
|
+
object_=_response.json(),
|
|
1680
|
+
),
|
|
1681
|
+
),
|
|
1682
|
+
)
|
|
1683
|
+
if _response.status_code == 403:
|
|
1684
|
+
raise ForbiddenError(
|
|
1685
|
+
headers=dict(_response.headers),
|
|
1686
|
+
body=typing.cast(
|
|
1687
|
+
typing.Optional[typing.Any],
|
|
1688
|
+
parse_obj_as(
|
|
1689
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1690
|
+
object_=_response.json(),
|
|
1691
|
+
),
|
|
1692
|
+
),
|
|
1693
|
+
)
|
|
1694
|
+
if _response.status_code == 500:
|
|
1695
|
+
raise InternalServerError(
|
|
1696
|
+
headers=dict(_response.headers),
|
|
1697
|
+
body=typing.cast(
|
|
1698
|
+
typing.Optional[typing.Any],
|
|
1699
|
+
parse_obj_as(
|
|
1700
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1701
|
+
object_=_response.json(),
|
|
1702
|
+
),
|
|
1703
|
+
),
|
|
1704
|
+
)
|
|
1705
|
+
_response_json = _response.json()
|
|
1706
|
+
except JSONDecodeError:
|
|
1707
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
1708
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
phenoml/agent/types/__init__.py
CHANGED
|
@@ -3,43 +3,43 @@
|
|
|
3
3
|
# isort: skip_file
|
|
4
4
|
|
|
5
5
|
from .agent_chat_response import AgentChatResponse
|
|
6
|
-
from .agent_create_request_provider import AgentCreateRequestProvider
|
|
7
|
-
from .agent_create_request_provider_item import AgentCreateRequestProviderItem
|
|
8
6
|
from .agent_delete_response import AgentDeleteResponse
|
|
9
7
|
from .agent_fhir_config import AgentFhirConfig
|
|
8
|
+
from .agent_get_chat_messages_request_order import AgentGetChatMessagesRequestOrder
|
|
9
|
+
from .agent_get_chat_messages_response import AgentGetChatMessagesResponse
|
|
10
10
|
from .agent_list_response import AgentListResponse
|
|
11
11
|
from .agent_prompts_response import AgentPromptsResponse
|
|
12
|
+
from .agent_provider import AgentProvider
|
|
12
13
|
from .agent_response import AgentResponse
|
|
13
14
|
from .agent_template import AgentTemplate
|
|
14
|
-
from .agent_template_provider import AgentTemplateProvider
|
|
15
|
-
from .agent_template_provider_item import AgentTemplateProviderItem
|
|
16
|
-
from .agent_update_request_provider import AgentUpdateRequestProvider
|
|
17
|
-
from .agent_update_request_provider_item import AgentUpdateRequestProviderItem
|
|
18
15
|
from .chat_fhir_client_config import ChatFhirClientConfig
|
|
16
|
+
from .chat_message_template import ChatMessageTemplate
|
|
17
|
+
from .chat_session_template import ChatSessionTemplate
|
|
19
18
|
from .json_patch import JsonPatch
|
|
20
19
|
from .json_patch_operation import JsonPatchOperation
|
|
21
20
|
from .json_patch_operation_op import JsonPatchOperationOp
|
|
22
21
|
from .prompt_template import PromptTemplate
|
|
22
|
+
from .provider_type import ProviderType
|
|
23
23
|
from .success_response import SuccessResponse
|
|
24
24
|
|
|
25
25
|
__all__ = [
|
|
26
26
|
"AgentChatResponse",
|
|
27
|
-
"AgentCreateRequestProvider",
|
|
28
|
-
"AgentCreateRequestProviderItem",
|
|
29
27
|
"AgentDeleteResponse",
|
|
30
28
|
"AgentFhirConfig",
|
|
29
|
+
"AgentGetChatMessagesRequestOrder",
|
|
30
|
+
"AgentGetChatMessagesResponse",
|
|
31
31
|
"AgentListResponse",
|
|
32
32
|
"AgentPromptsResponse",
|
|
33
|
+
"AgentProvider",
|
|
33
34
|
"AgentResponse",
|
|
34
35
|
"AgentTemplate",
|
|
35
|
-
"AgentTemplateProvider",
|
|
36
|
-
"AgentTemplateProviderItem",
|
|
37
|
-
"AgentUpdateRequestProvider",
|
|
38
|
-
"AgentUpdateRequestProviderItem",
|
|
39
36
|
"ChatFhirClientConfig",
|
|
37
|
+
"ChatMessageTemplate",
|
|
38
|
+
"ChatSessionTemplate",
|
|
40
39
|
"JsonPatch",
|
|
41
40
|
"JsonPatchOperation",
|
|
42
41
|
"JsonPatchOperationOp",
|
|
43
42
|
"PromptTemplate",
|
|
43
|
+
"ProviderType",
|
|
44
44
|
"SuccessResponse",
|
|
45
45
|
]
|
|
@@ -0,0 +1,22 @@
|
|
|
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 .chat_message_template import ChatMessageTemplate
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class AgentGetChatMessagesResponse(UniversalBaseModel):
|
|
11
|
+
messages: typing.Optional[typing.List[ChatMessageTemplate]] = None
|
|
12
|
+
total: typing.Optional[int] = None
|
|
13
|
+
session_id: typing.Optional[str] = None
|
|
14
|
+
|
|
15
|
+
if IS_PYDANTIC_V2:
|
|
16
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
17
|
+
else:
|
|
18
|
+
|
|
19
|
+
class Config:
|
|
20
|
+
frozen = True
|
|
21
|
+
smart_union = True
|
|
22
|
+
extra = pydantic.Extra.allow
|
|
@@ -5,7 +5,7 @@ import typing
|
|
|
5
5
|
import pydantic
|
|
6
6
|
from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
|
|
7
7
|
from .agent_fhir_config import AgentFhirConfig
|
|
8
|
-
from .
|
|
8
|
+
from .agent_provider import AgentProvider
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
class AgentTemplate(UniversalBaseModel):
|
|
@@ -29,6 +29,11 @@ class AgentTemplate(UniversalBaseModel):
|
|
|
29
29
|
Array of prompt IDs used by this agent
|
|
30
30
|
"""
|
|
31
31
|
|
|
32
|
+
tools: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
|
|
33
|
+
"""
|
|
34
|
+
Array of MCP server tool IDs used by this agent
|
|
35
|
+
"""
|
|
36
|
+
|
|
32
37
|
is_active: typing.Optional[bool] = pydantic.Field(default=None)
|
|
33
38
|
"""
|
|
34
39
|
Whether the agent is active
|
|
@@ -39,7 +44,7 @@ class AgentTemplate(UniversalBaseModel):
|
|
|
39
44
|
Tags for categorizing the agent
|
|
40
45
|
"""
|
|
41
46
|
|
|
42
|
-
provider: typing.Optional[
|
|
47
|
+
provider: typing.Optional[AgentProvider] = pydantic.Field(default=None)
|
|
43
48
|
"""
|
|
44
49
|
FHIR provider type - can be a single provider or array of providers
|
|
45
50
|
"""
|
|
@@ -0,0 +1,72 @@
|
|
|
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
|
+
|
|
8
|
+
|
|
9
|
+
class ChatMessageTemplate(UniversalBaseModel):
|
|
10
|
+
id: typing.Optional[str] = pydantic.Field(default=None)
|
|
11
|
+
"""
|
|
12
|
+
Chat message ID
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
session_id: typing.Optional[str] = pydantic.Field(default=None)
|
|
16
|
+
"""
|
|
17
|
+
Chat session ID
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
role: typing.Optional[str] = pydantic.Field(default=None)
|
|
21
|
+
"""
|
|
22
|
+
Message role
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
content: typing.Optional[str] = pydantic.Field(default=None)
|
|
26
|
+
"""
|
|
27
|
+
Message content
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
created: typing.Optional[str] = pydantic.Field(default=None)
|
|
31
|
+
"""
|
|
32
|
+
Message created time
|
|
33
|
+
"""
|
|
34
|
+
|
|
35
|
+
updated: typing.Optional[str] = pydantic.Field(default=None)
|
|
36
|
+
"""
|
|
37
|
+
Message updated time
|
|
38
|
+
"""
|
|
39
|
+
|
|
40
|
+
user_id: typing.Optional[str] = pydantic.Field(default=None)
|
|
41
|
+
"""
|
|
42
|
+
User ID
|
|
43
|
+
"""
|
|
44
|
+
|
|
45
|
+
function_name: typing.Optional[str] = pydantic.Field(default=None)
|
|
46
|
+
"""
|
|
47
|
+
Function name
|
|
48
|
+
"""
|
|
49
|
+
|
|
50
|
+
function_args: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = pydantic.Field(default=None)
|
|
51
|
+
"""
|
|
52
|
+
Function arguments
|
|
53
|
+
"""
|
|
54
|
+
|
|
55
|
+
function_result: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = pydantic.Field(default=None)
|
|
56
|
+
"""
|
|
57
|
+
Function result
|
|
58
|
+
"""
|
|
59
|
+
|
|
60
|
+
message_order: typing.Optional[int] = pydantic.Field(default=None)
|
|
61
|
+
"""
|
|
62
|
+
Message order
|
|
63
|
+
"""
|
|
64
|
+
|
|
65
|
+
if IS_PYDANTIC_V2:
|
|
66
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
67
|
+
else:
|
|
68
|
+
|
|
69
|
+
class Config:
|
|
70
|
+
frozen = True
|
|
71
|
+
smart_union = True
|
|
72
|
+
extra = pydantic.Extra.allow
|
|
@@ -0,0 +1,67 @@
|
|
|
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
|
+
|
|
8
|
+
|
|
9
|
+
class ChatSessionTemplate(UniversalBaseModel):
|
|
10
|
+
id: typing.Optional[str] = pydantic.Field(default=None)
|
|
11
|
+
"""
|
|
12
|
+
Chat session ID
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
user_id: typing.Optional[str] = pydantic.Field(default=None)
|
|
16
|
+
"""
|
|
17
|
+
User ID
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
session_id: typing.Optional[str] = pydantic.Field(default=None)
|
|
21
|
+
"""
|
|
22
|
+
Chat session ID
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
status: typing.Optional[str] = pydantic.Field(default=None)
|
|
26
|
+
"""
|
|
27
|
+
Chat session status
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
system_prompt: typing.Optional[str] = pydantic.Field(default=None)
|
|
31
|
+
"""
|
|
32
|
+
System prompt
|
|
33
|
+
"""
|
|
34
|
+
|
|
35
|
+
title: typing.Optional[str] = pydantic.Field(default=None)
|
|
36
|
+
"""
|
|
37
|
+
Chat session title
|
|
38
|
+
"""
|
|
39
|
+
|
|
40
|
+
agent_id: typing.Optional[str] = pydantic.Field(default=None)
|
|
41
|
+
"""
|
|
42
|
+
Agent ID
|
|
43
|
+
"""
|
|
44
|
+
|
|
45
|
+
created: typing.Optional[str] = pydantic.Field(default=None)
|
|
46
|
+
"""
|
|
47
|
+
Chat session created time
|
|
48
|
+
"""
|
|
49
|
+
|
|
50
|
+
last_message_at: typing.Optional[str] = pydantic.Field(default=None)
|
|
51
|
+
"""
|
|
52
|
+
Chat session last message time
|
|
53
|
+
"""
|
|
54
|
+
|
|
55
|
+
updated: typing.Optional[str] = pydantic.Field(default=None)
|
|
56
|
+
"""
|
|
57
|
+
Chat session updated time
|
|
58
|
+
"""
|
|
59
|
+
|
|
60
|
+
if IS_PYDANTIC_V2:
|
|
61
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
62
|
+
else:
|
|
63
|
+
|
|
64
|
+
class Config:
|
|
65
|
+
frozen = True
|
|
66
|
+
smart_union = True
|
|
67
|
+
extra = pydantic.Extra.allow
|
phenoml/core/client_wrapper.py
CHANGED
|
@@ -22,10 +22,10 @@ class BaseClientWrapper:
|
|
|
22
22
|
|
|
23
23
|
def get_headers(self) -> typing.Dict[str, str]:
|
|
24
24
|
headers: typing.Dict[str, str] = {
|
|
25
|
-
"User-Agent": "phenoml/0.0.
|
|
25
|
+
"User-Agent": "phenoml/0.0.2",
|
|
26
26
|
"X-Fern-Language": "Python",
|
|
27
27
|
"X-Fern-SDK-Name": "phenoml",
|
|
28
|
-
"X-Fern-SDK-Version": "0.0.
|
|
28
|
+
"X-Fern-SDK-Version": "0.0.2",
|
|
29
29
|
**(self.get_custom_headers() or {}),
|
|
30
30
|
}
|
|
31
31
|
headers["Authorization"] = f"Bearer {self._get_token()}"
|
phenoml/tools/__init__.py
CHANGED
|
@@ -11,9 +11,15 @@ from .types import (
|
|
|
11
11
|
Lang2FhirAndCreateResponse,
|
|
12
12
|
Lang2FhirAndSearchRequestProvider,
|
|
13
13
|
Lang2FhirAndSearchResponse,
|
|
14
|
+
McpServerResponse,
|
|
15
|
+
McpServerResponseData,
|
|
16
|
+
McpServerToolCallResponse,
|
|
17
|
+
McpServerToolResponse,
|
|
18
|
+
McpServerToolResponseData,
|
|
14
19
|
SearchConcept,
|
|
15
20
|
)
|
|
16
21
|
from .errors import BadRequestError, FailedDependencyError, ForbiddenError, InternalServerError, UnauthorizedError
|
|
22
|
+
from . import mcp_server
|
|
17
23
|
|
|
18
24
|
__all__ = [
|
|
19
25
|
"BadRequestError",
|
|
@@ -28,6 +34,12 @@ __all__ = [
|
|
|
28
34
|
"Lang2FhirAndCreateResponse",
|
|
29
35
|
"Lang2FhirAndSearchRequestProvider",
|
|
30
36
|
"Lang2FhirAndSearchResponse",
|
|
37
|
+
"McpServerResponse",
|
|
38
|
+
"McpServerResponseData",
|
|
39
|
+
"McpServerToolCallResponse",
|
|
40
|
+
"McpServerToolResponse",
|
|
41
|
+
"McpServerToolResponseData",
|
|
31
42
|
"SearchConcept",
|
|
32
43
|
"UnauthorizedError",
|
|
44
|
+
"mcp_server",
|
|
33
45
|
]
|