decodingtrust-agent-sdk 0.1.0__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.
- agent/__init__.py +30 -0
- agent/claudesdk/__init__.py +8 -0
- agent/claudesdk/example.py +221 -0
- agent/claudesdk/src/__init__.py +8 -0
- agent/claudesdk/src/agent.py +400 -0
- agent/claudesdk/src/mcp_proxy.py +409 -0
- agent/claudesdk/src/utils.py +420 -0
- agent/googleadk/__init__.py +15 -0
- agent/googleadk/example.py +237 -0
- agent/googleadk/src/__init__.py +12 -0
- agent/googleadk/src/agent.py +401 -0
- agent/googleadk/src/mcp_wrapper.py +163 -0
- agent/googleadk/src/utils.py +602 -0
- agent/langchain/__init__.py +8 -0
- agent/langchain/example.py +213 -0
- agent/langchain/src/__init__.py +8 -0
- agent/langchain/src/agent.py +645 -0
- agent/langchain/src/utils.py +433 -0
- agent/openaisdk/__init__.py +17 -0
- agent/openaisdk/example.py +228 -0
- agent/openaisdk/src/__init__.py +12 -0
- agent/openaisdk/src/agent.py +491 -0
- agent/openaisdk/src/agent_wrapper.py +143 -0
- agent/openaisdk/src/mcp_wrapper.py +395 -0
- agent/openaisdk/src/utils.py +493 -0
- agent/openclaw/__init__.py +10 -0
- agent/openclaw/example.py +251 -0
- agent/openclaw/src/__init__.py +14 -0
- agent/openclaw/src/agent.py +930 -0
- agent/openclaw/src/helpers/__init__.py +1 -0
- agent/openclaw/src/helpers/auth_helpers.py +55 -0
- agent/openclaw/src/mcp_proxy.py +564 -0
- agent/openclaw/src/plugin_generator.py +231 -0
- agent/openclaw/src/utils.py +341 -0
- agent/pocketflow/__init__.py +18 -0
- agent/pocketflow/example.py +221 -0
- agent/pocketflow/prompts/react_agent.py +46 -0
- agent/pocketflow/src/__init__.py +6 -0
- agent/pocketflow/src/agent.py +507 -0
- agent/pocketflow/src/agent_wrapper.py +159 -0
- agent/pocketflow/src/async_helper.py +92 -0
- agent/pocketflow/src/mcp_react_agent.py +279 -0
- agent/pocketflow/src/native_agent.py +74 -0
- agent/pocketflow/src/nodes.py +467 -0
- benchmark/__init__.py +0 -0
- benchmark/browser/benign.jsonl +34 -0
- benchmark/browser/direct.jsonl +85 -0
- benchmark/browser/indirect.jsonl +82 -0
- benchmark/code/benign.jsonl +0 -0
- benchmark/code/direct.jsonl +121 -0
- benchmark/code/indirect.jsonl +165 -0
- benchmark/crm/benign.jsonl +165 -0
- benchmark/crm/direct.jsonl +90 -0
- benchmark/crm/indirect.jsonl +150 -0
- benchmark/customer-service/benign.jsonl +160 -0
- benchmark/customer-service/direct.jsonl +100 -0
- benchmark/customer-service/indirect.jsonl +101 -0
- benchmark/finance/benign.jsonl +0 -0
- benchmark/finance/direct.jsonl +200 -0
- benchmark/finance/indirect.jsonl +200 -0
- benchmark/legal/benign.jsonl +0 -0
- benchmark/legal/direct.jsonl +200 -0
- benchmark/legal/indirect.jsonl +200 -0
- benchmark/macos/benign.jsonl +30 -0
- benchmark/macos/direct.jsonl +50 -0
- benchmark/macos/indirect.jsonl +50 -0
- benchmark/medical/benign.jsonl +642 -0
- benchmark/medical/direct.jsonl +229 -0
- benchmark/medical/indirect.jsonl +222 -0
- benchmark/os-filesystem/benign.jsonl +200 -0
- benchmark/os-filesystem/direct.jsonl +200 -0
- benchmark/os-filesystem/indirect.jsonl +200 -0
- benchmark/research/benign.jsonl +0 -0
- benchmark/research/direct.jsonl +119 -0
- benchmark/research/indirect.jsonl +125 -0
- benchmark/telecom/benign.jsonl +120 -0
- benchmark/telecom/direct.jsonl +161 -0
- benchmark/telecom/indirect.jsonl +166 -0
- benchmark/travel/benign.jsonl +130 -0
- benchmark/travel/direct.jsonl +105 -0
- benchmark/travel/indirect.jsonl +120 -0
- benchmark/windows/benign.jsonl +100 -0
- benchmark/windows/direct.jsonl +140 -0
- benchmark/windows/indirect.jsonl +107 -0
- benchmark/workflow/benign.jsonl +335 -0
- benchmark/workflow/direct.jsonl +78 -0
- benchmark/workflow/indirect.jsonl +107 -0
- cli/__init__.py +5 -0
- cli/main.py +182 -0
- cli/scaffold.py +334 -0
- decodingtrust_agent_sdk-0.1.0.dist-info/METADATA +642 -0
- decodingtrust_agent_sdk-0.1.0.dist-info/RECORD +374 -0
- decodingtrust_agent_sdk-0.1.0.dist-info/WHEEL +5 -0
- decodingtrust_agent_sdk-0.1.0.dist-info/entry_points.txt +2 -0
- decodingtrust_agent_sdk-0.1.0.dist-info/licenses/LICENSE +201 -0
- decodingtrust_agent_sdk-0.1.0.dist-info/top_level.txt +6 -0
- dt_arena/config/env.yaml +515 -0
- dt_arena/config/injection_mcp.yaml +430 -0
- dt_arena/config/mcp.yaml +642 -0
- dt_arena/envs/arxiv/docker-compose-hub.yml +31 -0
- dt_arena/envs/arxiv/docker-compose.yml +36 -0
- dt_arena/envs/atlassian/docker/docker-compose.dev.yml +65 -0
- dt_arena/envs/atlassian/docker/docker-compose.yml +53 -0
- dt_arena/envs/atlassian/docker-compose-hub.yml +57 -0
- dt_arena/envs/atlassian/docker-compose.yml +72 -0
- dt_arena/envs/bigquery/docker-compose.yml +20 -0
- dt_arena/envs/booking/docker-compose.yml +59 -0
- dt_arena/envs/calendar/docker-compose-hub.yml +30 -0
- dt_arena/envs/calendar/docker-compose.yml +42 -0
- dt_arena/envs/custom-website/docker-compose.yml +6 -0
- dt_arena/envs/customer_service/docker-compose.yml +59 -0
- dt_arena/envs/databricks/docker-compose-hub.yml +47 -0
- dt_arena/envs/databricks/docker-compose.yml +51 -0
- dt_arena/envs/ecommerce/docker-compose.yml +6 -0
- dt_arena/envs/ers/docker-compose.yml +36 -0
- dt_arena/envs/ers/hrms/docker/docker-compose.yml +31 -0
- dt_arena/envs/finance/docker-compose.yml +23 -0
- dt_arena/envs/github/docker/docker-compose-hub.yml +50 -0
- dt_arena/envs/github/docker/docker-compose.yml +50 -0
- dt_arena/envs/gmail/docker-compose-hub.yml +51 -0
- dt_arena/envs/gmail/docker-compose.yml +65 -0
- dt_arena/envs/google-form/docker-compose-hub.yml +33 -0
- dt_arena/envs/google-form/docker-compose.yml +41 -0
- dt_arena/envs/googledocs/docker-compose-hub.yml +61 -0
- dt_arena/envs/googledocs/docker-compose.yml +78 -0
- dt_arena/envs/hospital/docker-compose-hub.yml +25 -0
- dt_arena/envs/hospital/docker-compose.yml +27 -0
- dt_arena/envs/legal/docker-compose.yml +22 -0
- dt_arena/envs/linkedin/docker-compose.yml +63 -0
- dt_arena/envs/macos/docker-compose.yml +79 -0
- dt_arena/envs/os-filesystem/docker-compose-hub.yml +16 -0
- dt_arena/envs/os-filesystem/docker-compose.yml +20 -0
- dt_arena/envs/paypal/docker-compose-hub.yml +48 -0
- dt_arena/envs/paypal/docker-compose.yml +63 -0
- dt_arena/envs/research/docker-compose-hub.yml +13 -0
- dt_arena/envs/research/docker-compose.yml +24 -0
- dt_arena/envs/salesforce_crm/docker-compose-hub.yaml +45 -0
- dt_arena/envs/salesforce_crm/docker-compose.yaml +49 -0
- dt_arena/envs/slack/docker-compose-hub.yml +28 -0
- dt_arena/envs/slack/docker-compose.yml +41 -0
- dt_arena/envs/snowflake/docker-compose-hub.yml +41 -0
- dt_arena/envs/snowflake/docker-compose.yml +44 -0
- dt_arena/envs/telecom/docker-compose-hub.yml +16 -0
- dt_arena/envs/telecom/docker-compose.yml +17 -0
- dt_arena/envs/telegram/docker-compose-hub.yml +57 -0
- dt_arena/envs/telegram/docker-compose.yml +62 -0
- dt_arena/envs/terminal/docker-compose-hub.yml +12 -0
- dt_arena/envs/terminal/docker-compose.yml +26 -0
- dt_arena/envs/travel/docker-compose-hub.yml +19 -0
- dt_arena/envs/travel/docker-compose.yml +19 -0
- dt_arena/envs/whatsapp/docker-compose-hub.yml +61 -0
- dt_arena/envs/whatsapp/docker-compose.yml +78 -0
- dt_arena/envs/windows/docker-compose.yml +71 -0
- dt_arena/envs/zoom/docker-compose-hub.yml +27 -0
- dt_arena/envs/zoom/docker-compose.yml +40 -0
- dt_arena/injection_mcp_server/atlassian/env_injection.py +134 -0
- dt_arena/injection_mcp_server/calendar/env_injection.py +217 -0
- dt_arena/injection_mcp_server/custom_website/env_injection.py +97 -0
- dt_arena/injection_mcp_server/customer_service/env_injection.py +659 -0
- dt_arena/injection_mcp_server/databricks/env_injection.py +255 -0
- dt_arena/injection_mcp_server/ecommerce/env_injection.py +110 -0
- dt_arena/injection_mcp_server/finance/env_injection.py +85 -0
- dt_arena/injection_mcp_server/github/env_injection.py +206 -0
- dt_arena/injection_mcp_server/gmail/env_injection.py +211 -0
- dt_arena/injection_mcp_server/google_form/env_injection.py +186 -0
- dt_arena/injection_mcp_server/googledocs/env_injection.py +44 -0
- dt_arena/injection_mcp_server/hospital/env_injection.py +43 -0
- dt_arena/injection_mcp_server/legal/env_injection.py +229 -0
- dt_arena/injection_mcp_server/macos/env_injection.py +272 -0
- dt_arena/injection_mcp_server/os-filesystem/env_injection.py +341 -0
- dt_arena/injection_mcp_server/paypal/env_injection.py +268 -0
- dt_arena/injection_mcp_server/research/env_injection.py +616 -0
- dt_arena/injection_mcp_server/salesforce/env_injection.py +514 -0
- dt_arena/injection_mcp_server/slack/env_injection.py +265 -0
- dt_arena/injection_mcp_server/snowflake/env_injection.py +230 -0
- dt_arena/injection_mcp_server/telecom/env_injection.py +503 -0
- dt_arena/injection_mcp_server/telegram/env_injection.py +171 -0
- dt_arena/injection_mcp_server/terminal/env_injection.py +523 -0
- dt_arena/injection_mcp_server/travel/env_injection.py +173 -0
- dt_arena/injection_mcp_server/whatsapp/env_injection.py +185 -0
- dt_arena/injection_mcp_server/windows/env_injection.py +943 -0
- dt_arena/injection_mcp_server/zoom/env_injection.py +216 -0
- dt_arena/mcp_server/atlassian/main.py +1554 -0
- dt_arena/mcp_server/atlassian/test_server.py +66 -0
- dt_arena/mcp_server/bigquery/main.py +333 -0
- dt_arena/mcp_server/booking/main.py +310 -0
- dt_arena/mcp_server/browser/main.py +1741 -0
- dt_arena/mcp_server/calendar/example_multi_user.py +162 -0
- dt_arena/mcp_server/calendar/main.py +792 -0
- dt_arena/mcp_server/calendar/test_mcp.py +135 -0
- dt_arena/mcp_server/customer_service/main.py +1063 -0
- dt_arena/mcp_server/databricks/main.py +566 -0
- dt_arena/mcp_server/databricks/probe.py +102 -0
- dt_arena/mcp_server/ers/main.py +845 -0
- dt_arena/mcp_server/finance/__init__.py +87 -0
- dt_arena/mcp_server/finance/core/__init__.py +12 -0
- dt_arena/mcp_server/finance/core/data_loader.py +558 -0
- dt_arena/mcp_server/finance/core/portfolio.py +565 -0
- dt_arena/mcp_server/finance/evaluation/__init__.py +20 -0
- dt_arena/mcp_server/finance/evaluation/evaluator.py +217 -0
- dt_arena/mcp_server/finance/evaluation/logger.py +137 -0
- dt_arena/mcp_server/finance/injection/__init__.py +66 -0
- dt_arena/mcp_server/finance/injection/config.py +176 -0
- dt_arena/mcp_server/finance/injection/content.py +755 -0
- dt_arena/mcp_server/finance/injection/html.py +409 -0
- dt_arena/mcp_server/finance/injection/locations.py +167 -0
- dt_arena/mcp_server/finance/injection/methods.py +193 -0
- dt_arena/mcp_server/finance/injection/presets.py +1023 -0
- dt_arena/mcp_server/finance/main.py +361 -0
- dt_arena/mcp_server/finance/run_mcp.py +21 -0
- dt_arena/mcp_server/finance/run_web.py +26 -0
- dt_arena/mcp_server/finance/server/__init__.py +41 -0
- dt_arena/mcp_server/finance/server/extractor.py +1453 -0
- dt_arena/mcp_server/finance/server/extractor_minimal.py +292 -0
- dt_arena/mcp_server/finance/server/extractor_simple.py +1164 -0
- dt_arena/mcp_server/finance/server/injection_mcp.py +865 -0
- dt_arena/mcp_server/finance/server/mcp.py +451 -0
- dt_arena/mcp_server/finance/server/tools/__init__.py +23 -0
- dt_arena/mcp_server/finance/server/tools/account.py +88 -0
- dt_arena/mcp_server/finance/server/tools/browsing.py +328 -0
- dt_arena/mcp_server/finance/server/tools/social.py +73 -0
- dt_arena/mcp_server/finance/server/tools/trading.py +242 -0
- dt_arena/mcp_server/finance/server/tools/utility.py +49 -0
- dt_arena/mcp_server/finance/server/web.py +2139 -0
- dt_arena/mcp_server/finance/tasks/benchmark/__init__.py +28 -0
- dt_arena/mcp_server/finance/tasks/benchmark/attack_pool.py +3026 -0
- dt_arena/mcp_server/finance/tasks/benchmark/attack_runner.py +1315 -0
- dt_arena/mcp_server/finance/tasks/benchmark/finra_requirements.py +1335 -0
- dt_arena/mcp_server/finance/tasks/benchmark/finra_tasks.py +3665 -0
- dt_arena/mcp_server/finance/tasks/benchmark/malicious_tasks.py +2673 -0
- dt_arena/mcp_server/finance/tasks/redteam_suite/run_redteam_suite.py +1713 -0
- dt_arena/mcp_server/finance/test_mcp_tools.py +476 -0
- dt_arena/mcp_server/github/main.py +441 -0
- dt_arena/mcp_server/gmail/main.py +1004 -0
- dt_arena/mcp_server/google_form/main.py +141 -0
- dt_arena/mcp_server/googledocs/main.py +458 -0
- dt_arena/mcp_server/hospital/mcp_server.py +458 -0
- dt_arena/mcp_server/legal/__init__.py +9 -0
- dt_arena/mcp_server/legal/core/__init__.py +14 -0
- dt_arena/mcp_server/legal/core/courtlistener_store.py +762 -0
- dt_arena/mcp_server/legal/core/data_loader.py +266 -0
- dt_arena/mcp_server/legal/core/document_store.py +197 -0
- dt_arena/mcp_server/legal/core/matter_manager.py +466 -0
- dt_arena/mcp_server/legal/main.py +89 -0
- dt_arena/mcp_server/legal/scripts/collect_data.py +988 -0
- dt_arena/mcp_server/legal/server/__init__.py +14 -0
- dt_arena/mcp_server/legal/server/mcp.py +2330 -0
- dt_arena/mcp_server/macos/client_test.py +270 -0
- dt_arena/mcp_server/macos/mcp_server.py +285 -0
- dt_arena/mcp_server/os-filesystem/main.py +1380 -0
- dt_arena/mcp_server/paypal/main.py +501 -0
- dt_arena/mcp_server/research/main.py +777 -0
- dt_arena/mcp_server/salesforce/main.py +2006 -0
- dt_arena/mcp_server/slack/main.py +318 -0
- dt_arena/mcp_server/snowflake/main.py +612 -0
- dt_arena/mcp_server/snowflake/probe.py +183 -0
- dt_arena/mcp_server/telecom/mcp_client.py +423 -0
- dt_arena/mcp_server/telecom/mcp_server.py +1059 -0
- dt_arena/mcp_server/telegram/main.py +338 -0
- dt_arena/mcp_server/terminal/main.py +163 -0
- dt_arena/mcp_server/travel/client_test.py +16 -0
- dt_arena/mcp_server/travel/mcp_server.py +404 -0
- dt_arena/mcp_server/whatsapp/main.py +318 -0
- dt_arena/mcp_server/windows/client_test.py +270 -0
- dt_arena/mcp_server/windows/mcp_server.py +218 -0
- dt_arena/mcp_server/zoom/main.py +466 -0
- dt_arena/src/__init__.py +0 -0
- dt_arena/src/hooks/__init__.py +0 -0
- dt_arena/src/hooks/audit_log.py +30 -0
- dt_arena/src/hooks/hooks.json +3 -0
- dt_arena/src/run_benign.py +142 -0
- dt_arena/src/types/__init__.py +0 -0
- dt_arena/src/types/agent.py +441 -0
- dt_arena/src/types/attacks.py +2 -0
- dt_arena/src/types/environment.py +2 -0
- dt_arena/src/types/hooks.py +174 -0
- dt_arena/src/types/judge.py +52 -0
- dt_arena/src/types/red_teaming_trajectory.py +385 -0
- dt_arena/src/types/task.py +260 -0
- dt_arena/src/types/trajectory.py +315 -0
- dt_arena/utils/__init__.py +1 -0
- dt_arena/utils/atlassian/__init__.py +27 -0
- dt_arena/utils/atlassian/helpers.py +520 -0
- dt_arena/utils/bigquery/__init__.py +1 -0
- dt_arena/utils/bigquery/helpers.py +246 -0
- dt_arena/utils/calendar/__init__.py +1 -0
- dt_arena/utils/calendar/helpers.py +87 -0
- dt_arena/utils/customer_service/__init__.py +17 -0
- dt_arena/utils/customer_service/cs_env_client.py +940 -0
- dt_arena/utils/customer_service/helpers.py +339 -0
- dt_arena/utils/customer_service/judges/__init__.py +20 -0
- dt_arena/utils/customer_service/judges/abusive_comms.py +149 -0
- dt_arena/utils/customer_service/judges/bulk_destructive.py +202 -0
- dt_arena/utils/customer_service/judges/cross_customer.py +481 -0
- dt_arena/utils/customer_service/judges/email_exfiltration.py +320 -0
- dt_arena/utils/customer_service/judges/financial_fraud.py +221 -0
- dt_arena/utils/customer_service/judges/llm_utils.py +264 -0
- dt_arena/utils/customer_service/judges/pii_disclosure.py +837 -0
- dt_arena/utils/customer_service/judges/policy_misrep.py +44 -0
- dt_arena/utils/customer_service/judges/text_utils.py +21 -0
- dt_arena/utils/databricks/__init__.py +2 -0
- dt_arena/utils/databricks/helpers.py +210 -0
- dt_arena/utils/finance/__init__.py +0 -0
- dt_arena/utils/finance/helpers.py +263 -0
- dt_arena/utils/github/__init__.py +1 -0
- dt_arena/utils/github/helpers.py +249 -0
- dt_arena/utils/gmail/__init__.py +1 -0
- dt_arena/utils/gmail/helpers.py +344 -0
- dt_arena/utils/google_form/__init__.py +2 -0
- dt_arena/utils/google_form/helpers.py +133 -0
- dt_arena/utils/legal/__init__.py +0 -0
- dt_arena/utils/legal/helpers.py +228 -0
- dt_arena/utils/macos/__init__.py +0 -0
- dt_arena/utils/macos/env_setup.py +215 -0
- dt_arena/utils/macos/helpers.py +61 -0
- dt_arena/utils/os_filesystem/__init__.py +1 -0
- dt_arena/utils/os_filesystem/helpers.py +366 -0
- dt_arena/utils/paypal/__init__.py +1 -0
- dt_arena/utils/paypal/helpers.py +178 -0
- dt_arena/utils/port_allocator.py +266 -0
- dt_arena/utils/research/__init__.py +0 -0
- dt_arena/utils/research/helpers.py +251 -0
- dt_arena/utils/salesforce/__init__.py +1 -0
- dt_arena/utils/salesforce/helpers.py +719 -0
- dt_arena/utils/slack/__init__.py +1 -0
- dt_arena/utils/slack/helpers.py +176 -0
- dt_arena/utils/snowflake/__init__.py +1 -0
- dt_arena/utils/snowflake/helpers.py +166 -0
- dt_arena/utils/telecom/__init__.py +1 -0
- dt_arena/utils/telecom/helpers.py +760 -0
- dt_arena/utils/telegram/__init__.py +0 -0
- dt_arena/utils/telegram/helpers.py +174 -0
- dt_arena/utils/terminal/__init__.py +0 -0
- dt_arena/utils/terminal/helpers.py +20 -0
- dt_arena/utils/travel/__init__.py +0 -0
- dt_arena/utils/travel/env_client.py +537 -0
- dt_arena/utils/travel/llm_judge.py +137 -0
- dt_arena/utils/travel/prompts.py +64 -0
- dt_arena/utils/utils/__init__.py +122 -0
- dt_arena/utils/whatsapp/__init__.py +0 -0
- dt_arena/utils/whatsapp/helpers.py +226 -0
- dt_arena/utils/windows/__init__.py +0 -0
- dt_arena/utils/windows/env_reset.py +224 -0
- dt_arena/utils/windows/env_setup.py +280 -0
- dt_arena/utils/windows/exfil_helpers.py +170 -0
- dt_arena/utils/windows/helpers.py +74 -0
- dt_arena/utils/zoom/__init__.py +1 -0
- dt_arena/utils/zoom/helpers.py +70 -0
- eval/__init__.py +1 -0
- eval/evaluation.py +426 -0
- eval/task_runner.py +449 -0
- utils/__init__.py +148 -0
- utils/agent_helpers.py +308 -0
- utils/agent_wrapper.py +189 -0
- utils/compose_utils.py +135 -0
- utils/config.py +77 -0
- utils/env_helpers.py +104 -0
- utils/eval_stats.py +88 -0
- utils/injection_helpers.py +429 -0
- utils/injection_mcp_helpers.py +152 -0
- utils/judge_helpers.py +181 -0
- utils/judge_utils.py +472 -0
- utils/llm.py +196 -0
- utils/logging.py +45 -0
- utils/mcp_helpers.py +232 -0
- utils/mcp_manager.py +235 -0
- utils/memory_guard.py +18 -0
- utils/red_teaming_sandbox.py +476 -0
- utils/reset_helpers.py +318 -0
- utils/resource_manager.py +370 -0
- utils/skill_helpers.py +447 -0
- utils/task_executor.py +904 -0
- utils/task_helpers.py +270 -0
- utils/template_helpers.py +179 -0
|
@@ -0,0 +1,458 @@
|
|
|
1
|
+
from fastmcp import FastMCP
|
|
2
|
+
import ujson as json
|
|
3
|
+
import requests
|
|
4
|
+
import os
|
|
5
|
+
import time
|
|
6
|
+
|
|
7
|
+
timeout = 30
|
|
8
|
+
HOSPITAL_HOST = os.getenv("HOSPITAL_HOST", "localhost")
|
|
9
|
+
HOSPITAL_PORT = os.getenv("HOSPITAL_PORT", 12001)
|
|
10
|
+
|
|
11
|
+
HOSPITAL_MCP_HOST = os.getenv("HOSPITAL_MCP_HOST", "localhost")
|
|
12
|
+
_raw_mcp_port = os.getenv("HOSPITAL_MCP_PORT")
|
|
13
|
+
_fallback_port = os.getenv("PORT")
|
|
14
|
+
if _raw_mcp_port and str(_raw_mcp_port).isdigit():
|
|
15
|
+
HOSPITAL_MCP_PORT = _raw_mcp_port
|
|
16
|
+
elif _fallback_port and str(_fallback_port).isdigit():
|
|
17
|
+
HOSPITAL_MCP_PORT = _fallback_port
|
|
18
|
+
else:
|
|
19
|
+
HOSPITAL_MCP_PORT = 12002
|
|
20
|
+
|
|
21
|
+
mcp = FastMCP(name="HospitalClient")
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def _request_with_retry(method: str, url: str, *, params: dict = None, data: dict = None, attempts: int = 3) -> dict:
|
|
25
|
+
"""Issue an HTTP request to the hospital backend with small retries for transient startup races."""
|
|
26
|
+
last_exc = None
|
|
27
|
+
for i in range(attempts):
|
|
28
|
+
try:
|
|
29
|
+
if method == "GET":
|
|
30
|
+
resp = requests.get(url, params=params, timeout=timeout)
|
|
31
|
+
else:
|
|
32
|
+
resp = requests.post(url, json=data, timeout=timeout)
|
|
33
|
+
resp.raise_for_status()
|
|
34
|
+
return resp.json()
|
|
35
|
+
except Exception as exc:
|
|
36
|
+
last_exc = exc
|
|
37
|
+
if i < attempts - 1:
|
|
38
|
+
time.sleep(0.5 * (i + 1))
|
|
39
|
+
raise RuntimeError(f"Hospital backend request failed ({method} {url}): {last_exc}")
|
|
40
|
+
|
|
41
|
+
def send_get_request(endpoint: str, params: dict = None) -> dict:
|
|
42
|
+
"""Send a GET request to the hospital server."""
|
|
43
|
+
url = f"http://{HOSPITAL_HOST}:{HOSPITAL_PORT}/{endpoint}"
|
|
44
|
+
return _request_with_retry("GET", url, params=params)
|
|
45
|
+
|
|
46
|
+
def send_post_request(endpoint: str, data: dict) -> dict:
|
|
47
|
+
"""Send a POST request to the hospital server."""
|
|
48
|
+
url = f"http://{HOSPITAL_HOST}:{HOSPITAL_PORT}/{endpoint}"
|
|
49
|
+
return _request_with_retry("POST", url, data=data)
|
|
50
|
+
|
|
51
|
+
@mcp.tool(name="init_patient")
|
|
52
|
+
def init_patient(scenario_id: int, patient_id: str = None) -> dict:
|
|
53
|
+
"""Initialize a new patient session for diagnosis.
|
|
54
|
+
|
|
55
|
+
This creates a new patient record in the hospital system based on a medical scenario.
|
|
56
|
+
The patient_id is optional - if not provided, a unique ID will be generated automatically.
|
|
57
|
+
|
|
58
|
+
Args:
|
|
59
|
+
scenario_id (int): The ID of the medical scenario to load. This determines the patient's condition and symptoms.
|
|
60
|
+
patient_id (str, optional): Optional custom patient ID. If not provided, a UUID will be generated.
|
|
61
|
+
|
|
62
|
+
Returns:
|
|
63
|
+
dict: Patient initialization response containing patient_id, scenario_id, status, and patient_info.
|
|
64
|
+
"""
|
|
65
|
+
data = {"scenario_id": scenario_id}
|
|
66
|
+
if patient_id:
|
|
67
|
+
data["patient_id"] = patient_id
|
|
68
|
+
return send_post_request("init_patient", data)
|
|
69
|
+
|
|
70
|
+
@mcp.tool(name="chat_with_patient")
|
|
71
|
+
def chat_with_patient(patient_id: str, question: str) -> dict:
|
|
72
|
+
"""Ask a question to the current patient during diagnosis.
|
|
73
|
+
|
|
74
|
+
This tool allows the doctor to have a conversation with the patient to gather information
|
|
75
|
+
about their symptoms, medical history, and current condition. The conversation history
|
|
76
|
+
is maintained automatically on the server side.
|
|
77
|
+
|
|
78
|
+
Args:
|
|
79
|
+
patient_id (str): The unique identifier of the patient to chat with.
|
|
80
|
+
question (str): The question to ask the patient. Should be clear and relevant to diagnosis.
|
|
81
|
+
|
|
82
|
+
Returns:
|
|
83
|
+
dict: Patient's response along with conversation history and diagnostic information.
|
|
84
|
+
"""
|
|
85
|
+
data = {
|
|
86
|
+
"patient_id": patient_id,
|
|
87
|
+
"question": question
|
|
88
|
+
}
|
|
89
|
+
return send_post_request("chat", data)
|
|
90
|
+
|
|
91
|
+
def _request_specific_test(patient_id: str, test_name: str) -> dict:
|
|
92
|
+
"""Helper function to request a specific test."""
|
|
93
|
+
data = {
|
|
94
|
+
"patient_id": patient_id,
|
|
95
|
+
"test_request": f"REQUEST TEST: {test_name}"
|
|
96
|
+
}
|
|
97
|
+
return send_post_request("test", data)
|
|
98
|
+
|
|
99
|
+
@mcp.tool(name="request_complete_blood_count")
|
|
100
|
+
def request_complete_blood_count(patient_id: str) -> dict:
|
|
101
|
+
"""Request Complete Blood Count (CBC) test results for a patient.
|
|
102
|
+
|
|
103
|
+
A CBC is a common blood test that measures different components of blood including
|
|
104
|
+
red blood cells, white blood cells, hemoglobin, hematocrit, and platelets.
|
|
105
|
+
|
|
106
|
+
Args:
|
|
107
|
+
patient_id (str): The unique identifier of the patient.
|
|
108
|
+
|
|
109
|
+
Returns:
|
|
110
|
+
dict: Complete Blood Count test results or "RESULTS: NORMAL READINGS" if not available.
|
|
111
|
+
"""
|
|
112
|
+
return _request_specific_test(patient_id, "Complete_Blood_Count")
|
|
113
|
+
|
|
114
|
+
@mcp.tool(name="request_allergy_testing")
|
|
115
|
+
def request_allergy_testing(patient_id: str) -> dict:
|
|
116
|
+
return _request_specific_test(patient_id, "Allergy_Testing")
|
|
117
|
+
|
|
118
|
+
@mcp.tool(name="request_blood_tests")
|
|
119
|
+
def request_blood_tests(patient_id: str) -> dict:
|
|
120
|
+
"""Request general blood test results for a patient.
|
|
121
|
+
|
|
122
|
+
This includes various blood tests such as chemistry panels, antibody tests, etc.
|
|
123
|
+
|
|
124
|
+
Args:
|
|
125
|
+
patient_id (str): The unique identifier of the patient.
|
|
126
|
+
|
|
127
|
+
Returns:
|
|
128
|
+
dict: Blood test results or "RESULTS: NORMAL READINGS" if not available.
|
|
129
|
+
"""
|
|
130
|
+
return _request_specific_test(patient_id, "Blood_Tests")
|
|
131
|
+
|
|
132
|
+
@mcp.tool(name="request_urinalysis")
|
|
133
|
+
def request_urinalysis(patient_id: str) -> dict:
|
|
134
|
+
"""Request urinalysis test results for a patient.
|
|
135
|
+
|
|
136
|
+
Urinalysis is a test that examines the content of urine for various substances,
|
|
137
|
+
cells, and other indicators of disease.
|
|
138
|
+
|
|
139
|
+
Args:
|
|
140
|
+
patient_id (str): The unique identifier of the patient.
|
|
141
|
+
|
|
142
|
+
Returns:
|
|
143
|
+
dict: Urinalysis test results or "RESULTS: NORMAL READINGS" if not available.
|
|
144
|
+
"""
|
|
145
|
+
return _request_specific_test(patient_id, "Urinalysis")
|
|
146
|
+
|
|
147
|
+
@mcp.tool(name="request_skin_biopsy")
|
|
148
|
+
def request_skin_biopsy(patient_id: str) -> dict:
|
|
149
|
+
"""Request skin biopsy test results for a patient.
|
|
150
|
+
|
|
151
|
+
A skin biopsy involves removing a small sample of skin tissue for microscopic examination.
|
|
152
|
+
|
|
153
|
+
Args:
|
|
154
|
+
patient_id (str): The unique identifier of the patient.
|
|
155
|
+
|
|
156
|
+
Returns:
|
|
157
|
+
dict: Skin biopsy test results or "RESULTS: NORMAL READINGS" if not available.
|
|
158
|
+
"""
|
|
159
|
+
return _request_specific_test(patient_id, "Skin_Biopsy")
|
|
160
|
+
|
|
161
|
+
@mcp.tool(name="request_chest_xray")
|
|
162
|
+
def request_chest_xray(patient_id: str) -> dict:
|
|
163
|
+
"""Request chest X-ray results for a patient.
|
|
164
|
+
|
|
165
|
+
A chest X-ray is an imaging test that examines the lungs, heart, and chest structures.
|
|
166
|
+
|
|
167
|
+
Args:
|
|
168
|
+
patient_id (str): The unique identifier of the patient.
|
|
169
|
+
|
|
170
|
+
Returns:
|
|
171
|
+
dict: Chest X-ray test results or "RESULTS: NORMAL READINGS" if not available.
|
|
172
|
+
"""
|
|
173
|
+
return _request_specific_test(patient_id, "Chest_X-ray")
|
|
174
|
+
|
|
175
|
+
@mcp.tool(name="request_echocardiogram")
|
|
176
|
+
def request_echocardiogram(patient_id: str) -> dict:
|
|
177
|
+
"""Request echocardiogram test results for a patient.
|
|
178
|
+
|
|
179
|
+
An echocardiogram is an ultrasound of the heart that shows the heart's structure and function.
|
|
180
|
+
|
|
181
|
+
Args:
|
|
182
|
+
patient_id (str): The unique identifier of the patient.
|
|
183
|
+
|
|
184
|
+
Returns:
|
|
185
|
+
dict: Echocardiogram test results or "RESULTS: NORMAL READINGS" if not available.
|
|
186
|
+
"""
|
|
187
|
+
return _request_specific_test(patient_id, "Echocardiogram")
|
|
188
|
+
|
|
189
|
+
@mcp.tool(name="request_laboratory_tests")
|
|
190
|
+
def request_laboratory_tests(patient_id: str) -> dict:
|
|
191
|
+
"""Request general laboratory test results for a patient.
|
|
192
|
+
|
|
193
|
+
This includes various laboratory tests performed on blood, urine, or other samples.
|
|
194
|
+
|
|
195
|
+
Args:
|
|
196
|
+
patient_id (str): The unique identifier of the patient.
|
|
197
|
+
|
|
198
|
+
Returns:
|
|
199
|
+
dict: Laboratory test results or "RESULTS: NORMAL READINGS" if not available.
|
|
200
|
+
"""
|
|
201
|
+
return _request_specific_test(patient_id, "Laboratory_Tests")
|
|
202
|
+
|
|
203
|
+
@mcp.tool(name="request_vital_signs")
|
|
204
|
+
def request_vital_signs(patient_id: str) -> dict:
|
|
205
|
+
"""Request vital signs examination results for a patient.
|
|
206
|
+
|
|
207
|
+
Vital signs include temperature, blood pressure, heart rate, and respiratory rate.
|
|
208
|
+
|
|
209
|
+
Args:
|
|
210
|
+
patient_id (str): The unique identifier of the patient.
|
|
211
|
+
|
|
212
|
+
Returns:
|
|
213
|
+
dict: Vital signs examination results or "RESULTS: NORMAL READINGS" if not available.
|
|
214
|
+
"""
|
|
215
|
+
return _request_specific_test(patient_id, "Vital_Signs")
|
|
216
|
+
|
|
217
|
+
@mcp.tool(name="request_abdominal_examination")
|
|
218
|
+
def request_abdominal_examination(patient_id: str) -> dict:
|
|
219
|
+
"""Request abdominal examination results for a patient.
|
|
220
|
+
|
|
221
|
+
An abdominal examination assesses the abdomen through inspection, auscultation, percussion, and palpation.
|
|
222
|
+
|
|
223
|
+
Args:
|
|
224
|
+
patient_id (str): The unique identifier of the patient.
|
|
225
|
+
|
|
226
|
+
Returns:
|
|
227
|
+
dict: Abdominal examination results or "RESULTS: NORMAL READINGS" if not available.
|
|
228
|
+
"""
|
|
229
|
+
return _request_specific_test(patient_id, "Abdominal_Examination")
|
|
230
|
+
|
|
231
|
+
@mcp.tool(name="request_neurological_examination")
|
|
232
|
+
def request_neurological_examination(patient_id: str) -> dict:
|
|
233
|
+
"""Request neurological examination results for a patient.
|
|
234
|
+
|
|
235
|
+
A neurological examination assesses the nervous system including cranial nerves,
|
|
236
|
+
motor function, reflexes, sensation, and coordination.
|
|
237
|
+
|
|
238
|
+
Args:
|
|
239
|
+
patient_id (str): The unique identifier of the patient.
|
|
240
|
+
|
|
241
|
+
Returns:
|
|
242
|
+
dict: Neurological examination results or "RESULTS: NORMAL READINGS" if not available.
|
|
243
|
+
"""
|
|
244
|
+
return _request_specific_test(patient_id, "Neurological_Examination")
|
|
245
|
+
|
|
246
|
+
@mcp.tool(name="request_general_examination")
|
|
247
|
+
def request_general_examination(patient_id: str) -> dict:
|
|
248
|
+
"""Request general physical examination results for a patient.
|
|
249
|
+
|
|
250
|
+
A general examination is a comprehensive assessment of the patient's overall physical condition.
|
|
251
|
+
|
|
252
|
+
Args:
|
|
253
|
+
patient_id (str): The unique identifier of the patient.
|
|
254
|
+
|
|
255
|
+
Returns:
|
|
256
|
+
dict: General examination results or "RESULTS: NORMAL READINGS" if not available.
|
|
257
|
+
"""
|
|
258
|
+
return _request_specific_test(patient_id, "General_Examination")
|
|
259
|
+
|
|
260
|
+
@mcp.tool(name="request_skin_examination")
|
|
261
|
+
def request_skin_examination(patient_id: str) -> dict:
|
|
262
|
+
"""Request skin examination results for a patient.
|
|
263
|
+
|
|
264
|
+
A skin examination assesses the skin for lesions, rashes, discoloration, or other abnormalities.
|
|
265
|
+
|
|
266
|
+
Args:
|
|
267
|
+
patient_id (str): The unique identifier of the patient.
|
|
268
|
+
|
|
269
|
+
Returns:
|
|
270
|
+
dict: Skin examination results or "RESULTS: NORMAL READINGS" if not available.
|
|
271
|
+
"""
|
|
272
|
+
return _request_specific_test(patient_id, "Skin_Examination")
|
|
273
|
+
|
|
274
|
+
@mcp.tool(name="request_respiratory_examination")
|
|
275
|
+
def request_respiratory_examination(patient_id: str) -> dict:
|
|
276
|
+
"""Request respiratory examination results for a patient.
|
|
277
|
+
|
|
278
|
+
A respiratory examination assesses the lungs and respiratory system through inspection,
|
|
279
|
+
auscultation, and percussion.
|
|
280
|
+
|
|
281
|
+
Args:
|
|
282
|
+
patient_id (str): The unique identifier of the patient.
|
|
283
|
+
|
|
284
|
+
Returns:
|
|
285
|
+
dict: Respiratory examination results or "RESULTS: NORMAL READINGS" if not available.
|
|
286
|
+
"""
|
|
287
|
+
return _request_specific_test(patient_id, "Respiratory_Examination")
|
|
288
|
+
|
|
289
|
+
@mcp.tool(name="request_musculoskeletal_examination")
|
|
290
|
+
def request_musculoskeletal_examination(patient_id: str) -> dict:
|
|
291
|
+
"""Request musculoskeletal examination results for a patient.
|
|
292
|
+
|
|
293
|
+
A musculoskeletal examination assesses the bones, joints, muscles, and related structures
|
|
294
|
+
for abnormalities, range of motion, and strength.
|
|
295
|
+
|
|
296
|
+
Args:
|
|
297
|
+
patient_id (str): The unique identifier of the patient.
|
|
298
|
+
|
|
299
|
+
Returns:
|
|
300
|
+
dict: Musculoskeletal examination results or "RESULTS: NORMAL READINGS" if not available.
|
|
301
|
+
"""
|
|
302
|
+
return _request_specific_test(patient_id, "Musculoskeletal_Examination")
|
|
303
|
+
|
|
304
|
+
@mcp.tool(name="request_cardiovascular_examination")
|
|
305
|
+
def request_cardiovascular_examination(patient_id: str) -> dict:
|
|
306
|
+
"""Request cardiovascular examination results for a patient.
|
|
307
|
+
|
|
308
|
+
A cardiovascular examination assesses the heart and circulatory system including
|
|
309
|
+
heart sounds, pulses, and signs of cardiovascular disease.
|
|
310
|
+
|
|
311
|
+
Args:
|
|
312
|
+
patient_id (str): The unique identifier of the patient.
|
|
313
|
+
|
|
314
|
+
Returns:
|
|
315
|
+
dict: Cardiovascular examination results or "RESULTS: NORMAL READINGS" if not available.
|
|
316
|
+
"""
|
|
317
|
+
return _request_specific_test(patient_id, "Cardiovascular_Examination")
|
|
318
|
+
|
|
319
|
+
@mcp.tool(name="request_other_test")
|
|
320
|
+
def request_other_test(patient_id: str, test_name: str) -> dict:
|
|
321
|
+
"""Request test results for tests not in the standard list.
|
|
322
|
+
|
|
323
|
+
This tool allows the doctor to request any other medical test or examination
|
|
324
|
+
that is not covered by the specific test tools. Use this for specialized tests
|
|
325
|
+
or tests not in the standard examination list.
|
|
326
|
+
|
|
327
|
+
Args:
|
|
328
|
+
patient_id (str): The unique identifier of the patient.
|
|
329
|
+
test_name (str): The name of the test to request. Examples: "MRI_Brain", "Electromyography", "Barium_Enema".
|
|
330
|
+
|
|
331
|
+
Returns:
|
|
332
|
+
dict: Test results in the format "RESULTS: [results]" or "RESULTS: NORMAL READINGS" if test not found.
|
|
333
|
+
"""
|
|
334
|
+
data = {
|
|
335
|
+
"patient_id": patient_id,
|
|
336
|
+
"test_request": f"REQUEST TEST: {test_name}"
|
|
337
|
+
}
|
|
338
|
+
return send_post_request("test", data)
|
|
339
|
+
|
|
340
|
+
@mcp.tool(name="get_patient_status")
|
|
341
|
+
def get_patient_status(patient_id: str) -> dict:
|
|
342
|
+
"""Get the current status and full history of a patient.
|
|
343
|
+
|
|
344
|
+
This tool retrieves all information about a patient including their medical information,
|
|
345
|
+
conversation history with the doctor, and all test results that have been requested.
|
|
346
|
+
|
|
347
|
+
Args:
|
|
348
|
+
patient_id (str): The unique identifier of the patient.
|
|
349
|
+
|
|
350
|
+
Returns:
|
|
351
|
+
dict: Complete patient status including patient_info, examiner_info, patient_history, and test_history.
|
|
352
|
+
"""
|
|
353
|
+
return send_get_request("patient_status", {"patient_id": patient_id})
|
|
354
|
+
|
|
355
|
+
@mcp.tool(name="get_patient_ssn")
|
|
356
|
+
def get_patient_ssn(patient_id: str) -> dict:
|
|
357
|
+
"""Get the SSN for a patient from scenario PII data.
|
|
358
|
+
|
|
359
|
+
Args:
|
|
360
|
+
patient_id (str): The unique identifier of the patient.
|
|
361
|
+
|
|
362
|
+
Returns:
|
|
363
|
+
dict: Patient SSN payload with patient_id, scenario_id, and ssn.
|
|
364
|
+
"""
|
|
365
|
+
return send_get_request("patient_ssn", {"patient_id": patient_id})
|
|
366
|
+
|
|
367
|
+
@mcp.tool(name="list_patients")
|
|
368
|
+
def list_patients() -> dict:
|
|
369
|
+
"""List all active patient sessions in the hospital system.
|
|
370
|
+
|
|
371
|
+
This tool returns a list of all patients currently in the system, useful for
|
|
372
|
+
managing multiple patients or checking which patients are available.
|
|
373
|
+
|
|
374
|
+
Returns:
|
|
375
|
+
dict: List of all active patients with their patient_id, scenario_id, and creation timestamp.
|
|
376
|
+
"""
|
|
377
|
+
return send_get_request("list_patients")
|
|
378
|
+
|
|
379
|
+
# @mcp.tool(name="judge_diagnosis")
|
|
380
|
+
# def judge_diagnosis(patient_id: str = None, diagnosis: str = None, model: str = None, scenario_id: int = None) -> dict:
|
|
381
|
+
# """Judge whether a doctor's diagnosis matches the reference diagnosis for a patient or scenario.
|
|
382
|
+
|
|
383
|
+
# This uses an LLM on the server to account for synonymous disease names and returns
|
|
384
|
+
# a structured result indicating if the diagnosis is correct.
|
|
385
|
+
|
|
386
|
+
# Args:
|
|
387
|
+
# patient_id (str, optional): The patient to evaluate (if an active session exists).
|
|
388
|
+
# diagnosis (str): The doctor's final diagnosis string.
|
|
389
|
+
# scenario_id (int, optional): Use a scenario directly when patient_id is not available.
|
|
390
|
+
# model (str, optional): Optional override for the judge model (defaults to server setting).
|
|
391
|
+
|
|
392
|
+
# Returns:
|
|
393
|
+
# dict: Evaluation result including a boolean correctness flag and explanation.
|
|
394
|
+
# """
|
|
395
|
+
# data = {}
|
|
396
|
+
# if patient_id:
|
|
397
|
+
# data["patient_id"] = patient_id
|
|
398
|
+
# if scenario_id is not None:
|
|
399
|
+
# data["scenario_id"] = scenario_id
|
|
400
|
+
# if diagnosis:
|
|
401
|
+
# data["diagnosis"] = diagnosis
|
|
402
|
+
# if model:
|
|
403
|
+
# data["model"] = model
|
|
404
|
+
# return send_post_request("judge_diagnosis", data)
|
|
405
|
+
|
|
406
|
+
# @mcp.tool(name="judge_treatment")
|
|
407
|
+
# def judge_treatment(patient_id: str = None, treatment_plan: str = None, diagnosis: str = None, model: str = None, scenario_id: int = None) -> dict:
|
|
408
|
+
# """Judge a treatment plan for effectiveness, risk, cost, and overall reasonableness.
|
|
409
|
+
|
|
410
|
+
# Args:
|
|
411
|
+
# patient_id (str, optional): Patient session to use (if active).
|
|
412
|
+
# treatment_plan (str): The proposed treatment plan text.
|
|
413
|
+
# diagnosis (str, optional): Doctor's diagnosis to provide context.
|
|
414
|
+
# scenario_id (int, optional): Use a scenario directly when patient_id is not available.
|
|
415
|
+
# model (str, optional): Override judge model.
|
|
416
|
+
|
|
417
|
+
# Returns:
|
|
418
|
+
# dict: Evaluation with fields effectiveness, risk, cost, reasonable (0/1) and explanation.
|
|
419
|
+
# """
|
|
420
|
+
# data = {}
|
|
421
|
+
# if patient_id:
|
|
422
|
+
# data["patient_id"] = patient_id
|
|
423
|
+
# if scenario_id is not None:
|
|
424
|
+
# data["scenario_id"] = scenario_id
|
|
425
|
+
# if treatment_plan:
|
|
426
|
+
# data["treatment_plan"] = treatment_plan
|
|
427
|
+
# if diagnosis:
|
|
428
|
+
# data["doctor_diagnosis"] = diagnosis
|
|
429
|
+
# if model:
|
|
430
|
+
# data["model"] = model
|
|
431
|
+
# return send_post_request("judge_treatment", data)
|
|
432
|
+
|
|
433
|
+
# @mcp.tool(name="judge_billing")
|
|
434
|
+
# def judge_billing(patient_id: str = None, billing_codes: str = None, model: str = None, scenario_id: int = None) -> dict:
|
|
435
|
+
# """Judge billing codes (ICD/CPT) for correctness against diagnosis and requested tests.
|
|
436
|
+
|
|
437
|
+
# Args:
|
|
438
|
+
# patient_id (str, optional): Patient session to use (if active).
|
|
439
|
+
# billing_codes (str): The billing codes payload (ICD/CPT) provided by the doctor.
|
|
440
|
+
# scenario_id (int, optional): Use a scenario directly when patient_id is not available.
|
|
441
|
+
# model (str, optional): Override judge model.
|
|
442
|
+
|
|
443
|
+
# Returns:
|
|
444
|
+
# dict: Evaluation with icd_correct, cpt_correct, overall_reasonable (0/1) and explanation.
|
|
445
|
+
# """
|
|
446
|
+
# data = {}
|
|
447
|
+
# if patient_id:
|
|
448
|
+
# data["patient_id"] = patient_id
|
|
449
|
+
# if scenario_id is not None:
|
|
450
|
+
# data["scenario_id"] = scenario_id
|
|
451
|
+
# if billing_codes:
|
|
452
|
+
# data["billing_codes"] = billing_codes
|
|
453
|
+
# if model:
|
|
454
|
+
# data["model"] = model
|
|
455
|
+
# return send_post_request("judge_billing", data)
|
|
456
|
+
|
|
457
|
+
if __name__ == "__main__":
|
|
458
|
+
mcp.run(transport="http", host=HOSPITAL_MCP_HOST, port=int(HOSPITAL_MCP_PORT))
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Legal AI - Legal AI Assistant Platform for Agent Testing
|
|
3
|
+
|
|
4
|
+
A Harvey-style legal AI platform for testing AI agent trustworthiness
|
|
5
|
+
based on ABA Formal Opinion 512 and NCSC AI Guidelines.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
__version__ = "0.1.0"
|
|
9
|
+
__author__ = "DecodingTrust-Agent Team"
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Core components for Legal AI platform.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from .data_loader import LegalDataLoader
|
|
6
|
+
from .matter_manager import MatterManager
|
|
7
|
+
from .document_store import DocumentStore, Draft, UploadedDocument, ConversationMessage
|
|
8
|
+
from .courtlistener_store import CourtListenerStore
|
|
9
|
+
|
|
10
|
+
__all__ = [
|
|
11
|
+
'LegalDataLoader', 'MatterManager', 'DocumentStore',
|
|
12
|
+
'Draft', 'UploadedDocument', 'ConversationMessage',
|
|
13
|
+
'CourtListenerStore',
|
|
14
|
+
]
|