atrmkj commited on
Commit
9f2bbcc
·
1 Parent(s): 2e7f8c7

edited readme

Browse files
Files changed (2) hide show
  1. README.md +20 -3
  2. debug.log +59 -0
README.md CHANGED
@@ -7,6 +7,25 @@ sdk: gradio
7
  sdk_version: 5.27.1
8
  app_file: app.py
9
  pinned: false
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  ---
11
  # MedTranscript QA Agent
12
 
@@ -115,11 +134,9 @@ The agent uses Claude 3.7 Sonnet to:
115
  - Improve document chunking for more precise retrieval
116
  - Implement a feedback mechanism to improve tool selection over time
117
 
118
- ## License
119
 
120
- This project is licensed under the MIT License - see the LICENSE file for details.
121
 
122
  ## Acknowledgments
123
 
124
- - Medical transcription samples from [MTSamples](https://www.mtsamples.com/)
125
  - Built with Claude 3.7 Sonnet by Anthropic
 
7
  sdk_version: 5.27.1
8
  app_file: app.py
9
  pinned: false
10
+ tags:
11
+ - medical
12
+ - healthcare
13
+ - transcription
14
+ - question-answering
15
+ - rag
16
+ - anthropic
17
+ - claude-3
18
+ - faiss
19
+ - vector-search
20
+ - sentence-transformers
21
+ - gradio
22
+ - duckduckgo
23
+ - web-search
24
+ - multi-tool
25
+ - agent
26
+ - tool-selection
27
+ - mimic-iii
28
+ - clinical
29
  ---
30
  # MedTranscript QA Agent
31
 
 
134
  - Improve document chunking for more precise retrieval
135
  - Implement a feedback mechanism to improve tool selection over time
136
 
 
137
 
 
138
 
139
  ## Acknowledgments
140
 
141
+ - Medical transcription samples from Kaggle (deided from MIMIC III)
142
  - Built with Claude 3.7 Sonnet by Anthropic
debug.log CHANGED
@@ -825,3 +825,62 @@
825
  2025-04-28 19:57:28,706 - httpcore.connection - DEBUG - close.started
826
  2025-04-28 19:57:28,706 - httpcore.connection - DEBUG - close.complete
827
  2025-04-28 19:57:28,746 - urllib3.connectionpool - DEBUG - https://huggingface.co:443 "HEAD /api/telemetry/gradio/launched HTTP/1.1" 200 0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
825
  2025-04-28 19:57:28,706 - httpcore.connection - DEBUG - close.started
826
  2025-04-28 19:57:28,706 - httpcore.connection - DEBUG - close.complete
827
  2025-04-28 19:57:28,746 - urllib3.connectionpool - DEBUG - https://huggingface.co:443 "HEAD /api/telemetry/gradio/launched HTTP/1.1" 200 0
828
+ 2025-04-28 20:30:35,646 - agent - DEBUG - Received question: What was the diagnosis for the ORIF surgery?
829
+ 2025-04-28 20:30:35,654 - anthropic._base_client - DEBUG - Request options: {'method': 'post', 'url': '/v1/messages', 'timeout': Timeout(connect=5.0, read=600, write=600, pool=600), 'files': None, 'idempotency_key': 'stainless-python-retry-a6fb3d48-5230-4beb-a3a0-650f3824a93b', 'json_data': {'max_tokens': 500, 'messages': [{'role': 'user', 'content': 'Question: "Decide which tool(s) are needed to answer this question: "What was the diagnosis for the ORIF surgery?".\n Available tools:\n - Document RAG (for clinical facts)\n - Search (for public info)\n\n Reply in format:\n TOOL: [Document/Search/Both/All]\n "\n\nDecide the best tool for answering it. Reply exactly with TOOL: [Document], TOOL: [Search], or TOOL: [Both]. No other text.'}], 'model': 'claude-3-7-sonnet-20250219', 'system': 'You are an expert clinical AI assistant. You must strictly reply in ONLY one of the following formats: TOOL: [Document], TOOL: [Search], or TOOL: [Both].\n\nFor questions about general medical information like recovery times, procedure durations, or standard practices, prefer TOOL: [Search].\nFor questions about specific medical cases or rare conditions found in the document database, use TOOL: [Document].\nFor questions that would benefit from both sources, use TOOL: [Both].\n\nNever explain, never say anything else.', 'temperature': 0}}
830
+ 2025-04-28 20:30:35,683 - anthropic._base_client - DEBUG - Sending HTTP Request: POST https://api.anthropic.com/v1/messages
831
+ 2025-04-28 20:30:35,683 - httpcore.connection - DEBUG - connect_tcp.started host='api.anthropic.com' port=443 local_address=None timeout=5.0 socket_options=[(65535, 8, True), (6, 257, 60), (6, 258, 5)]
832
+ 2025-04-28 20:30:35,699 - httpcore.connection - DEBUG - connect_tcp.complete return_value=<httpcore._backends.sync.SyncStream object at 0x15321cb60>
833
+ 2025-04-28 20:30:35,699 - httpcore.connection - DEBUG - start_tls.started ssl_context=<ssl.SSLContext object at 0x1311aef50> server_hostname='api.anthropic.com' timeout=5.0
834
+ 2025-04-28 20:30:35,710 - httpcore.connection - DEBUG - start_tls.complete return_value=<httpcore._backends.sync.SyncStream object at 0x1322df9b0>
835
+ 2025-04-28 20:30:35,710 - httpcore.http11 - DEBUG - send_request_headers.started request=<Request [b'POST']>
836
+ 2025-04-28 20:30:35,710 - httpcore.http11 - DEBUG - send_request_headers.complete
837
+ 2025-04-28 20:30:35,710 - httpcore.http11 - DEBUG - send_request_body.started request=<Request [b'POST']>
838
+ 2025-04-28 20:30:35,710 - httpcore.http11 - DEBUG - send_request_body.complete
839
+ 2025-04-28 20:30:35,710 - httpcore.http11 - DEBUG - receive_response_headers.started request=<Request [b'POST']>
840
+ 2025-04-28 20:30:36,399 - httpcore.http11 - DEBUG - receive_response_headers.complete return_value=(b'HTTP/1.1', 200, b'OK', [(b'Date', b'Tue, 29 Apr 2025 03:30:36 GMT'), (b'Content-Type', b'application/json'), (b'Transfer-Encoding', b'chunked'), (b'Connection', b'keep-alive'), (b'anthropic-ratelimit-input-tokens-limit', b'20000'), (b'anthropic-ratelimit-input-tokens-remaining', b'20000'), (b'anthropic-ratelimit-input-tokens-reset', b'2025-04-29T03:30:36Z'), (b'anthropic-ratelimit-output-tokens-limit', b'8000'), (b'anthropic-ratelimit-output-tokens-remaining', b'8000'), (b'anthropic-ratelimit-output-tokens-reset', b'2025-04-29T03:30:36Z'), (b'anthropic-ratelimit-requests-limit', b'50'), (b'anthropic-ratelimit-requests-remaining', b'49'), (b'anthropic-ratelimit-requests-reset', b'2025-04-29T03:30:37Z'), (b'anthropic-ratelimit-tokens-limit', b'28000'), (b'anthropic-ratelimit-tokens-remaining', b'28000'), (b'anthropic-ratelimit-tokens-reset', b'2025-04-29T03:30:36Z'), (b'request-id', b'req_011CNcKKR1jsLM9sKwZ2aKp9'), (b'anthropic-organization-id', b'961c62a8-661b-402f-b3ec-38f150bfa917'), (b'via', b'1.1 google'), (b'cf-cache-status', b'DYNAMIC'), (b'X-Robots-Tag', b'none'), (b'Server', b'cloudflare'), (b'CF-RAY', b'937bb8bd7ac27ac2-SJC'), (b'Content-Encoding', b'gzip')])
841
+ 2025-04-28 20:30:36,400 - httpx - INFO - HTTP Request: POST https://api.anthropic.com/v1/messages "HTTP/1.1 200 OK"
842
+ 2025-04-28 20:30:36,401 - httpcore.http11 - DEBUG - receive_response_body.started request=<Request [b'POST']>
843
+ 2025-04-28 20:30:36,402 - httpcore.http11 - DEBUG - receive_response_body.complete
844
+ 2025-04-28 20:30:36,402 - httpcore.http11 - DEBUG - response_closed.started
845
+ 2025-04-28 20:30:36,402 - httpcore.http11 - DEBUG - response_closed.complete
846
+ 2025-04-28 20:30:36,403 - anthropic._base_client - DEBUG - HTTP Response: POST https://api.anthropic.com/v1/messages "200 OK" Headers({'date': 'Tue, 29 Apr 2025 03:30:36 GMT', 'content-type': 'application/json', 'transfer-encoding': 'chunked', 'connection': 'keep-alive', 'anthropic-ratelimit-input-tokens-limit': '20000', 'anthropic-ratelimit-input-tokens-remaining': '20000', 'anthropic-ratelimit-input-tokens-reset': '2025-04-29T03:30:36Z', 'anthropic-ratelimit-output-tokens-limit': '8000', 'anthropic-ratelimit-output-tokens-remaining': '8000', 'anthropic-ratelimit-output-tokens-reset': '2025-04-29T03:30:36Z', 'anthropic-ratelimit-requests-limit': '50', 'anthropic-ratelimit-requests-remaining': '49', 'anthropic-ratelimit-requests-reset': '2025-04-29T03:30:37Z', 'anthropic-ratelimit-tokens-limit': '28000', 'anthropic-ratelimit-tokens-remaining': '28000', 'anthropic-ratelimit-tokens-reset': '2025-04-29T03:30:36Z', 'request-id': 'req_011CNcKKR1jsLM9sKwZ2aKp9', 'anthropic-organization-id': '961c62a8-661b-402f-b3ec-38f150bfa917', 'via': '1.1 google', 'cf-cache-status': 'DYNAMIC', 'x-robots-tag': 'none', 'server': 'cloudflare', 'cf-ray': '937bb8bd7ac27ac2-SJC', 'content-encoding': 'gzip'})
847
+ 2025-04-28 20:30:36,403 - anthropic._base_client - DEBUG - request_id: req_011CNcKKR1jsLM9sKwZ2aKp9
848
+ 2025-04-28 20:30:36,420 - agent - DEBUG - Tool decision raw response: 'TOOL: [Document]'
849
+ 2025-04-28 20:30:36,420 - agent - DEBUG - Parsed decision - Use Document: True, Use Search: False
850
+ 2025-04-28 20:30:36,421 - agent - DEBUG - Retrieving from documents...
851
+ 2025-04-28 20:30:36,838 - agent - DEBUG - Document retrieval returned 5595 characters
852
+ 2025-04-28 20:31:37,924 - agent - DEBUG - Received question: How long is recovery after a bilateral reduction mammoplasty?
853
+ 2025-04-28 20:31:37,925 - anthropic._base_client - DEBUG - Request options: {'method': 'post', 'url': '/v1/messages', 'timeout': Timeout(connect=5.0, read=600, write=600, pool=600), 'files': None, 'idempotency_key': 'stainless-python-retry-c1bb6795-1cd1-4d76-8366-2a1c15c4e79e', 'json_data': {'max_tokens': 500, 'messages': [{'role': 'user', 'content': 'Question: "Decide which tool(s) are needed to answer this question: "How long is recovery after a bilateral reduction mammoplasty?".\n Available tools:\n - Document RAG (for clinical facts)\n - Search (for public info)\n\n Reply in format:\n TOOL: [Document/Search/Both/All]\n "\n\nDecide the best tool for answering it. Reply exactly with TOOL: [Document], TOOL: [Search], or TOOL: [Both]. No other text.'}], 'model': 'claude-3-7-sonnet-20250219', 'system': 'You are an expert clinical AI assistant. You must strictly reply in ONLY one of the following formats: TOOL: [Document], TOOL: [Search], or TOOL: [Both].\n\nFor questions about general medical information like recovery times, procedure durations, or standard practices, prefer TOOL: [Search].\nFor questions about specific medical cases or rare conditions found in the document database, use TOOL: [Document].\nFor questions that would benefit from both sources, use TOOL: [Both].\n\nNever explain, never say anything else.', 'temperature': 0}}
854
+ 2025-04-28 20:31:37,925 - anthropic._base_client - DEBUG - Sending HTTP Request: POST https://api.anthropic.com/v1/messages
855
+ 2025-04-28 20:31:37,926 - httpcore.connection - DEBUG - close.started
856
+ 2025-04-28 20:31:37,926 - httpcore.connection - DEBUG - close.complete
857
+ 2025-04-28 20:31:37,926 - httpcore.connection - DEBUG - connect_tcp.started host='api.anthropic.com' port=443 local_address=None timeout=5.0 socket_options=[(65535, 8, True), (6, 257, 60), (6, 258, 5)]
858
+ 2025-04-28 20:31:37,933 - httpcore.connection - DEBUG - connect_tcp.complete return_value=<httpcore._backends.sync.SyncStream object at 0x132f6b1d0>
859
+ 2025-04-28 20:31:37,933 - httpcore.connection - DEBUG - start_tls.started ssl_context=<ssl.SSLContext object at 0x1311aef50> server_hostname='api.anthropic.com' timeout=5.0
860
+ 2025-04-28 20:31:37,955 - httpcore.connection - DEBUG - start_tls.complete return_value=<httpcore._backends.sync.SyncStream object at 0x132f6b680>
861
+ 2025-04-28 20:31:37,955 - httpcore.http11 - DEBUG - send_request_headers.started request=<Request [b'POST']>
862
+ 2025-04-28 20:31:37,956 - httpcore.http11 - DEBUG - send_request_headers.complete
863
+ 2025-04-28 20:31:37,956 - httpcore.http11 - DEBUG - send_request_body.started request=<Request [b'POST']>
864
+ 2025-04-28 20:31:37,956 - httpcore.http11 - DEBUG - send_request_body.complete
865
+ 2025-04-28 20:31:37,956 - httpcore.http11 - DEBUG - receive_response_headers.started request=<Request [b'POST']>
866
+ 2025-04-28 20:31:38,742 - httpcore.http11 - DEBUG - receive_response_headers.complete return_value=(b'HTTP/1.1', 200, b'OK', [(b'Date', b'Tue, 29 Apr 2025 03:31:38 GMT'), (b'Content-Type', b'application/json'), (b'Transfer-Encoding', b'chunked'), (b'Connection', b'keep-alive'), (b'anthropic-ratelimit-input-tokens-limit', b'20000'), (b'anthropic-ratelimit-input-tokens-remaining', b'20000'), (b'anthropic-ratelimit-input-tokens-reset', b'2025-04-29T03:31:38Z'), (b'anthropic-ratelimit-output-tokens-limit', b'8000'), (b'anthropic-ratelimit-output-tokens-remaining', b'8000'), (b'anthropic-ratelimit-output-tokens-reset', b'2025-04-29T03:31:38Z'), (b'anthropic-ratelimit-requests-limit', b'50'), (b'anthropic-ratelimit-requests-remaining', b'49'), (b'anthropic-ratelimit-requests-reset', b'2025-04-29T03:31:39Z'), (b'anthropic-ratelimit-tokens-limit', b'28000'), (b'anthropic-ratelimit-tokens-remaining', b'28000'), (b'anthropic-ratelimit-tokens-reset', b'2025-04-29T03:31:38Z'), (b'request-id', b'req_011CNcKQ19gDVN1u2JqPd7CN'), (b'anthropic-organization-id', b'961c62a8-661b-402f-b3ec-38f150bfa917'), (b'via', b'1.1 google'), (b'cf-cache-status', b'DYNAMIC'), (b'X-Robots-Tag', b'none'), (b'Server', b'cloudflare'), (b'CF-RAY', b'937bba428b5bce8c-SJC'), (b'Content-Encoding', b'gzip')])
867
+ 2025-04-28 20:31:38,743 - httpx - INFO - HTTP Request: POST https://api.anthropic.com/v1/messages "HTTP/1.1 200 OK"
868
+ 2025-04-28 20:31:38,743 - httpcore.http11 - DEBUG - receive_response_body.started request=<Request [b'POST']>
869
+ 2025-04-28 20:31:38,744 - httpcore.http11 - DEBUG - receive_response_body.complete
870
+ 2025-04-28 20:31:38,744 - httpcore.http11 - DEBUG - response_closed.started
871
+ 2025-04-28 20:31:38,744 - httpcore.http11 - DEBUG - response_closed.complete
872
+ 2025-04-28 20:31:38,744 - anthropic._base_client - DEBUG - HTTP Response: POST https://api.anthropic.com/v1/messages "200 OK" Headers({'date': 'Tue, 29 Apr 2025 03:31:38 GMT', 'content-type': 'application/json', 'transfer-encoding': 'chunked', 'connection': 'keep-alive', 'anthropic-ratelimit-input-tokens-limit': '20000', 'anthropic-ratelimit-input-tokens-remaining': '20000', 'anthropic-ratelimit-input-tokens-reset': '2025-04-29T03:31:38Z', 'anthropic-ratelimit-output-tokens-limit': '8000', 'anthropic-ratelimit-output-tokens-remaining': '8000', 'anthropic-ratelimit-output-tokens-reset': '2025-04-29T03:31:38Z', 'anthropic-ratelimit-requests-limit': '50', 'anthropic-ratelimit-requests-remaining': '49', 'anthropic-ratelimit-requests-reset': '2025-04-29T03:31:39Z', 'anthropic-ratelimit-tokens-limit': '28000', 'anthropic-ratelimit-tokens-remaining': '28000', 'anthropic-ratelimit-tokens-reset': '2025-04-29T03:31:38Z', 'request-id': 'req_011CNcKQ19gDVN1u2JqPd7CN', 'anthropic-organization-id': '961c62a8-661b-402f-b3ec-38f150bfa917', 'via': '1.1 google', 'cf-cache-status': 'DYNAMIC', 'x-robots-tag': 'none', 'server': 'cloudflare', 'cf-ray': '937bba428b5bce8c-SJC', 'content-encoding': 'gzip'})
873
+ 2025-04-28 20:31:38,744 - anthropic._base_client - DEBUG - request_id: req_011CNcKQ19gDVN1u2JqPd7CN
874
+ 2025-04-28 20:31:38,745 - agent - DEBUG - Tool decision raw response: 'TOOL: [Search]'
875
+ 2025-04-28 20:31:38,745 - agent - DEBUG - Parsed decision - Use Document: False, Use Search: True
876
+ 2025-04-28 20:31:38,745 - agent - DEBUG - Searching web...
877
+ 2025-04-28 20:31:38,758 - primp.utils - DEBUG - Loaded CA certs
878
+ 2025-04-28 20:31:38,763 - rquest.connect - DEBUG - starting new connection: https://lite.duckduckgo.com/
879
+ 2025-04-28 20:31:38,764 - rquest.util.client.connect.dns - DEBUG - resolving lite.duckduckgo.com
880
+ 2025-04-28 20:31:38,772 - rquest.util.client.connect.http - DEBUG - connecting to 52.250.42.157:443
881
+ 2025-04-28 20:31:38,802 - rquest.util.client.connect.http - DEBUG - connected to 52.250.42.157:443
882
+ 2025-04-28 20:31:38,834 - rquest.util.client.pool - DEBUG - pooling idle connection for PoolKey { uri: https://lite.duckduckgo.com/, alpn_protos: None, network: default }
883
+ 2025-04-28 20:31:39,789 - cookie_store.cookie_store - DEBUG - inserting secure cookie 'kl'
884
+ 2025-04-28 20:31:39,790 - primp - INFO - response: https://lite.duckduckgo.com/lite/ 200
885
+ 2025-04-28 20:31:39,793 - duckduckgo_search.DDGS - DEBUG - _get_url() https://lite.duckduckgo.com/lite/ 200
886
+ 2025-04-28 20:31:39,800 - agent - DEBUG - Search returned 1319 characters